diff --git a/AUTHORS b/AUTHORS index 949847d..320efbe 100644 --- a/AUTHORS +++ b/AUTHORS @@ -96,11 +96,6 @@ N: Lars Balker Rasmussen E: lbr@mjolner.dk D: Solaris and minor patches -N: Carlos Rodrigues -E: carlos.efr@mail.telepac.pt -W: http://students.fct.unl.pt/~cer09566/ -D: author of the "megatec" driver - N: David Santinoli E: david@santinoli.com W: http://www.santinoli.com diff --git a/ChangeLog b/ChangeLog index 4bd5b6f..a21849b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,23 +1,1156 @@ -2.4.3 +2011-01-14 Arnaud Quette + + * [r2832] docs/download.txt, docs/website/news.txt: Missing website + update for 2.6.0 + * [r2830] configure.in: Final update for 2.6.0 release + * [r2829] autogen.sh, docs/download.txt, nut-autoreconf: Rename the + nut-autoreconf script to autogen.sh, since it is a more standard + name + +2011-01-14 Charles Lepple + + * [r2828] docs/developer-guide.txt, docs/history.txt, + docs/user-manual.txt: Remove work-in-progress warnings. + * [r2827] docs/Makefile.am, docs/docinfo.xml: Add basic revision + information to PDF documentation. + + This should be automated later. + +2011-01-13 Arnaud Quette + + * [r2825] docs/Makefile.am, docs/configure.txt: Remove AsciiDoc + hard-coded verbose flag, which can now be enabled using + 'ASCIIDOC_VERBOSE=-v make' + +2011-01-13 Arjen de Korte + + * [r2824] clients/upsclient.c: Revert commit 2819 which seems to + break certificate validation on some systems + +2011-01-13 Arnaud Quette + + * [r2823] docs/documentation.txt: Add a NUT Korean GuideBook to the + documentation (from PointBre) + * [r2821] clients/Makefile.am, configure.in, drivers/Makefile.am, + m4/nut_check_libhal.m4, m4/nut_check_libneon.m4, + m4/nut_check_libnetsnmp.m4, m4/nut_check_libpowerman.m4, + m4/nut_check_libssl.m4, m4/nut_check_libusb.m4, + m4/nut_check_libwrap.m4, server/Makefile.am: Fix the wrong use of + *_LDFLAGS instead of *_LIBS, which break compilation on newer + toolchains like the on the upcoming Ubuntu Natty (patch from + Laurent Bigonville, from Debian) + +2011-01-11 Arjen de Korte + + * [r2819] clients/upsclient.c: Set SSL verification method in CTX, + rather than through the filedescriptor (for clarity, no + functional change) + +2011-01-11 Arnaud Quette + + * [r2816] drivers/idowell-hid.c: Remove the wrong + 'battery.capacity' data mapping + * [r2815] NEWS, data/driver.list.in: Add iDowell iBox UPS to the + list of usbhid-ups supported models, and upgrade the NEWS + * [r2814] Makefile.am: Disable distcleancheck rule, which fails due + to files generated at 'make dist' time, while waiting for a + proper solution. This will allow older Unix to enter the BuildBot + system + +2011-01-10 Arnaud Quette + + * [r2812] configure.in: Restore --with[out]-all flags that were + lost during the AsciiDoc branch merge + +2011-01-08 Arjen de Korte + + * [r2811] scripts/upower/95-upower-hid.rules: Update upower script + with iDowell driver + +2011-01-05 Arjen de Korte + + * [r2803] drivers/idowell-hid.c: Complete HID to NUT mapping + +2011-01-04 Arjen de Korte + + * [r2802] drivers/Makefile.am, drivers/idowell-hid.c, + drivers/idowell-hid.h, drivers/usbhid-ups.c: Add generated + 'iDowell' subdriver (HID to NUT mapping to be added) + * [r2801] server/desc.c: Minor cleanup (change 'struct dlist_t' to + proper 'dlist_t' and zero dynamically allocated memory before + use) + * [r2800] server/conf.c: If multiple 'driver', 'port' or 'desc' + entries were specified in 'ups.conf', the server would leak + memory on (re)loading the configuration file. Also make sure + dynamically allocated memory is zero'd before use (to prevent + accidentally free'ing uninitialized pointers). + +2011-01-04 Arnaud Quette + + * [r2799] NEWS, data/driver.list.in: Add Rocketfish RF-1000VA / + RF-1025VA to the list of usbhid-ups supported models (reported by + James "Among The Living") + +2010-12-31 Charles Lepple + + * [r2795] nut-autoreconf, scripts/augeas/Makefile.am, + scripts/augeas/gen-nutupsconf-aug.py, + scripts/python/app/NUT-Monitor, scripts/python/module/PyNUT.py, + scripts/python/module/test_nutclient.py, tools/Makefile.am, + tools/nut-hclinfo.py, tools/nut-usbinfo.pl: Do not hardcode + Python and Perl interpreter paths + + Useful for systems like FreeBSD where Python is optional, and + pulled in from + the ports tree. + + This patch uses the first interpreter seen in $PATH. A future + improvement would + be to add a configure script argument, although that might be + annoying for the + nut-autoreconf script. + +2010-12-24 Arnaud Quette + + * [r2793] docs, docs/man: Don't version generated files (no + functional change) + * [r2792] docs/Makefile.am, docs/images/old-cgi.png: Add the + missing old CGI image + * [r2791] docs/configure.txt: Add a mention that '--with-doc=auto' + will try to build only the possible documents + * [r2790] docs/download.txt, docs/website/news.txt: Website update + for 2.6.0-pre1 + * [r2789] NEWS, UPGRADING, configure.in: News, upgrading + information and configure version bump for 2.6.0(-pre1) + * [r2788] docs/Makefile.am, docs/stable-hcl.txt, + docs/user-manual.txt, docs/website/Makefile.am, + docs/website/stable-hcl.txt, tools/nut-hclinfo.py: Fist stab to + integrate hardware compatibility list to the user manual + * [r2787] docs/asciidoc.conf: Fix linkdoc AsciiDoc macro, to handle + more smartly links with no anchors + * [r2786] docs/website/website.txt: Prepare website for the switch + to production, by removing the WARNING banner on the homepage + * [r2785] scripts/augeas: Don't version generated files (no + functional change) + * [r2784] docs/Makefile.am, docs/config-notes.txt, + docs/developer-guide.txt, scripts/augeas/README: Improve Augeas + documentation, integrate it as a chapter in the developer guide, + and reference the user section in the user manual + +2010-12-23 Arnaud Quette + + * [r2783] docs/download.txt, nut-autoreconf: Create an autoreconf + wrapper script to ensure that the source tree is in a buildable + state after an initial Subversion checkout + * [r2782] INSTALL, README, docs/asciidoc.conf, + docs/config-notes.txt, docs/configure.txt, + docs/documentation.txt, docs/download.txt, docs/nut-names.txt, + docs/support.txt, docs/user-manual.txt: Create a linkdoc AsciiDoc + macro to deal with cross references between NUT documentations + and variables paths (which depend on the generated documentation + format). A remaining limitation is that anchors are only + supported for single page HTML + * [r2781] configure.in, scripts/Makefile.am, scripts/README, + scripts/augeas: Merge the Augeas branch, related to configuration + files management + +2010-12-22 Arnaud Quette + + * [r2778] data/Makefile.am, data/epdu-managed.dev, + data/evolution500.dev, data/evolution500.seq: Add more comments + to the simulation files samples, and rename the UPS one to .seq + since it includes TIMER examples + +2010-12-22 Arjen de Korte + + * [r2777] data, docs/man, drivers, scripts/hal, + scripts/hal/ups-nut-device.fdi.in, scripts/hotplug, + scripts/hotplug/libhid.usermap, scripts/udev, + scripts/udev/nut-usbups.rules.in: Don't version generated files + +2010-12-22 Arnaud Quette + + * [r2775] README, docs/Makefile.am, docs/asciidoc.conf, + docs/config-notes.txt, docs/contact-closure.txt, + docs/developer-guide.txt, docs/new-clients.txt, + docs/scheduling.txt, docs/security.txt: Create, and distribute, a + linkman AsciiDoc macro to deal with variables manual pages path + (which depend on the generated documentation format): chunked + HTML points a level up, single page HTML points to the same + directory and PDF points online versions (which will only be + active once the new website is in production!) + * [r2774] docs/man/Makefile.am: Also distribute asciidoc.conf, + since it is needed for the linkman macro + * [r2773] docs/man/upscli_connect.txt, + docs/man/upscli_disconnect.txt, docs/man/upscli_fd.txt, + docs/man/upscli_get.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_ssl.txt, + docs/man/upscli_strerror.txt, docs/man/upscli_upserror.txt, + docs/man/upsclient.txt: Fix wrong references to the NUT C client + structure (UPSCONN instead of UPSCONN_t) + +2010-12-21 Arnaud Quette + + * [r2766] AUTHORS, conf/ups.conf.sample, data/driver.list.in, + docs/FAQ.txt, docs/acknowledgements.txt, docs/cables/sms.txt, + docs/config-notes.txt, docs/man/Makefile.am, docs/man/blazer.txt, + docs/man/index.txt, docs/man/megatec.txt, + docs/man/megatec_usb.txt, docs/man/nutupsdrv.txt, + docs/man/ups.conf.txt, docs/new-drivers.txt, + docs/website/scripts/nut_jquery.js, drivers/Makefile.am, + drivers/megatec.c, drivers/megatec.h, drivers/megatec_usb.c, + tools/nut-usbinfo.pl: Final removal of the megatec and + megatec_usb drivers, now replaced by blazer_ser and blazer_usb + * [r2765] drivers/dstate.c, drivers/dstate.h: Rename the second + parameter of dstate_init() from 'port' to 'devname', since the + port name has been replaced for long by the device entry name, as + specified in ups.conf + * [r2764] docs/man/Makefile.am: Fix HTML_CONF_MANS files extension, + complete the clean stage and make AsciiDoc mandatory for 'make + dist' + +2010-12-20 Arnaud Quette + + * [r2759] tools/nut-usbinfo.pl: Fix udev rules refreshing issue + (reported by Laurent Bigonville, Debian bug #557178) + +2010-12-20 Arjen de Korte + + * [r2758] drivers/ietf-mib.c: Extend the IETF MIB with some + previously unmapped variables + * [r2757] drivers/snmp-ups.c, drivers/snmp-ups.h: Add + 'input.bypass' to the list of variables for which we support + detection of single or three phase operation + +2010-12-20 Arnaud Quette + + * [r2756] conf/upsd.conf.sample, docs/man/upsd.conf.txt: Complete + missing configuration directives in upsd.conf manual page and + sample configuration file + +2010-12-20 Charles Lepple + + * [r2753] tools/svn2cl.authors: Update authors list for ChangeLog + generation + +2010-12-19 Arnaud Quette + + * [r2751] configure.in, m4/nut_report_feature.m4: Rework + configuration summary report ordering in a more comprehensive way + * [r2750] configure.in: Revert commit r2748 + +2010-12-17 Arnaud Quette + + * [r2749] drivers/mge-utalk.c: Fix initialisation sequence, improve + model detection, don't declare stale too quickly and bump driver + version to 0.92 + * [r2748] configure.in: --with-doc=auto now behave depending on + AsciiDoc presence + * [r2747] docs/man/Makefile.am: Fix manual pages distribution and + installation issue + +2010-12-16 Arnaud Quette + + * [r2742] docs/website/news.txt, docs/website/projects.txt: Update + NUT-Monitor link, and announce release 1.3 + * [r2741] configure.in: Fix minor typo, among which some broke some + syntax highlighters + +2010-12-15 Arnaud Quette + + * [r2739] Makefile.am, configure.in, docs/man/Makefile.am, + docs/man/index.txt, docs/man/ivtscd.txt, man: Switch manual pages + to AsciiDoc, thus removing the redundant toplevel man/ directory, + now replaced by docs/man/ + +2010-12-15 Arjen de Korte + + * [r2738] drivers/ietf-mib.c, drivers/powerware-mib.c: The + upsConfigLowBattTime OID is in minutes. In order to convert this + to the seconds, we need to multiply by 60. Currently, the + conversion factor is stored in the length field. So we can either + make this value ST_FLAG_RW (and not convert from minutes to + seconds) or show the correct value without being able to modify + it. + + If we set ST_FLAG_RW | ST_FLAG_STRING, the length field must show + the length of the string that needs to be passed by clients (and + this can't be done). + * [r2737] clients/upsrw.c: Cleanup of upsrw client (no functional + changes) + * [r2736] clients/upscmd.c: Return server response to user (instead + of silently failing, which confuses the heck out of people) + + [http://lists.alioth.debian.org/pipermail/nut-upsuser/2010-December/006459.html] + +2010-12-13 Arjen de Korte + + * [r2735] drivers/belkin.c: Discard the manufacturer information + (which doesn't seem to be consistent between models) and instead + only require a valid reply format + +2010-12-12 Arjen de Korte + + * [r2734] drivers/powerp-bin.c: Reinstate support for older + CyberPower models that report the model number in a numerical + format (which was supported through the now obsolete 'cyberpower' + driver) + + [http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-July/004866.html] + * [r2733] conf/upsd.users.sample, docs/man/upsd.users.txt: + upsd.users: Specifying multiple instcmds + Add examples for adding multiple instcmds to upsd.users + + [https://alioth.debian.org/tracker/index.php?func=detail&aid=312768&group_id=30602&atid=411544] + * [r2732] drivers/belkin.c, drivers/belkin.h: Update to fix + datastale reports and general overhaul of driver code + + [https://alioth.debian.org/tracker/index.php?func=detail&aid=312877&group_id=30602&atid=411544] + +2010-12-11 Arnaud Quette + + * [r2731] docs, docs/man, docs/website, docs/website/scripts: + Complete the list of Subversion ignored files, with AsciiDoc + generated contents (no functional changes) + +2010-12-10 Arnaud Quette + + * [r2730] docs/Makefile.am, docs/cables.txt, + docs/cables/73-0724.png, docs/cables/940-0024C.jpg, + docs/cables/Lansafecable.jpg, docs/cables/SOLA-330.png, + docs/cables/belkin-f6cx-rkm-xu-cable.jpg, + docs/cables/mac-940-0024C.png, docs/cables/mge-66049.png, + docs/cables/mge-db9-rj12.jpg, docs/cables/mge-db9-rj45.jpg, + docs/documentation.txt, docs/images/cables, + 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/support.txt: Fix + cabling information integration, and some remaining broken links + in the documentation and website + +2010-12-06 Arjen de Korte + + * [r2725] drivers/apc-hid.c: Add HID to NUT mappings + + [http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-December/005105.html] + +2010-12-05 Arjen de Korte + + * [r2724] clients/upsclient.c: Rather than relying on + TLSv1_client_method() to never return a NULL pointer and/or + SSL_CTX_new() dealing with this gracefully, make this check + explicit (no functional change) + * [r2723] server/ssl.c: Fixed compilation warning (OpenSSL 1.0.0 + added the 'const' qualifier to SSL_METHOD) + +2010-12-04 Charles Lepple + + * [r2722] INSTALL, Makefile.am, README, TODO, UPGRADING, + configure.in, data/Makefile.am, data/driver.list, + data/driver.list.in, 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/cables/73-0724.png, docs/cables/940-0024C.jpg, + docs/cables/Lansafecable.jpg, docs/cables/SOLA-330.png, + docs/cables/belkin-f6cx-rkm-xu-cable.jpg, + docs/cables/mac-940-0024C.png, docs/cables/mge-66049.png, + docs/cables/mge-db9-rj12.jpg, docs/cables/mge-db9-rj45.jpg, + 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, docs/images/advanced.png, docs/images/asciidoc.png, + docs/images/bigbox.png, docs/images/bizarre.png, + docs/images/blue-arrow.png, 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, 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/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, 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, docs/man/upscli_fd.txt, + docs/man/upscli_get.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_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, 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, + docs/website/Makefile.am, docs/website/css, + 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, + 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/skel.c, m4/ax_compare_version.m4, + m4/nut_check_asciidoc.m4, m4/nut_check_os.m4, tools/Makefile.am, + tools/nut-hclinfo.py: Merging AsciiDoc branch into trunk + + Merged svn://svn.debian.org/nut/branches/AsciiDoc at r2701, with + the trunk + as of r2720. The AsciiDoc branch commit r2721 was cherry-picked + later. + + The AsciiDoc homepage is http://www.methods.co.nz/asciidoc/ and + the earliest + suggested version to use (in order to properly generate all + output formats) + is 8.6.3. + + The commits have been grouped into the following categories: + + == Build Machinery, File Management, Miscellaneous == + + r1874, r1880, r1894, r1895, r1896, r1897, r1898, r1908, r1909, + r1910, r1917, + r1920, r1927, r1928, r1929, r1931, r1958, r1976, r1977, r1978, + r1994, r2032, + r2125, r2126, r2130, r2155, r2160, r2246, r2470, r2473, r2474, + r2475, r2505, + r2522, r2538, ~~r2541~~, r2542, r2544, r2546, r2547, r2548, + r2549, r2552, + ~~r2553~~, r2554, r2558, r2560, ~~r2563~~, r2564, r2565, r2566, + r2606, r2607, + r2608, r2611, r2612, r2613, r2614, r2615, r2617, r2630, r2661, + r2669, r2670, + r2672, r2673, r2674, ~~r2679~~, r2683, r2684, r2685, r2686, + r2689, r2690 + + == Text File Conversion == + + r1875, r1881, r1899, r1900, r1901, r1902, r1903, r1912, r1913, + r1916, r1921, + r1922, r1923, r1924, r1925, r1926, r1997, r1998, r2003, r2030, + r2031, r2064, + r2065, r2135, r2150, r2157, r2158, r2245, r2283, r2284, r2285, + r2289, r2291, + r2292, r2328, r2409, r2463, r2465, r2481, r2482, r2497, r2498, + r2499, r2502, + r2517, r2519, r2520, r2525, r2526, r2527, r2530, r2533, r2534, + r2535, r2536, + r2537, r2556, r2561, r2562, r2649, r2701 + + == Updated Content == + + r1938, r1939, r1984, r1985, r1991, r1992, r2052, r2069, r2108, + r2124, r2131, + r2142, r2144, r2149, r2154, r2156, r2164, r2211, r2227, r2293, + r2304, r2309, + r2351, r2358, r2409, r2416, r2418, r2419, r2420, r2438, r2460, + r2461, r2462, + r2464, r2466, r2469, r2471, r2472, r2476, r2477, r2478, r2479, + r2480, r2483, + r2484, r2485, r2493, r2496, r2501, r2503, r2506, r2507, r2510, + r2512, r2518, + r2529, r2540, r2543, r2545, r2550, r2551, r2555, r2557, r2559, + r2631, r2632, + r2633, r2634, r2637, r2638, r2639, r2640, r2643, r2648, r2652, + r2653, r2655, + r2662, r2664, r2665, r2666, r2681 + + == Website == + + r1883, r1905, r1907, r1911, r1933, r1935, r1937, r1940, r1950, + r1953, r1954, + r1967, r1973, r1974, r1975, r2000, r2001, r2002, r2058, r2059, + ~~r2060~~, + r2061, r2063, r2066, r2123, r2134, r2136, r2159, r2225, r2288, + r2290, r2486, + r2487, r2494, r2495, r2500, r2504, r2515, r2521, r2523, r2539, + r2562, r2607, + r2721 + + == Manual Page Conversion == + + r1961, r1962, r1963, r1965, r1969, r1971, r1972, r1981, r1982, + r1986, r1987, + r1988, r1993, r2004, r2005, r2006, r2007, r2008, r2009, r2010, + r2011, r2012, + r2013, r2014, r2019, r2020, r2021, r2028, r2033, r2034, r2038, + r2044, r2047, + r2048, r2049, r2050, r2051, r2062, r2067, r2068, r2074, r2075, + r2107, r2109, + r2110, r2111, r2112, r2113, r2127, r2129, r2132, r2137, r2146, + r2147, r2151, + r2152, r2162, r2204, r2205, r2206, r2207, r2208, r2209, r2210, + r2211, r2226, + r2227, r2228, r2229, r2249, r2251, r2252, r2258, r2259, r2310, + r2311, r2312, + r2313, r2314, r2572, r2580 + + == Ported from trunk == + + r2039, r2043, r2049, r2076, r2110, r2120, r2209, r2210, r2249, + r2258, r2287, + r2325, r2358, r2393, r2429, r2430, r2434, r2439, r2440, r2443, + r2447, r2514, + r2532, r2567, r2657, r2694, r2696, r2700 + +2010-12-03 Arjen de Korte + + * [r2720] server/upsd.c: Allow hostnames in /etc/hosts.allow too + (not only IPv4 and/or IPv6 addresses). This is a frequent source + of confusion for people setting up libwrap access control. + + [http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-December/005097.html] + * [r2719] drivers/libhid.c: Revert commit 2407 (which breaks + reading reports larger than 8 bytes) and make sure we only store + data that was read. + + Breaking up the buffer in chunks that the USB interface can + handle is the job of the libusb library. If this doesn't work, + it's libusb that needs fixing, not NUT. + +2010-11-30 Arjen de Korte + + * [r2713] server/ssl.c: When a CERTFILE is configured for the + server, mandate that SSL is started or else fail starting the + server (so that a configuration problem doesn't remain hidden). + + Remove redundant OpenSSL_add_ssl_algorithms() call (same as + SSL_library_init). + +2010-11-29 Arnaud Quette + + * [r2710] scripts/upower/95-upower-hid.rules, tools/nut-usbinfo.pl: + Complete the renaming from DeviceKit-power to UPower, synchronise + the rules file as per upstream changes and update the generated + content + +2010-11-23 Arnaud Quette + + * [r2699] drivers/dummy-ups.c, drivers/dummy-ups.h, + man/dummy-ups.8: dummy-ups 0.12 now allows variable removal, by + setting an empty value + +2010-11-20 Arnaud Quette + + * [r2697] data/driver.list: Also add CyberPower CP1500AVRLCD to the + list of usbhid-ups supported models (reported by Patrick + O'Malley) + * [r2695] data/driver.list: Add CyberPower CP1350AVRLCD to the list + of usbhid-ups supported models (reported by Patrick O'Malley) + +2010-11-13 Arjen de Korte + + * [r2688] Makefile.am: Create empty website target (to silence + warnings about missing target) + +2010-11-12 Arjen de Korte + + * [r2687] drivers/apc-hid.c: Add additional HID mappings for + shutting down APC SmartUPS RM series + + [http://lists.alioth.debian.org/pipermail/nut-upsuser/2010-November/006318.html] + +2010-11-06 David Goncalves + + * [r2682] scripts/python/Makefile.am, + scripts/python/app/NUT-Monitor, scripts/python/app/gui-1.2.glade, + scripts/python/app/gui-1.3.glade, scripts/python/app/locale, + scripts/python/app/locale/fr, + scripts/python/app/locale/fr/LC_MESSAGES, + scripts/python/app/locale/fr/LC_MESSAGES/NUT-Monitor.mo: + NUT-Monitor 1.3 - Added localization support + +2010-11-05 Arjen de Korte + + * [r2680] drivers/blazer.c: Check for NULL pointer before checking + the status flags was missing + + [http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-November/005045.html] + +2010-11-03 Arnaud Quette + + * [r2656] data/driver.list, drivers/tripplite-hid.c: Add HP T750 G2 + to the list of usbhid-ups supported models (patch from Jorge + Salamero Sanz) + +2010-11-02 Arjen de Korte + + * [r2654] configure.in, m4/nut_check_libnetsnmp.m4: Exclude -I. and + extra developer warning flags with Net-SNMP support enabled + (using them is the responsibility of the NUT developers) + +2010-10-31 Arjen de Korte + + * [r2651] configure.in, drivers/upsdrvctl.c: Fix remaining + compilation warnings by doing an explicit cast that removes the + 'const' qualification and ignoring this specific GCC warning. + Sadly the underlying functions don't support this qualifier (and + it's not trivial to work around these remaining warnings). + +2010-10-28 Arjen de Korte + + * [r2647] drivers/powerman-pdu.c: Fix compilation warnings + * [r2646] drivers/dstate-hal.c: Fix compilation warnings + * [r2645] drivers/megatec_usb.c: Fix compilation warnings + +2010-10-27 Arjen de Korte + + * [r2636] drivers/mge-utalk.c, drivers/mge-utalk.h: Fix compilation + warnings + * [r2635] drivers/mge-shut.c, drivers/mge-shut.h: Fix compilation + warnings + +2010-10-26 Arjen de Korte + + * [r2629] drivers/tripplite.c: Fix compilation warnings + * [r2628] drivers/rhino.c: Fix compilation warnings + * [r2627] drivers/powercom.h: Fix compilation warnings + * [r2626] drivers/libshut.c, drivers/libshut.h: Fix compilation + warnings + * [r2625] drivers/microdowell.c: Fix compilation warnings + * [r2624] drivers/gamatronic.c, drivers/gamatronic.h: Fix + compilation warnings + * [r2623] drivers/usb-common.c: Fix compilation warnings + * [r2622] drivers/mge-xml.c, drivers/netxml-ups.h: Fix compilation + warnings + * [r2621] drivers/bestfortress.c: Fix compilation warnings + * [r2620] drivers/dummy-ups.h: Fix compilation warnings + * [r2619] drivers/bcmxcp.c, drivers/bcmxcp.h: Fix compilation + warnings + * [r2618] drivers/powerp-txt.c, drivers/powerpanel.h: Fix + compilation warnings + +2010-10-25 Arjen de Korte + + * [r2616] drivers/mge-hid.c, drivers/powercom-hid.c, + drivers/usbhid-ups.h: Remove superfluous const declaration + (function return values can never be a lvalue) + +2010-10-20 Arjen de Korte + + * [r2604] server/upsd.c: Revert experimental stuff that + accidentally made it into commit 2600 + * [r2603] drivers/mge-hid.c: Fix wrong pointer type + * [r2602] configure.in: Remove inet_aton from AC_REPLACE_FUNCS (no + longer needed) + * [r2601] drivers/bcmxcp_usb.c, drivers/bestfcom.c, + drivers/ivtscd.c, drivers/libshut.c, drivers/metasys.c, + drivers/optiups.c, drivers/powerp-bin.c, drivers/powerp-txt.c, + drivers/rhino.c, drivers/richcomm_usb.c, drivers/safenet.c, + drivers/snmp-ups.c, drivers/solis.h: Fix bad prototypes (missing + void) + * [r2600] Makefile.am, clients/upsclient.c, clients/upsclient.h, + clients/upsmon.c, common/inet_aton.c, configure.in, + docs/configure.txt, m4/nut_check_ipv6.m4, server/upsd.c: Remove + code that used the (now obsoleted) gethostbyaddr in favor of the + (IPv6 capable) getaddrinfo function + * [r2599] drivers/libusb.h: Fix compilation warnings + * [r2598] drivers/tripplite_usb.c: Fix compilation warnings + * [r2597] drivers/serial.c: Replace explicit typecasts of void + pointers by adding an intermediate variable of the proper type + * [r2596] drivers/apcsmart.c: Fix compilation warnings (functions + returning string contants, should return (const char *), not + (char *)) + +2010-10-19 Charles Lepple + + * [r2581] scripts/python/module/PyNUT.py: Fix small typo in + comments of PyNUT class + +2010-10-16 Arjen de Korte + + * [r2573] man/upsd.conf.5: Add information on the CERTFILE keyword, + needed for SSL support in the upsd server + +2010-10-13 Arnaud Quette + + * [r2571] drivers/belkin.c, drivers/belkin.h: Add battery tests and + beeper control commands, and report the beeper and test status + (patch from John Bayly) + +2010-10-08 Arjen de Korte + + * [r2570] drivers/apc-hid.c, drivers/belkin-hid.c, + drivers/cps-hid.c, drivers/explore-hid.c, drivers/liebert-hid.c, + drivers/mge-hid.c, drivers/powercom-hid.c, + drivers/tripplite-hid.c, drivers/usbhid-ups.c, + drivers/usbhid-ups.h, scripts/subdriver/path-to-subdriver.sh: Fix + compilation warnings for the usbhid-ups driver (functions + returning string contants, should return (const char *), not + (char *)) + * [r2569] clients/upsmon.c, common/common.c: Change strange (but + valid) construction. Setting a flag should be done by either + '*val |= *flag' or '*val = (*val | flag)'. Using '*val = (*val |= + flag)' will first set the flag in *val and then assign the result + to *val (which is redundant). + * [r2568] server/upsd.c: Initialize SSL before we drop privileges + (we may not be able to read the keyfile as non-root) + +2010-09-22 Arnaud Quette + + * [r2531] drivers/snmp-ups.c, drivers/snmp-ups.h, man/snmp-ups.8: + Add SNMP v3 support, and rework SNMP initialisation + +2010-09-20 Charles Lepple + + * [r2528] drivers/libhid.c, drivers/usbhid-ups.c: Print HID values + in scientific notation. + +2010-09-15 Arnaud Quette + + * [r2524] data/driver.list, drivers/tripplite-hid.c: Add a bunch of + Tripplite USB/HID devices, reported from UPower, and HP R1500 G2 + INTL to the list of supported Tripplite HID devices + +2010-09-11 Arjen de Korte + + * [r2516] data/driver.list, drivers/tripplite-hid.c: Add + Smart1000LCD to list of supported devices + [http://lists.alioth.debian.org/pipermail/nut-upsuser/2010-September/006188.html] + +2010-09-08 Chetan Agarwal + + * [r2513] data/driver.list: Fixed renaming of liebertgxt2 to + liebert-esp2 driver done in commit r2432 and in r2444 + +2010-09-07 Chetan Agarwal + + * [r2511] data/driver.list: Add Eaton ConnectUPS X / BD / E Slot to + compatibility list for bcmxcp and snmp-ups + +2010-09-06 Arjen de Korte + + * [r2509] data/driver.list, drivers/tripplite-hid.c: Add HP T1500 + INTL to list of supported devices + [http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-September/004938.html] + +2010-08-30 Arnaud Quette + + * [r2508] drivers/mge-hid.c: ups.test.result is now refreshed upon + each full polling cycle + +2010-07-25 David Goncalves + + * [r2492] scripts/python/Makefile.am, scripts/python/app/pixmaps, + scripts/python/app/pixmaps/on_battery.png, + scripts/python/app/pixmaps/on_line.png, + scripts/python/app/pixmaps/var-ro.png, + scripts/python/app/pixmaps/var-rw.png, + scripts/python/app/pixmaps/warning.png: Added missing pixmaps for + NUT-Monitor 1.2 + +2010-07-25 Arjen de Korte + + * [r2491] drivers/upsdrvctl.c: Check for NULL before xbasename() on + 'port' variable (legacy code for nut-2.0.4 drivers and older) + + [http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-July/004894.html] + +2010-07-24 Charles Lepple + + * [r2490] scripts/python/Makefile.am: Add new glade filename to + Makefile.am + + Should fix Buildbot failure from r2489. + +2010-07-23 David Goncalves + + * [r2489] scripts/python/app/NUT-Monitor, + scripts/python/app/gui-1.2.glade, scripts/python/app/gui.glade, + scripts/python/module/PyNUT.py: Upgrade NUT-Monitor to 1.2 + * [r2488] scripts/python/module/PyNUT.py: Upgrade PyNUT module to + 1.2 + +2010-07-11 Charles Lepple + + * [r2468] data/driver.list: driver.list: Split entries for Tripp + Lite OmniVS1000 + + http://article.gmane.org/gmane.comp.monitoring.nut.user/5591 + +2010-06-25 Arjen de Korte + + * [r2459] drivers/apc-hid.c: Add support for APC 5G models + http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-June/004846.html + +2010-06-24 Arnaud Quette + + * [r2458] drivers/mge-hid.c: Do no ignore DST offset, or it will be + substracted from the actual value in the target device + +2010-06-22 Arnaud Quette + + * [r2457] drivers/dummy-ups.c: Fix status handling in simulation + (dummy) mode, conform to the coding rules, fix a memory leak and + bump the release to 0.11 + +2010-05-13 Charles Lepple + + * [r2456] tools/nut-usbinfo.pl: BUS to SUBSYSTEMS in nut-usbinfo.pl + (to match r2411) + * [r2455] data/driver.list, drivers/tripplite-hid.c: Add "Tripp + Lite SmartOnline SU1000XLA" to list of supported devices. [Ron + Peterson] + + http://lists.alioth.debian.org/pipermail/nut-upsuser/2010-May/006055.html + +2010-05-04 Arjen de Korte + + * [r2454] configure.in, drivers/main-hal.c, m4/nut_check_libhal.m4: + Use AC_CHECK_FUNCS to see if g_timeout_add_seconds is available + (rather than checking the version of the library that is + installed) + +2010-05-04 Arnaud Quette + + * [r2453] drivers/mge-xml.c, drivers/usbhid-ups.c: Add "Test + scheduled" handling for ups.test.result on Eaton and derivative + units + +2010-05-02 Arjen de Korte + + * [r2452] m4/nut_check_libhal.m4: Additionally check for 'glib.h' + and 'dbus/glib.h' to see if the requirements for HAL are met + +2010-04-19 Arnaud Quette + + * [r2445] data/driver.list, drivers/Makefile.am, + drivers/bestpower-mib.c, drivers/bestpower-mib.h, + drivers/snmp-ups.c, drivers/snmp-ups.h: Add Eaton Best Ferrups + with older ConnectUPS card to the list of snmp-ups supported + models + +2010-04-18 Arjen de Korte + + * [r2444] drivers/Makefile.am: Renaming the liebertgxt2 to + liebert-esp2 driver in commit r2432 failed to update the + Makefile.am + * [r2442] data/driver.list: Add two models that were reported on + the mailinglists: + http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-April/004738.html + http://lists.alioth.debian.org/pipermail/nut-upsuser/2010-April/006023.html + * [r2441] drivers/tripplite-hid.c: Allow 'productid' overrides for + Hewlett Packard UPS devices + +2010-04-15 Arjen de Korte + + * [r2437] drivers/tripplite-hid.c: Add 'HP T1000 INTL UPS' to list + of supported devices [Sturle Sunde] + http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-April/004735.html + +2010-04-14 Arjen de Korte + + * [r2436] docs/new-names.txt: Add 'output.crestfactor' and + 'outlet.n.crestfactor' to list of supported variables + +2010-04-10 Arjen de Korte + + * [r2435] drivers/liebert-esp2.c: Allow spaces in model name and + add 'battery.temperature' variable (Spiros Ioannou) + http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-April/004719.html + +2010-04-10 Charles Lepple + + * [r2433] drivers: Add 'liebert-esp2' driver to svn:ignore list. + +2010-04-10 Arjen de Korte + + * [r2432] drivers/Makefile.am, drivers/liebert-esp2.c, + drivers/liebertgxt2.c, man/Makefile.am, man/liebert-esp2.8, + man/liebertgxt2.8: Rename 'liebertgxt2' driver to 'liebert-esp2' + (GXT2 is a model name, ESP-II the serial protocol being used by + other models as well) + +2010-04-09 Arjen de Korte + + * [r2431] drivers/liebertgxt2.c, man/liebertgxt2.8: Allow to + override default baudrate to user specified value (needed on some + models) + +2010-04-09 Arnaud Quette + + * [r2428] data/driver.list: Add Eaton 9395 with serial interface to + the list of bcmxcp supported models + +2010-04-07 Arjen de Korte + + * [r2426] drivers/liebertgxt2.c: Add CHRG and DISCHRG status flags + (based on the reported battery.current) + * [r2425] drivers/liebertgxt2.c: Fix previous commit + * [r2424] drivers/liebertgxt2.c: Add 'battery.current' value + [Spiros Ioannou] removing the CHRG flag at the same time (which + doesn't seem to be usable) + http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-April/004700.html + * [r2423] drivers/liebertgxt2.c: Fix ups.firmware [Robert Jobbagy] + and only require ups.model for successful detection + http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-April/004701.html + +2010-04-07 Arnaud Quette + + * [r2422] scripts/Makefile.am, scripts/README, scripts/dkp, + scripts/upower, scripts/upower/95-devkit-power-hid.rules, + scripts/upower/95-upower-hid.rules: Update DeviceKit-power + resource to the new UPower name + +2010-04-06 Arjen de Korte + + * [r2421] drivers/liebertgxt2.c: More byte swapping issues fixed + [Richard Gregory] + http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-April/004698.html + +2010-04-02 Arjen de Korte + + * [r2415] drivers/liebertgxt2.c: Swap bytes in calculations for + reported values by the UPS [Robert Jobbagy] + http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-April/004695.html] + +2010-03-29 Charles Lepple + + * [r2414] ., ChangeLog, Makefile.am, tools/Makefile.am, + tools/svn2cl.authors: Generate the ChangeLog file with 'make + dist' from SVN history + + ` svn merge -r2401:r2413 + svn+ssh://svn.debian.org/svn/nut/branches/svn-auto-changelog ` + + Includes the following: + - r2402 removes the static ChangeLog and adds a rule and the + authors file. + - r2403 shows how little I remember about automake + - r2404 and r2413 cancel each other out + - r2405 fixes the SVN starting revision syntax. + +2010-03-27 Arnaud Quette + + * [r2411] scripts/udev/nut-usbups.rules.in: Change BUS to + SUBSYSTEMS, since the former is deprecated (patch from Michal + Hlavinka, Red Hat) + +2010-03-26 Arjen de Korte + + * [r2410] drivers/powercom-hid.c, man/usbhid-ups.8: Reject devices + that are known not to be supported by the powercom-hid subdriver + +2010-03-23 Arnaud Quette + + * [r2408] clients/Makefile.am, common/Makefile.am, + drivers/Makefile.am, server/Makefile.am: Fix the distribution and + compilation of local implementation of missing systems functions. + This resulted in compilation failure on HP-UX, and possibly other + older Unix systems, like Aix. Refer to configure.in -> + AC_REPLACE_FUNCS for more information. + +2010-03-22 Arjen de Korte + + * [r2407] drivers/libhid.c: Reduce size of buffer to maximum size + supported by low-speed USB devices. + +2010-03-22 Arnaud Quette + + * [r2406] drivers/Makefile.am: Add the missing link to the math + library for bcmxcp driver + +2010-03-12 Arjen de Korte + + * [r2400] README: Remove monitor-only option that never existed. + Whether or not a system will shutdown is determined by the + combined powervalue of all devices it monitors (this has nothing + to do with the master or slave setting). + +2010-03-08 Arjen de Korte + + * [r2399] clients/upsclient.h, drivers/hidparser.h, + drivers/hidtypes.h, include/parseconf.h: Add control comments for + 'ident' to switch off formatting in some places + * [r2398] clients/upsimage.c, clients/upsimagearg.h, + clients/upslog.c, clients/upslog.h, clients/upssched.c, + clients/upssched.h, drivers/apcsmart.c, drivers/apcsmart.h, + drivers/dstate-hal.h, drivers/gamatronic.h, drivers/main-hal.h, + drivers/main.h, drivers/netxml-ups.h, drivers/usbhid-ups.h, + server/netcmds.h: Finalize cleanup of type definitions for + structures where needed and/or useful (and replace a couple of + void pointers by the proper structures) + +2010-03-07 Arjen de Korte + + * [r2397] common/state.c, drivers/dstate-hal.h, drivers/dstate.c, + drivers/dstate.h, include/extstate.h, include/state.h, + server/netget.c, server/netinstcmd.c, server/netlist.c, + server/netset.c, server/sstate.c, server/sstate.h, + server/upstype.h: Create types for structures that already + suggested that they were types, but were not (cmdlist_t, conn_t, + enum_t and st_tree_t) and use these instead + * [r2396] drivers/blazer.c: Fix loss of precision in dividing + integers + +2010-03-07 Charles Lepple + + * [r2395] docs/cables/ge-imv-victron.txt: Remove escape sequence + from cable diagram. + + Pointed out on Feb 25 2010 by Yury V. Zaytsev on nut-upsuser. + +2010-03-04 Arjen de Korte + + * [r2392] data/driver.list: Add PowerWare 5119 RM support through + upscode2 driver + [http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-March/004608.html] + * [r2391] drivers/upscode2.c: Use "shutdown.reboot" (which was used + before r2389 was committed) instead of "shutdown.return" in the + shutdown function + +2010-03-03 Arjen de Korte + + * [r2390] drivers/upscode2.c: Update based on information provided + by Steve Golson + [http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-March/004608.html] + * [r2389] drivers/upscode2.c: Update based on information provided + by Steve Golson + [http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-March/004608.html] + +2010-03-01 Arjen de Korte + + * [r2387] configure.in: No longer require autoconf version 2.60 or + better and work around broken quadrigraphs before autoconf + version 2.62 + * [r2385] drivers/mge-hid.c: Add missing Kelvin to Celcius + conversion + [http://lists.alioth.debian.org/pipermail/nut-upsuser/2010-March/005944.html] + * [r2384] configure.in: Attempt to fix problem with two consecutive + '@:>@' quadrigraphs (also reports m4 version used) + +2010-02-28 Arjen de Korte + + * [r2383] configure.in, m4/nut_check_libgd.m4, + m4/nut_check_libhal.m4, m4/nut_check_libneon.m4, + m4/nut_check_libnetsnmp.m4, m4/nut_check_libpowerman.m4, + m4/nut_check_libssl.m4, m4/nut_check_libusb.m4, + m4/nut_config_libhal.m4: Restore @<:@ and @:>@ quadrigraphs + * [r2382] configure.in: Revert commit 2380 which fails on Debian + * [r2381] m4/nut_check_libgd.m4, m4/nut_check_libhal.m4, + m4/nut_check_libneon.m4, m4/nut_check_libnetsnmp.m4, + m4/nut_check_libpowerman.m4, m4/nut_check_libssl.m4, + m4/nut_check_libusb.m4, m4/nut_config_libhal.m4: Revert commit + 2380 which fails on Debian + * [r2380] configure.in, m4/nut_check_libgd.m4, + m4/nut_check_libhal.m4, m4/nut_check_libneon.m4, + m4/nut_check_libnetsnmp.m4, m4/nut_check_libpowerman.m4, + m4/nut_check_libssl.m4, m4/nut_check_libusb.m4, + m4/nut_config_libhal.m4: Change escaped characters (no functional + changes) + * [r2379] configure.in, m4/nut_check_libgd.m4, + m4/nut_check_libhal.m4, m4/nut_check_libneon.m4, + m4/nut_check_libnetsnmp.m4, m4/nut_check_libpowerman.m4, + m4/nut_check_libssl.m4, m4/nut_check_libusb.m4, + m4/nut_config_libhal.m4: Clean up output of 'configure --help' + (indentation, optional parameters) and don't allow options which + need a parameter + * [r2378] m4/nut_check_libgd.m4, m4/nut_check_libhal.m4, + m4/nut_check_libneon.m4, m4/nut_check_libnetsnmp.m4, + m4/nut_check_libpowerman.m4, m4/nut_check_libssl.m4, + m4/nut_check_libusb.m4, m4/nut_config_libhal.m4, + scripts/hal/ups-nut-device.fdi.in, + scripts/udev/nut-usbups.rules.in: When setting variables from + pkg-config, rather than checking for the return value, check for + a (non-)zero length. It will happily return zero for unknown + variables in otherwise supported packages (and this is usually + not what we want). + Also direct stderr to /dev/null for systems that don't use + pkg-config. + * [r2377] m4/nut_config_libhal.m4: Fix type (leftover from + debugging) + * [r2376] configure.in, m4/nut_check_libhal.m4, + m4/nut_config_libhal.m4: Keep compile and linker options separate + from runtime configuration parameters (and skip the latter if the + first are not usable) + +2010-02-27 Arjen de Korte + + * [r2375] m4/nut_check_libhal.m4: Test for empty variable, rather + than the return value of pkg-config + * [r2374] docs/configure.txt, m4/nut_check_libhal.m4: Allow + overrides in ./configure for all variables needed for HAL support + +2010-02-26 Arjen de Korte + + * [r2372] common/common.c, configure.in, drivers/main.c, + include/common.h, man/nutupsdrv.8, man/upsd.8, server/upsd.c: Due + to popular demand, add a possibility to reduce the verbosity of + messages written to the syslog (by adding one or more -q flags in + a similar fashion as the -D debug flag) + * [r2371] m4/nut_check_libgd.m4, m4/nut_check_libneon.m4, + m4/nut_check_libnetsnmp.m4, m4/nut_check_libpowerman.m4, + m4/nut_check_libssl.m4, m4/nut_check_libusb.m4: Check if + overrides are specified, but the mandatory argument is missing + (and refer to 'docs/configure.txt') + +2010-02-25 Arjen de Korte + + * [r2370] clients/upslog.c, clients/upsmon.c, clients/upsrw.c, + clients/upssched.c, server/sockdebug.c, server/upsd.c: Use + open_syslog wrapper function instead of openlog directly and grab + program name from argv[0] + +2010-02-23 Arjen de Korte + + * [r2367] drivers/netvision-mib.c: Fixes Alioth bug #312364 2010-02-23 Arnaud Quette - * [r2366] ChangeLog, configure.in, NEWS, UPGRADING: Final update for - 2.4.3 release + * [r2366] ChangeLog, NEWS, UPGRADING, configure.in: Final update + for 2.4.3 release 2010-02-20 Arjen de Korte * [r2365] m4/nut_check_ipv6.m4: Fix broken logic to enable IPv6 support -2.4.2 - 2010-02-19 Arnaud Quette * [r2363] ChangeLog, configure.in: Final update for 2.4.2 release - -2010-02-19 Arnaud Quette - * [r2362] NEWS, data/driver.list: Add HP R1500 G2 to compatibility list for bcmxcp (reported by Stephan Schupfer) @@ -97,7 +1230,7 @@ the mailinglist [http://lists.alioth.debian.org/pipermail/nut-upsuser/2005-August/000118.html] -2010-02-11 Charles Lepple +2010-02-11 Charles Lepple * [r2338] ChangeLog: Generate ChangeLog entries from r2337 through r2331. @@ -108,7 +1241,158 @@ 2010-02-11 Arjen de Korte - * [r2336] (numerous files) No functional changes (properties only) + * [r2336] COPYING, ChangeLog, INSTALL, LICENSE-GPL2, LICENSE-GPL3, + MAINTAINERS, Makefile.am, NEWS, UPGRADING, clients/cgilib.c, + clients/cgilib.h, clients/status.h, clients/upsc.c, + clients/upsclient.c, clients/upsclient.h, clients/upscmd.c, + clients/upsimage.c, clients/upsimagearg.h, clients/upslog.c, + clients/upslog.h, clients/upsmon.c, clients/upsmon.h, + clients/upsrw.c, clients/upssched-cmd, clients/upssched.c, + clients/upssched.h, clients/upsset.c, clients/upsstats.c, + clients/upsstats.h, common/Makefile.am, common/atexit.c, + common/common.c, common/inet_aton.c, common/parseconf.c, + common/setenv.c, common/snprintf.c, common/state.c, + common/strerror.c, common/upsconf.c, compile, conf/Makefile.am, + conf/hosts.conf.sample, conf/nut.conf.sample, + conf/ups.conf.sample, conf/upsd.conf.sample, + conf/upsd.users.sample, conf/upsmon.conf.sample, + conf/upssched.conf.sample.in, conf/upsset.conf.sample, + conf/upsstats-single.html.sample, conf/upsstats.html.sample, + configure.in, data/Makefile.am, data/cmdvartab, data/driver.list, + data/epdu-managed.dev, data/evolution500.dev, + data/html/Makefile.am, data/html/README, data/html/bottom.html, + data/html/header.html.in, data/html/index.html, + data/html/nut-banner.png, docs/FAQ, docs/Makefile.am, + docs/README, docs/acpi.txt, docs/big-servers.txt, + docs/cables/apc-rs500-serial.txt, docs/cables/apc.txt, + docs/cables/ge-imv-victron.txt, docs/cables/imv.txt, + docs/cables/mgeups.txt, docs/cables/powerware.txt, + docs/cables/repotec.txt, docs/cables/sms.txt, docs/chroot.txt, + docs/commands.txt, docs/config-files.txt, docs/configure.txt, + docs/contact-closure.txt, docs/data-room.txt, docs/design.txt, + docs/developers.txt, docs/hid-subdrivers.txt, docs/ideas.txt, + docs/macros.txt, docs/megatec.txt, docs/new-drivers.txt, + docs/new-names.txt, docs/nut-hal.txt, docs/osd-notify.txt, + docs/pager.txt, docs/powersaving.txt, docs/protocol.txt, + docs/shutdown.txt, docs/snmp.txt, docs/sock-protocol.txt, + docs/ssl.txt, docs/suspend-to-disk.txt, docs/upssched.txt, + drivers/Makefile.am, drivers/apc-hid.c, drivers/apc-hid.h, + drivers/apc-mib.c, drivers/apc-mib.h, drivers/apcsmart.c, + drivers/apcsmart.h, drivers/baytech-mib.c, drivers/baytech-mib.h, + drivers/bcmxcp.c, drivers/bcmxcp.h, drivers/bcmxcp_io.h, + drivers/bcmxcp_ser.c, drivers/bcmxcp_usb.c, drivers/belkin-hid.c, + drivers/belkin-hid.h, drivers/belkin.c, drivers/belkin.h, + drivers/belkinunv.c, drivers/bestfcom.c, drivers/bestfortress.c, + drivers/bestuferrups.c, drivers/bestups.c, drivers/blazer.c, + drivers/blazer.h, drivers/blazer_ser.c, drivers/blazer_usb.c, + drivers/clone-outlet.c, drivers/clone.c, drivers/compaq-mib.c, + drivers/compaq-mib.h, drivers/cps-hid.c, drivers/cps-hid.h, + drivers/dstate-hal.c, drivers/dstate-hal.h, drivers/dstate.c, + drivers/dstate.h, drivers/dummy-ups.c, drivers/dummy-ups.h, + drivers/eaton-mib.h, drivers/etapro.c, drivers/everups.c, + drivers/explore-hid.c, drivers/explore-hid.h, + drivers/gamatronic.c, drivers/gamatronic.h, drivers/genericups.c, + drivers/genericups.h, drivers/hidparser.c, drivers/hidparser.h, + drivers/hidtypes.h, drivers/ietf-mib.c, drivers/ietf-mib.h, + drivers/isbmex.c, drivers/ivtscd.c, drivers/libhid.c, + drivers/libhid.h, drivers/libshut.c, drivers/libshut.h, + drivers/libusb.c, drivers/libusb.h, drivers/liebert-hid.c, + drivers/liebert-hid.h, drivers/liebert.c, drivers/liebertgxt2.c, + drivers/main-hal.c, drivers/main-hal.h, drivers/main.c, + drivers/main.h, drivers/masterguard.c, drivers/megatec.c, + drivers/megatec.h, drivers/megatec_usb.c, drivers/metasys.c, + drivers/mge-hid.c, drivers/mge-hid.h, drivers/mge-mib.c, + drivers/mge-mib.h, drivers/mge-shut.c, drivers/mge-shut.h, + drivers/mge-utalk.c, drivers/mge-utalk.h, drivers/mge-xml.c, + drivers/mge-xml.h, drivers/microdowell.c, drivers/microdowell.h, + drivers/netvision-mib.c, drivers/netvision-mib.h, + drivers/netxml-ups.c, drivers/netxml-ups.h, drivers/optiups.c, + drivers/powercom-hid.c, drivers/powercom-hid.h, + drivers/powercom.c, drivers/powercom.h, drivers/powerman-pdu.c, + drivers/powerp-bin.c, drivers/powerp-bin.h, drivers/powerp-txt.c, + drivers/powerp-txt.h, drivers/powerpanel.c, drivers/powerpanel.h, + drivers/powerware-mib.c, drivers/powerware-mib.h, + drivers/raritan-pdu-mib.h, drivers/rhino.c, + drivers/richcomm_usb.c, drivers/safenet.c, drivers/safenet.h, + drivers/serial.c, drivers/serial.h, drivers/skel.c, + drivers/snmp-ups.c, drivers/snmp-ups.h, drivers/solis.c, + drivers/solis.h, drivers/tripplite-hid.c, + drivers/tripplite-hid.h, drivers/tripplite.c, + drivers/tripplite.h, drivers/tripplite_usb.c, + drivers/tripplitesu.c, drivers/upscode2.c, drivers/upsdrvctl.c, + drivers/upshandler.h, drivers/usb-common.c, drivers/usb-common.h, + drivers/usbhid-ups.c, drivers/usbhid-ups.h, drivers/victronups.c, + include/Makefile.am, include/attribute.h, include/common.h, + include/extstate.h, include/parseconf.h, include/proto.h, + include/state.h, include/timehead.h, include/upsconf.h, + lib/Makefile.am, lib/README, lib/libupsclient-config.in, + lib/libupsclient.pc.in, m4/ax_create_stdint_h.m4, + m4/nut_arg_with.m4, m4/nut_check_ipv6.m4, m4/nut_check_libgd.m4, + m4/nut_check_libhal.m4, m4/nut_check_libneon.m4, + m4/nut_check_libnetsnmp.m4, m4/nut_check_libpowerman.m4, + m4/nut_check_libssl.m4, m4/nut_check_libusb.m4, + m4/nut_check_libwrap.m4, m4/nut_check_os.m4, + m4/nut_report_feature.m4, m4/nut_type_socklen_t.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.8, man/liebertgxt2.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/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/HP-UX/Makefile, + scripts/HP-UX/nut-drvctl, scripts/HP-UX/nut-drvctl.sh, + scripts/HP-UX/nut-upsd, scripts/HP-UX/nut-upsd.sh, + scripts/HP-UX/nut-upsmon, scripts/HP-UX/nut-upsmon.sh, + scripts/Makefile.am, scripts/README, scripts/RedHat/README, + scripts/RedHat/halt.patch, scripts/RedHat/ups, + scripts/RedHat/upsd, scripts/RedHat/upsd.in, + scripts/RedHat/upsmon, scripts/RedHat/upsmon.in, + scripts/Solaris8/S99upsmon, scripts/Windows/Makefile, + scripts/Windows/halt.c, scripts/dkp/95-devkit-power-hid.rules, + scripts/hal/Makefile.am, scripts/hal/ups-nut-device.fdi.in, + scripts/hotplug/Makefile.am, scripts/hotplug/README, + scripts/hotplug/libhid.usermap, scripts/hotplug/libhidups.in, + scripts/misc/nut.bash_completion, scripts/misc/osd-notify, + scripts/perl/Nut.pm, scripts/python/Makefile.am, + scripts/python/README, scripts/python/app/NUT-Monitor, + scripts/python/app/README, scripts/python/app/gui.glade, + scripts/python/app/nut-monitor.desktop, + scripts/python/app/nut-monitor.png, + scripts/python/module/PyNUT.py, + scripts/python/module/test_nutclient.py, + scripts/subdriver/path-to-subdriver.sh, scripts/udev/Makefile.am, + scripts/udev/README, scripts/udev/nut-usbups.rules.in, + server/Makefile.am, server/conf.c, server/conf.h, server/ctype.h, + server/desc.c, server/desc.h, server/netcmds.h, server/neterr.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/sockdebug.c, server/ssl.c, server/ssl.h, server/sstate.c, + server/sstate.h, server/stype.h, server/upsd.c, server/upsd.h, + server/upstype.h, server/user-data.h, server/user.c, + server/user.h, tools/Makefile.am, tools/device-recorder.sh, + tools/nut-usbinfo.pl: No functional changes (properties only) * [r2335] AUTHORS: No functional changes (properties only) 2010-02-10 Arnaud Quette @@ -121,971 +1405,8 @@ required for IPv6 support in the header files that are defined by POSIX (don't rely on the netdb.h header to include them) -2010-02-10 Charles Lepple +2010-02-10 Charles Lepple * [r2332] ChangeLog: Generate ChangeLog entries from SVN r2331 back through r2117. -2010-02-10 Arjen de Korte - - * [r2331] drivers/genericups.c: Fix typo in previous commit - * [r2330] drivers/genericups.c: Don't hang up on last close - (initial state of HUPCL is implementation dependent) - [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=327072] - -2010-02-09 Arjen de Korte - - * [r2329] drivers/main.c: Some drivers set - 'driver.version.internal' in upsdrv_initinfo() so we should set - the generic message before running that - * [r2327] man/upssched.conf.5: Fix wrong reference - [http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-February/004532.html] - * [r2326] server/netuser.c: Check if user is allowed to login - before accepting connection - - [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=544390] - -2010-02-08 Arjen de Korte - - * [r2324] UPGRADING: The tcp-wrappers support is optional in - addition to the LISTEN directive (not the other way around) - -2010-02-08 Arnaud Quette - - * [r2323] UPGRADING: Add a double explicit note about the ACL - mechanism removal in 2.4.0. - (reported on Debian by Anthony DeRobertis, Bug #526811) - -2010-02-08 Arjen de Korte - - * [r2322] data/driver.list: Added lots of Ippon devices that were - mentioned on the mailinglists (serial devices will undoubtly - work, USB support still experimental) - -2010-02-07 Arjen de Korte - - * [r2321] UPGRADING, drivers/blazer_usb.c, man/blazer.8: Use - 'ippon' subdriver for devices with USB id 06da:0003 (old - 'phoenix' subdriver still available) - * [r2320] drivers/raritan-mib.h, drivers/snmp-ups.c: Fix wrong name - * [r2319] drivers/raritan-mib.h: Add missing file in previous - commit - * [r2318] drivers, drivers/Makefile.am, drivers/apc-mib.c, - drivers/apc-mib.h, drivers/apccmib.h, drivers/baytech-mib.c, - drivers/baytech-mib.h, drivers/baytechmib.h, - drivers/compaq-mib.c, drivers/compaq-mib.h, - drivers/cpqpowermib.h, drivers/eaton-aphel-mib.h, - drivers/eaton-mib.c, drivers/eaton-mib.h, drivers/ietf-mib.c, - drivers/ietf-mib.h, drivers/ietfmib.h, drivers/mge-mib.c, - drivers/mge-mib.h, drivers/mgemib.h, drivers/netvision-mib.c, - drivers/netvision-mib.h, drivers/netvisionmib.h, - drivers/powerware-mib.c, drivers/powerware-mib.h, - drivers/pwmib.h, drivers/raritan-mib.h, - drivers/raritan-pdu-mib.c, drivers/raritan-pdu-mib.h, - drivers/snmp-ups.c, drivers/snmp-ups.h: Extract subdriver info - from main driver body into separate modules. This prevents - namespace conflicts and ensures that changes in one subdriver - don't lead to surprise changes in others. - - It also allows to use a single mapping file to be used in several - subdrivers by specifying a different entry point (which doesn't - work if everything is in one module). - -2010-02-07 Charles Lepple - - * [r2317] drivers/apcsmart.c, drivers/apcsmart.h: apcsmart: Add - input.transfer.reason - - Contributed by Michael Haardt: - http://article.gmane.org/gmane.comp.monitoring.nut.devel/4498 - -2010-02-05 Arjen de Korte - - * [r2316] drivers/cpqpowermib.h: Could this be a Powerware OEM - device? - -2010-02-04 Arjen de Korte - - * [r2315] drivers/cpqpowermib.h: Based on patch from Philip Ward - [http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-February/004509.html] - -2010-02-01 Arjen de Korte - - * [r2305] clients/upsimage.c, common/strerror.c, drivers/bcmxcp.c, - drivers/main-hal.c, drivers/powerman-pdu.c: Prefer snprintf over - sprintf to prevent overflowing buffers (also removes trailing - whitespace) - * [r2303] drivers/Makefile.am, drivers/cpqpowermib.h, - drivers/snmp-ups.c, man/snmp-ups.8: - -2010-01-31 Charles Lepple - - * [r2297] drivers/tripplite_usb.c: Revert trunk commit r2294, which - was meant for a branch. - * [r2296] drivers/clone-outlet.c: clone-outlet.c: remove executable - bit - * [r2294] drivers/tripplite_usb.c: tripplite_usb: initial changes - to test protocol 3004 - -2010-01-30 Arnaud Quette - - * [r2286] tools/Makefile.am, tools/device-recorder.sh: Create a - script to record device running sequence and dump it in a .seq - format. - The .seq file can then be used by dummy-ups to replay the - sequence. - -2010-01-28 Charles Lepple - - * [r2282] m4/nut_report_feature.m4: Another attempt to fix the - feature report on OS X. - -2010-01-27 Arjen de Korte - - * [r2281] m4/nut_report_feature.m4: Attempt to get rid of spurious - '-n' on MacOSX-10.5 BuildBot - * [r2280] m4/nut_check_libhal.m4: Prefer to use 'test' over '[ ]' - (on many shells, this first a built-in function while the second - is a symbolic link to 'test') - -2010-01-27 Charles Lepple - - * [r2279] m4/nut_check_libhal.m4: Remove fallback HAL information - path, and remove extra parentheses. - -2010-01-25 Arjen de Korte - - * [r2278] drivers/megatec.c: Don't check reliability of connection - at driver startup. This confuses users and really serves no - purpose for normal use. In case the connection is unreliable, it - should ultimately be the decision of the user whether or not it - is acceptable (not the driver). - * [r2277] drivers/apc-hid.c, drivers/belkin-hid.c, - drivers/cps-hid.c, drivers/explore-hid.c, drivers/liebert-hid.c, - drivers/mge-hid.c, drivers/powercom-hid.c, - drivers/tripplite-hid.c, include/common.h: The "config.h" header - should be the first included, since it contains the _GNU_SOURCE - declaration (enables Posix extensions to C) - * [r2276] configure.in: Add AC_USE_SYSTEM_EXTENSIONS to use - features of Posix that are extensions to C (requires Autoconf - 2.60 or better) - * [r2275] common/common.c: Fix compiler warning on MacOSX-10.5 - * [r2274] common/common.c: Fix compiler warning on FreeBSD - * [r2273] configure.in: - * [r2272] configure.in, drivers/mge-hid.c: Check for presence of - strptime() before using it - -2010-01-24 Arjen de Korte - - * [r2271] configure.in, drivers/mge-hid.c: The previous patch was a - resounding failure (reverting back to setting _XOPEN_SOURCE in - one specific source file instead) - * [r2270] configure.in: Request SUSv2 compliance for all sources - (experimental) - * [r2269] drivers/mge-hid.c: _XOPEN_SOURCE seems to break on - FreeBSD - * [r2268] drivers/mge-xml.c: Fix compiler warning - -2010-01-24 Charles Lepple - - * [r2267] drivers/mge-hid.c: Define _XOPEN_SOURCE=500 for - strptime() prototype in glibc2 - -2010-01-24 Arjen de Korte - - * [r2266] drivers/mge-hid.c: Removing stuff that was added to fix - strptime on Debian Etch (incompatible with FreeBSD) - -2010-01-23 Arjen de Korte - - * [r2265] drivers/mge-hid.c: Fourth attempt of fixing strptime() - declaration missing on Debian - * [r2264] drivers/mge-hid.c: Third attempt of fixing strptime() - declaration missing on Debian - * [r2263] drivers/mge-hid.c: Second attempt of fixing strptime() - declaration missing on Debian - * [r2262] drivers/apc-hid.c, drivers/belkin-hid.c, - drivers/cps-hid.c, drivers/explore-hid.c, drivers/liebert-hid.c, - drivers/mge-hid.c, drivers/powercom-hid.c, - drivers/tripplite-hid.c, scripts/subdriver/path-to-subdriver.sh: - Remove redundant #include's (are being dealt with by main.h) - * [r2261] data/cmdvartab: Add descriptions for - 'ups.timer.(start|reboot|shutdown)' variables - * [r2260] drivers/mge-hid.c: Need to define _XOPEN_SOURCE for - strptime() prototype in glibc2 - -2010-01-22 Arjen de Korte - - * [r2257] drivers/mge-shut.c, drivers/mge-shut.h: Change naming of - ups.delay.* variables to ups.timer.*, since writing these values - immediately starts the countdown (and not when a shutdown command - is issued) - * [r2256] drivers/powercom-hid.c: Fallback to stored value of - 'ups.delay.(start|shutdown)' only if no parameter is given (to - fix 'load.on' command) - -2010-01-21 Arjen de Korte - - * [r2255] drivers/powercom-hid.c: Fix beeper.status and add - load.on.delay command (to allow starting up with delay when UPS - is shutdown) - -2010-01-19 Arjen de Korte - - * [r2254] data/driver.list, drivers, drivers/Makefile.am, - drivers/liebertgxt2.c, man/Makefile.am, man/liebertgxt2.8: Based - on the patch from the below message (needs to be tested) - - http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-January/004391.html - * [r2253] drivers/powercom-hid.c: Add - 'beeper.(enable|disable|mute)' instcmd's - -2010-01-17 Charles Lepple - - * [r2250] drivers/tripplite_usb.c: tripplite_usb: Detect protocol - before using tl_model - - Reported by Chase Wallis. - -2010-01-17 Arjen de Korte - - * [r2248] man/blazer.8: Add 'ippon' subdriver to man page - * [r2247] drivers/blazer_usb.c: ETIME is not defined on FreeBSD, so - make this test conditional (also fixes wrong sign) - -2010-01-13 Arjen de Korte - - * [r2244] drivers/blazer_usb.c: Close device handle after - usb_reset() is called and reconnect - * [r2243] drivers/blazer_usb.c: Attempt to clear stalled devices by - sending them an usb_reset() command - -2010-01-13 Charles Lepple - - * [r2242] drivers/tripplite_usb.c: tripplite_usb: don't reset - watchdog on SMARTPRO models - - Patch by Chase Wallis: - http://article.gmane.org/gmane.comp.monitoring.nut.devel/4376 - -2010-01-12 Arjen de Korte - - * [r2241] drivers/blazer_usb.c: Fix bug in ippon subdriver - -2010-01-07 Arjen de Korte - - * [r2240] drivers/blazer_usb.c: Fix minor bug in debug code - * [r2239] drivers/blazer_usb.c: Add experimental 'ippon' subdriver - to communicate with UPS devices of the same name - -2010-01-06 Arjen de Korte - - * [r2238] drivers/blazer_usb.c: Clear potential stall condition - while flushing interrupt pipe - * [r2237] drivers/libusb.c, drivers/usbhid-ups.c: Reconnect if - usb_clear_halt() is not implemented (older libusb on *BSD - systems) so that we don't get stuck with a stalled interrupt - endpoint (correction of 2235) - * [r2236] drivers/usbhid-ups.c: EPIPE should not result in - reconnecting since we're reading from a control endpoint here, - not an interrupt endpoint (where this would be an appropriate - action after attempting to fix the stall condition through - usb_clear_halt() first) - * [r2235] drivers/usbhid-ups.c: Reconnect if usb_clear_halt() is - not implemented (older libusb on *BSD systems) so that we don't - get stuck with a stalled interrupt endpoint - -2010-01-05 Arjen de Korte - - * [r2234] drivers/libusb.c: Don't ignore persistent "Broken pipe" - on stalled interrupt endpoint (only ignore them on control - endpoints) - * [r2233] drivers/libusb.c: Clear stall condition on interrupt - endpoint if needed (since we no longer reconnect, this may be - needed) - * [r2232] drivers/libusb.c, drivers/usbhid-ups.c: Change libusb.c - error handling. Most important (functional) change is that - "Broken pipe" is no longer considered a reason to reconnect - (fixes MGE/Eaton Ellipse series UPS stability problems). - -2010-01-04 Arjen de Korte - - * [r2231] drivers/libusb.c: Fix previous patch - * [r2230] drivers/libusb.c: Log message to syslog when - usb_get/set_* operation fails (except timeouts) at LOG_DEBUG to - make sure we have something to work with for debugging frequent - disconnects - -2010-01-02 Arjen de Korte - - * [r2224] m4/nut_check_libneon.m4: Fix output when library is not - installed - * [r2223] m4/nut_check_libhal.m4: Don't wast effort trying to - detect HAL stuff if we already know it is not available - * [r2222] m4/nut_check_libgd.m4: Remove braces around test - conditions - * [r2221] m4/nut_check_libpowerman.m4, m4/nut_check_libssl.m4: - Remove braces around test conditions - * [r2220] m4/nut_check_libusb.m4: Fix one "==" that was left behind - (and slightly improve message when pkg-config is not available) - -2010-01-01 Charles Lepple - - * [r2219] m4/nut_check_libusb.m4: Remove extra parentheses from - libusb test. - - Also change '==' to '=' for string equality test. - -2009-12-31 Arjen de Korte - - * [r2218] m4/nut_check_libusb.m4: Add pkg-config as method to - retrieve CFLAGS and LDFLAGS (but fall back to libusb-config) - -2009-12-30 Arjen de Korte - - * [r2217] drivers/libusb.c: Fix previous patch (failed to remove - closing #endif statement) - * [r2216] drivers/libusb.c, drivers/usbhid-ups.c: Enable the use of - the interrupt pipe on Solaris (for drivers that require this), - but disable it on the usbhid-ups driver (for which it is - optional). - * [r2215] drivers/powercom-hid.c: Honor 'offdelay' configuration - parameter and allow changing the 'ups.delay.shutdown' variable at - runtime - -2009-12-28 Arjen de Korte - - * [r2214] data/driver.list: Add new PowerCOM devices with HID PDC - interface to list of supported models - * [r2213] drivers/powercom-hid.c: The PowerCOM subdriver has now - reached a state where it is useable. Commands have been tested on - a BNT-500AP. - * [r2212] drivers/usbhid-ups.c: The composite commands - 'shutdown.return' and 'shutdown.stayoff' require 'load.on.delay' - and 'load.off.delay' (not 'ups.delay.start' and - 'ups.delay.shutdown'). - -2009-12-27 Charles Lepple - - * [r2203] scripts/hal/Makefile.am: Hard-code source file in - scripts/hal - -2009-12-26 Arjen de Korte - - * [r2202] m4/nut_check_libhal.m4: Revert previous patch that breaks - on OpenSUSE (and add HAL_CALLOUTS_PATH instead of relying on the - default) - * [r2201] m4/nut_check_libhal.m4: Use ${datarootdir} instead of - /usr/share or /usr/local/share (we check for the presence of a - subdirectory, so the chance of a false positive is low) - * [r2200] m4/nut_check_libneon.m4: Only check for optional - functions if we know library is available - * [r2199] m4/nut_check_libgd.m4: Simplify the --with-gd-includes - and --with-gd-libs processing - -2009-12-25 Arjen de Korte - - * [r2198] configure.in: FreeBSD requires both and - so explicitly use only these two headers to check for - availability of uu_lock - * [r2197] m4/nut_check_libusb.m4: Check for presence of 'usb.h' - (not 'libusb.h', which is what we use internally) - -2009-12-24 Charles Lepple - - * [r2196] m4/nut_check_libhal.m4: Test for FDI files in /usr/local - as well as /usr - - This should fix HAL-enabled builds on FreeBSD. - -2009-12-24 Arjen de Korte - - * [r2195] m4/nut_check_libhal.m4: If we can't detect the - HAL_FDI_PATH automatically, set it to /dev/null and emit warning - * [r2194] m4/nut_check_libusb.m4: Fix missing default -lusb library - and improve comments during detection - * [r2193] m4/nut_check_libusb.m4: Work around missing libusb-config - on FreeBSD 8 by falling back to defaults for CFLAGS and LDFLAGS - * [r2192] configure.in: Try to workaround some FreeBSD bugs - * [r2191] drivers/powercom-hid.c: Updated HID to NUT mappings (work - in progress and still quite broken, do not run on production - systems!) - -2009-12-22 Arjen de Korte - - * [r2190] drivers/libhid.c: Add debug information for input reports - that are not in the report descriptor - -2009-12-21 Arjen de Korte - - * [r2189] drivers/libhid.c: Use hexadecimal report numbers in debug - messages (to be consistent throughout the code) - -2009-12-20 Arjen de Korte - - * [r2188] m4/nut_check_libwrap.m4: Small improvement to better - mimic the behavior of AC_SEARCH_LIBS (by checking if we need to - add -lwrap before adding it to LIBS) - -2009-12-19 Arjen de Korte - - * [r2187] m4/ax_create_stdint_h.m4: Update location of Autoconf - Archive in header (so that we can check for modifications) - * [r2186] m4/nut_check_libgd.m4: AC_SEARCH_LIBS puts the result in - LIB, so we need to add that to the LIBGD_LDFLAGS (otherwise, this - will be part of the global LIBS that are used) - -2009-12-18 Arjen de Korte - - * [r2185] m4/nut_check_libgd.m4: Apparently, gdlib-config sometimes - fails to mention '-lgd' when asked for the LDFLAGS, so we need to - test once again if we need to include this library. - * [r2184] common/snprintf.c, configure.in: Instead of trying to - figure out if 'long long' is supported through AC_TRY_RUN - (obsolete), use AC_TYPE_LONG_LONG_INT (and AC_TYPE_LONG_DOUBLE). - Since this is only used by common/snprintf.c, only do this if - snprintf isn't a build-in function (which means probably never). - * [r2183] configure.in: Don't run preprocessor tests on - AC_CHECK_HEADERS (so CPPFLAGS is no longer needed). Replace shell - scripting by autoconf macros. - * [r2182] m4/nut_check_libgd.m4, m4/nut_check_libnetsnmp.m4, - m4/nut_check_libwrap.m4: Don't run preprocessor tests on - AC_CHECK_HEADERS (so CPPFLAGS is no longer needed). - * [r2181] m4/nut_check_libhal.m4: Don't run preprocessor tests on - AC_CHECK_HEADERS (so CPPFLAGS is no longer needed). Reformatted - macro (no functional changes). - * [r2180] m4/nut_check_libwrap.m4: Prefer AC_CHECK_HEADERS over - AC_CHECK_HEADER - * [r2179] m4/nut_check_libgd.m4: Set CPPFLAGS in case autoconf only - runs the preprocessor for AC_CHECK_HEADERS (which doesn't use - CFLAGS) - -2009-12-17 Arjen de Korte - - * [r2178] m4/nut_check_libnetsnmp.m4: Set CPPFLAGS in case autoconf - only runs the preprocessor (which doesn't use CFLAGS) - * [r2177] m4/nut_check_libneon.m4: Cleanup autoconf macro - * [r2176] clients/upsimage.c: Remove redundant test (this is - already handled by autoconf) - * [r2175] Makefile.am: - * [r2174] configure.in: Keep defaults and checks together - * [r2173] drivers/bcmxcp.c: Automatic variables must have a length - that can be computed at compile time rather than runtime. GCC - will happily accept this C++ construction here, but this is not - C. - - Follow the same principle as used elsewhere in the code, by hard - coding this to PW_ANSWER_MAX_SIZE, the maximum size of replies we - expect. - -2009-12-16 Arjen de Korte - - * [r2172] m4/nut_check_libgd.m4: Check for all GD specific header - files while we're at it - * [r2171] clients/upsimage.c: The HAVE_GD_H should not be used - here, it is better to check for HAVE_LIBGD since that one is only - set if both the header file and the gd library are found (and not - just the first). - * [r2170] m4/nut_check_libnetsnmp.m4: Cleanup autoconf macro - * [r2169] m4/nut_check_libgd.m4: Cleanup GD autoconf stuff (also - fixes double -lgd linker flag) - * [r2168] configure.in, m4/nut_check_ipv6.m4, - m4/nut_check_libssl.m4, m4/nut_check_libwrap.m4: Cleanup some - autoconf macros - -2009-12-15 Arjen de Korte - - * [r2167] m4/nut_check_libnetsnmp.m4: Use AC_CHECK_HEADER to check - for required headers. - * [r2166] m4/nut_check_libwrap.m4: Fix autoconf magic for Solaris. - Apparently, allow/deny_severity are not defined as weak symbols, - so autoconf fails with undefined symbols when checking for the - library through AC_SEARCH_LIBS. - -2009-12-15 Charles Lepple - - * [r2165] include/common.h: Fix __attribute__ in common.h - - Patch provided by Tim Rice - http://lists.alioth.debian.org/pipermail/nut-upsdev/2009-December/004288.html - -2009-12-10 Arnaud Quette - - * [r2163] drivers/mge-utalk.c: complete r2151 with the - implementation details that were removed from the new mge-utalk - man page. - -2009-12-09 Arnaud Quette - - * [r2161] drivers/mge-hid.c: complete alarms and status handling - for Eaton / MGE / Dell. - -2009-12-04 Arnaud Quette - - * [r2153] m4/nut_check_libssl.m4: fix a wrong pkg-config call - parameter, that resulted in using pkg-config's own version - instead of OpenSSL's one. - -2009-12-02 Arnaud Quette - - * [r2148] drivers/libhid.c: skip reports 254/255 for Eaton / MGE / - Dell due to special handling needs - -2009-11-30 Arjen de Korte - - * [r2145] man/upsd.8, man/upsd.conf.5, man/upsd.users.5: Add - upgrading notes for versions earlier than nut-2.4.0 - * [r2143] drivers/usbhid-ups.c, drivers/usbhid-ups.h: Use contents - of interrupt report. In case these are broken, set 'pollonly' - flag in ups.conf or use_interrupt_pipe = FALSE in subdriver (when - device matches!) - -2009-11-26 Arjen de Korte - - * [r2141] man/usbhid-ups.8: Document the 'pollonly' flag - -2009-11-25 Arjen de Korte - - * [r2140] drivers/microdowell.c: Fix compiler warning (dead code, - no functional change) - * [r2139] drivers/usbhid-ups.c: Fix compiler warning - * [r2138] drivers/usbhid-ups.c: Add some USB error codes observed - in the field for possible future handling (and the comments from - the headerfiles where these are defined) - -2009-11-24 Arjen de Korte - - * [r2133] drivers/mge-hid.c: We already know if the value to the - reverse conversion functions should be a time or date value, so - there is no need to guess it. - -2009-11-23 Arnaud Quette - - * [r2128] drivers/mge-hid.c: - fix mge_time_date_conversion_nuf() - to actually use the input value - - force ignoring the DST offset for the output value - -2009-11-19 Arnaud Quette - - * [r2122] data/driver.list, drivers/libshut.c, man/mge-shut.8: Add - serial / SHUT support for the new Dell UPS range - - list all models in driver.list using newmge-shut, - - add "battery.runtime.elapsed" support, - - update mge-shut manual page and add an alias for newmge-shut. - -2009-11-19 Arjen de Korte - - * [r2121] drivers/mge-hid.c: Prefer to use non-negated logic when - possible (also minimizes changes) - -2009-11-19 Arnaud Quette - - * [r2119] data/driver.list, docs/new-names.txt, drivers/mge-hid.c, - man/usbhid-ups.8, scripts/dkp/95-devkit-power-hid.rules, - scripts/hal/ups-nut-device.fdi.in, - scripts/hotplug/libhid.usermap, scripts/udev/nut-usbups.rules.in: - Add USB support for the new Dell UPS range - - list all models in driver.list, - - add "battery.runtime.elapsed" in mge-hid.c and NUT namespace, - - adapt ups.model formating to Dell rules, - - update USB helper files, - - update usbhid-ups manual page. - -2009-11-18 Arjen de Korte - - * [r2118] drivers/netxml-ups.c: Re-subscribe to NMC when it doesn't - send us alarm messages anymore - -2009-11-18 Arnaud Quette - - * [r2117] drivers/mge-xml.c: minor typo fix on comment - -Mon Nov 16 01:57:23 UTC 2009 / Charles Lepple - - - drivers/tripplite_usb.c: fix copy-n-paste error in load.on instcmd. - -Fri Oct 9 11:26:49 UTC 2009 / Arjen de Korte - -- m4/nut_check_libssl.m4,nut_check_libusb.m4: show version information during - configuration - -Thu Oct 8 19:38:03 UTC 2009 / Arjen de Korte - - - m4/nut_check_libneon.m4,nut_check_libusb.m4: changes in autoconf magic to - detect optional functions (without making assumptions on where they are - located) - - configure.in: update for the above - - drivers/libusb.c,netxml-ups.c,richcomm_usb.c: update for the above - -Wed Oct 7 17:53:42 UTC 2009 / Arnaud Quette - - * drivers/dummy-ups.c: dummy-ups general improvements - - dummy mode now loop on reading the .dev file, instead of reading it once. - Interacting through this method is also possible, by changing the .dev file - content on the fly, - - dummy mode now support actions (TIMER only ATM) in the .dev file. This - allows to have an automated scripting sequence (see data/evolution.dev and - dummy-ups manpage for examples), - - repeater mode now check the upsd connection, and reconnect if needed, - (reported by Gabor Kiss) - - cleanup the inline TODO list, - - bump the driver version to 0.10. - * man/dummy-ups.8: update according to the above changes. - * data/epdu-managed.dev: new dummy-ups definition file. - -Wed Oct 7 14:05:35 UTC 2009 / Arjen de Korte - - - drivers/snmp-ups.c: remove suspicious code for shutdown.* commands - -Wed Oct 7 13:43:15 UTC 2009 / Arjen de Korte - - - drivers/apc-hid.c: add support for Back-UPS RS series test.battery.* - commands (experimental) - -Tue Oct 6 19:39:22 UTC 2009 / Arjen de Korte - - - m4/nut_check_libssl.m4: use pkg-config for compiler and linker flags - - m4/nut_check_libusb.m4: minor change - -Tue Oct 6 19:16:08 UTC 2009 / Arjen de Korte - - - MAINTAINERS: Remove entry for Peter Selinger (by request) - -Tue Oct 6 12:13:01 UTC 2009 / Arnaud Quette - - - drivers/mge-shut.c: actually apply the low battery level if provided (either - through "-x lowbatt" or ups.conf). Also change the driver reported name from - "MGE UPS SYSTEMS" to "Eaton". - (reported by Daniel O'Connor) - -Mon Oct 5 20:02:42 UTC 2009 / Arnaud Quette - - - drivers/nut_usb.c: remove the calls to usb_set_configuration() and - usb_set_altinterface(), which were not needed and caused troubles - with some Eaton / Powerware models. Also add some older HP T500 / T750 which - seem to be supported, - - data/driver.list: add entries for the above. - -Mon Sep 21 08:30:18 UTC 2009 / Arjen de Korte - - - drivers/tripplite-hid.c: add ECO550UPS to list of supported devices. - - data/driver.list: add an entry for the above. - -Sun Sep 20 19:06:34 UTC 2009 / Arjen de Korte - - - drivers/tripplite-hid.c: fix broken matcher function that would - unconditionally reject possibly supported devices, even when the - productid option was supplied. - -Tue Sep 15 09:06:32 UTC 2009 / Arnaud Quette - - - data/driver.list: add an entry for Eaton E Series DX UPS (1-20 kVA) with - mge-utalk. - -Tue Sep 15 08:16:32 UTC 2009 / Arnaud Quette - - - data/driver.list: add an entry for Eaton E Series NV UPS (400-2000 VA) with - megatec_usb (reported by Vitor Choi Feitosa). - -Tue Sep 8 18:57:51 UTC 2009 / Arjen de Korte - - - m4/nut_check_libnetsnmp.m4: check for presence of header files to see - if development files are installed - -Tue Sep 8 09:39:24 UTC 2009 / Arnaud Quette - - - drivers/ivtscd.c: complete general information (device.{mfr,model,type}), - - man/ivtscd.8, man/Makefile.am: add the manpage for ivtscd driver, - - data/driver.list: add an entry for IVT SCD-series devices. - -Fri Sep 4 08:36:21 UTC 2009 / Arnaud Quette - - - scripts/perl/Nut.pm: embed the NUT Perl client module, - (patch from Gabor Kiss) - - COPYING, scripts/README: update information for Perl module inclusion. - -Fri Sep 4 08:12:52 UTC 2009 / Arnaud Quette - - - drivers/apc-hid.c: fix input.transfer.reason support by using the standard - BOOL lookup mechanism (thanks Arjen), and bump the subdriver version to 0.94. - -Thu Sep 3 11:49:12 UTC 2009 / Arnaud Quette - - - drivers/apc-hid.c: add input.transfer.reason and input.sensitivity, along - with some more reverse engineered information. - (reported by Markus Wildi) - -Wed Sep 2 19:52:21 UTC 2009 / Arjen de Korte - - - drivers/ietfmib.h,drivers/mgemib.h: Indexes start at 1 (not 0). - -Tue Aug 25 20:40:28 UTC 2009 / Arjen de Korte - - - drivers/usbhid-ups.[ch]: remove delayed matching which wasn't really - useful, since it requires claiming the device, breaking any existing - bindings in the process (should also fix Alioth bug #311869) - -Tue Aug 18 01:22:14 UTC 2009 / Charles Lepple - - - drivers/bestfortress.c, man/bestfortress.8, data/driver.list: Resurrect the - bestfortress driver (submitted by Stuart D. Gathman) - -Sat Aug 15 17:42:49 UTC 2009 / Charles Lepple - - - drivers/cps-hid.c, data/driver.list: Add CyberPower OR2200 to usbhid-ups - (reported by James Erickson) - -Wed Aug 12 13:42:21 UTC 2009 / Arnaud Quette - - - data/drivers.list: also list Inform Informer Compact 1000VA with blazer_ser - (reported by Mutlu Tunç) - -Mon Aug 10 12:18:42 UTC 2009 / Arnaud Quette - - - drivers/mge-xml.c: add support for newer Eaton ePDU monitored - - man/netxml-ups.8: add a reference to Eaton ePDU monitored - - data/drivers.list: update the Eaton ePDU monitored to include netxml-ups - -Sun Aug 9 15:43:21 UTC 2009 / Arnaud Quette - - - data/drivers.list: add Inform Informer Compact 1000VA - (reported by Mutlu Tunç) - -Fri Jul 31 03:07:27 UTC 2009 / Charles Lepple - - - drivers/liebert.c: Hard-code the baud rate to 9600 to prevent problems with - noise. - -Wed Jul 29 01:37:06 UTC 2009 / Charles Lepple - - - data/driver.list: Add "CP 1500C" to compatibility list for usbhid-ups - (reported by Svein Skogen) - -Mon Jul 27 22:00:00 UTC 2009 / Arnaud Quette - - - tools/nut-usbinfo.pl, scripts/dkp/95-devkit-power-hid.rules: remove - the 0x prefix from the VendorIDs - -Mon Jul 27 11:21:21 UTC 2009 / Arnaud Quette - - - tools/nut-usbinfo.pl, scripts/dkp/95-devkit-power-hid.rules: generate - the DeviceKit-power rule file, so that it can be maintained up to - date from the NUT source. - -Mon Jul 20 19:20:35 UTC 2009 / Arjen de Korte - - - Renamed 'virtual' to 'clone' driver, to resolve a conflict with the - Postfix virtual domain mail delivery agent man pages - -Sat Jul 11 15:58:16 UTC 2009 / Charles Lepple - - * Makefile.am: Add "." to "find" command - -Sat Jul 11 14:25:00 UTC 2009 / Charles Lepple - - * drivers/nut_usb.c: Add usb_strerror() to USB error messages. - -Tue Jul 7 11:06:32 UTC 2009 / Arnaud Quette - - * device collection completion, for the transition period - - drivers/main.c: remap device.{mfr,model,serial} from the ups.* - equivalent, and preset device.type to ups so that it only has to be - overriden if necessary. - - drivers/skel.c: some update for the device collection - - docs/new-names.txt: add the device collection description - -Mon Jul 6 09:28:10 UTC 2009 / Arnaud Quette - - - drivers/tripplite.c: fix the reading with some SmartUPS models - (patch from Robert Waldie, Opengear) - -Tue Jun 30 13:28:42 UTC 2009 / Arnaud Quette - - - drivers/baytechmib.h: add outlet.{current,voltage} and fix some - comments (from Scott Burns, Opengear) - -Wed May 27 20:35:41 UTC 2009 / Arjen de Korte - - - clients/upsmon.c: multilevel debug information (similar to other NUT - binaries) - -Mon May 25 19:53:02 UTC 2009 / Arjen de Korte - - * Enable timestamp on debug messages by default - - common/common.c: prepend elapsed number of seconds and microseconds - since start of program for upsdebug() messages, - - drivers/upsdrvctl.c: inform people that adding debug flags to upsdrvctl - is not the way to debug a driver, - - revert remainder of previous patch - -Mon May 18 11:48:31 UTC 2009 / Arnaud Quette - - * Enable timestamp on output messages (format "%H:%M:%S: msg") - - common/common.c, include/common.h: modify vupslog() to allow optional - appending of a timestamp on debug output, - - clients/upsmon.c, drivers/main.c, drivers/upsdrvctl.c, server/upsd.c: - enable timestamping using the "-T" option, - - man/upsmon.8, man/nutupsdrv.8, man/upsdrvctl.8, man/upsd.8: document the - timestamp option. - -Thu May 14 19:19:52 UTC 2009 / Arnaud Quette - - - drivers/baytechmib.h: add native NUT support for Baytech SNMP PDUs (RPCs), - - drivers/snmp-ups.c: enable Baytech MIB, - - drivers/Makefile.am: add the new MIB file, - - data/driver.list: add the supported PDUs from BayTech, - - man/snmp-ups.8: document the new MIB and devices. - (patch from Scott Burns, Opengear) - -Thu May 14 21:06:11 UTC 2009 / Arnaud Quette - - - drivers/raritan-mib.h: use the outlets template mechanism and remove all - the OIDs defines for a better readability - - drivers/snmp-ups.c: enable Raritan MIB back. - -Thu May 14 19:19:52 UTC 2009 / Arnaud Quette - - - drivers/eaton-aphel-mib.h: use the outlets template mechanism. - -Thu May 14 14:44:22 UTC 2009 / Arnaud Quette - - - docs/configure.txt: a bit of completion and standardisation. - -Thu May 14 14:23:41 UTC 2009 / Arnaud Quette - - - drivers/snmp-ups.[ch]: add a template mechanism for outlets declaration, and - the needed helpers. Also disable temporarily the Raritan MIB as it conflicts - with Eaton (Aphel) . - -Wed May 13 13:54:32 UTC 2009 / Arnaud Quette - - - man/Makefile.am, man/nut.conf.5: add a manpage for nut.conf - (patch from Debian BTS, #528222) - -Tue May 05 13:26:21 UTC 2009 / Arnaud Quette - - - drivers/apcsmart.h: add support for older SmartUPS 600 responding to other - D codes (D7, D8 and D9) - (patch from Konstantin 'Kastus' Shchuka) - -Tue May 05 02:01:13 UTC 2009 / Charles Lepple - - - drivers/tripplite_usb.c, man/tripplite_usb.8, data/driver.list: update list - of units tested with tripplite_usb - -Mon May 04 08:11:01 UTC 2009 / Arnaud Quette - - - drivers/apcsmart.[ch]: add support for older SmartUPS, which do not respond - to the ^Z, a or b commands (used to inquire the supported data) - (patch from Thomas Juerges) - -Thu Apr 30 21:20:42 UTC 2009 / Arnaud Quette - - - data/driver.list: add Apollo 1000A and 1000F compatibility with genericups - upstype=4 (reported by mvochin) - -Thu Apr 23 12:46:12 UTC 2009 / Arnaud Quette - - - man/snmp-ups.8: remove the EXPERIMENTAL section to the profit of a LIMITATION - section. - -Fri Apr 17 13:26:21 UTC 2009 / Arnaud Quette - - - data/driver.list: add UPSonic DS-800 compatibility with megatec_usb - (reported by Nick Jenkins) - -Sun Mar 29 20:59:09 UTC 2009 / Arjen de Korte - - - drivers/netxml.c: Either do a quick poll or a complete poll (not both). - -Sun Mar 29 20:21:19 UTC 2009 / Arjen de Korte - - * clients/upsimage.c, clients/upsstats.c: - - Add ups.temperature, ambient.temperature and ambient.humidity (sorry folks, - Celsius only for now). - - The graph for the battery.charge now honors battery.charge.low for the red zone. - - The number of minor dashes for the battery.charge is reduced. - - Value on the scales is now right aligned. Display of negative values is corrected. - * conf/upsstats-single.html.sample: - - If ambient.(temperature|humidity) is supported, an 'Ambient' column is added to - display the bars for them. - -Thu Mar 26 20:04:53 UTC 2009 / Arjen de Korte - - * drivers/netxml.[ch], drivers/mge-xml.c: - - Allow multiple entry points for the initial XML page that is loaded - - Use different XML pages for quick and full status updates (the latter - is only polled once every 10 times) - -Mon Mar 23 17:34:10 UTC 2009 / Kjell Claesson - - - data/driver.list, add Eaton Powerware 9130 compatibility with bcmxcp and usbhid-ups. - -Sun Mar 22 01:13:18 UTC 2009 / Alexander I. Gordeev - - - drivers/blazer_usb.c: read data from device until timeout. - -Mon Mar 16 22:10:30 UTC 2009 / Kjell Claesson - - - drivers/bcmxcp.[ch]: Extend alarm map to fix debug crash on PW9130. Driver version 0.22. - -Wed Mar 04 19:37:12 UTC 2009 / Arnaud Quette - - - drivers/mge-utalk.c: fix enable_ups_comm() - (patch from Hans-Werner Paulsen) - -Sun Mar 01 19:51:54 UTC 2009 / Arnaud Quette - - - data/driver.list, drivers/tripplite-hid.c: add HP T750 INTL - (reported by KP Kirchdoerfer) - -Fri Feb 27 09:33:27 UTC 2009 / Arnaud Quette - - - data/driver.list: add Mustek PowerMust 424 / 636 / 848 (USB) compatibility - with blazer_usb (reported by Vitaly Polyakov) - -Fri Feb 27 09:07:05 UTC 2009 / Arnaud Quette - - - drivers/apcsmart.[ch]: add APC Matrix 5000, vintage 12/00 - (patch from Jarett Stevens) - -Tue Feb 17 22:00:01 UTC 2009 / Arnaud Quette - - - drivers/Makefile.am: Fix snmp-ups overlinking with lcrypto. - (Debian Lintian report) - -2.4.1 - -Mon Feb 16 17:41:32 UTC 2009 / Arnaud Quette - - - configure.in: 2.4.1 - -Mon Feb 16 16:13:47 UTC 2009 / David Goncalves - - - scripts/python/app/NUT-Monitor: Changed version from 1.0 to 1.1. Changed - the way NUT-Monitor deals with 'ups.status' var to better handle composite - status (OL + TRIM, OL + CHRG, ...) - -Thu Feb 12 13:23:41 UTC 2009 / Arnaud Quette - - - scripts/udev/Makefile.am, scripts/hal/Makefile.am, scripts/hotplug/Makefile.am, - Makefile.am: fix the autotools issue with the clean/distclean target removing - the USB helper files. - -Wed Feb 11 10:43:10 UTC 2009 / Kjell Claesson - - - data/driver.list: Updated list with ups supported by microdowell driver. - -Thu Feb 05 22:16:10 UTC 2009 / Kjell Claesson - - - drivers/microdowell.c: Cleaned some of the code. Fixed reading of ups.conf variables. - -Wed Feb 04 15:01:20 UTC 2009 / Kjell Claesson - - - Added microdowell.c/h into drivers/. add man/microdowell.8. Adjusted - drivers/Makefile.am and man/makefile.am. Adjusted the code for 2.4.0 - in the microdowell.c. - -*** File trimmed here 28 January 2009 *** - -For entries before this point, start with version 2.4.1 and work back. diff --git a/INSTALL b/INSTALL index ceb81b6..1e58c4c 100644 --- a/INSTALL +++ b/INSTALL @@ -1,522 +1,320 @@ -Network UPS Tools: INSTALL +Installation instructions +========================= -These are the essential steps for compiling and installing this -software, including configuring safe shutdowns when the UPS battery -runs out of power. +This chapter describe the various methods for installing Network UPS Tools. -There are many programs and other features in this package. You should -check out the README file and other accompanying documentation to see -how it all works. +Whenever it is possible, prefer <>. +Packagers have done an excellent and hard work at improving NUT integration into +their system. -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. +[[Installing_source]] +Installing from source +---------------------- -Note: 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: +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. + +[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 - man -M /usr/local/ups/man upsd.conf +- 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. -Also, if your favorite system offers up to date binary packages, -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 - =================== - - 1. Create at least one 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 - ================= +================================================================================ - 1. 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. +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: +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 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 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. +* to build and install CGI scripts, add '--with-cgi'. - * to build and install NUT development files (needed to compile - WMNut and MGE PSP), add --with-lib. +See <> from the User Manual, +docs/configure.txt or './configure --help' for all the available +options. - * to build and install HAL support, add --with-hal. +If you alter paths with additional switches, be sure to use those +new paths while reading the rest of the steps. - See docs/configure.txt or "./configure --help" for the available - options. +Reference: <> from the +User Manual. - If you alter paths with additional switches, be sure to use those - new paths while reading the rest of the steps. - *** Reference: docs/configure.txt - ---------------------------------------------------------------------------- - - 2. Build the programs. +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 configuration in step 1. above. +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. ---------------------------------------------------------------------------- - 3. Gain privileges for installing software if necessary. +Installation +^^^^^^^^^^^^ + +[NOTE] +===================================================================== + +you should now gain privileges for installing software if necessary: su ---------------------------------------------------------------------------- +===================================================================== - - 4. Install the files to a system level directory. +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 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. +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.: +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 +^^^^^^^^^^^^^^^^^^^ - 5. 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. +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 +^^^^^^^^^^^^^^^^^^^^^^^^^ - 6. 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. +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. +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 - 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". +//////////////////////////////////////////////////////////////////////////////// +FIXME: TBR +//////////////////////////////////////////////////////////////////////////////// - (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!). +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". - 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. +(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. - 7. Create one section per UPS in /usr/local/ups/etc/ups.conf - To find out which driver to use, check the "HARDWARE SUPPORT TABLE" - in the README file, or data/driver.list. +You are now ready to configure NUT, and start testing and using it. - Once you have picked a driver, create a section for your UPS in - ups.conf. You must supply values for "driver" and "port". +You can jump directly to the <>. - Some drivers may require other flags or settings. The "desc" value - is optional, but is recommended to provide a better description of - what your UPS is supporting. - A typical UPS without any extra settings looks like this: +[[Installing_packages]] +Installing from packages +------------------------ - [myupsname] - driver = mydriver - port = /dev/ttyS1 - desc = "Workstation" +This chapter describes the specific installation steps when using +binary packages that exist on various major systems. - NOTE: usbhid-ups is a special case and ignores the "port" value. - You must still set this value, but it does not matter what you set - it to; you can set "port" to "auto" if you like. If you only own - one local UBS UPS, the driver will find it automatically. If you - own more than one UBS UPS, refer to the usbhid-ups(8) man page for - more information. +[[Debian]] +Debian, Ubuntu and other derivatives +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - *** References: man pages: ups.conf(5), nutupsdrv(8), plus - whatever driver(s) you intend to use. +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: - 8. Start the driver(s) for your hardware. +- '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. - /usr/local/ups/bin/upsdrvctl start +//////////////////////////////////////////////////////////////////////////////// +- nut-client +- nut-hal-drivers +//////////////////////////////////////////////////////////////////////////////// - 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 belkin driver looks like this: +Configuration files are located in /etc/nut. +nut.conf must be edited to be able to invoke /etc/init.d/nut - # /usr/local/ups/bin/upsdrvctl start - Network UPS Tools - UPS driver controller 1.5.12 - Network UPS Tools - Belkin Smart protocol driver 0.21 (1.5.12) - Detected F6C525-SER on /dev/cuaa0 - # +NOTE: Ubuntu users can access the APT URL installation by clicking on link:apt://nut[this link]. - 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. - Be sure to check the driver's man page to see if it needs any extra - settings in ups.conf to detect your hardware. +[[Mandriva]] +Mandriva +~~~~~~~~ - If it says "can't bind /var/state/ups/..." or similar, then your - state path probably isn't writable by the driver. Check the - permissions and mode on that directory (step 5). +NOTE: NUT is packaged and well maintained in these systems. +The official Mandriva packager is part of the NUT Team. - After making changes, try step 6 again. +Using your prefered method (urpmi, RPMdrake, ...), install one of the two below +packages: - *** References: man pages: nutupsdrv(8), upsdrvctl(8) +- 'nut-server' if you have a 'standalone' or 'netserver' installation, +- 'nut' if you have a 'netclient' installation. ---------------------------------------------------------------------------- +Optionaly, you can also install the following: - 9. Configure upsd, which serves data from the drivers to the clients. +- 'nut-cgi', if you need the CGI (HTML) option, +- 'nut-devel', if you need the development files. - 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. - LISTEN 127.0.0.1 3493 - LISTEN ::1 3493 +[[Suse]] +Suse / Opensuse +~~~~~~~~~~~~~~~ - Note: if you run a firewall of some sort, you may have to add rules - to allow these incoming connections. +NOTE: NUT is packaged and well maintained in these systems. +The official Suse packager is part of the NUT Team. - 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. +Install the 'nut-classic' package, and optionaly the following: - 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. +- '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, - The suggested configuration is to chown it to root, chgrp it to the - group you created, then make it readable by the group. +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. - chown root:nut upsd.conf upsd.users - chmod 0640 upsd.conf upsd.users - *** References: man pages: upsd.conf(5), upsd.users(5), upsd(8) +[[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. -10. Start the network server. +Using your prefered method (yum, Add/Remove Software, ...), install one of the +two below packages: - /usr/local/ups/sbin/upsd +- 'nut' if you have a 'standalone' or 'netserver' installation, +- 'nut-client' if you have a 'netclient' installation. - Make sure it is able to connect to the driver(s) on your system. - A successful run looks like this: +Optionaly, you can also install the following: - # /usr/local/ups/sbin/upsd - Network UPS Tools upsd 1.5.12 - Connected to UPS [belkin]: belkin-cuaa0 - Synchronizing...done - # +- '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. - 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 - have a driver that isn't working properly. You must fix this before - going on to the next step. +[[FreeBSD]] +FreeBSD +~~~~~~~ - *** Reference: man page: upsd(8) +You can either install NUT as a binary package or as a port. ---------------------------------------------------------------------------- +Binary package +^^^^^^^^^^^^^^ -11. Make sure that the UPS is providing good status data. +To install the main component, use the following command: - /usr/local/ups/bin/upsc myupsname@localhost ups.status + # pkg_add -r nut - You should see just one line in response: +Port +^^^^ - OL +The port is located under /usr/ports/sysutils/nut. +To install it, use the following command: - 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 in step 7. If you reconfigure the driver, - use 'upsdrvctl stop' to stop it, then start it again in step 8. + # cd /usr/ports/sysutils/nut/ && make install clean - *** Reference: man page: upsc(8) +You have to define WITH_NUT_CGI to build the optional CGI scripts. ---------------------------------------------------------------------------- +Optionaly, you can also install the following ports: -12. Look at all of the status data which is being monitored. +- sysutils/nut-snmp, for the SNMP driver, +- sysutils/nut-usb, for the USB drivers, +- sysutils/nut-libupsclient, for the upsclient library. - /usr/local/ups/bin/upsc myupsname@localhost - What happens now depends on the kind of UPS and driver you have. - In the list, you should see ups.status with the same value you got - above. A sample run on a MGE UPS SYSTEMS Ellipse ASR 600 looks - like this: +You are now ready to configure NUT, and start testing and using it. - battery.charge: 82 - battery.charge.low: 30 - battery.runtime: 1563 - driver.name: usbhid-ups - driver.parameter.port: auto - driver.version: 2.0.3 - driver.version.data: MGE HID 0.8 - driver.version.internal: 0.28 - input.transfer.high: 264.0 - input.transfer.low: 184.0 - outlet.desc: Main Outlet - outlet.id: 1 - outlet.switchable: 0 - outlet.1.desc: PowerShare Outlet 1 - outlet.1.id: 2 - outlet.1.switch: 0 - outlet.1.switchable: 0 - output.voltage: 230.0 - ups.delay.shutdown: -1 - ups.delay.start: -10 - ups.load: 0 - ups.mfr: MGE UPS SYSTEMS - ups.model: Ellipse 600 - ups.power.nominal: 600 - ups.serial: AP8F15005 - ups.status: OB DISCHRG - - *** Reference: man page: upsc(8) - ---------------------------------------------------------------------------- - -13. Edit your startup scripts. - - Make sure upsdrvctl and upsd are run every time your system starts. - -============================================================================ -============================================================================ -============================================================================ - - Configuring 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 just eye candy. To make -sure your system shuts down properly, you will need to perform some -additional configuration and run upsmon. Here are the basics: - ---------------------------------------------------------------------------- - - 1. Create a upsd user for upsmon to use while monitoring this UPS. - - 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 master # or upsmon slave - - *** References: man pages: upsd(8), upsd.users(5) - ---------------------------------------------------------------------------- - - 2. Reload upsd. Depending on your configuration, you may be able to - do this without stopping upsd: - - /usr/local/ups/sbin/upsd -c reload - - If that doesn't work (check the syslog), just restart it: - - /usr/local/ups/sbin/upsd -c stop - /usr/local/ups/sbin/upsd - - Later: if you want to make reloading work, see the entry in the FAQ - about starting upsd as a different user. - ---------------------------------------------------------------------------- - - 3. Set the POWERDOWNFLAG location for upsmon. - - 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. - - POWERDOWNFLAG /etc/killpower - - *** References: man pages: upsmon(8), upsmon.conf(5) - ---------------------------------------------------------------------------- - - 4. Secure upsmon.conf. - - 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. - ---------------------------------------------------------------------------- - - 5. Create a MONITOR directive for upsmon - - Edit upsmon.conf and create a MONITOR line with the UPS definition - (@), username and password from step 2, and - the master or slave setting. - - If it's the master (i.e., it's connected to this UPS directly): - - MONITOR myupsname@mybox 1 monuser mypass master - - If it's just monitoring this UPS over the network, and some other - system is the master: - - 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. See big-servers.txt and data-room.txt. - - *** References: man pages: upsmon(8), upsmon.conf(5) - ---------------------------------------------------------------------------- - - 6. 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: - - SHUTDOWNCMD "/sbin/shutdown -h +0" - - Notice the presence of "quotes" here to keep it together. - - If your system has special needs, you may want to set this to - a script which does local shutdown tasks before calling init. - ---------------------------------------------------------------------------- - - 7. Start upsmon. - - /usr/local/ups/sbin/upsmon - - If it complains about something, then check your configuration. - ---------------------------------------------------------------------------- - - 8. 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 - logged into UPS [myupsname] - - Any errors seen here are probably due to an error in the config - files of either upsmon or upsd. You should fix them before - continuing. - ---------------------------------------------------------------------------- - - 9. Edit your startup scripts: add upsmon - - 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. - ---------------------------------------------------------------------------- - -10. Edit your shutdown scripts: 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 upsmon.conf), using this as an example: - - if (test -f /etc/killpower) - then - echo "Killing the power, bye!" - /usr/local/ups/bin/upsdrvctl shutdown - - sleep 120 - - # uh oh... the UPS power-off failed - # you probably want to reboot here so you don't get stuck! - # *** see the section on power races in shutdown.txt! *** - fi - - 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, be sure the arrays are ready to lose power. - Your kernel's power-off routines may not execute. - - Make sure that the filesystem(s) holding your UPS drivers and - configuration details are still mounted when that part of the script - is run. You need upsdrvctl, ups.conf, and any drivers for the - hardware on your system. - ---------------------------------------------------------------------------- - -More information can be found in the README file, the shutdown.txt document, -the upsmon(8) man page and the upsmon.conf(5) man page. +You can jump directly to the +<>. diff --git a/Makefile.am b/Makefile.am index fea5ed4..82c212c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ ACLOCAL_AMFLAGS = -I m4 # subdirectories to build and distribute. The order matters, as # several subdirectories depend on stuff in "common" being built first -SUBDIRS = include common clients conf data docs drivers lib man \ +SUBDIRS = include common clients conf data docs drivers lib \ tools scripts server EXTRA_DIST = MAINTAINERS UPGRADING @@ -16,8 +16,8 @@ EXTRA_DIST = MAINTAINERS UPGRADING # need to give hotplug-dir and udev-dir, so that staged install does # not fail. -DISTCHECK_FLAGS = --with-all --with-ssl --with-ipv6 -DISTCHECK_LIGHT_FLAGS = --with-all=auto --with-ssl=auto --with-ipv6=auto +DISTCHECK_FLAGS = --with-all --with-ssl --with-doc=auto +DISTCHECK_LIGHT_FLAGS = --with-all=auto --with-ssl=auto --with-doc=auto DISTCHECK_CONFIGURE_FLAGS = ${DISTCHECK_FLAGS} \ --with-hotplug-dir='$${prefix}/etc/hotplug' \ @@ -27,8 +27,29 @@ distcheck-light: $(MAKE) $(AM_MAKEFLAGS) DISTCHECK_FLAGS="$(DISTCHECK_LIGHT_FLAGS)" distcheck # workaround the dist generated files that are also part of the distribution -distcleancheck_listfiles = \ - find . -type f -exec sh -c 'test -f $(srcdir)/{} || echo {}' ';' +# Note that distcleancheck is disabled for now, while waiting for a proper +# solution, that do not break older unix systems +#distcleancheck_listfiles = \ +# find . -type f -exec sh -c 'test -f $(srcdir)/{} || echo {}' ';' +distcleancheck: + @: + +# Automatically generate the ChangeLog from SVN logs: +MAINTAINERCLEAN_FILES = ChangeLog +ChangeLog: tools/svn2cl.authors + svn2cl --group-by-day --include-rev --authors=$< --revision 'HEAD:2332' --output=$@ || \ + echo "svn2cl failed to generate the ChangeLog. See http://trac.networkupstools.org/projects/nut/timeline" > $@ + +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). diff --git a/Makefile.in b/Makefile.in index 7839a3a..f7b5c89 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -39,15 +39,16 @@ target_triplet = @target@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ - ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \ - install-sh ltmain.sh missing + 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_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -57,6 +58,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -120,9 +122,12 @@ am__relativize = \ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -135,8 +140,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -153,7 +160,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -164,22 +170,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ @@ -281,7 +287,7 @@ ACLOCAL_AMFLAGS = -I m4 # subdirectories to build and distribute. The order matters, as # several subdirectories depend on stuff in "common" being built first -SUBDIRS = include common clients conf data docs drivers lib man \ +SUBDIRS = include common clients conf data docs drivers lib \ tools scripts server EXTRA_DIST = MAINTAINERS UPGRADING @@ -291,17 +297,15 @@ EXTRA_DIST = MAINTAINERS UPGRADING # distcheck-light". Try to check as many features as possible! Also # need to give hotplug-dir and udev-dir, so that staged install does # not fail. -DISTCHECK_FLAGS = --with-all --with-ssl --with-ipv6 -DISTCHECK_LIGHT_FLAGS = --with-all=auto --with-ssl=auto --with-ipv6=auto +DISTCHECK_FLAGS = --with-all --with-ssl --with-doc=auto +DISTCHECK_LIGHT_FLAGS = --with-all=auto --with-ssl=auto --with-doc=auto DISTCHECK_CONFIGURE_FLAGS = ${DISTCHECK_FLAGS} \ --with-hotplug-dir='$${prefix}/etc/hotplug' \ --with-udev-dir='$${prefix}/etc/udev' -# workaround the dist generated files that are also part of the distribution -distcleancheck_listfiles = \ - find . -type f -exec sh -c 'test -f $(srcdir)/{} || echo {}' ';' - +# Automatically generate the ChangeLog from SVN logs: +MAINTAINERCLEAN_FILES = ChangeLog # ---------------------------------------------------------------------- # targets from old build system (pre-automake). @@ -361,7 +365,7 @@ distclean-libtool: # (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): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -386,7 +390,7 @@ $(RECURSIVE_TARGETS): fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -550,7 +554,8 @@ distdir: $(DISTFILES) fi; \ done -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ @@ -594,17 +599,17 @@ dist dist-all: distdir distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ - unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac @@ -654,15 +659,6 @@ distuninstallcheck: fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile @@ -784,6 +780,25 @@ uninstall-am: distcheck-light: $(MAKE) $(AM_MAKEFLAGS) DISTCHECK_FLAGS="$(DISTCHECK_LIGHT_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 +#distcleancheck_listfiles = \ +# find . -type f -exec sh -c 'test -f $(srcdir)/{} || echo {}' ';' +distcleancheck: + @: +ChangeLog: tools/svn2cl.authors + svn2cl --group-by-day --include-rev --authors=$< --revision 'HEAD:2332' --output=$@ || \ + echo "svn2cl failed to generate the ChangeLog. See http://trac.networkupstools.org/projects/nut/timeline" > $@ + +@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) @echo "Warning: 'make build' is deprecated. Use 'make all' instead." diff --git a/NEWS b/NEWS index d47ff06..ab1bb39 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,67 @@ If you're upgrading from an earlier version, see the UPGRADING file. For a complete list of changes, please refer to the ChangeLog file. +--------------------------------------------------------------------------- +Release notes for NUT 2.6.0 - what's new since 2.4.3: + + - the main focus of this release is the complete documentation revamping, + using AsciiDoc. This includes a new website, user manual, developer guide, + packager guide and manual pages, available in various formats (single and + multiple pages HTML, and PDF at the moment). + Be sure to check the --with-doc configure option help, and + docs/configure.txt for more information. + + - Add Augeas support, to provide easy NUT configuration management, through + tools and development APIs. For more information, refer to the developer + guide, or scripts/augeas/README in the source directory. + + - support for new devices: APC 5G; Eaton PowerWare 5119 RM (smart mode using + upscode2 driver), Eaton Best Ferrups (using older ConnectUPS card), + Eaton 9395 (serial interface), Eaton ConnectUPS X / BD / E Slot; + HP T1000 INTL, HP T1500 INTL, HP T750 G2, HP R1500 G2 INTL; iDowell iBox UPS; + Tripp Lite SmartOnline SU1000XLA, Tripp Lite Smart1000LCD, and some + more USB/HID devices IDs; CyberPower CP1500AVRLCD and CP1350AVRLCD; + PowerWalker Line-Interactive VI 1400 ; Rocketfish RF-1000VA / RF-1025VA. + + - usbhid-ups has better support for shutting down APC SmartUPS RM series, + and finally fix the "buffer size" issue, which was breaking some + devices data retrieval, or truncating some data on others. + + - snmp-ups now support SNMP v3 and its security parameters. IETF MIB support + has also been extended. + + - fix dummy-ups simulation driver status handling bug, and add the + capability to remove exposed variables on the fly. + + - the belkin driver now support control commands and status reporting + for beeper and battery test. + + - the powerpanel driver supports more older CyberPower units. + + - mge-utalk, upscode2, blazer and liebert-esp2 have also received some + care, and been improved. + + - NUT-Monitor and the PyNUT client module have been updated to 1.3, + adding more features like automatic connection to the first local device + and i18n support. + + - improve configure time dependencies checking and processing. + + - improve older Unix systems support (HP-UX, Aix, ...) for missing functions. + + - refresh and improve USB helper files (udev and UPower). + + - more generation automation: the ChangeLog file is now generated + automatically at distribution time, along with the files needed for + the website hardware compatibility list. + + - SSL support has also received some improvements. + + - tcp-wrapper now allows hostnames in /etc/hosts.allow too (not only IPv4 + and/or IPv6 addresses). + + - many bugfixes, cleanup and improvements. + --------------------------------------------------------------------------- Release notes for NUT 2.4.3 - what's new since 2.4.2: diff --git a/README b/README index c43679b..2f9213b 100644 --- a/README +++ b/README @@ -1,144 +1,111 @@ -================================= - Network UPS Tools Documentation -================================= +Network UPS Tools Overview +=========================== -:Info: Program support page: -:Author: Arnaud Quette and others, see AUTHORS file. -:Copyright: Released under the GNU GPL - see COPYING for details. - -Mailing list details: http://alioth.debian.org/mail/?group_id=30602 - -.. contents:: - -=========== Description -=========== +----------- Network UPS Tools is a collection of programs which provide a common -interface for monitoring and administering UPS and PDU hardware. NUT comes in -two flavors: the "classic" and the "HAL enabled" one. - -The "classic" flavor --------------------- - -It is the standard installation that uses a layered approach to connect -all of the NUT parts. +interface for monitoring and administering UPS, PDU and SCD hardware. +It uses a layered approach to connect all of the parts. Drivers are provided for a wide assortment of equipment. They understand the specific language of each device and map it back to a -compatibility layer. This means both an expensive "smart" protocol UPS -and a simple "power strip" model can be handled transparently. +compatibility layer. This means both an expensive high end UPS, a simple +"power strip" PDU, or any other power device can be handled transparently with +a uniform management interface. -This information is cached by the network server ``upsd``, which then +This information is cached by the network server `upsd`, which then answers queries from the clients. upsd contains a number of access control features to limit the abilities of the clients. Only authorized hosts may monitor or control your hardware if you wish. Since the notion of monitoring over the network is built into the software, you -can hang many systems off one large UPS and they will all shut down -together. You can also use NUT to power on, off or cycle your data centers -nodes, individually or globally through PDUs outlets. +can hang many systems off one large UPS, and they will all shut down +together. You can also use NUT to power on, off or cycle your data center +nodes, individually or globally through PDU outlets. -Clients such as upsmon check on the status of the hardware and do things +Clients such as `upsmon` check on the status of the hardware and do things when necessary. The most important task is shutting down the operating system cleanly before the UPS runs out of power. Other programs are -also provided to log UPS status regularly, monitor status through your +also provided to log information regularly, monitor status through your web browser, and more. -The "HAL enabled" flavor ------------------------- -This one is intended for use: - -- with supported USB UPS, -- on HAL enabled systems (Linux, FreeBSD, Sun Solaris), -- on HAL enabled desktops (Gnome and possibly KDE) - -Using this approach, you don't have to configure NUT files, nor to -manually start components, nor to install a specific NUT client. - -Upon plugging your USB UPS, the right driver will be automatically -launched, and the according Power Manager GUI will pop up. - -Note that this feature is still beta and incomplete. But it -represents a major evolution, and a huge user experience improvement! - -For more information, refer to INSTALL and docs/nut-hal.txt. - -========== Installing -========== +---------- If you are installing these programs for the first time, go read the -INSTALL file to find out how to do that. This document contains more -information on what all of this stuff does. +<<_installation_instructions,installation instructions>> +to find out how to do that. This document contains more information on what all +of this stuff does. -========= Upgrading -========= +--------- -When upgrading from an older version, always check the UPGRADING file to -see what may have changed. Compatibility issues and other changes will -be listed there to ease the process. +When upgrading from an older version, always check the +<> to see what may have +changed. Compatibility issues and other changes will be listed there to ease +the process. + + +Configuring and using +--------------------- + +Once NUT is installed, refer to the +<> for directions. -============= Documentation -============= +------------- -This file gives an overview of the software. You should read the man -pages, included example configuration files, and auxiliary documentation -for the parts that you intend to use. +This is just an overview of the software. You should read the man pages, +included example configuration files, and auxiliary documentation for the parts +that you intend to use. -=================== Network Information -=================== +------------------- These programs are designed to share information over the network. In -the examples below, ``localhost`` is used as the hostname. This can also +the examples below, `localhost` is used as the hostname. This can also be an IP address or a fully qualified domain name. You can specify a port number if your upsd process runs on another port. -In the case of the program ``upsc``, to view the variables on the UPS called -sparky on the ``upsd`` server running on the local machine, you'd do this:: +In the case of the program `upsc`, to view the variables on the UPS called +sparky on the `upsd` server running on the local machine, you'd do this: /usr/local/ups/bin/upsc sparky@localhost -The default port number is 3493. You can change this with +The default port number is 3493. You can change this with "configure --with-port" at compile-time. To make a client talk to upsd -on a specific port, add it after the hostname with a colon, like this:: +on a specific port, add it after the hostname with a colon, like this: /usr/local/ups/bin/upsc sparky@localhost:1234 This is handy when you have a mixed environment and some of the systems are on different ports. -The general form for UPS identifiers is this:: +The general form for UPS identifiers is this: [@[:]] Keep this in mind when viewing the examples below. -======== Manifest -======== +-------- This package is broken down into several categories: -- *drivers* - These programs talk directly to your UPS hardware. +- *drivers* - These programs talk directly to your UPS hardware. +- *server* - upsd serves data from the drivers to the network. +- *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. -- *server* - upsd serves data from the drivers to the network. - -- *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. - - -======= Drivers -======= +------- These programs provide support for specific UPS models. They understand the protocols and port specifications which define status information @@ -146,170 +113,189 @@ and convert it to a form that upsd can understand. To configure drivers, edit ups.conf. For this example, we'll have a UPS called "sparky" that uses the apcsmart driver and is connected to -``/dev/ttyS1``. That's the second serial port on most Linux-based systems. -The entry in ``ups.conf`` looks like this:: +`/dev/ttyS1`. That's the second serial port on most Linux-based systems. +The entry in `ups.conf` looks like this: [sparky] driver = apcsmart port = /dev/ttyS1 To start and stop drivers, use upsdrvctl. By default, it will start or -stop every UPS in the config file:: +stop every UPS in the config file: /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:: +However, you can also just start or stop one by adding its name: /usr/local/ups/bin/upsdrvctl start sparky /usr/local/ups/bin/upsdrvctl stop sparky -To get the driver name for your device, refer to the below section +To find the driver name for your device, refer to the section below called "HARDWARE SUPPORT TABLE". Extra Settings --------------- +~~~~~~~~~~~~~~ Some drivers may require additional settings to properly communicate with your hardware. If it doesn't detect your UPS by default, check the driver's man page or help (-h) to see which options are available. -For example, the apcsmart driver allows setting "cable" to "940-0095B". -To use this feature, just add another line to your ups.conf section for -that UPS:: +For example, the usbhid-ups driver allows you to use USB serial numbers to +distingish between units via the "serial" configuration option. To use this +feature, just add another line to your ups.conf section for that UPS: [sparky] - driver = apcsmart - port = /dev/ttyS1 - cable = 940-0095B + driver = usbhid-ups + port = auto + serial = 1234567890 -Hardware Support Table ----------------------- +Hardware Compatibility List +~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The NUT Hardware support table is available in the source directory: - - nut-X.Y.Z/data/driver.list - -This one should also be distributed with your favorite packages. +The <> is available in the source directory +('nut-X.Y.Z/data/driver.list'), and is generally distributed with packages. For example, it is available on Debian systems as: /usr/share/nut/driver.list -For another take on this list, try the web page: +This table is also available link:http://www.networkupstools.org/stable-hcl.html[online]. - http://random.networkupstools.org/compat/ -If your driver has vanished, see the FAQ and UPGRADING files. +If your driver has vanished, see the link:FAQ.html[FAQ] and +<>. -Generic UPS Driver ------------------- +Generic Device Drivers +~~~~~~~~~~~~~~~~~~~~~~ -The ``genericups`` driver will support many models that use the same basic +NUT provides several generic drivers that support a variety of very similar models. + +- The `genericups` driver supports many serial models that use the same basic principle to communicate with the computer. This is known as "contact closure", and basically involves raising or lowering signals to indicate power status. - ++ This type of UPS tends to be cheaper, and only provides the very simplest data about power and battery status. Advanced features like battery charge readings and such require a "smart" UPS and a driver which supports it. ++ +See the linkman:genericups[8] man page for more information. -See the genericups(8) man page for more information. +- The `usbhid-ups` driver attempts to communicate with USB HID Power Device +Class (PDC) UPSes. These units generally implement the same basic protocol, +with minor variations in the exact set of supported attributes. This driver +also applies several correction factors when the UPS firmware reports values +with incorrect scale factors. ++ +See the linkman:usbhid-ups[8] man page for more information. + +- The `blazer_ser` and `blazer_usb` drivers supports the Megatec / Q1 +protocol that is used in many brands (Blazer, Energy Sistem, Fenton +Technologies, Mustek and many others). ++ +See the linkman:blazer[8] man page for more information. + +- The `snmp-ups` driver handles various SNMP enabled devices, from many +different manufacturers. In SNMP terms, `snmp-ups` is a manager, that +monitors SNMP agents. ++ +See the linkman:snmp-ups[8] man page for more information. + +- The `powerman-pdu` is a bridge to the PowerMan daemon, thus handling all +PowerMan supported devices. The PowerMan project supports several serial +and networked PDU, along with Blade and IPMI enabled servers. ++ +See the linkman:powerman-pdu[8] man page for more +information. -There is also a document called contact-closure.txt included with the -source distribution that contains information on this kind of hardware -and details on adding additional types to the genericups driver. UPS Shutdowns -------------- +~~~~~~~~~~~~~ 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:: +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/bin/upsdrvctl shutdown /usr/local/ups/bin/upsdrvctl shutdown sparky -You should read the shutdown.txt file in the docs subdirectory to -learn more about when to use this feature. If called at the wrong time, -you may cause data loss by turning off a system with a filesystem +You should read the <> +chapter to learn more about when to use this feature. If called at the wrong +time, you may cause data loss by turning off a system with a filesystem mounted read-write. +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. -============== Network Server -============== +-------------- -``upsd`` is responsible for passing data from the drivers to the client -programs via the network. It should be run immediately after ``upsdrvctl`` +`upsd` is responsible for passing data from the drivers to the client +programs via the network. It should be run immediately after `upsdrvctl` in your system's startup scripts. -``upsd`` should be kept running whenever possible, as it is the only source -of status information for the monitoring clients like ``upsmon``. +`upsd` should be kept running whenever possible, as it is the only source +of status information for the monitoring clients like `upsmon`. -====== -upsmon -====== +Monitoring client +----------------- -``upsmon`` provides the essential feature that you expect to find in UPS +`upsmon` provides the essential feature that you expect to find in UPS monitoring software: safe shutdowns when the power fails. In the layered scheme of NUT software, it is a client. It has this 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 three possible types: +upsmon.conf. Each UPS can be defined as one of two possible types: -- Master +Master +~~~~~~ - 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. +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. - If your UPS is plugged directly into a system's serial port, - the upsmon on that system should define that UPS as a master. +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. -- Slave +For a typical home user, there's one computer connected to one UPS. +That means you run a driver, `upsd`, and `upsmon` in master mode. - This UPS supplies power to the system running upsmon, but - this system can't shut it down directly. This system will - shut down the operating system before the master turns off the - power. +Slave +~~~~~ - 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. - -- Monitor-only +This UPS may supply power to the system running `upsmon`, but this system can't +shut it down directly. - This UPS will still generate notifications about status - changes (on battery, on line, etc.) but no shutdowns of the - local system result from critical situations on that UPS. +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 master mode. Additional Information ----------------------- +~~~~~~~~~~~~~~~~~~~~~~ More information on configuring upsmon can be found in these places: - - The man page - upsmon(8) - - - big-servers.txt in the docs subdirectory - - - shutdown.txt in the docs subdirectory - - - The stock upsmon.conf that comes with the package +- The linkman:upsmon[8] man page +- <> +- <> chapter +- The stock `upsmon.conf` that comes with the package -======= Clients -======= +------- Clients talk to upsd over the network and do useful things with the data from the drivers. There are tools for command line access, and a few @@ -319,48 +305,48 @@ programs. For more details on specific programs, refer to their man pages. upsc ----- +~~~~ -upsc is a simple client that will display the values of variables known -to upsd and your UPS drivers. It will list every variable by default, -or just one if you specify an additional argument. This can be useful -in shell scripts for monitoring something without writing your own +`upsc` is a simple client that will display the values of variables known +to `upsd` and your UPS drivers. It will list every variable by default, +or just one if you specify an additional argument. This can be useful +in shell scripts for monitoring something without writing your own network code. -upsc is a quick way to find out if your driver(s) and upsd are working -together properly. Just run upsc to see what's going on, i.e.:: +`upsc` is a quick way to find out if your driver(s) and upsd are working +together properly. Just run `upsc ` to see what's going on, i.e.: - morbo:~$ upsc su700@localhost + morbo:~$ upsc sparky@localhost ambient.humidity: 035.6 ambient.humidity.alarm.maximum: NO,NO ambient.humidity.alarm.minimum: NO,NO ambient.temperature: 25.14 + ... - [ and so on ] - -If you are interested in writing a simple client that monitors upsd, -the source code for upsc is a good way to learn about using the +If you are interested in writing a simple client that monitors `upsd`, +the source code for `upsc` is a good way to learn about using the upsclient functions. -See the upsc(8) man page for more information. +See the linkman:upsc[8] man page and +<> for more information. upslog ------- +~~~~~~ -upslog will write status information from upsd to a file at set +`upslog` will write status information from `upsd` to a file at set intervals. You can use this to generate graphs or reports with other -programs such as gnuplot. +programs such as `gnuplot`. upsrw ------ +~~~~~ -upsrw allows you to display and change the read/write variables in your +`upsrw` allows you to display and change the read/write variables in your UPS hardware. Not all devices or drivers implement this, so this may -not have any effect on your system. +not have any effect on your system. -A driver that supports read/write variables will give results like this:: +A driver that supports read/write variables will give results like this: - $ upsrw su700@localhost + $ upsrw sparky@localhost ( many skipped ) @@ -373,64 +359,66 @@ A driver that supports read/write variables will give results like this:: ( more skipped ) -On the other hand, one that doesn't support them won't print anything:: +On the other hand, one that doesn't support them won't print anything: $ upsrw fenton@gearbox ( nothing ) -upsrw requires administrator powers to change settings in the hardware. -Refer to upsd.users(5) for information on defining users in upsd. +`upsrw` requires administrator powers to change settings in the hardware. +Refer to linkman:upsd.users[5] for information on defining +users in `upsd`. upscmd ------- +~~~~~~ Some UPS hardware and drivers support the notion of an instant command - a feature such as starting a battery test, or powering off the load. You can use upscmd to list or invoke instant commands if your hardware/drivers support them. -Use the -l command to list them, like this:: +Use the -l command to list them, like this: - $ upscmd -l su700@localhost - Instant commands supported on UPS [su700@localhost]: + $ upscmd -l sparky@localhost + Instant commands supported on UPS [sparky@localhost]: load.on - Turn on the load immediately test.panel.start - Start testing the UPS panel calibrate.start - Start run time calibration calibrate.stop - Stop run time calibration + ... - [ snip ] +`upscmd` requires administrator powers to start instant commands. +To define users and passwords in `upsd`, see +linkman:upsd.users[5]. -upscmd requires administrator powers to start instant commands. -To define users and passwords in upsd, see upsd.users(5). -============ CGI Programs -============ +------------ The CGI programs are clients that run through your web server. They allow you to see UPS status and perform certain administrative commands from any web browser. Javascript and cookies are not required. These programs are not installed or compiled by default. To compile -and install them, first run 'configure --with-cgi', then do 'make' and -'make install'. If you receive errors about "gd" during configure, go +and install them, first run `configure --with-cgi`, then do `make` and +`make install`. If you receive errors about "gd" during configure, go get it and install it before continuing. You can get the source here: - http://www.boutell.com/gd/ + http://www.libgd.org/ -In the event that you need libpng or zlib in order to compile gd, +In the event that you need libpng or zlib in order to compile gd, they can be found at these URLs: http://www.libpng.org/pub/png/pngcode.html http://www.gzip.org/zlib/ + Access Restrictions -------------------- +~~~~~~~~~~~~~~~~~~~ The CGI programs use hosts.conf to see if they are allowed to talk to a host. This keeps malicious visitors from creating queries from your web @@ -440,107 +428,58 @@ If you get error messages that say "Access to that host is not authorized", you're probably missing an entry in your hosts.conf. upsstats --------- +~~~~~~~~ -upsstats generates web pages from HTML templates, and plugs in status +`upsstats` generates web pages from HTML templates, and plugs in status information in the right places. It looks like a distant relative of APC's old Powerchute interface. You can use it to monitor several systems or just focus on one. -It also can generate IMG references to upsimage. +It also can generate IMG references to `upsimage`. upsimage --------- +~~~~~~~~ This is usually called by upsstats via IMG SRC tags to draw either the utility or outgoing voltage, battery charge percent, or load percent. upsset ------- +~~~~~~ -upsset provides several useful administration functions through a web -interface. You can use upsset to kick off instant commands on your UPS +`upsset` provides several useful administration functions through a web +interface. You can use `upsset` to kick off instant commands on your UPS hardware like running a battery test. You can also use it to change variables in your UPS that accept user-specified values. -Essentially, upsset provides the functions of upsrw and upscmd, but +Essentially, `upsset` provides the functions of `upsrw` and `upscmd`, but with a happy pointy-clicky interface. -upsset will not run until you convince it that you have secured your +`upsset` will not run until you convince it that you have secured your system. You *must* secure your CGI path so that random interlopers -can't run this program remotely. See the upsset.conf file. Once you +can't run this program remotely. See the `upsset.conf` file. Once you have secured the directory, you can enable this program in that configuration file. It is not active by default. -===================== -Support / Help / etc. -===================== - -The main URL: - - http://www.networkupstools.org/ - -There is also a mailing list for general queries and discussion about -this software called nut-upsuser. It typically moves around 50-100 messages -per month at the time of this writing. To join, go to the below address and -subscribe to the desired list. - -Finally, there is a developer list called nut-upsdev. This is not -an install help list, and any such mails probably will be ignored. - -The mailing lists are archived on the web: - - http://alioth.debian.org/mail/?group_id=30602 - -Try running some searches against the archives. Many times, problems have -already been answered by someone else. Currently, there is no internal -search engine, so you will have to try with a search engine like Google. - -There is more documentation in the docs/ directory within the source -tree. Be sure to read through the files in there (especially the -FAQ) before mailing the list for help. Many times the questions have -already been answered in the files which are right in front of you. - - -=================================== -Making your own clients (upsclient) -=================================== - -The upsclient.a library can be linked into other programs to give access -to upsd and UPS status information. Clients like upsc are provided as -examples of how to retrieve data using the upsclient functions. Other -programs not included in this package may also use this library, as wmnut. - -This library file and the associated header files are not installed by -default. You must './configure --with-lib' to enable building and -installing these files. The libraries can then be build and installed -with 'make' and 'make install' as usual. This must be done before -building other (non-NUT) programs which depend on them. - -To obtain the right compilation and link flags, two helpers are provided: -one for platform providing pkg-config, and the other (libupsclient-config) -for platform not providing pkg-config. - - -================= Version Numbering -================= +----------------- The version numbers work like this: if the middle number is odd, it's a development tree, otherwise it is the stable tree. -The past stable trees were 1.0, 1.2, 1.4 and 2.0, with the latest stable tree -designated 2.2. The development trees were 1.1, 1.3, 1.5 and 2.1. +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. -The jump to 2.2 is mostly due to the large changes to the features list. -There have also been a number of architectural changes which may not be -noticeable to most users. +Major release jumps are mostly due to large changes to the features +list. There have also been a number of architectural changes which +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 was introduced up to the recent 1.4 series. It used variable names @@ -567,21 +506,17 @@ use the new names. Here's a table to make it easier to visualize: - +--------+------------------------+ - | | Server | - +--------+-----+-----+-----+------+ - | Client | 1.0 | 1.2 | 1.4 | 2.0+ | - +========+=====+=====+=====+======+ - | 1.0 | yes | yes | yes | no | - +--------+-----+-----+-----+------+ - | 1.2 | yes | yes | yes | no | - +--------+-----+-----+-----+------+ - | 1.4 | yes | yes | yes | yes | - +--------+-----+-----+-----+------+ - | 2.0 | no | no | yes | yes | - +--------+-----+-----+-----+------+ +[options="header"] +|============================================= +| 4+| Server version +| *Client version* | 1.0 | 1.2 | 1.4 | 2.0+ +| 1.0 | yes | yes | yes | no +| 1.2 | yes | yes | yes | no +| 1.4 | yes | yes | yes | yes +| 2.0+ | no | no | yes | yes +|============================================= -Version 2.0 (and more recent) does not contain backwards compatibility for +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" @@ -593,67 +528,24 @@ software can easily support both versions as long as they like. If upsd returns 'ERR UNKNOWN-COMMAND' to a GET request, you need to use REQ. -========================== +Support / Help / etc. +--------------------- + +If you are in need of help, refer to the +<> in the user manual. + + Hacking / Development Info -========================== +-------------------------- -Additional documentation can be found in the docs subdirectory. +Additional documentation can be found in: -Information on creating new drivers can be found in new-drivers.txt. -Also be sure to look at skel.c and main.c. All drivers are just -collections of support functions built around a common core, so most of -the dull housekeeping work has been handled for you. - -Information on the NUT variables naming can be found in new-names.txt. -Information on the architecture and how it all fits together is in the -design.txt file. In short, there's a lot more documentation out there. - -Also be sure to read developers.txt, as it explains a lot about the -tree, including some of the functions that are provided for your use. +- the linkdoc:developer-guide[Developer Guide], +- the linkdoc:packager-guide[Packager Guide]. -================================ Acknowledgements / Contributions -================================ - -MGE UPS SYSTEMS provided extensive technical documents for their UPS product -line, along with many units for development of NUT-related projects. The -company also sponsored and later hired Arnaud Quette to further officially -support these efforts. - -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, .... The features page has improved artwork thanks to Luc -and Arnaud of MGE. Other client projects such as KNutClient and ups-monitor -have also received assistance. - -The master NUT site and several related projects are hosted on MGE's equipment -at no cost to the project. - -More information on their open source support can be found on their web site: -http://opensource.mgeups.com/contrib.htm - -Fenton Technologies contributed a PowerPal 660 to the project. Their open -stance and quick responses to technical inquiries are appreciated for -making the development of the fentonups driver possible. - -Bo Kersey of VirCIO (http://www.vircio.com) provided a Best Power -Fortress 750 to facilitate the bestups driver. - -Invensys Energy Systems provided the SOLA/Best "Phoenixtec" protocol -document currently residing at the following URL: - - http://random.networkupstools.org/protocols/sola.html - -PowerKinetics technical support provided documentation on their MiniCOL -protocol, which is archived in the NUT protocol library online: - - http://random.networkupstools.org/protocols/minicol/ - -Cyber Power Systems contributed a 700AVR model for testing and driver -development. - -Liebert Corporation supplied serial test boxes and a UPStation GXT2 -with the Web/SNMP card for development of the liebert driver and -expansion of the existing snmp-ups driver. +-------------------------------- +The many people who have participated in creating and improving NUT are +listed in the user manual <>. diff --git a/docs/ideas.txt b/TODO similarity index 68% rename from docs/ideas.txt rename to TODO index 5fc90f8..1c45636 100644 --- a/docs/ideas.txt +++ b/TODO @@ -1,14 +1,35 @@ -Desc: Ideas for future expansion and features -File: ideas.txt -Date: 20 October 2003 -Auth: Russell Kroll +NUT roadmap and ideas for future expansion +------------------------------------------ Here are some ideas that have come up over the years but haven't been implemented yet. This may be a good place to start if you're looking for a rainy day hacking project. + +Roadmap +~~~~~~~ + +2.6 +^^^ + +This release is focused on the website and documentation rewrite, using +the excellent link:http://www.methods.co.nz/asciidoc[AsciiDoc]. + +2.8 +^^^ + +This branch will focus on configuration and user interface improvements. + +3.0 +^^^ + +This major transition will mark the final switch to a complete power +device broker. + + + Non-network "upsmon" -==================== +~~~~~~~~~~~~~~~~~~~~ Some systems don't want a daemon listening to the network. This can be for security reasons, or perhaps because the system has been squashed @@ -20,16 +41,13 @@ This also makes monitoring extremely easy to automate - you don't need to worry about usernames, passwords or firewalling. Just start a driver and drop this program on top of it. - - Parse ups.conf and open the state socket for a driver - - - Send DUMPALL and enter a select loop - - - Parse SETINFOs that change ups.status - - - When you get OB LB, shut down +- Parse ups.conf and open the state socket for a driver +- Send DUMPALL and enter a select loop +- Parse SETINFOs that change ups.status +- When you get OB LB, shut down Completely unprivileged upsmon -============================== +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ upsmon currently retains root in a forked process so it can call the shutdown command. The only reason it needs root on most systems is that @@ -51,7 +69,7 @@ down the group access so only upsmon's unprivileged user can access it, and make that your SHUTDOWNCMD. Then it could drop root completely. Chrooted upsmon -=============== +~~~~~~~~~~~~~~~ upsmon could run the network monitoring part in a chroot jail if it had a pipe to another process running outside for NOTIFY dispatches. Such a @@ -64,7 +82,7 @@ All it has to do is dispatch the UPS name and event type. [start] [type] [length] [stop] Monitor program with interpreted language -========================================= +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Once in awhile, I get requests for a way to shut down based on the UPS temperature, or ambient humidity, or at a certain battery charge level, @@ -83,3 +101,18 @@ timers. Due to the expected size and limited audience for such a program, it might have to be distributed separately. + +NOTE: Python may be a good candidate. + +Sandbox +~~~~~~~ + +- check to refresh and integrate the https://alioth.debian.org/pm/?group_id=30602[tasks] list +and https://alioth.debian.org/tracker/?atid=411545&group_id=30602&func=browse[feature requests] list from Alioth +- add "Generic ?Ascii? driver": I've got to think more about that, but the recent +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/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 63ed28d..9336069 100644 --- a/UPGRADING +++ b/UPGRADING @@ -1,373 +1,198 @@ -This file lists changes that affect users who installed older versions +ifdef::txt[] +Upgrading notes +=============== +endif::txt[] + +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.4.2 to 2.4.3: - - - nothing that affects upgraded systems. - ---------------------------------------------------------------------------- -Changes from 2.4.1 to 2.4.2: - - - The default subdriver for the blazer_usb driver USB id 06da:0003 has - changed. If you use such a device and it is no longer working with this - driver, override the 'subdriver' default in 'ups.conf' (see man 8 blazer). - - NUT ACL and the allowfrom mechanism has been replaced in 2.4.0 by the LISTEN - directive and tcp-wrappers respectively. This information was missing - below, so a double note has been added. - ---------------------------------------------------------------------------- -Changes from 2.4.0 to 2.4.1: - - - nothing that affects upgraded systems. - ---------------------------------------------------------------------------- -Changes from 2.2.2 to 2.4.0: - - - The nut.conf file has been introduced to standardize startup configuration - across the various systems. - - The cpsups and nitram drivers have been replaced by the powerpanel driver, - and removed from the tree. The cyberpower driver may suffer the same in the - future. - - The al175 and energizerups drivers have been removed from the tree, since - these were tagged broken for a long time. - - Developers of external client application using libupsclient must rename - their "UPSCONN" client structure to "UPSCONN_t". - - The upsd server will now disconnect clients that remain silent for more than - 60 seconds. - - The files under scripts/python/client are distributed under GPL 3+, whereas - the rest of the files are distributed under GPL 2+. Refer to COPYING for more - information. - - The generated udev rules file has been renamed with dash only, no underscore - anymore (ie 52-nut-usbups.rules instead of 52_nut-usbups.rules) - - (Note: this has been missed at release time): The NUT internal network access - control (ACL using ACCEPT / REJECT in upsd.conf) has been replaced by - the LISTEN directive. This can also be complemented by tcp-wrappers. - Refer to upsd and upsd.conf manual pages for more information. - ---------------------------------------------------------------------------- -Changes from 2.2.1 to 2.2.2: - - - The configure option "--with-lib" has been replaced by "--with-dev". - 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 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 - encouraged to test this feature by calling "upsmon -c fsd" and - report any issue on the NUT mailing lists. - ---------------------------------------------------------------------------- -Changes from 2.2.0 to 2.2.1: - - - nothing that affects upgraded systems. - (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. - ---------------------------------------------------------------------------- -Changes from 2.0.5 to 2.2.0: - - - users of the newhidups driver are advised that the driver name has changed - to usbhid-ups. - - users of the hidups driver must switch to usbhid-ups. - - users of the following drivers (powermust, blazer, fentonups, mustek, - esupssmart, ippon, sms) must switch to megatec, which replaces - all these drivers. Please refer to doc/megatec.txt for details. - - users of the mge-shut driver are encouraged to test newmge-shut, which - is an alternate driver scheduled to replace mge-shut, - - users of the cpsups driver are encouraged to switch to powerpanel which - is scheduled to replace cpsups, - - packagers will have to rework the whole nut packaging due to the - major changes in the build system (completely modified, and now using - automake). Refer to packaging/debian/ for an example of migration. - - specifying '-a ' is now mandatory when starting a driver manually, - 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 disapear by the release of NUT 2.4. - ---------------------------------------------------------------------------- -Changes from 2.0.4 to 2.0.5: - - - users of the newhidups driver: the driver is now more strict about - refusing to connect to unknown devices. If your device was - previously supported, but fails to be recognized now, add - 'productid=XXXX' to ups.conf. Please report the device to the NUT - developer's mailing list. - ---------------------------------------------------------------------------- -Changes from 2.0.3 to 2.0.4: - - - nothing that affects upgraded systems. - - users of the following drivers (powermust, blazer, fentonups, mustek, - esupssmart, ippon, sms, masterguard) are encouraged to switch to megatec, - which should replace all these drivers by nut 2.2. For more information, - please refer to doc/megatec.txt - ---------------------------------------------------------------------------- -Changes from 2.0.2 to 2.0.3: - - - nothing that affects upgraded systems. - - hidups users are encouraged to switch to newhidups, as hidups will be - removed by nut 2.2. - ---------------------------------------------------------------------------- -Changes from 2.0.1 to 2.0.2: - - - The newhidups driver, which is the long run USB support approach, - needs hotplug files installed to setup the right permissions on - device file to operate. Check newhidups manual page for more information. - ---------------------------------------------------------------------------- -Changes from 2.0.0 to 2.0.1: - - - The cyberpower1100 driver is now called cpsups since it supports - more than just one model. If you use this driver, be sure to remove - the old binary and update your ups.conf 'driver=' setting with the - new name. - - - The upsstats.html template page has been changed slightly to reflect - better HTML compliance, so you may want to update your installed copy - accordingly. If you've customized your file, don't just copy the new - one over it, or your changes will be lost! - ---------------------------------------------------------------------------- -Changes from 1.4.0 to 2.0.0: - - - The sample config files are no longer installed by default. If you - want to install them, use 'make install-conf' for the main programs, - and 'make install-cgi-conf' for the CGI programs. - - - ACCESS is no longer supported in upsd.conf. Use ACCEPT and REJECT. +Changes from 2.4.3 to 2.6.0 +--------------------------- + +- users of the megatec and megatec_usb drivers must respectively switch to +blazer_ser and blazer_usb. +- users of the liebertgxt2 driver are advised that the driver name has changed +to liebert-esp2. + +Changes from 2.4.2 to 2.4.3 +--------------------------- + +- nothing that affects upgraded systems. + +Changes from 2.4.1 to 2.4.2 +--------------------------- + +- The default subdriver for the blazer_usb driver USB id 06da:0003 has changed. +If you use such a device and it is no longer working with this driver, override +the 'subdriver' default in 'ups.conf' (see man 8 blazer). +- NUT ACL and the allowfrom mechanism has been replaced in 2.4.0 by the LISTEN +directive and tcp-wrappers respectively. This information was missing below, so +a double note has been added. + +Changes from 2.4.0 to 2.4.1 +--------------------------- + +- nothing that affects upgraded systems. + +Changes from 2.2.2 to 2.4.0 +--------------------------- + +- The nut.conf file has been introduced to standardize startup configuration +across the various systems. +- The cpsups and nitram drivers have been replaced by the powerpanel driver, +and removed from the tree. The cyberpower driver may suffer the same in the +future. +- The al175 and energizerups drivers have been removed from the tree, since +these were tagged broken for a long time. +- Developers of external client application using libupsclient must rename +their "UPSCONN" client structure to "UPSCONN_t". +- The upsd server will now disconnect clients that remain silent for more than +60 seconds. +- The files under scripts/python/client are distributed under GPL 3+, whereas +the rest of the files are distributed under GPL 2+. Refer to COPYING for more +information. +- The generated udev rules file has been renamed with dash only, no underscore +anymore (ie 52-nut-usbups.rules instead of 52_nut-usbups.rules) + +Changes from 2.2.1 to 2.2.2 +--------------------------- + +- The configure option "--with-lib" has been replaced by "--with-dev". +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 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 +encouraged to test this feature by calling "upsmon -c fsd" and +report any issue on the NUT mailing lists. + +Changes from 2.2.0 to 2.2.1 +--------------------------- + +- nothing that affects upgraded systems. +(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. + +Changes from 2.0.5 to 2.2.0 +--------------------------- + +- users of the newhidups driver are advised that the driver name has changed +to usbhid-ups. +- users of the hidups driver must switch to usbhid-ups. +- users of the following drivers (powermust, blazer, fentonups, mustek, +esupssmart, ippon, sms) must switch to megatec, which replaces +all these drivers. Please refer to doc/megatec.txt for details. +- users of the mge-shut driver are encouraged to test newmge-shut, which +is an alternate driver scheduled to replace mge-shut, +- users of the cpsups driver are encouraged to switch to powerpanel which +is scheduled to replace cpsups, +- packagers will have to rework the whole nut packaging due to the +major changes in the build system (completely modified, and now using +automake). Refer to packaging/debian/ for an example of migration. +- specifying '-a ' is now mandatory when starting a driver manually, +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 disapear by the release of NUT 2.4. + +Changes from 2.0.4 to 2.0.5 +--------------------------- + +- users of the newhidups driver: the driver is now more strict about +refusing to connect to unknown devices. If your device was +previously supported, but fails to be recognized now, add +'productid=XXXX' to ups.conf. Please report the device to the NUT +developer's mailing list. + +Changes from 2.0.3 to 2.0.4 +--------------------------- + +- nothing that affects upgraded systems. +- users of the following drivers (powermust, blazer, fentonups, mustek, +esupssmart, ippon, sms, masterguard) are encouraged to switch to megatec, +which should replace all these drivers by nut 2.2. For more information, +please refer to doc/megatec.txt + +Changes from 2.0.2 to 2.0.3 +--------------------------- + +- nothing that affects upgraded systems. +- hidups users are encouraged to switch to newhidups, as hidups will be +removed by nut 2.2. + +Changes from 2.0.1 to 2.0.2 +--------------------------- + +- The newhidups driver, which is the long run USB support approach, +needs hotplug files installed to setup the right permissions on +device file to operate. Check newhidups manual page for more information. + +Changes from 2.0.0 to 2.0.1 +--------------------------- + +- The cyberpower1100 driver is now called cpsups since it supports +more than just one model. If you use this driver, be sure to remove +the old binary and update your ups.conf 'driver=' setting with the +new name. + +- The upsstats.html template page has been changed slightly to reflect +better HTML compliance, so you may want to update your installed copy +accordingly. If you've customized your file, don't just copy the new +one over it, or your changes will be lost! + +Changes from 1.4.0 to 2.0.0 +--------------------------- + +- The sample config files are no longer installed by default. If you +want to install them, use 'make install-conf' for the main programs, +and 'make install-cgi-conf' for the CGI programs. + +- ACCESS is no longer supported in upsd.conf. Use ACCEPT and REJECT. +Old way: + + ACCESS grant all adminbox + ACCESS grant all webserver + ACCESS deny all all + +New way: + + ACCEPT adminbox + ACCEPT webserver + REJECT all + +Note that ACCEPT and REJECT can take multiple arguments, so this +will also work: + + ACCEPT adminbox webserver + REJECT all + +- The drivers no longer support sddelay in ups.conf or -d on the +command line. If you need a delay after calling 'upsdrvctl +shutdown', add a call to sleep in your shutdown script. + +- The templates used by upsstats have changed considerably to reflect +the new variable names. If you use upsstats, you will need to +install new copies or edit your existing files to use the new names. + +- Nobody needed UDP mode, so it has been removed. The only users +seemed to be a few people like me with ancient asapm-ups binaries. +If you really want to run asapm-ups again, bug me for the new patch +which makes it work with upsclient. + +- 'make install-misc' is now 'make install-lib'. The misc directory +has been gone for a long time, and the target was ambiguous. +>>>>>>> switch UPGRADING information to AsciiDoc, and integrate these in the User Manual. - Old way: +- The newapc driver has been renamed to apcsmart. If you previously +used newapc, make sure you delete the old binary and fix your +ups.conf. Otherwise, you may run the old driver from 1.4. - ACCESS grant all adminbox - ACCESS grant all webserver - ACCESS deny all all - New way: +*** File trimmed here on changes from 1.2.2 to 1.4.0 *** - ACCEPT adminbox - ACCEPT webserver - REJECT all - - Note that ACCEPT and REJECT can take multiple arguments, so this - will also work: - - ACCEPT adminbox webserver - REJECT all - - - The drivers no longer support sddelay in ups.conf or -d on the - command line. If you need a delay after calling 'upsdrvctl - shutdown', add a call to sleep in your shutdown script. - - - The templates used by upsstats have changed considerably to reflect - the new variable names. If you use upsstats, you will need to - install new copies or edit your existing files to use the new names. - - - Nobody needed UDP mode, so it has been removed. The only users - seemed to be a few people like me with ancient asapm-ups binaries. - If you really want to run asapm-ups again, bug me for the new patch - which makes it work with upsclient. - - - 'make install-misc' is now 'make install-lib'. The misc directory - has been gone for a long time, and the target was ambiguous. - - - The newapc driver has been renamed to apcsmart. If you previously - used newapc, make sure you delete the old binary and fix your - ups.conf. Otherwise, you may run the old driver from 1.4. - ---------------------------------------------------------------------------- - -Changes from 1.2.2 to 1.4.0: - - - The clients no longer support the notion of a "default UPS" when - communicating with newer versions of upsd. If you leave off a UPS - name, they will fall back on compatibility mode and will use the - old variable and command names. - - That is, "upsc localhost" will give you things like STATUS, and you - have to do "upsc myups@localhost" to get the new ones like - ups.status. - - The old variable names and default UPS mode will be supported - throughout the 1.4 series to allow users to convert to the new - style. This support will be formally dropped in 2.0. - - - upsmon is part of the "no default upsname" change. You must change - the MONITOR directives in your upsmon.conf if you were using this - technique before. - - Old way: - - MONITOR bigserver 1 monuser password master - - New way: - - MONITOR myups@bigserver 1 monuser password master - - Just look at the top of ups.conf on 'bigserver' to figure out what - the first UPS is called, and stick it and a @ on that MONITOR line. - - - upsrw's appearance has changed to avoid wrapping when displaying - the new longer variable names and descriptions. It still displays - the old format when talking to an older upsd. - - To see the difference, try "upsrw localhost" and then compare it to - "upsrw myups@localhost", assuming a new version of upsd is running - on localhost. - - - upslog now uses the new variable names in the default format - string. It will still monitor the old variable names for backwards - compatibility, but you will have to specify the format string - explicitly. - - - 'make install' no longer creates the state path. Instructions for - creating it properly have been added to the INSTALL file. - - Technically, this only affects packagers, since this is the - UPGRADING file and normal users should already have a state path. - If you are a packager, you will need to add the right mkdir + chown + - chmod magic to your install process to keep things working. - - This also means that you no longer need any special permissions to - bundle this software into a package. The installer no longer - requires root now that the chown is gone. - - - configure --with-group no longer does anything useful. The programs - which will drop permissions support "-u ", and will pick up - the group id based on the values in /etc/passwd for that user name. - - configure --with-user still works as before, and provides the default - value if you don't specify another one with -u. - - - The "DROP" action in upsd.conf now behaves a little differently. - - It still causes new TCP connections to be closed without reading - from the socket, and still causes UDP datagrams to be ignored. - - The only difference is that commands that are denied after the - remote host connects will now generate an error message. Previously, - upsd would just ignore them, and the clients could get out of sync. - - DENY also has been changed slightly to silently ignore UDP packets. - - Essentially, DROP and DENY are now the same thing. If you use DROP - anywhere, you should change to DENY before it goes away in the future. - - - upsmon now requires a username on the MONITOR lines. If you have an - older installation from the 1.x era or earlier, you probably need - to convert them. - - Old way: MONITOR ups@mybox 1 mypass master - New way: MONITOR ups@mybox 1 username mypass master - - You will also have to add a [username] section to the upsd.users - with a matching password, an allowfrom value, and "upsmon master" or - "upsmon slave". - - If upsmon says the login failed due to "username required" or fails to - start, saying "Unable to use old-style MONITOR line without a username", - then you're still using the old method. - ---------------------------------------------------------------------------- - -Changes from 1.2.1 to 1.2.2: - - - upssched.conf now requires the LOCKFN directive to prevent races when - handling two events that happen at nearly the same time. - - If you use upssched, you must add this to your upssched.conf or it - will fail to run. - ---------------------------------------------------------------------------- - -Changes from 1.0.0 to 1.2.0: - - - upsct is gone. upsc now uses the new upsclient library which is - TCP only, so there is no need for a separate client for TCP polling. - - - upsct2 has been renamed to upsrw since the name was already - ambiguous and it looked even more out of place with upsct gone. - - - The multimon.cgi behavior has been absorbed into upsstats.cgi. - - - Calling upsstats.cgi with no arguments will make it render - the template file called upsstats.html in your confpath. The default - version of this file looks a lot like multimon, but is flexible. - You will have to copy this file from upsstats.html.sample to - upsstats.html the first time you install this version. - - - Calling upsstats.cgi with host= set will still render a single status - page as before, but the markup for that page now comes from - upsstats-single.html. This is also a template and may be - reconfigured to suit your needs. It must also be copied over from - the .sample filename the first time. - - - upsmon can now send a username when authenticating to upsd. It is - recommended that you change to this mode, as the old host-based - authentication is clunky and eventually will be removed. - - Old way: - - MONITOR myups@bigserver 1 blah master - - New way: - - MONITOR myups@bigserver 1 monmaster blah master - - Note that the username has been inserted between the power value and - the password. When switching to this method, be sure to add a user - to upsd.users, i.e.: - - [monmaster] - password = blah - allowfrom = localhost - upsmon master - - You still need to give the upsmon host(s) at least "monitor" access, - so don't delete those old ACCESS lines in your upsd.conf. Just - lower the access level and remove the password. - - Old way: - - ACCESS grant master localhost blah - - New way: - - ACCESS grant monitor localhost - - - The old upsfetch "library" (used loosely) has been replaced by - upsclient. This will be installed if you do "make install-misc", - but it goes into $(prefix)/lib and $(prefix)/include by default. - - The upsclient interface is not compatible with upsfetch. Old - accessory programs which linked to upsfetch will have to be updated - to work with upsclient instead. - - Existing binaries that were linked against upsfetch will still work - since the network protocol used by upsd has not changed. - - - SET and INSTCMD no longer work via host-level authentication. This - is only a meaningful change if you are using very old versions of - upscmd/upsct2/upsset.cgi, or if you're talking to upsd directly. - - You must now set a USERNAME first, and authentication will occur - through upsd.users as a result. - - This means that the "manager" level in upsd.conf ACCESS directives - is no longer meaningful, and you should remove them. - - - INSTALLROOT is no longer available for redirecting 'make install' - - use DESTDIR instead. - - - Makefile targets have been reworked to allow fine-grained control - over what happens at install-time. 'make install' and 'make - install-cgi' still do everything, but you can call subsets instead - if necessary. See ChangeLog. +For information before this point, start with version 2.4.1 and work back. diff --git a/aclocal.m4 b/aclocal.m4 index b52cc76..9da2cb1 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.11 -*- Autoconf -*- +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. @@ -13,8 +13,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],, -[m4_warning([this file was generated for autoconf 2.64. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, +[m4_warning([this file was generated for autoconf 2.65. 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'.])]) @@ -144,7 +144,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [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.11], [], +m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -160,7 +160,7 @@ 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.11])dnl +[AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) @@ -1134,6 +1134,7 @@ AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR +m4_include([m4/ax_compare_version.m4]) m4_include([m4/ax_create_stdint_h.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) @@ -1141,7 +1142,7 @@ m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) m4_include([m4/nut_arg_with.m4]) -m4_include([m4/nut_check_ipv6.m4]) +m4_include([m4/nut_check_asciidoc.m4]) m4_include([m4/nut_check_libgd.m4]) m4_include([m4/nut_check_libhal.m4]) m4_include([m4/nut_check_libneon.m4]) @@ -1151,5 +1152,6 @@ m4_include([m4/nut_check_libssl.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_config_libhal.m4]) m4_include([m4/nut_report_feature.m4]) m4_include([m4/nut_type_socklen_t.m4]) diff --git a/clients/Makefile.am b/clients/Makefile.am index 59e92c7..24c11b6 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -1,9 +1,9 @@ # Network UPS Tools: clients # by default, link programs in this directory with libcommon.a -LDADD = ../common/libcommon.a libupsclient.la $(NETLIBS) +LDADD = ../common/libcommon.la libupsclient.la $(NETLIBS) if WITH_SSL - LDADD += $(LIBSSL_LDFLAGS) + LDADD += $(LIBSSL_LIBS) endif # Avoid per-target CFLAGS, because this will prevent re-use of object @@ -35,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 = ../common/libcommon.a ../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) @@ -48,6 +48,6 @@ upsstats_cgi_SOURCES = upsstats.c upsclient.h status.h upsstats.h \ libupsclient_la_SOURCES = upsclient.c upsclient.h libupsclient_la_LIBADD = ../common/libparseconf.la if WITH_SSL - libupsclient_la_LIBADD += $(LIBSSL_LDFLAGS) + libupsclient_la_LIBADD += $(LIBSSL_LIBS) endif libupsclient_la_LDFLAGS = -version-info 1:0:0 diff --git a/clients/Makefile.in b/clients/Makefile.in index 27cd0c6..d2ca2fc 100644 --- a/clients/Makefile.in +++ b/clients/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -40,7 +40,7 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -@WITH_SSL_TRUE@am__append_1 = $(LIBSSL_LDFLAGS) +@WITH_SSL_TRUE@am__append_1 = $(LIBSSL_LIBS) @WITH_SSL_TRUE@am__append_2 = $(LIBSSL_CFLAGS) @WITH_CGI_TRUE@am__append_3 = $(LIBGD_CFLAGS) bin_PROGRAMS = upsc$(EXEEXT) upslog$(EXEEXT) upsrw$(EXEEXT) \ @@ -48,17 +48,18 @@ bin_PROGRAMS = upsc$(EXEEXT) upslog$(EXEEXT) upsrw$(EXEEXT) \ sbin_PROGRAMS = upsmon$(EXEEXT) upssched$(EXEEXT) @WITH_CGI_TRUE@cgiexec_PROGRAMS = upsstats.cgi$(EXEEXT) \ @WITH_CGI_TRUE@ upsimage.cgi$(EXEEXT) upsset.cgi$(EXEEXT) -@WITH_SSL_TRUE@am__append_4 = $(LIBSSL_LDFLAGS) +@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_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -68,6 +69,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -115,47 +117,47 @@ PROGRAMS = $(bin_PROGRAMS) $(cgiexec_PROGRAMS) $(sbin_PROGRAMS) am_upsc_OBJECTS = upsc.$(OBJEXT) upsc_OBJECTS = $(am_upsc_OBJECTS) upsc_LDADD = $(LDADD) -upsc_DEPENDENCIES = ../common/libcommon.a libupsclient.la \ +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 = ../common/libcommon.a libupsclient.la \ +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 = ../common/libcommon.a libupsclient.la \ +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 = ../common/libcommon.a libupsclient.la \ +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 = ../common/libcommon.a libupsclient.la \ +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 = ../common/libcommon.a libupsclient.la \ +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 = ../common/libcommon.a \ +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 = ../common/libcommon.a libupsclient.la \ +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 = ../common/libcommon.a libupsclient.la \ +upsstats_cgi_DEPENDENCIES = ../common/libcommon.la libupsclient.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) SCRIPTS = $(dist_bin_SCRIPTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include @@ -184,9 +186,11 @@ HEADERS = $(include_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -199,8 +203,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -217,7 +223,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -228,22 +233,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ @@ -341,7 +346,7 @@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ # by default, link programs in this directory with libcommon.a -LDADD = ../common/libcommon.a 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 @@ -357,7 +362,7 @@ 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 = ../common/libcommon.a ../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 diff --git a/clients/upsclient.c b/clients/upsclient.c index ae29b2c..50177d1 100644 --- a/clients/upsclient.c +++ b/clients/upsclient.c @@ -298,6 +298,11 @@ int upscli_sslcert(UPSCONN_t *ups, const char *dir, const char *file, int verify static int upscli_sslinit(UPSCONN_t *ups) { +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + const SSL_METHOD *ssl_method; +#else + SSL_METHOD *ssl_method; +#endif char buf[UPSCLI_NETBUF_LEN]; /* see if upsd even talks SSL/TLS */ @@ -317,10 +322,16 @@ static int upscli_sslinit(UPSCONN_t *ups) /* upsd is happy, so let's crank up the client */ - SSL_library_init(); SSL_load_error_strings(); + SSL_library_init(); - ups->ssl_ctx = SSL_CTX_new(TLSv1_client_method()); + ssl_method = TLSv1_client_method(); + + if (!ssl_method) { + return 0; + } + + ups->ssl_ctx = SSL_CTX_new(ssl_method); if (!ups->ssl_ctx) { return 0; @@ -385,14 +396,9 @@ int upscli_sslcert(UPSCONN_t *ups, const char *file, const char *path, int verif int upscli_connect(UPSCONN_t *ups, const char *host, int port, int flags) { int sock_fd; -#ifndef HAVE_IPV6 - struct sockaddr_in local, server; - struct hostent *serv; -#else struct addrinfo hints, *res, *ai; char sport[NI_MAXSERV]; int v; -#endif if (!ups) { return -1; @@ -408,58 +414,6 @@ int upscli_connect(UPSCONN_t *ups, const char *host, int port, int flags) return -1; } -#ifndef HAVE_IPV6 - serv = gethostbyname(host); - - if (!serv) { - struct in_addr listenaddr; - - if (!inet_aton(host, &listenaddr)) { - ups->upserror = UPSCLI_ERR_NOSUCHHOST; - return -1; - } - - serv = gethostbyaddr(&listenaddr, sizeof(listenaddr), AF_INET); - - if (!serv) { - ups->upserror = UPSCLI_ERR_NOSUCHHOST; - return -1; - } - } - - if ((sock_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - ups->upserror = UPSCLI_ERR_SOCKFAILURE; - ups->syserrno = errno; - close(sock_fd); - return -1; - } - - memset(&local, '\0', sizeof(local)); - local.sin_family = AF_INET; - local.sin_port = htons(INADDR_ANY); - - memset(&server, '\0', sizeof(server)); - server.sin_family = AF_INET; - server.sin_port = htons(port); - - memcpy(&server.sin_addr, serv->h_addr, serv->h_length); - - if (bind(sock_fd, (struct sockaddr *) &local, sizeof(local)) < 0) { - ups->upserror = UPSCLI_ERR_BINDFAILURE; - ups->syserrno = errno; - close(sock_fd); - return -1; - } - - if (connect(sock_fd, (struct sockaddr *) &server, sizeof(struct sockaddr_in)) < 0) { - ups->upserror = UPSCLI_ERR_CONNFAILURE; - ups->syserrno = errno; - close(sock_fd); - return -1; - } - - ups->fd = sock_fd; -#else snprintf(sport, sizeof(sport), "%hu", (unsigned short int)port); memset(&hints, 0, sizeof(hints)); @@ -543,7 +497,7 @@ int upscli_connect(UPSCONN_t *ups, const char *host, int port, int flags) if (ups->fd < 0) { return -1; } -#endif + pconf_init(&ups->pc_ctx, NULL); ups->host = strdup(host); diff --git a/clients/upsclient.h b/clients/upsclient.h index 1b05341..55ffd29 100644 --- a/clients/upsclient.h +++ b/clients/upsclient.h @@ -26,7 +26,9 @@ #endif #ifdef __cplusplus +/* *INDENT-OFF* */ extern "C" { +/* *INDENT-ON* */ #endif #define UPSCLI_ERRBUF_LEN 256 @@ -154,13 +156,12 @@ int upscli_ssl(UPSCONN_t *ups); #define UPSCLI_CONN_TRYSSL 0x0001 /* try SSL, OK if not supported */ #define UPSCLI_CONN_REQSSL 0x0002 /* try SSL, fail if not supported */ -#ifdef HAVE_IPV6 #define UPSCLI_CONN_INET 0x0004 /* IPv4 only */ #define UPSCLI_CONN_INET6 0x0008 /* IPv6 only */ -#endif #ifdef __cplusplus +/* *INDENT-OFF* */ } +/* *INDENT-ON* */ #endif - #endif /* UPSCLIENT_H_SEEN */ diff --git a/clients/upscmd.c b/clients/upscmd.c index cba125d..c3952a1 100644 --- a/clients/upscmd.c +++ b/clients/upscmd.c @@ -152,6 +152,13 @@ static void do_cmd(char **argv, const int argc) if (upscli_readline(ups, buf, sizeof(buf)) < 0) { fatalx(EXIT_FAILURE, "Instant command failed: %s", upscli_strerror(ups)); } + + /* FUTURE: status cookies will tie in here */ + if (strncmp(buf, "OK", 2) != 0) { + fatalx(EXIT_FAILURE, "Unexpected response from upsd: %s", buf); + } + + fprintf(stderr, "%s\n", buf); } static void clean_exit(void) diff --git a/clients/upsimage.c b/clients/upsimage.c index 9a64463..3d6a51d 100644 --- a/clients/upsimage.c +++ b/clients/upsimage.c @@ -620,7 +620,7 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } -struct imgvar_t imgvar[] = { +imgvar_t imgvar[] = { { "input.voltage", "input.transfer.low", "input.voltage.nominal", "input.transfer.high", 0, "%.1f VAC", draw_utility }, diff --git a/clients/upsimagearg.h b/clients/upsimagearg.h index 4ecc85a..6bd5f08 100644 --- a/clients/upsimagearg.h +++ b/clients/upsimagearg.h @@ -44,7 +44,7 @@ struct { { NULL, 0, 0, 0 } }; -struct imgvar_t { +typedef struct { char *name; /* name of the UPS variable */ char *minimum; /* name of minimum value UPS variable or variable in imgarg table */ @@ -55,6 +55,6 @@ struct imgvar_t { /* pointer to drawing function */ void (*drawfunc)(double, int, int, int, int, const char*); -}; +} imgvar_t; -extern struct imgvar_t imgvar[]; +extern imgvar_t imgvar[]; diff --git a/clients/upslog.c b/clients/upslog.c index 49084b6..170a378 100644 --- a/clients/upslog.c +++ b/clients/upslog.c @@ -47,7 +47,7 @@ static sigset_t nut_upslog_sigmask; static char logbuffer[LARGEBUF], *logformat; - static struct flist_t *fhead = NULL; + static flist_t *fhead = NULL; #define DEFAULT_LOGFORMAT "%TIME @Y@m@d @H@M@S% %VAR battery.charge% " \ "%VAR input.voltage% %VAR ups.load% [%VAR ups.status%] " \ @@ -109,7 +109,7 @@ static void help(const char *prog) 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\n"); - printf(" -p - Base name for PID file (defaults to \"upslog\")\n"); + printf(" -p - Base name for PID file (defaults to \"%s\")\n", prog); printf(" -s - Monitor UPS - @[:]\n"); printf(" - Example: -s myups@server\n"); printf(" -u - Switch to if started as root\n"); @@ -238,7 +238,7 @@ static void print_literal(const char *arg) /* register another parsing function to be called later */ static void add_call(void (*fptr)(const char *arg), const char *arg) { - struct flist_t *tmp, *last; + flist_t *tmp, *last; tmp = last = fhead; @@ -247,7 +247,7 @@ static void add_call(void (*fptr)(const char *arg), const char *arg) tmp = tmp->next; } - tmp = xmalloc(sizeof(struct flist_t)); + tmp = xmalloc(sizeof(flist_t)); tmp->fptr = fptr; @@ -343,7 +343,7 @@ static void compile_format(void) /* go through the list of functions and call them in order */ static void run_flist(void) { - struct flist_t *tmp; + flist_t *tmp; tmp = fhead; @@ -369,18 +369,16 @@ static void run_flist(void) int main(int argc, char **argv) { int interval = 30, i; - char *prog = NULL; + const char *prog = xbasename(argv[0]); time_t now, nextpoll = 0; - const char *user = NULL; - struct passwd *new_uid = NULL; - const char *pidfilebase = "upslog"; + const char *user = NULL; + struct passwd *new_uid = NULL; + const char *pidfilebase = prog; logformat = DEFAULT_LOGFORMAT; user = RUN_AS_USER; - printf("Network UPS Tools upslog %s\n", UPS_VERSION); - - prog = argv[0]; + printf("Network UPS Tools %s %s\n", prog, UPS_VERSION); while ((i = getopt(argc, argv, "+hs:l:i:f:u:Vp:")) != -1) { switch(i) { @@ -476,7 +474,7 @@ int main(int argc, char **argv) /* now drop root if we have it */ new_uid = get_user_pwent(user); - openlog("upslog", LOG_PID, LOG_FACILITY); + open_syslog(prog); if (logfile != stdout) background(); diff --git a/clients/upslog.h b/clients/upslog.h index 506cd15..cf06e01 100644 --- a/clients/upslog.h +++ b/clients/upslog.h @@ -1,11 +1,11 @@ /* upslog.h - table of functions for handling various logging functions */ /* function list */ -struct flist_t { +typedef struct flist_s { void (*fptr)(const char *arg); const char *arg; - struct flist_t *next; -}; + struct flist_s *next; +} flist_t; static void do_host(const char *arg); static void do_upshost(const char *arg); diff --git a/clients/upsmon.c b/clients/upsmon.c index d5566a8..fe3f5fb 100644 --- a/clients/upsmon.c +++ b/clients/upsmon.c @@ -73,9 +73,7 @@ static int userfsd = 0, use_pipe = 1, pipefd[2]; static utype_t *firstups = NULL; -#ifdef HAVE_IPV6 static int opt_af = AF_UNSPEC; -#endif /* signal handling things */ static struct sigaction sa; @@ -89,12 +87,12 @@ static sigset_t nut_upsmon_sigmask; static void setflag(int *val, int flag) { - *val = (*val |= flag); + *val |= flag; } static void clearflag(int *val, int flag) { - *val = (*val ^= (*val & flag)); + *val ^= (*val & flag); } static int flag_isset(int num, int flag) @@ -1431,13 +1429,11 @@ static int try_connect(utype_t *ups) else flags |= UPSCLI_CONN_TRYSSL; -#ifdef HAVE_IPV6 if (opt_af == AF_INET) flags |= UPSCLI_CONN_INET; if (opt_af == AF_INET6) flags |= UPSCLI_CONN_INET6; -#endif ret = upscli_connect(&ups->conn, ups->hostname, ups->port, flags); @@ -1674,10 +1670,8 @@ static void help(const char *progname) printf(" -K checks POWERDOWNFLAG, sets exit code to 0 if set\n"); printf(" -p always run privileged (disable privileged parent)\n"); printf(" -u run child as user (ignored when using -p)\n"); -#ifdef HAVE_IPV6 printf(" -4 IPv4 only\n"); printf(" -6 IPv6 only\n"); -#endif exit(EXIT_SUCCESS); } @@ -1718,16 +1712,9 @@ static void runparent(int fd) } /* fire up the split parent/child scheme */ -static void start_pipe(const char *user) +static void start_pipe(void) { int ret; - struct passwd *new_uid = NULL; - - /* default user = the --with-user value from configure */ - if (user) - new_uid = get_user_pwent(user); - else - new_uid = get_user_pwent(RUN_AS_USER); ret = pipe(pipefd); @@ -1748,11 +1735,6 @@ static void start_pipe(const char *user) } close(pipefd[0]); - - /* write the pid file now, as we will soon lose root */ - writepid("upsmon"); - - become_user(new_uid); } static void delete_ups(utype_t *target) @@ -1897,11 +1879,17 @@ static void check_parent(void) int main(int argc, char *argv[]) { - int i, cmd, checking_flag = 0; + const char *prog = xbasename(argv[0]); + int i, cmd = 0, checking_flag = 0; - cmd = 0; + printf("Network UPS Tools %s %s\n", prog, UPS_VERSION); - printf("Network UPS Tools upsmon %s\n", UPS_VERSION); + /* if no configuration file is specified on the command line, use default */ + configfile = xmalloc(SMALLBUF); + snprintf(configfile, SMALLBUF, "%s/upsmon.conf", confpath()); + configfile = xrealloc(configfile, strlen(configfile) + 1); + + run_as_user = xstrdup(RUN_AS_USER); while ((i = getopt(argc, argv, "+Dhic:f:pu:VK46")) != -1) { switch (i) { @@ -1921,6 +1909,7 @@ int main(int argc, char *argv[]) nut_debug_level++; break; case 'f': + free(configfile); configfile = xstrdup(optarg); break; case 'h': @@ -1933,19 +1922,18 @@ int main(int argc, char *argv[]) use_pipe = 0; break; case 'u': + free(run_as_user); run_as_user = xstrdup(optarg); break; case 'V': /* just show the banner */ exit(EXIT_SUCCESS); -#ifdef HAVE_IPV6 case '4': opt_af = AF_INET; break; case '6': opt_af = AF_INET6; break; -#endif default: help(argv[0]); break; @@ -1953,21 +1941,14 @@ int main(int argc, char *argv[]) } if (cmd) { - sendsignal("upsmon", cmd); + sendsignal(prog, cmd); exit(EXIT_SUCCESS); } argc -= optind; argv += optind; - openlog("upsmon", LOG_PID, LOG_FACILITY); - - /* if no configuration file was specified on the command line, use default */ - if (!configfile) { - configfile = xmalloc(SMALLBUF); - snprintf(configfile, SMALLBUF, "%s/upsmon.conf", confpath()); - configfile = xrealloc(configfile, strlen(configfile) + 1); - } + open_syslog(prog); loadconfig(); @@ -1997,14 +1978,21 @@ int main(int argc, char *argv[]) upsdebugx(1, "debug level is '%d'", nut_debug_level); } - /* === root parent and unprivileged child split here === */ - /* only do the pipe stuff if the user hasn't disabled it */ - if (use_pipe) - start_pipe(run_as_user); - else { + if (use_pipe) { + struct passwd *new_uid = get_user_pwent(run_as_user); + + /* === root parent and unprivileged child split here === */ + start_pipe(); + + /* write the pid file now, as we will soon lose root */ + writepid(prog); + + become_user(new_uid); + } else { upslogx(LOG_INFO, "Warning: running as one big root process by request (upsmon -p)"); - writepid("upsmon"); + + writepid(prog); } /* prep our signal handlers */ @@ -2012,7 +2000,7 @@ int main(int argc, char *argv[]) /* reopen the log for the child process */ closelog(); - openlog("upsmon", LOG_PID, LOG_FACILITY); + open_syslog(prog); while (exit_flag == 0) { utype_t *ups; diff --git a/clients/upsrw.c b/clients/upsrw.c index cdc16b9..21649ff 100644 --- a/clients/upsrw.c +++ b/clients/upsrw.c @@ -26,6 +26,9 @@ #include "upsclient.h" +static char *upsname = NULL, *hostname = NULL; +static UPSCONN_t *ups = NULL; + struct list_t { char *name; struct list_t *next; @@ -33,7 +36,7 @@ struct list_t { static void usage(const char *prog) { - printf("Network UPS Tools upsrw %s\n\n", UPS_VERSION); + printf("Network UPS Tools %s %s\n\n", prog, UPS_VERSION); printf("usage: %s [-h]\n", prog); printf(" %s [-s ] [-u ] [-p ] \n\n", prog); printf("Demo program to set variables within UPS hardware.\n"); @@ -47,56 +50,45 @@ static void usage(const char *prog) printf(" UPS identifier - [@[:]]\n"); printf("\n"); printf("Call without -s to show all possible read/write variables.\n"); - - exit(EXIT_SUCCESS); } -static void clean_exit(UPSCONN_t *ups, char *upsname, char *hostname, int code) +static void clean_exit(void) { + if (ups) { + upscli_disconnect(ups); + } + free(upsname); free(hostname); - - upscli_disconnect(ups); - - exit(code); + free(ups); } -static int do_set(UPSCONN_t *ups, const char *upsname, const char *varname, - const char *newval) +static void do_set(const char *varname, const char *newval) { char buf[SMALLBUF], enc[SMALLBUF]; - snprintf(buf, sizeof(buf), "SET VAR %s %s \"%s\"\n", - upsname, varname, pconf_encode(newval, enc, sizeof(enc))); + snprintf(buf, sizeof(buf), "SET VAR %s %s \"%s\"\n", upsname, varname, pconf_encode(newval, enc, sizeof(enc))); if (upscli_sendline(ups, buf, strlen(buf)) < 0) { - fprintf(stderr, "Can't set variable: %s\n", - upscli_strerror(ups)); - - return EXIT_FAILURE; + fatalx(EXIT_FAILURE, "Can't set variable: %s", upscli_strerror(ups)); } if (upscli_readline(ups, buf, sizeof(buf)) < 0) { - fprintf(stderr, "Set variable failed: %s\n", - upscli_strerror(ups)); - - return EXIT_FAILURE; + fatalx(EXIT_FAILURE, "Set variable failed: %s", upscli_strerror(ups)); } /* FUTURE: status cookies will tie in here */ if (strncmp(buf, "OK", 2) != 0) { - printf("Unexpected response from upsd: %s\n", buf); - return EXIT_FAILURE; + fatalx(EXIT_FAILURE, "Unexpected response from upsd: %s", buf); } - return EXIT_SUCCESS; + fprintf(stderr, "%s\n", buf); } -static int do_setvar(UPSCONN_t *ups, const char *varname, char *uin, - const char *pass, char *upsname, char *hostname) +static void do_setvar(const char *varname, char *uin, const char *pass) { char newval[SMALLBUF], temp[SMALLBUF], user[SMALLBUF], *ptr; - struct passwd *pw; + struct passwd *pw; if (uin) { snprintf(user, sizeof(user), "%s", uin); @@ -105,22 +97,24 @@ static int do_setvar(UPSCONN_t *ups, const char *varname, char *uin, pw = getpwuid(getuid()); - if (pw) + if (pw) { printf("Username (%s): ", pw->pw_name); - else + } else { printf("Username: "); + } if (fgets(user, sizeof(user), stdin) == NULL) { upsdebug_with_errno(LOG_INFO, "%s", __func__); } /* deal with that pesky newline */ - if (strlen(user) > 1) + if (strlen(user) > 1) { user[strlen(user) - 1] = '\0'; - else { - if (!pw) + } else { + if (!pw) { fatalx(EXIT_FAILURE, "No username available - even tried getpwuid"); - + } + snprintf(user, sizeof(user), "%s", pw->pw_name); } } @@ -130,10 +124,7 @@ static int do_setvar(UPSCONN_t *ups, const char *varname, char *uin, pass = GETPASS("Password: " ); if (!pass) { - fprintf(stderr, "getpass failed: %s\n", - strerror(errno)); - - return EXIT_FAILURE; + fatal_with_errno(EXIT_FAILURE, "getpass failed"); } } @@ -153,116 +144,93 @@ static int do_setvar(UPSCONN_t *ups, const char *varname, char *uin, snprintf(temp, sizeof(temp), "USERNAME %s\n", user); if (upscli_sendline(ups, temp, strlen(temp)) < 0) { - fprintf(stderr, "Can't set username: %s\n", - upscli_strerror(ups)); - - return EXIT_FAILURE; + fatalx(EXIT_FAILURE, "Can't set username: %s", upscli_strerror(ups)); } if (upscli_readline(ups, temp, sizeof(temp)) < 0) { if (upscli_upserror(ups) == UPSCLI_ERR_UNKCOMMAND) { - fprintf(stderr, "Set username failed due to an " - "unknown command.\n"); - - fprintf(stderr, "You probably need to upgrade upsd.\n"); - - clean_exit(ups, upsname, hostname, EXIT_FAILURE); + fatalx(EXIT_FAILURE, "Set username failed due to an unknown command. You probably need to upgrade upsd."); } - fprintf(stderr, "Set username failed: %s\n", - upscli_strerror(ups)); - - return EXIT_FAILURE; + fatalx(EXIT_FAILURE, "Set username failed: %s", upscli_strerror(ups)); } snprintf(temp, sizeof(temp), "PASSWORD %s\n", pass); if (upscli_sendline(ups, temp, strlen(temp)) < 0) { - fprintf(stderr, "Can't set password: %s\n", - upscli_strerror(ups)); - - return EXIT_FAILURE; + fatalx(EXIT_FAILURE, "Can't set password: %s", upscli_strerror(ups)); } if (upscli_readline(ups, temp, sizeof(temp)) < 0) { - fprintf(stderr, "Set password failed: %s\n", - upscli_strerror(ups)); - - return EXIT_FAILURE; + fatalx(EXIT_FAILURE, "Set password failed: %s", upscli_strerror(ups)); } /* no upsname means die */ if (!upsname) { - fprintf(stderr, "Error: a UPS name must be specified (upsname[@hostname[:port]])\n"); - return EXIT_FAILURE; + fatalx(EXIT_FAILURE, "Error: a UPS name must be specified (upsname[@hostname[:port]])"); } /* old variable names are no longer supported */ if (!strchr(varname, '.')) { - fprintf(stderr, "Error: old variable names are not supported\n"); - return EXIT_FAILURE; + fatalx(EXIT_FAILURE, "Error: old variable names are not supported"); } - return do_set(ups, upsname, varname, newval); -} + do_set(varname, newval); +} -static const char *get_data(const char *type, UPSCONN_t *ups, - const char *upsname, const char *varname) +static const char *get_data(const char *type, const char *varname) { int ret; unsigned int numq, numa; char **answer; - const char *query[4]; + const char *query[4]; query[0] = type; query[1] = upsname; query[2] = varname; + numq = 3; ret = upscli_get(ups, numq, query, &numa, &answer); - if ((ret < 0) || (numa < numq)) + if ((ret < 0) || (numa < numq)) { return NULL; + } /* */ return answer[3]; } -static void do_string(UPSCONN_t *ups, const char *upsname, const char *varname) +static void do_string(const char *varname) { - const char *val; + const char *val; - val = get_data("VAR", ups, upsname, varname); + val = get_data("VAR", varname); if (!val) { - fprintf(stderr, "do_string: can't get current value of %s\n", - varname); - return; + fatalx(EXIT_FAILURE, "do_string: can't get current value of %s", varname); } printf("Type: STRING\n"); printf("Value: %s\n", val); } -static void do_enum(UPSCONN_t *ups, const char *upsname, const char *varname) +static void do_enum(const char *varname) { int ret; unsigned int numq, numa; - char **answer, *val; - const char *query[4], *tmp; + char **answer, buf[SMALLBUF]; + const char *query[4], *val; /* get current value */ - tmp = get_data("VAR", ups, upsname, varname); + val = get_data("VAR", varname); - if (!tmp) { - fprintf(stderr, "do_enum: can't get current value of %s\n", - varname); - return; + if (!val) { + fatalx(EXIT_FAILURE, "do_enum: can't get current value of %s", varname); } - /* tmp is a pointer into answer - have to save it somewhere else */ - val = xstrdup(tmp); + snprintf(buf, sizeof(buf), "%s", val); query[0] = "ENUM"; query[1] = upsname; @@ -272,8 +240,7 @@ static void do_enum(UPSCONN_t *ups, const char *upsname, const char *varname) ret = upscli_list_start(ups, numq, query); if (ret < 0) { - fprintf(stderr, "Error: %s\n", upscli_strerror(ups)); - return; + fatalx(EXIT_FAILURE, "Error: %s", upscli_strerror(ups)); } ret = upscli_list_next(ups, numq, query, &numa, &answer); @@ -285,32 +252,27 @@ static void do_enum(UPSCONN_t *ups, const char *upsname, const char *varname) /* ENUM */ if (numa < 4) { - fprintf(stderr, "Error: insufficient data " - "(got %d args, need at least 4)\n", numa); - - free(val); - return; + fatalx(EXIT_FAILURE, "Error: insufficient data (got %d args, need at least 4)", numa); } printf("Option: \"%s\"", answer[3]); - if (!strcmp(answer[3], val)) + if (!strcmp(answer[3], buf)) { printf(" SELECTED"); + } printf("\n"); ret = upscli_list_next(ups, numq, query, &numa, &answer); } - - free(val); } -static void do_type(UPSCONN_t *ups, const char *upsname, const char *varname) +static void do_type(const char *varname) { int ret; unsigned int i, numq, numa; char **answer; - const char *query[4]; + const char *query[4]; query[0] = "TYPE"; query[1] = upsname; @@ -328,54 +290,54 @@ static void do_type(UPSCONN_t *ups, const char *upsname, const char *varname) for (i = 3; i < numa; i++) { if (!strcasecmp(answer[i], "ENUM")) { - do_enum(ups, upsname, varname); + do_enum(varname); return; } if (!strncasecmp(answer[i], "STRING:", 7)) { - do_string(ups, upsname, varname); + do_string(varname); return; } /* ignore this one */ - if (!strcasecmp(answer[i], "RW")) + if (!strcasecmp(answer[i], "RW")) { continue; + } printf("Type: %s (unrecognized)\n", answer[i]); } - } -static void print_rw(UPSCONN_t *ups, const char *upsname, const char *varname) +static void print_rw(const char *varname) { - const char *tmp; + const char *tmp; printf("[%s]\n", varname); - tmp = get_data("DESC", ups, upsname, varname); + tmp = get_data("DESC", varname); - if (tmp) + if (tmp) { printf("%s\n", tmp); - else + } else { printf("Description unavailable\n"); + } - do_type(ups, upsname, varname); + do_type(varname); printf("\n"); -} +} -static int print_rwlist(UPSCONN_t *ups, const char *upsname) +static void print_rwlist(void) { int ret; unsigned int numq, numa; - const char *query[2]; + const char *query[2]; char **answer; struct list_t *lhead, *llast, *ltmp, *lnext; /* the upsname is now required */ if (!upsname) { - fprintf(stderr, "Error: a UPS name must be specified (upsname[@hostname[:port]])\n"); - return EXIT_FAILURE; + fatalx(EXIT_FAILURE, "Error: a UPS name must be specified (upsname[@hostname[:port]])"); } llast = lhead = NULL; @@ -390,12 +352,10 @@ static int print_rwlist(UPSCONN_t *ups, const char *upsname) /* old upsd --> fall back on old LISTRW technique */ if (upscli_upserror(ups) == UPSCLI_ERR_UNKCOMMAND) { - fprintf(stderr, "Error: upsd is too old to support this query\n"); - return EXIT_FAILURE; + fatalx(EXIT_FAILURE, "Error: upsd is too old to support this query"); } - fprintf(stderr, "Error: %s\n", upscli_strerror(ups)); - return EXIT_FAILURE; + fatalx(EXIT_FAILURE, "Error: %s", upscli_strerror(ups)); } ret = upscli_list_next(ups, numq, query, &numa, &answer); @@ -404,9 +364,7 @@ static int print_rwlist(UPSCONN_t *ups, const char *upsname) /* RW */ if (numa < 4) { - fprintf(stderr, "Error: insufficient data " - "(got %d args, need at least 4)\n", numa); - return EXIT_FAILURE; + fatalx(EXIT_FAILURE, "Error: insufficient data (got %d args, need at least 4)", numa); } /* sock this entry away for later */ @@ -415,10 +373,11 @@ static int print_rwlist(UPSCONN_t *ups, const char *upsname) ltmp->name = xstrdup(answer[2]); ltmp->next = NULL; - if (llast) + if (llast) { llast->next = ltmp; - else + } else { lhead = ltmp; + } llast = ltmp; @@ -432,28 +391,23 @@ static int print_rwlist(UPSCONN_t *ups, const char *upsname) while (ltmp) { lnext = ltmp->next; - print_rw(ups, upsname, ltmp->name); + print_rw(ltmp->name); free(ltmp->name); free(ltmp); ltmp = lnext; } - - return EXIT_SUCCESS; } int main(int argc, char **argv) { - int i, port, ret; - char *upsname, *hostname, *setvar, *prog; - char *password = NULL, *username = NULL; - UPSCONN_t ups; - - setvar = username = NULL; - prog = argv[0]; + int i, port; + const char *prog = xbasename(argv[0]); + char *password = NULL, *username = NULL, *setvar = NULL; while ((i = getopt(argc, argv, "+s:p:u:V")) != -1) { - switch (i) { + switch (i) + { case 's': setvar = optarg; break; @@ -464,45 +418,42 @@ int main(int argc, char **argv) username = optarg; break; case 'V': - printf("Network UPS Tools upsrw %s\n", UPS_VERSION); + printf("Network UPS Tools %s %s\n", prog, UPS_VERSION); exit(EXIT_SUCCESS); default: usage(prog); - break; + exit(EXIT_SUCCESS); } } argc -= optind; argv += optind; - if (argc < 1) + if (argc < 1) { usage(prog); + exit(EXIT_SUCCESS); + } - upsname = hostname = NULL; + /* be a good little client that cleans up after itself */ + atexit(clean_exit); if (upscli_splitname(argv[0], &upsname, &hostname, &port) != 0) { - fprintf(stderr, "Error: invalid UPS definition. Required format: upsname[@hostname[:port]]\n"); - clean_exit(&ups, upsname, hostname, EXIT_FAILURE); + fatalx(EXIT_FAILURE, "Error: invalid UPS definition. Required format: upsname[@hostname[:port]]"); } - if (upscli_connect(&ups, hostname, port, 0) < 0) { - fprintf(stderr, "Can't connect: %s\n", upscli_strerror(&ups)); - clean_exit(&ups, upsname, hostname, EXIT_FAILURE); + ups = xcalloc(1, sizeof(*ups)); + + if (upscli_connect(ups, hostname, port, 0) < 0) { + fatalx(EXIT_FAILURE, "Error: %s", upscli_strerror(ups)); } - /* setting a variable? */ if (setvar) { - ret = do_setvar(&ups, setvar, username, password, upsname, - hostname); - - clean_exit(&ups, upsname, hostname, ret); + /* setting a variable */ + do_setvar(setvar, username, password); + } else { + /* if not, get the list of supported read/write variables */ + print_rwlist(); } - /* if not, get the list of supported read/write variables */ - ret = print_rwlist(&ups, upsname); - - clean_exit(&ups, upsname, hostname, ret); - - /* NOTREACHED */ - exit(EXIT_FAILURE); + exit(EXIT_SUCCESS); } diff --git a/clients/upssched.c b/clients/upssched.c index e00ae17..e707248 100644 --- a/clients/upssched.c +++ b/clients/upssched.c @@ -50,14 +50,14 @@ #include "upssched.h" #include "timehead.h" -typedef struct { +typedef struct ttype_s { char *name; time_t etime; - void *next; -} ttype_t; + struct ttype_s *next; +} ttype_t; ttype_t *thead = NULL; - static struct conn_t *connhead = NULL; + static conn_t *connhead = NULL; char *cmdscript = NULL, *pipefn = NULL, *lockfn = NULL; int verbose = 0; /* use for debugging */ @@ -300,9 +300,9 @@ static int open_sock(void) return fd; } -static void conn_del(struct conn_t *target) +static void conn_del(conn_t *target) { - struct conn_t *tmp, *last = NULL; + conn_t *tmp, *last = NULL; tmp = connhead; @@ -327,7 +327,7 @@ static void conn_del(struct conn_t *target) upslogx(LOG_ERR, "Tried to delete a bogus state connection"); } -static int send_to_one(struct conn_t *conn, const char *fmt, ...) +static int send_to_one(conn_t *conn, const char *fmt, ...) { int ret; va_list ap; @@ -354,7 +354,7 @@ static int send_to_one(struct conn_t *conn, const char *fmt, ...) static void conn_add(int sockfd) { int acc, ret; - struct conn_t *tmp, *last; + conn_t *tmp, *last; struct sockaddr_un saddr; socklen_t salen; @@ -391,7 +391,7 @@ static void conn_add(int sockfd) tmp = tmp->next; } - tmp = xmalloc(sizeof(struct conn_t)); + tmp = xmalloc(sizeof(conn_t)); tmp->fd = acc; tmp->next = NULL; @@ -405,7 +405,7 @@ static void conn_add(int sockfd) pconf_init(&tmp->ctx, NULL); } -static int sock_arg(struct conn_t *conn) +static int sock_arg(conn_t *conn) { if (conn->ctx.numargs < 1) return 0; @@ -446,7 +446,7 @@ static void log_unknown(int numarg, char **arg) upslogx(LOG_INFO, "arg %d: %s", i, arg[i]); } -static int sock_read(struct conn_t *conn) +static int sock_read(conn_t *conn) { int i, ret; char ch; @@ -494,7 +494,7 @@ static void start_daemon(int lockfd) int maxfd, pid, pipefd, ret; struct timeval tv; fd_set rfds; - struct conn_t *tmp, *tmpnext; + conn_t *tmp, *tmpnext; socklen_t fromlen; fromlen = sizeof(struct sockaddr); @@ -899,10 +899,12 @@ static void checkconf(void) int main(int argc, char **argv) { + const char *prog = xbasename(argv[0]); + verbose = 1; /* TODO: remove when done testing */ /* normally we don't have stderr, so get this going to syslog early */ - openlog("upssched", LOG_PID, LOG_DAEMON); + open_syslog(prog); syslogbit_set(); upsname = getenv("UPSNAME"); diff --git a/clients/upssched.h b/clients/upssched.h index 94be9e3..c9aca9f 100644 --- a/clients/upssched.h +++ b/clients/upssched.h @@ -7,8 +7,8 @@ #define SERIALIZE_WAIT 3 /* track client connections */ -struct conn_t { +typedef struct conn_s { int fd; PCONF_CTX_t ctx; - void *next; -}; + struct conn_s *next; +} conn_t; diff --git a/common/Makefile.am b/common/Makefile.am index 026a239..84caa0f 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -2,14 +2,15 @@ AM_CFLAGS = -I$(top_srcdir)/include -noinst_LIBRARIES = libcommon.a -libcommon_a_SOURCES = common.c state.c upsconf.c ../include/nut_version.h -libcommon_a_LIBADD = libparseconf.la - ../include/nut_version.h: FORCE (cd ../include/ && $(MAKE) $(AM_MAKEFLAGS) nut_version.h) FORCE: -noinst_LTLIBRARIES = libparseconf.la +noinst_LTLIBRARIES = libparseconf.la libcommon.la libparseconf_la_SOURCES = parseconf.c + +libcommon_la_SOURCES = common.c state.c upsconf.c ../include/nut_version.h +# ensure inclusion of local implementation of missing systems functions +# using LTLIBOBJS. Refer to configure.in -> AC_REPLACE_FUNCS +libcommon_la_LIBADD = libparseconf.la @LTLIBOBJS@ diff --git a/common/Makefile.in b/common/Makefile.in index 9707bd6..8006e9e 100644 --- a/common/Makefile.in +++ b/common/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -17,7 +17,6 @@ # Network UPS Tools: common - VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -39,14 +38,16 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = common -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +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_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -56,6 +57,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -65,14 +67,10 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru -libcommon_a_AR = $(AR) $(ARFLAGS) -libcommon_a_DEPENDENCIES = libparseconf.la -am_libcommon_a_OBJECTS = common.$(OBJEXT) state.$(OBJEXT) \ - upsconf.$(OBJEXT) -libcommon_a_OBJECTS = $(am_libcommon_a_OBJECTS) LTLIBRARIES = $(noinst_LTLIBRARIES) +libcommon_la_DEPENDENCIES = libparseconf.la @LTLIBOBJS@ +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) @@ -89,14 +87,16 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(libcommon_a_SOURCES) $(libparseconf_la_SOURCES) -DIST_SOURCES = $(libcommon_a_SOURCES) $(libparseconf_la_SOURCES) +SOURCES = $(libcommon_la_SOURCES) $(libparseconf_la_SOURCES) +DIST_SOURCES = $(libcommon_la_SOURCES) $(libparseconf_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -109,8 +109,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -127,7 +129,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -138,22 +139,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ @@ -250,11 +251,12 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ AM_CFLAGS = -I$(top_srcdir)/include -noinst_LIBRARIES = libcommon.a -libcommon_a_SOURCES = common.c state.c upsconf.c ../include/nut_version.h -libcommon_a_LIBADD = libparseconf.la -noinst_LTLIBRARIES = libparseconf.la +noinst_LTLIBRARIES = libparseconf.la libcommon.la libparseconf_la_SOURCES = parseconf.c +libcommon_la_SOURCES = common.c state.c upsconf.c ../include/nut_version.h +# ensure inclusion of local implementation of missing systems functions +# using LTLIBOBJS. Refer to configure.in -> AC_REPLACE_FUNCS +libcommon_la_LIBADD = libparseconf.la @LTLIBOBJS@ all: all-am .SUFFIXES: @@ -290,13 +292,6 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libcommon.a: $(libcommon_a_OBJECTS) $(libcommon_a_DEPENDENCIES) - -rm -f libcommon.a - $(libcommon_a_AR) libcommon.a $(libcommon_a_OBJECTS) $(libcommon_a_LIBADD) - $(RANLIB) libcommon.a - clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ @@ -305,6 +300,8 @@ clean-noinstLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done +libcommon.la: $(libcommon_la_OBJECTS) $(libcommon_la_DEPENDENCIES) + $(LINK) $(libcommon_la_OBJECTS) $(libcommon_la_LIBADD) $(LIBS) libparseconf.la: $(libparseconf_la_OBJECTS) $(libparseconf_la_DEPENDENCIES) $(LINK) $(libparseconf_la_OBJECTS) $(libparseconf_la_LIBADD) $(LIBS) @@ -314,10 +311,14 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ +@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.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsconf.Po@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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -430,7 +431,7 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) +all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am @@ -459,11 +460,11 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ - clean-noinstLTLIBRARIES mostlyclean-am +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -rf $(DEPDIR) ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -509,7 +510,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -rf $(DEPDIR) ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -531,18 +532,17 @@ uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLIBRARIES 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 + 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 ../include/nut_version.h: FORCE diff --git a/common/atexit.c b/common/atexit.c new file mode 100644 index 0000000..9279c66 --- /dev/null +++ b/common/atexit.c @@ -0,0 +1,22 @@ +/* atexit() Mark Powell */ +/* Implemented in terms of on_exit() for old BSD-style systems, like SunOS4 */ + +#include "config.h" + +#ifndef HAVE_ATEXIT + +#include + +int atexit(fn) + void (*fn)(); +{ +#ifdef HAVE_ON_EXIT + return on_exit(fn, 0); +#else + /* Choose some errno thats likely to exist on lots of systems */ + errno = EPERM; + return (-1); +#endif /* HAVE_ON_EXIT */ +} + +#endif /* HAVE_ATEXIT */ diff --git a/common/common.c b/common/common.c index a4bcaed..f443cb7 100644 --- a/common/common.c +++ b/common/common.c @@ -33,16 +33,17 @@ const char *UPS_VERSION = NUT_VERSION_MACRO; int nut_debug_level = 0; + int nut_log_level = 0; static int upslog_flags = UPSLOG_STDERR; static void xbit_set(int *val, int flag) { - *val = (*val |= flag); + *val |= flag; } static void xbit_clear(int *val, int flag) { - *val = (*val ^= (*val & flag)); + *val ^= (*val & flag); } static int xbit_test(int val, int flag) @@ -70,6 +71,44 @@ void open_syslog(const char *progname) #endif openlog(progname, opt, LOG_FACILITY); + + switch (nut_log_level) + { +#if HAVE_SETLOGMASK && HAVE_DECL_LOG_UPTO + case 7: + setlogmask(LOG_UPTO(LOG_EMERG)); /* system is unusable */ + break; + case 6: + setlogmask(LOG_UPTO(LOG_ALERT)); /* action must be taken immediately */ + break; + case 5: + setlogmask(LOG_UPTO(LOG_CRIT)); /* critical conditions */ + break; + case 4: + setlogmask(LOG_UPTO(LOG_ERR)); /* error conditions */ + break; + case 3: + setlogmask(LOG_UPTO(LOG_WARNING)); /* warning conditions */ + break; + case 2: + setlogmask(LOG_UPTO(LOG_NOTICE)); /* normal but significant condition */ + break; + case 1: + setlogmask(LOG_UPTO(LOG_INFO)); /* informational */ + break; + case 0: + setlogmask(LOG_UPTO(LOG_DEBUG)); /* debug-level messages */ + break; + default: + fatalx(EXIT_FAILURE, "Invalid log level threshold"); +#else + case 0: + break; + default: + upslogx(LOG_INFO, "Changing log level threshold not possible"); + break; +#endif + } } /* close ttys and become a daemon */ diff --git a/common/setenv.c b/common/setenv.c new file mode 100644 index 0000000..00f7a6b --- /dev/null +++ b/common/setenv.c @@ -0,0 +1,26 @@ +/* setenv.c Ben Collver */ +#ifndef HAVE_SETENV +#include +#include +#include "common.h" + +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, "="); + strcat(buffer, value); + rv = putenv(buffer); /* man putenv, do not free(buffer) */ + return (rv); +} +#endif diff --git a/common/snprintf.c b/common/snprintf.c new file mode 100644 index 0000000..a180269 --- /dev/null +++ b/common/snprintf.c @@ -0,0 +1,914 @@ +/* + * Copyright Patrick Powell 1995 + * This code is based on code written by Patrick Powell (papowell@astart.com) + * It may be used for any purpose as long as this notice remains intact + * on all source code distributions + */ + +/************************************************************** + * Original: + * Patrick Powell Tue Apr 11 09:48:21 PDT 1995 + * A bombproof version of doprnt (dopr) included. + * Sigh. This sort of thing is always nasty do deal with. Note that + * the version here does not include floating point... + * + * snprintf() is used instead of sprintf() as it does limit checks + * for string length. This covers a nasty loophole. + * + * The other functions are there to prevent NULL pointers from + * causing nast effects. + * + * More Recently: + * Brandon Long 9/15/96 for mutt 0.43 + * This was ugly. It is still ugly. I opted out of floating point + * numbers, but the formatter understands just about everything + * from the normal C string format, at least as far as I can tell from + * the Solaris 2.5 printf(3S) man page. + * + * Brandon Long 10/22/97 for mutt 0.87.1 + * Ok, added some minimal floating point support, which means this + * probably requires libm on most operating systems. Don't yet + * support the exponent (e,E) and sigfig (g,G). Also, fmtint() + * was pretty badly broken, it just wasn't being exercised in ways + * which showed it, so that's been fixed. Also, formated the code + * to mutt conventions, and removed dead code left over from the + * 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. + * Unfortunately, unsigned formats simply didn't work. + * + * Michael Elkins 03/05/98 for mutt 0.90.8 + * The original code assumed that both snprintf() and vsnprintf() were + * missing. Some systems only have snprintf() but not vsnprintf(), so + * the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF. + * + * Andrew Tridgell (tridge@samba.org) Oct 1998 + * fixed handling of %.0f + * added test for HAVE_LONG_DOUBLE + * + **************************************************************/ + +#include "config.h" + +#include +# include +#include + +#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) + +/* Define this as a fall through, HAVE_STDARG_H is probably already set */ + +#ifndef HAVE_VARARGS_H +#define HAVE_VARARGS_H +#endif + +/* varargs declarations: */ + +#if defined(HAVE_STDARG_H) +# include +# define HAVE_STDARGS /* let's hope that works everywhere (mj) */ +# define VA_LOCAL_DECL va_list ap +# define VA_START(f) va_start(ap, f) +# define VA_SHIFT(v,t) ; /* no-op for ANSI */ +# define VA_END va_end(ap) +#else +# if defined(HAVE_VARARGS_H) +# include +# undef HAVE_STDARGS +# define VA_LOCAL_DECL va_list ap +# define VA_START(f) va_start(ap) /* f is ignored! */ +# define VA_SHIFT(v,t) v = va_arg(ap,t) +# define VA_END va_end(ap) +# else +/*XX ** NO VARARGS ** XX*/ +# endif +#endif + +#ifdef HAVE_LONG_DOUBLE +#define LDOUBLE long double +#else +#define LDOUBLE double +#endif + +#ifdef HAVE_LONG_LONG_INT +#define LLONG long long +#else +#define LLONG long +#endif + +/*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, + va_list args); +static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, + 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); +static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, + LDOUBLE fvalue, int min, int max, int flags); +static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c ); + +/* + * dopr(): poor man's version of doprintf + */ + +/* format read states */ +#define DP_S_DEFAULT 0 +#define DP_S_FLAGS 1 +#define DP_S_MIN 2 +#define DP_S_DOT 3 +#define DP_S_MAX 4 +#define DP_S_MOD 5 +#define DP_S_CONV 6 +#define DP_S_DONE 7 + +/* format flags - Bits */ +#define DP_F_MINUS (1 << 0) +#define DP_F_PLUS (1 << 1) +#define DP_F_SPACE (1 << 2) +#define DP_F_NUM (1 << 3) +#define DP_F_ZERO (1 << 4) +#define DP_F_UP (1 << 5) +#define DP_F_UNSIGNED (1 << 6) + +/* Conversion Flags */ +#define DP_C_SHORT 1 +#define DP_C_LONG 2 +#define DP_C_LDOUBLE 3 +#define DP_C_LLONG 4 + +#define char_to_int(p) ((p)- '0') +#define MAX(p,q) (((p) >= (q)) ? (p) : (q)) + +static void dopr (char *buffer, size_t maxlen, const char *format, va_list args) +{ + char ch; + LLONG value; + LDOUBLE fvalue; + char *strvalue; + int min; + int max; + int state; + int flags; + int cflags; + size_t currlen; + + state = DP_S_DEFAULT; + currlen = flags = cflags = min = 0; + max = -1; + ch = *format++; + + while (state != DP_S_DONE) + { + if ((ch == '\0') || (currlen >= maxlen)) + state = DP_S_DONE; + + switch(state) + { + case DP_S_DEFAULT: + if (ch == '%') + state = DP_S_FLAGS; + else + dopr_outch (buffer, &currlen, maxlen, ch); + ch = *format++; + break; + case DP_S_FLAGS: + switch (ch) + { + case '-': + flags |= DP_F_MINUS; + ch = *format++; + break; + case '+': + flags |= DP_F_PLUS; + ch = *format++; + break; + case ' ': + flags |= DP_F_SPACE; + ch = *format++; + break; + case '#': + flags |= DP_F_NUM; + ch = *format++; + break; + case '0': + flags |= DP_F_ZERO; + ch = *format++; + break; + default: + state = DP_S_MIN; + break; + } + break; + case DP_S_MIN: + if (isdigit((unsigned char)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; + break; + case DP_S_DOT: + if (ch == '.') + { + state = DP_S_MAX; + ch = *format++; + } + else + state = DP_S_MOD; + break; + case DP_S_MAX: + if (isdigit((unsigned char)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; + break; + case DP_S_MOD: + switch (ch) + { + case 'h': + 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; + case 'L': + cflags = DP_C_LDOUBLE; + ch = *format++; + break; + default: + break; + } + state = DP_S_CONV; + break; + case DP_S_CONV: + switch (ch) + { + case 'd': + case 'i': + 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) + 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) + 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; + case 'x': + 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; + case 'E': + flags |= DP_F_UP; + case 'e': + if (cflags == DP_C_LDOUBLE) + fvalue = va_arg (args, LDOUBLE); + else + fvalue = va_arg (args, double); + break; + case 'G': + flags |= DP_F_UP; + case 'g': + 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; + case 's': + 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; + case 'n': + 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; + } + break; + case '%': + dopr_outch (buffer, &currlen, maxlen, ch); + break; + case 'w': + /* not supported yet, treat as next char */ + ch = *format++; + break; + default: + /* Unknown, skip */ + break; + } + ch = *format++; + state = DP_S_DEFAULT; + flags = cflags = min = 0; + max = -1; + break; + case DP_S_DONE: + break; + default: + /* hmm? */ + break; /* some picky compilers need this */ + } + } + if (currlen < maxlen - 1) + buffer[currlen] = '\0'; + else + buffer[maxlen - 1] = '\0'; +} + +static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, + char *value, int flags, int min, int max) +{ + int padlen, strln; /* amount to pad */ + int cnt = 0; + + if (value == 0) + { + value = ""; + } + + for (strln = 0; value[strln]; ++strln); /* strlen */ + padlen = min - strln; + if (padlen < 0) + padlen = 0; + if (flags & DP_F_MINUS) + padlen = -padlen; /* Left Justify */ + + while ((padlen > 0) && (cnt < max)) + { + dopr_outch (buffer, currlen, maxlen, ' '); + --padlen; + ++cnt; + } + while (*value && (cnt < max)) + { + dopr_outch (buffer, currlen, maxlen, *value++); + ++cnt; + } + while ((padlen < 0) && (cnt < max)) + { + dopr_outch (buffer, currlen, maxlen, ' '); + ++padlen; + ++cnt; + } +} + +/* 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) +{ + int signvalue = 0; + unsigned long uvalue; + char convert[20]; + int place = 0; + int spadlen = 0; /* amount to space pad */ + int zpadlen = 0; /* amount to zero pad */ + int caps = 0; + + if (max < 0) + max = 0; + + uvalue = value; + + if(!(flags & DP_F_UNSIGNED)) + { + if( value < 0 ) { + signvalue = '-'; + uvalue = -value; + } + else + if (flags & DP_F_PLUS) /* Do a sign (+/i) */ + signvalue = '+'; + else + if (flags & DP_F_SPACE) + signvalue = ' '; + } + + if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ + + do { + convert[place++] = + (caps? "0123456789ABCDEF":"0123456789abcdef") + [uvalue % (unsigned)base ]; + uvalue = (uvalue / (unsigned)base ); + } while(uvalue && (place < 20)); + if (place == 20) place--; + convert[place] = 0; + + zpadlen = max - place; + spadlen = min - MAX (max, place) - (signvalue ? 1 : 0); + if (zpadlen < 0) zpadlen = 0; + if (spadlen < 0) spadlen = 0; + if (flags & DP_F_ZERO) + { + zpadlen = MAX(zpadlen, spadlen); + spadlen = 0; + } + 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); +#endif + + /* Spaces */ + while (spadlen > 0) + { + dopr_outch (buffer, currlen, maxlen, ' '); + --spadlen; + } + + /* Sign */ + if (signvalue) + dopr_outch (buffer, currlen, maxlen, signvalue); + + /* Zeros */ + if (zpadlen > 0) + { + while (zpadlen > 0) + { + dopr_outch (buffer, currlen, maxlen, '0'); + --zpadlen; + } + } + + /* Digits */ + while (place > 0) + dopr_outch (buffer, currlen, maxlen, convert[--place]); + + /* Left Justified spaces */ + while (spadlen < 0) { + dopr_outch (buffer, currlen, maxlen, ' '); + ++spadlen; + } +} + +static LDOUBLE abs_val (LDOUBLE value) +{ + LDOUBLE result = value; + + if (value < 0) + result = -value; + + return result; +} + +static LDOUBLE pow10 (int exp) +{ + LDOUBLE result = 1; + + while (exp) + { + result *= 10; + exp--; + } + + return result; +} + +static long round (LDOUBLE value) +{ + long intpart; + + intpart = (long)value; + value = value - intpart; + if (value >= 0.5) + intpart++; + + return intpart; +} + +static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, + LDOUBLE fvalue, int min, int max, int flags) +{ + int signvalue = 0; + LDOUBLE ufvalue; +#ifndef HAVE_FCVT + char iconvert[20]; + char fconvert[20]; +#else + char iconvert[311]; + char fconvert[311]; + char *result; + int dec_pt, sig; + int r_length; +# ifdef HAVE_FCVTL + extern char *fcvtl(long double value, int ndigit, int *decpt, int *sign); +# else + extern char *fcvt(double value, int ndigit, int *decpt, int *sign); +# endif +#endif + int iplace = 0; + int fplace = 0; + int padlen = 0; /* amount to pad */ + int zpadlen = 0; + int caps = 0; + long intpart; + long fracpart; + + /* + * AIX manpage says the default is 0, but Solaris says the default + * is 6, and sprintf on AIX defaults to 6 + */ + if (max < 0) + max = 6; + + ufvalue = abs_val (fvalue); + + if (fvalue < 0) + signvalue = '-'; + else + if (flags & DP_F_PLUS) /* Do a sign (+/i) */ + signvalue = '+'; + else + if (flags & DP_F_SPACE) + signvalue = ' '; + +#if 0 + if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ +#endif + +#ifndef HAVE_FCVT + intpart = (long)ufvalue; + + /* + * Sorry, we only support 9 digits past the decimal because of our + * conversion method + */ + if (max > 9) + max = 9; + + /* We "cheat" by converting the fractional part to integer by + * multiplying by a factor of 10 + */ + fracpart = round ((pow10 (max)) * (ufvalue - intpart)); + + if (fracpart >= pow10 (max)) + { + intpart++; + fracpart -= pow10 (max); + } + +#ifdef DEBUG_SNPRINTF + printf("fmtfp: %g %d.%d min=%d max=%d\n", + (double)fvalue, intpart, fracpart, min, max); +#endif + + /* Convert integer part */ + do { + iconvert[iplace++] = + (caps? "0123456789ABCDEF":"0123456789abcdef")[intpart % 10]; + intpart = (intpart / 10); + } while(intpart && (iplace < 20)); + if (iplace == 20) iplace--; + iconvert[iplace] = 0; + + /* Convert fractional part */ + do { + fconvert[fplace++] = + (caps? "0123456789ABCDEF":"0123456789abcdef")[fracpart % 10]; + fracpart = (fracpart / 10); + } while(fracpart && (fplace < 20)); + if (fplace == 20) fplace--; + fconvert[fplace] = 0; +#else /* use fcvt() */ + if (max > 310) + max = 310; +# ifdef HAVE_FCVTL + result = fcvtl(ufvalue, max, &dec_pt, &sig); +# else + result = fcvt(ufvalue, max, &dec_pt, &sig); +# endif + + r_length = strlen(result); + + /* + * Fix broken fcvt implementation returns.. + */ + + if (r_length == 0) + { + result[0] = '0'; + result[1] = '\0'; + r_length = 1; + } + + if ( r_length < dec_pt ) + dec_pt = r_length; + + if (dec_pt <= 0) { + iplace = 1; + iconvert[0] = '0'; + iconvert[1] = '\0'; + + fplace = 0; + + while(r_length) + fconvert[fplace++] = result[--r_length]; + + while ((dec_pt < 0) && (fplace < max)) { + 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); + zpadlen = max - fplace; + if (zpadlen < 0) + zpadlen = 0; + if (padlen < 0) + padlen = 0; + if (flags & DP_F_MINUS) + padlen = -padlen; /* Left Justifty */ + + if ((flags & DP_F_ZERO) && (padlen > 0)) + { + if (signvalue) + { + dopr_outch (buffer, currlen, maxlen, signvalue); + --padlen; + signvalue = 0; + } + while (padlen > 0) + { + dopr_outch (buffer, currlen, maxlen, '0'); + --padlen; + } + } + while (padlen > 0) + { + dopr_outch (buffer, currlen, maxlen, ' '); + --padlen; + } + if (signvalue) + dopr_outch (buffer, currlen, maxlen, signvalue); + + while (iplace > 0) + dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]); + + +#ifdef DEBUG_SNPRINTF + printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen); +#endif + + /* + * Decimal point. This should probably use locale to find the correct + * char to print out. + */ + if (max > 0) { + dopr_outch (buffer, currlen, maxlen, '.'); + + while (fplace > 0) + dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); + } + + while (zpadlen > 0) + { + dopr_outch (buffer, currlen, maxlen, '0'); + --zpadlen; + } + + while (padlen < 0) + { + dopr_outch (buffer, currlen, maxlen, ' '); + ++padlen; + } +} + +static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c) +{ + if (*currlen < maxlen) + buffer[(*currlen)++] = c; +} +#endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */ + +#ifndef HAVE_VSNPRINTF + int vsnprintf (char *str, size_t count, const char *fmt, va_list args) +{ + str[0] = 0; + dopr(str, count, fmt, args); + return(strlen(str)); +} +#endif /* !HAVE_VSNPRINTF */ + +#ifndef HAVE_SNPRINTF +/* VARARGS3 */ +#ifdef HAVE_STDARGS + int snprintf (char *str,size_t count,const char *fmt,...) +#else + int snprintf (va_alist) va_dcl +#endif +{ +#ifndef HAVE_STDARGS + char *str; + size_t count; + char *fmt; +#endif + VA_LOCAL_DECL; + + VA_START (fmt); + VA_SHIFT (str, char *); + VA_SHIFT (count, size_t ); + VA_SHIFT (fmt, char *); + (void) vsnprintf(str, count, fmt, ap); + VA_END; + return(strlen(str)); +} + + +#else + /* keep compilers happy about empty files */ + void dummy_snprintf(void) {} +#endif /* !HAVE_SNPRINTF */ + +#ifdef TEST_SNPRINTF +#ifndef LONG_STRING +#define LONG_STRING 1024 +#endif + int main (void) +{ + char buf1[LONG_STRING]; + char buf2[LONG_STRING]; + char *fp_fmt[] = { + "%-1.5f", + "%1.5f", + "%123.9f", + "%10.5f", + "% 10.5f", + "%+22.9f", + "%+4.9f", + "%01.3f", + "%4f", + "%3.1f", + "%3.2f", + "%.0f", + "%.1f", + NULL + }; + 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", + "%1.5d", + "%123.9d", + "%5.5d", + "%10.5d", + "% 10.5d", + "%+22.33d", + "%01.3d", + "%4d", + NULL + }; + long int_nums[] = { -1, 134, 91340, 341, 0203, 0}; + int x, y; + int fail = 0; + int num = 0; + + printf ("Testing snprintf format codes against system sprintf...\n"); + + for (x = 0; fp_fmt[x] != NULL ; x++) + for (y = 0; fp_nums[y] != 0 ; y++) + { + snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]); + 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++; + } + num++; + } + + for (x = 0; int_fmt[x] != NULL ; x++) + for (y = 0; int_nums[y] != 0 ; y++) + { + snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]); + 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++; + } + num++; + } + printf ("%d tests failed out of %d.\n", fail, num); +} +#endif /* SNPRINTF_TEST */ + diff --git a/common/state.c b/common/state.c index 42d77d6..0e728a7 100644 --- a/common/state.c +++ b/common/state.c @@ -30,7 +30,7 @@ #include "state.h" #include "parseconf.h" -static void val_escape(struct st_tree_t *node) +static void val_escape(st_tree_t *node) { char etmp[ST_MAX_VALUE_LEN]; @@ -53,7 +53,7 @@ static void val_escape(struct st_tree_t *node) node->val = node->safe; } -static void st_tree_enum_free(struct enum_t *list) +static void st_tree_enum_free(enum_t *list) { if (!list) { return; @@ -66,7 +66,7 @@ static void st_tree_enum_free(struct enum_t *list) } /* free all memory associated with a node */ -static void st_tree_node_free(struct st_tree_t *node) +static void st_tree_node_free(st_tree_t *node) { free(node->var); free(node->raw); @@ -82,7 +82,7 @@ static void st_tree_node_free(struct st_tree_t *node) } /* add a subtree to another subtree */ -static void st_tree_node_add(struct st_tree_t **nptr, struct st_tree_t *sptr) +static void st_tree_node_add(st_tree_t **nptr, st_tree_t *sptr) { if (!sptr) { return; @@ -90,7 +90,7 @@ static void st_tree_node_add(struct st_tree_t **nptr, struct st_tree_t *sptr) while (*nptr) { - struct st_tree_t *node = *nptr; + st_tree_t *node = *nptr; if (strcasecmp(node->var, sptr->var) > 0) { nptr = &node->left; @@ -110,11 +110,11 @@ static void st_tree_node_add(struct st_tree_t **nptr, struct st_tree_t *sptr) } /* remove a variable from a tree */ -int state_delinfo(struct st_tree_t **nptr, const char *var) +int state_delinfo(st_tree_t **nptr, const char *var) { while (*nptr) { - struct st_tree_t *node = *nptr; + st_tree_t *node = *nptr; if (strcasecmp(node->var, var) > 0) { nptr = &node->left; @@ -142,11 +142,11 @@ int state_delinfo(struct st_tree_t **nptr, const char *var) /* interface */ -int state_setinfo(struct st_tree_t **nptr, const char *var, const char *val) +int state_setinfo(st_tree_t **nptr, const char *var, const char *val) { while (*nptr) { - struct st_tree_t *node = *nptr; + st_tree_t *node = *nptr; if (strcasecmp(node->var, var) > 0) { nptr = &node->left; @@ -193,9 +193,9 @@ int state_setinfo(struct st_tree_t **nptr, const char *var, const char *val) return 1; /* added */ } -static int st_tree_enum_add(struct enum_t **list, const char *enc) +static int st_tree_enum_add(enum_t **list, const char *enc) { - struct enum_t *item; + enum_t *item; while (*list) { @@ -217,9 +217,9 @@ static int st_tree_enum_add(struct enum_t **list, const char *enc) return 1; /* added */ } -int state_addenum(struct st_tree_t *root, const char *var, const char *val) +int state_addenum(st_tree_t *root, const char *var, const char *val) { - struct st_tree_t *sttmp; + st_tree_t *sttmp; char enc[ST_MAX_VALUE_LEN]; /* find the tree node for var */ @@ -237,9 +237,9 @@ int state_addenum(struct st_tree_t *root, const char *var, const char *val) return st_tree_enum_add(&sttmp->enum_list, enc); } -int state_setaux(struct st_tree_t *root, const char *var, const char *auxs) +int state_setaux(st_tree_t *root, const char *var, const char *auxs) { - struct st_tree_t *sttmp; + st_tree_t *sttmp; int aux; /* find the tree node for var */ @@ -263,9 +263,9 @@ int state_setaux(struct st_tree_t *root, const char *var, const char *auxs) return 1; } -const char *state_getinfo(struct st_tree_t *root, const char *var) +const char *state_getinfo(st_tree_t *root, const char *var) { - struct st_tree_t *sttmp; + st_tree_t *sttmp; /* find the tree node for var */ sttmp = state_tree_find(root, var); @@ -277,9 +277,9 @@ const char *state_getinfo(struct st_tree_t *root, const char *var) return sttmp->val; } -int state_getflags(struct st_tree_t *root, const char *var) +int state_getflags(st_tree_t *root, const char *var) { - struct st_tree_t *sttmp; + st_tree_t *sttmp; /* find the tree node for var */ sttmp = state_tree_find(root, var); @@ -291,9 +291,9 @@ int state_getflags(struct st_tree_t *root, const char *var) return sttmp->flags; } -int state_getaux(struct st_tree_t *root, const char *var) +int state_getaux(st_tree_t *root, const char *var) { - struct st_tree_t *sttmp; + st_tree_t *sttmp; /* find the tree node for var */ sttmp = state_tree_find(root, var); @@ -305,9 +305,9 @@ int state_getaux(struct st_tree_t *root, const char *var) return sttmp->aux; } -const struct enum_t *state_getenumlist(struct st_tree_t *root, const char *var) +const enum_t *state_getenumlist(st_tree_t *root, const char *var) { - struct st_tree_t *sttmp; + st_tree_t *sttmp; /* find the tree node for var */ sttmp = state_tree_find(root, var); @@ -319,10 +319,10 @@ const struct enum_t *state_getenumlist(struct st_tree_t *root, const char *var) return sttmp->enum_list; } -void state_setflags(struct st_tree_t *root, const char *var, int numflags, char **flag) +void state_setflags(st_tree_t *root, const char *var, int numflags, char **flag) { int i; - struct st_tree_t *sttmp; + st_tree_t *sttmp; /* find the tree node for var */ sttmp = state_tree_find(root, var); @@ -351,9 +351,9 @@ void state_setflags(struct st_tree_t *root, const char *var, int numflags, char } } -int state_addcmd(struct cmdlist_t **list, const char *cmd) +int state_addcmd(cmdlist_t **list, const char *cmd) { - struct cmdlist_t *item; + cmdlist_t *item; while (*list) { @@ -380,7 +380,7 @@ int state_addcmd(struct cmdlist_t **list, const char *cmd) return 1; /* added */ } -void state_infofree(struct st_tree_t *node) +void state_infofree(st_tree_t *node) { if (!node) { return; @@ -392,7 +392,7 @@ void state_infofree(struct st_tree_t *node) st_tree_node_free(node); } -void state_cmdfree(struct cmdlist_t *list) +void state_cmdfree(cmdlist_t *list) { if (!list) { return; @@ -404,11 +404,11 @@ void state_cmdfree(struct cmdlist_t *list) free(list); } -int state_delcmd(struct cmdlist_t **list, const char *cmd) +int state_delcmd(cmdlist_t **list, const char *cmd) { while (*list) { - struct cmdlist_t *item = *list; + cmdlist_t *item = *list; if (strcasecmp(item->name, cmd) > 0) { /* not found */ @@ -433,11 +433,11 @@ int state_delcmd(struct cmdlist_t **list, const char *cmd) return 0; /* not found */ } -static int st_tree_del_enum(struct enum_t **list, const char *val) +static int st_tree_del_enum(enum_t **list, const char *val) { while (*list) { - struct enum_t *item = *list; + enum_t *item = *list; /* if this is not the right value, go on to the next */ if (strcasecmp(item->val, val)) { @@ -457,9 +457,9 @@ static int st_tree_del_enum(struct enum_t **list, const char *val) return 0; /* not found */ } -int state_delenum(struct st_tree_t *root, const char *var, const char *val) +int state_delenum(st_tree_t *root, const char *var, const char *val) { - struct st_tree_t *sttmp; + st_tree_t *sttmp; /* find the tree node for var */ sttmp = state_tree_find(root, var); @@ -471,7 +471,7 @@ int state_delenum(struct st_tree_t *root, const char *var, const char *val) return st_tree_del_enum(&sttmp->enum_list, val); } -struct st_tree_t *state_tree_find(struct st_tree_t *node, const char *var) +st_tree_t *state_tree_find(st_tree_t *node, const char *var) { while (node) { diff --git a/common/strerror.c b/common/strerror.c new file mode 100644 index 0000000..b5cecb9 --- /dev/null +++ b/common/strerror.c @@ -0,0 +1,503 @@ +/* strerror() Mark Powell */ +/* Simple implementation derived from libiberty */ + +#include "config.h" + +#ifndef HAVE_STRERROR + +#include + +char *strerror(int errnum) +{ + static char buf[32]; + + switch (errnum) { +#if defined (EPERM) + case EPERM: + return "Not owner"; +#endif +#if defined (ENOENT) + case ENOENT: + return "No such file or directory"; +#endif +#if defined (ESRCH) + case ESRCH: + return "No such process"; +#endif +#if defined (EINTR) + case EINTR: + return "Interrupted system call"; +#endif +#if defined (EIO) + case EIO: + return "I/O error"; +#endif +#if defined (ENXIO) + case ENXIO: + return "No such device or address"; +#endif +#if defined (E2BIG) + return "Arg list too long"; +#endif +#if defined (ENOEXEC) + case ENOEXEC: + return "Exec format error"; +#endif +#if defined (EBADF) + case EBADF: + return "Bad file number"; +#endif +#if defined (ECHILD) + case ECHILD: + return "No child processes"; +#endif +#if defined (EWOULDBLOCK) /* Put before EAGAIN, sometimes aliased */ + case EWOULDBLOCK: + return "Operation would block"; +#endif +#if defined (EAGAIN) +#if defined (EWOULDBLOCK) && EAGAIN != EWOULDBLOCK + case EAGAIN: + return "No more processes"; +#endif +#endif +#if defined (ENOMEM) + case ENOMEM: + return "Not enough space"; +#endif +#if defined (EACCES) + case EACCES: + return "Permission denied"; +#endif +#if defined (EFAULT) + case EFAULT: + return "Bad address"; +#endif +#if defined (ENOTBLK) + case ENOTBLK: + return "Block device required"; +#endif +#if defined (EBUSY) + case EBUSY: + return "Device busy"; +#endif +#if defined (EEXIST) + case EEXIST: + return "File exists"; +#endif +#if defined (EXDEV) + case EXDEV: + return "Cross-device link"; +#endif +#if defined (ENODEV) + case ENODEV: + return "No such device"; +#endif +#if defined (ENOTDIR) + case ENOTDIR: + return "Not a directory"; +#endif +#if defined (EISDIR) + case EISDIR: + return "Is a directory"; +#endif +#if defined (EINVAL) + case EINVAL: + return "Invalid argument"; +#endif +#if defined (ENFILE) + case ENFILE: + return "File table overflow"; +#endif +#if defined (EMFILE) + case EMFILE: + return "Too many open files"; +#endif +#if defined (ENOTTY) + case ENOTTY: + return "Not a typewriter"; +#endif +#if defined (ETXTBSY) + case ETXTBSY: + return "Text file busy"; +#endif +#if defined (EFBIG) + case EFBIG: + return "File too large"; +#endif +#if defined (ENOSPC) + case ENOSPC: + return "No space left on device"; +#endif +#if defined (ESPIPE) + case ESPIPE: + return "Illegal seek"; +#endif +#if defined (EROFS) + case EROFS: + return "Read-only file system"; +#endif +#if defined (EMLINK) + case EMLINK: + return "Too many links"; +#endif +#if defined (EPIPE) + case EPIPE: + return "Broken pipe"; +#endif +#if defined (EDOM) + case EDOM: + return "Math argument out of domain of func"; +#endif +#if defined (ERANGE) + case ERANGE: + return "Math result not representable"; +#endif +#if defined (ENOMSG) + case ENOMSG: + return "No message of desired type"; +#endif +#if defined (EIDRM) + case EIDRM: + return "Identifier removed"; +#endif +#if defined (ECHRNG) + case ECHRNG: + return "Channel number out of range"; +#endif +#if defined (EL2NSYNC) + return "Level 2 not synchronized"; +#endif +#if defined (EL3HLT) + return "Level 3 halted"; +#endif +#if defined (EL3RST) + return "Level 3 reset"; +#endif +#if defined (ELNRNG) + case ELNRNG: + return "Link number out of range"; +#endif +#if defined (EUNATCH) + case EUNATCH: + return "Protocol driver not attached"; +#endif +#if defined (ENOCSI) + case ENOCSI: + return "No CSI structure available"; +#endif +#if defined (EL2HLT) + return "Level 2 halted"; +#endif +#if defined (EDEADLK) + case EDEADLK: + return "Deadlock condition"; +#endif +#if defined (ENOLCK) + case ENOLCK: + return "No record locks available"; +#endif +#if defined (EBADE) + case EBADE: + return "Invalid exchange"; +#endif +#if defined (EBADR) + case EBADR: + return "Invalid request descriptor"; +#endif +#if defined (EXFULL) + case EXFULL: + return "Exchange full"; +#endif +#if defined (ENOANO) + case ENOANO: + return "No anode"; +#endif +#if defined (EBADRQC) + case EBADRQC: + return "Invalid request code"; +#endif +#if defined (EBADSLT) + case EBADSLT: + return "Invalid slot"; +#endif +#if defined (EDEADLOCK) + case EDEADLOCK: + return "File locking deadlock error"; +#endif +#if defined (EBFONT) + case EBFONT: + return "Bad font file format"; +#endif +#if defined (ENOSTR) + case ENOSTR: + return "Device not a stream"; +#endif +#if defined (ENODATA) + case ENODATA: + return "No data available"; +#endif +#if defined (ETIME) + case ETIME: + return "Timer expired"; +#endif +#if defined (ENOSR) + case ENOSR: + return "Out of streams resources"; +#endif +#if defined (ENONET) + case ENONET: + return "Machine is not on the network"; +#endif +#if defined (ENOPKG) + case ENOPKG: + return "Package not installed"; +#endif +#if defined (EREMOTE) + case EREMOTE: + return "Object is remote"; +#endif +#if defined (ENOLINK) + case ENOLINK: + return "Link has been severed"; +#endif +#if defined (EADV) + case EADV: + return "Advertise error"; +#endif +#if defined (ESRMNT) + case ESRMNT: + return "Srmount error"; +#endif +#if defined (ECOMM) + case ECOMM: + return "Communication error on send"; +#endif +#if defined (EPROTO) + case EPROTO: + return "Protocol error"; +#endif +#if defined (EMULTIHOP) + case EMULTIHOP: + return "Multihop attempted"; +#endif +#if defined (EDOTDOT) + case EDOTDOT: + return "RFS specific error"; +#endif +#if defined (EBADMSG) + case EBADMSG: + return "Not a data message"; +#endif +#if defined (ENAMETOOLONG) + case ENAMETOOLONG: + return "File name too long"; +#endif +#if defined (EOVERFLOW) + case EOVERFLOW: + return "Value too large for defined data type"; +#endif +#if defined (ENOTUNIQ) + case ENOTUNIQ: + return "Name not unique on network"; +#endif +#if defined (EBADFD) + case EBADFD: + return "File descriptor in bad state"; +#endif +#if defined (EREMCHG) + case EREMCHG: + return "Remote address changed"; +#endif +#if defined (ELIBACC) + case ELIBACC: + return "Can not access a needed shared library"; +#endif +#if defined (ELIBBAD) + case ELIBBAD: + return "Accessing a corrupted shared library"; +#endif +#if defined (ELIBSCN) + case ELIBSCN: + return ".lib section in a.out corrupted"; +#endif +#if defined (ELIBMAX) + case ELIBMAX: + return "Attempting to link in too many shared libraries"; +#endif +#if defined (ELIBEXEC) + case ELIBEXEC: + return "Cannot exec a shared library directly"; +#endif +#if defined (EILSEQ) + case EILSEQ: + return "Illegal byte sequence"; +#endif +#if defined (ENOSYS) + case ENOSYS: + return "Operation not applicable"; +#endif +#if defined (ELOOP) + case ELOOP: + return "Too many symbolic links encountered"; +#endif +#if defined (ERESTART) + case ERESTART: + return "Interrupted system call should be restarted"; +#endif +#if defined (ESTRPIPE) + case ESTRPIPE: + return "Streams pipe error"; +#endif +#if defined (ENOTEMPTY) + case ENOTEMPTY: + return "Directory not empty"; +#endif +#if defined (EUSERS) + case EUSERS: + return "Too many users"; +#endif +#if defined (ENOTSOCK) + case ENOTSOCK: + return "Socket operation on non-socket"; +#endif +#if defined (EDESTADDRREQ) + case EDESTADDRREQ: + return "Destination address required"; +#endif +#if defined (EMSGSIZE) + case EMSGSIZE: + return "Message too long"; +#endif +#if defined (EPROTOTYPE) + case EPROTOTYPE: + return "Protocol wrong type for socket"; +#endif +#if defined (ENOPROTOOPT) + case ENOPROTOOPT: + return "Protocol not available"; +#endif +#if defined (EPROTONOSUPPORT) + case EPROTONOSUPPORT: + return "Protocol not supported"; +#endif +#if defined (ESOCKTNOSUPPORT) + case ESOCKTNOSUPPORT: + return "Socket type not supported"; +#endif +#if defined (EOPNOTSUPP) + case EOPNOTSUPP: + return "Operation not supported on transport endpoint"; +#endif +#if defined (EPFNOSUPPORT) + case EPFNOSUPPORT: + return "Protocol family not supported"; +#endif +#if defined (EAFNOSUPPORT) + case EAFNOSUPPORT: + return "Address family not supported by protocol"; +#endif +#if defined (EADDRINUSE) + case EADDRINUSE: + return "Address already in use"; +#endif +#if defined (EADDRNOTAVAIL) + case EADDRNOTAVAIL: + return "Cannot assign requested address"; +#endif +#if defined (ENETDOWN) + case ENETDOWN: + return "Network is down"; +#endif +#if defined (ENETUNREACH) + case ENETUNREACH: + return "Network is unreachable"; +#endif +#if defined (ENETRESET) + case ENETRESET: + return "Network dropped connection because of reset"; +#endif +#if defined (ECONNABORTED) + case ECONNABORTED: + return "Software caused connection abort"; +#endif +#if defined (ECONNRESET) + case ECONNRESET: + return "Connection reset by peer"; +#endif +#if defined (ENOBUFS) + case ENOBUFS: + return "No buffer space available"; +#endif +#if defined (EISCONN) + case EISCONN: + return "Transport endpoint is already connected"; +#endif +#if defined (ENOTCONN) + case ENOTCONN: + return "Transport endpoint is not connected"; +#endif +#if defined (ESHUTDOWN) + case ESHUTDOWN: + return "Cannot send after transport endpoint shutdown"; +#endif +#if defined (ETOOMANYREFS) + case ETOOMANYREFS: + return "Too many references: cannot splice"; +#endif +#if defined (ETIMEDOUT) + case ETIMEDOUT: + return "Connection timed out"; +#endif +#if defined (ECONNREFUSED) + case ECONNREFUSED: + return "Connection refused"; +#endif +#if defined (EHOSTDOWN) + case EHOSTDOWN: + return "Host is down"; +#endif +#if defined (EHOSTUNREACH) + case EHOSTUNREACH: + return "No route to host"; +#endif +#if defined (EALREADY) + case EALREADY: + return "Operation already in progress"; +#endif +#if defined (EINPROGRESS) + case EINPROGRESS: + return "Operation now in progress"; +#endif +#if defined (ESTALE) + case ESTALE: + return "Stale NFS file handle"; +#endif +#if defined (EUCLEAN) + case EUCLEAN: + return "Structure needs cleaning"; +#endif +#if defined (ENOTNAM) + case ENOTNAM: + return "Not a XENIX named type file"; +#endif +#if defined (ENAVAIL) + case ENAVAIL: + return "No XENIX semaphores available"; +#endif +#if defined (EISNAM) + case EISNAM: + return "Is a named type file"; +#endif +#if defined (EREMOTEIO) + case EREMOTEIO: + return "Remote I/O error"; +#endif + } + + /* Fallback: just print the error number */ + snprintf(buf, sizeof(buf), "Error %d", errnum); + return buf; +} + +#endif /* HAVE_STRERROR */ diff --git a/conf/Makefile.in b/conf/Makefile.in index 73ac244..8dd6128 100644 --- a/conf/Makefile.in +++ b/conf/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -41,12 +41,13 @@ subdir = conf DIST_COMMON = $(am__dist_sysconf_DATA_DIST) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/upssched.conf.sample.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -56,6 +57,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -95,9 +97,11 @@ am__base_list = \ am__installdirs = "$(DESTDIR)$(sysconfdir)" "$(DESTDIR)$(sysconfdir)" DATA = $(dist_sysconf_DATA) $(nodist_sysconf_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -110,8 +114,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -128,7 +134,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -139,22 +144,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ diff --git a/conf/ups.conf.sample b/conf/ups.conf.sample index 40a85a6..365a6f7 100644 --- a/conf/ups.conf.sample +++ b/conf/ups.conf.sample @@ -82,11 +82,11 @@ # Examples # -------- # -# A simple example for a UPS called "powerpal" that uses the megatec +# A simple example for a UPS called "powerpal" that uses the blazer_ser # driver on /dev/ttyS0 is: # # [powerpal] -# driver = megatec +# driver = blazer_ser # port = /dev/ttyS0 # desc = "Web server" # diff --git a/conf/upsd.conf.sample b/conf/upsd.conf.sample index 596fc55..56812ff 100644 --- a/conf/upsd.conf.sample +++ b/conf/upsd.conf.sample @@ -17,6 +17,13 @@ # the data fresh within the normal 15 second interval. Watch the syslog # for notifications from upsd about staleness. +# ======================================================================= +# STATEPATH +# STATEPATH /var/run/nut +# +# Tell upsd to look for the driver state sockets in 'path' rather +# than the default that was compiled into the program. + # ======================================================================= # LISTEN
[] # LISTEN 127.0.0.1 3493 @@ -34,8 +41,19 @@ # ======================================================================= # MAXCONN +# MAXCONN 1024 # # This defaults to maximum number allowed on your system. Each UPS, each # LISTEN address and each client count as one connection. If the server # runs out of connections, it will no longer accept new incoming client # connections. Only set this if you know exactly what you're doing. + +# ======================================================================= +# CERTFILE +# +# When compiled with SSL support, you can enter the certificate file here. +# The certificates must be in PEM format and must be sorted starting with +# the subject's certificate (server certificate), followed by intermediate +# CA certificates (if applicable_ and the highest level (root) CA. It should +# end with the server key. See 'docs/security.txt' or the Security chapter of +# NUT user manual for more information on the SSL support in NUT. diff --git a/conf/upsd.users.sample b/conf/upsd.users.sample index 4e0e0c6..ec78eb5 100644 --- a/conf/upsd.users.sample +++ b/conf/upsd.users.sample @@ -48,6 +48,14 @@ # instcmds = ALL # +# +# --- Configuring for a user who can execute tests only +# +# [testuser] +# password = pass +# instcmds = test.battery.start +# instcmds = test.battery.stop + # # --- Configuring for upsmon # diff --git a/config.guess b/config.guess index da83314..e3a2116 100755 --- a/config.guess +++ b/config.guess @@ -1,10 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. -timestamp='2009-04-27' +timestamp='2009-06-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 @@ -170,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null + | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? @@ -656,7 +656,7 @@ EOF # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null + grep -q __LP64__ then HP_ARCH="hppa2.0w" else @@ -822,6 +822,9 @@ EOF [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 @@ -882,40 +885,17 @@ EOF m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - mips:Linux:*:*) + mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU - #undef mips - #undef mipsel + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel + CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 + CPU=${UNAME_MACHINE} #else CPU= #endif @@ -947,7 +927,7 @@ EOF EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; @@ -1001,14 +981,6 @@ EOF elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -1074,7 +1046,7 @@ EOF i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) @@ -1182,7 +1154,7 @@ EOF rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) diff --git a/config.sub b/config.sub index a39437d..eb0389a 100755 --- a/config.sub +++ b/config.sub @@ -1,10 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. -timestamp='2009-04-17' +timestamp='2009-06-11' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -153,6 +153,9 @@ case $os in os= basic_machine=$1 ;; + -bluegene*) + os=-cnk + ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 @@ -467,6 +470,10 @@ case $basic_machine in basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; c90) basic_machine=c90-cray os=-unicos @@ -1260,7 +1267,7 @@ case $os in # 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* | -sunos | -sunos[34]*\ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ @@ -1613,7 +1620,7 @@ case $basic_machine in -sunos*) vendor=sun ;; - -aix*) + -cnk*|-aix*) vendor=ibm ;; -beos*) diff --git a/configure b/configure index 1828140..260bf0e 100755 --- a/configure +++ b/configure @@ -1,10 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.64 for nut 2.4.3. +# Generated by GNU Autoconf 2.65 for nut 2.6.0. +# # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software -# Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. @@ -673,7 +675,8 @@ fi -exec 7<&0 &1 +test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, @@ -695,8 +698,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='nut' PACKAGE_TARNAME='nut' -PACKAGE_VERSION='2.4.3' -PACKAGE_STRING='nut 2.4.3' +PACKAGE_VERSION='2.6.0' +PACKAGE_STRING='nut 2.6.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -759,28 +762,30 @@ NETLIBS DRIVER_INSTALL_TARGET DRIVER_MAN_LIST DRIVER_BUILD_LIST -LIBHAL_LDFLAGS +LIBHAL_LIBS LIBHAL_CFLAGS -HAVE_GLIB_2_14 HAL_CALLOUTS_PATH HAL_FDI_PATH HAL_DEVICE_MATCH_KEY HAL_USER -LIBWRAP_LDFLAGS +LIBWRAP_LIBS LIBWRAP_CFLAGS -LIBPOWERMAN_LDFLAGS +DOC_BUILD_LIST +LIBPOWERMAN_LIBS LIBPOWERMAN_CFLAGS -LIBNEON_LDFLAGS +LIBNEON_LIBS LIBNEON_CFLAGS -LIBUSB_LDFLAGS +LIBUSB_LIBS LIBUSB_CFLAGS -LIBNETSNMP_LDFLAGS +LIBNETSNMP_LIBS LIBNETSNMP_CFLAGS LIBGD_LDFLAGS LIBGD_CFLAGS -LIBSSL_LDFLAGS +LIBSSL_LIBS LIBSSL_CFLAGS OS_NAME +MANUALUPDATE_FALSE +MANUALUPDATE_TRUE WITH_UDEV_FALSE WITH_UDEV_TRUE WITH_HOTPLUG_FALSE @@ -789,18 +794,8 @@ WITH_PKG_CONFIG_FALSE WITH_PKG_CONFIG_TRUE SOME_DRIVERS_FALSE SOME_DRIVERS_TRUE -WITH_LIBPOWERMAN_FALSE -WITH_LIBPOWERMAN_TRUE -WITH_NEONXML_FALSE -WITH_NEONXML_TRUE -WITH_HAL_FALSE -WITH_HAL_TRUE -WITH_USB_FALSE -WITH_USB_TRUE -WITH_SNMP_FALSE -WITH_SNMP_TRUE -WITH_SERIAL_FALSE -WITH_SERIAL_TRUE +WITH_DEV_FALSE +WITH_DEV_TRUE OTOOL64 OTOOL LIPO @@ -816,14 +811,29 @@ LD FGREP SED LIBTOOL -WITH_DEV_FALSE -WITH_DEV_TRUE +HAVE_ASCIIDOC_FALSE +HAVE_ASCIIDOC_TRUE +DBLATEX +A2X +ASCIIDOC +WITH_HAL_FALSE +WITH_HAL_TRUE WITH_CGI_FALSE WITH_CGI_TRUE WITH_WRAP_FALSE WITH_WRAP_TRUE WITH_SSL_FALSE WITH_SSL_TRUE +WITH_LIBPOWERMAN_FALSE +WITH_LIBPOWERMAN_TRUE +WITH_NEONXML_FALSE +WITH_NEONXML_TRUE +WITH_SNMP_FALSE +WITH_SNMP_TRUE +WITH_USB_FALSE +WITH_USB_TRUE +WITH_SERIAL_FALSE +WITH_SERIAL_TRUE LIBOBJS RANLIB AR @@ -931,12 +941,19 @@ with_all with_dev with_serial with_usb +with_doc +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_snmp_includes -with_snmp_libs with_neon with_neon_includes with_neon_libs @@ -947,12 +964,11 @@ with_ssl with_ssl_includes with_ssl_libs with_wrap -with_ipv6 with_cgi with_gd_includes with_gd_libs -enable_static enable_shared +enable_static with_pic enable_fast_install with_gnu_ld @@ -1523,7 +1539,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.4.3 to adapt to many kinds of systems. +\`configure' configures nut 2.6.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1594,7 +1610,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of nut 2.4.3:";; + short | recursive ) echo "Configuration of nut 2.6.0:";; esac cat <<\_ACEOF @@ -1606,12 +1622,12 @@ Optional Features: --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-static[=PKGS] build static libraries [default=no] --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-strip Strip debugging symbols from binaries (no) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1621,59 +1637,44 @@ Optional Packages: --with-dev build and install the development files (no) --with-serial build and install serial drivers (yes) --with-usb build and install USB drivers (auto) - - --with-usb-includes=CFLAGS - include flags for the libusb library - - - --with-usb-libs=LDFLAGS linker flags for the libusb library - - --with-hal build and install HAL support (no) - --with-snmp build and install SNMP drivers (auto) - - --with-snmp-includes=CFLAGS + --with-doc build and install documentation (no) + [--with-snmp-includes=CFLAGS] include flags for the Net-SNMP library - - - --with-snmp-libs=LDFLAGS - linker 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 + [--with-neon-includes=CFLAGS] include flags for the neon library - - - --with-neon-libs=LDFLAGS - linker flags for the neon library - + [--with-neon-libs=LIBS] linker flags for the neon library --with-powerman build and install Powerman PDU client driver (auto) - - --with-powerman-includes=CFLAGS + [--with-powerman-includes=CFLAGS] include flags for the libpowerman library - - - --with-powerman-libs=LDFLAGS + [--with-powerman-libs=LIBS] linker flags for the libpowerman library - --with-ssl enable SSL development code (auto) - - --with-ssl-includes=CFLAGS + [--with-ssl-includes=CFLAGS] include flags for the OpenSSL library - - - --with-ssl-libs=LDFLAGS linker flags for the OpenSSL library - + [--with-ssl-libs=LIBS] linker flags for the OpenSSL library --with-wrap enable libwrap (tcp-wrappers) support (auto) - --with-ipv6 enable IPv6 support (auto) --with-cgi build and install the CGI programs (no) - - --with-gd-includes=CFLAGS + [--with-gd-includes=CFLAGS] include flags for the gd library - - - --with-gd-libs=LDFLAGS linker flags for the gd library - + [--with-gd-libs=LDFLAGS] + linker flags for the gd library --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] @@ -1689,7 +1690,7 @@ Optional Packages: root (nogroup) --with-logfacility=FACILITY facility for log messages (LOG_DAEMON) - [--with-drivers=driver[,driver...]] + [--with-drivers=driver[,driver]] Only use specific drivers (all) --with-pkgconfig-dir=PATH where to install pkg-config *.pc files @@ -1703,7 +1704,7 @@ Some influential environment variables: LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor @@ -1773,8 +1774,8 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -nut configure 2.4.3 -generated by GNU Autoconf 2.64 +nut configure 2.6.0 +generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1821,7 +1822,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1858,7 +1859,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1987,7 +1988,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -2064,7 +2065,7 @@ fi # 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; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -2402,15 +2403,15 @@ rm -f conftest.val fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_compute_int 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.4.3, which was -generated by GNU Autoconf 2.64. Invocation command line was +It was created by nut $as_me 2.6.0, which was +generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -2663,7 +2664,7 @@ fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue - if test -r "$ac_site_file"; then + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 @@ -2672,9 +2673,9 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;} done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in @@ -3347,6 +3348,7 @@ IFS=$as_save_IFS fi + test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else @@ -3354,7 +3356,6 @@ fi # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. - test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi @@ -3471,7 +3472,7 @@ fi # Define the identity of the package. PACKAGE='nut' - VERSION='2.4.3' + VERSION='2.6.0' cat >>confdefs.h <<_ACEOF @@ -3512,8 +3513,12 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' +{ $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; } -DEPDIR="${am__leading_dot}deps" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" @@ -3897,32 +3902,30 @@ $as_echo "$ac_try_echo"; } >&5 ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 - rm -f conftest.er1 conftest.err fi + rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + int main () { -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: @@ -3984,10 +3987,10 @@ test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } if test -z "$ac_file"; then : - $as_echo "$as_me: failed program was:" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 @@ -3995,51 +3998,18 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "C compiler cannot create executables See \`config.log' for more details." "$LINENO" 5; }; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { { 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 - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" @@ -4072,13 +4042,72 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." "$LINENO" 5; } fi -rm -f conftest$ac_cv_exeext +rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { 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; } + if { ac_try='./conftest$ac_cv_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 + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : @@ -4931,6 +4960,7 @@ $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. @@ -5309,8 +5339,8 @@ $as_echo "$ac_try_echo"; } >&5 ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 - rm -f conftest.er1 conftest.err fi + rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -6496,7 +6526,7 @@ _ACEOF fi done -for ac_func in on_exit strptime +for ac_func in on_exit strptime setlogmask 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" @@ -6509,6 +6539,18 @@ _ACEOF fi done +ac_fn_c_check_decl "$LINENO" "LOG_UPTO" "ac_cv_have_decl_LOG_UPTO" "#include +" +if test "x$ac_cv_have_decl_LOG_UPTO" = x""yes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_LOG_UPTO $ac_have_decl +_ACEOF + for ac_func in vsnprintf snprintf do : @@ -6668,7 +6710,7 @@ fi done -for ac_func in setenv inet_aton strerror atexit +for ac_func in setenv strerror atexit 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" @@ -7512,15 +7554,16 @@ $as_echo_n "checking for --with-all... " >&6; } # Check whether --with-all was given. if test "${with_all+set}" = set; then : - withval=$with_all; if test -n "${withval}"; then - if test -z "${with_cgi}"; then with_cgi="${withval}"; fi - if test -z "${with_dev}"; then with_dev="${withval}"; fi - if test -z "${with_serial}"; then with_serial="${withval}"; fi - if test -z "${with_snmp}"; then with_snmp="${withval}"; fi + withval=$with_all; + if test -n "${withval}"; then + 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_hal}"; then with_hal="${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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"${withval}\"" >&5 $as_echo "\"${withval}\"" >&6; } else @@ -7529,7 +7572,8 @@ $as_echo "not given" >&6; } fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not given" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not given" >&5 $as_echo "not given" >&6; } fi @@ -7567,43 +7611,160 @@ 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="no" + +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" = x""yes; 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" = x""yes; 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 + + if test -z "${nut_have_libusb_seen}"; then nut_have_libusb_seen=yes CFLAGS_ORIG="${CFLAGS}" - LDFLAGS_ORIG="${LDFLAGS}" + 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` - if test "$?" = "0"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBUSB_VERSION} found" >&5 -$as_echo "${LIBUSB_VERSION} found" >&6; } - CFLAGS="`pkg-config --silence-errors --cflags libusb`" - LDFLAGS="`pkg-config --silence-errors --libs libusb`" + 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"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBUSB_VERSION} found" >&5 -$as_echo "${LIBUSB_VERSION} found" >&6; } + LIBUSB_VERSION="`libusb-config --version 2>/dev/null`" + if test "$?" = "0" -a -n "${LIBUSB_VERSION}"; then CFLAGS="`libusb-config --cflags 2>/dev/null`" - LDFLAGS="`libusb-config --libs 2>/dev/null`" + LIBS="`libusb-config --libs 2>/dev/null`" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } + LIBUSB_VERSION="none" CFLAGS="" - LDFLAGS="-lusb" + 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; CFLAGS="${withval}" + 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 @@ -7614,11 +7775,20 @@ $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; LDFLAGS="${withval}" + 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: ${LDFLAGS}" >&5 -$as_echo "${LDFLAGS}" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 +$as_echo "${LIBS}" >&6; } for ac_header in usb.h do : @@ -7662,11 +7832,11 @@ fi done LIBUSB_CFLAGS="${CFLAGS}" - LIBUSB_LDFLAGS="${LDFLAGS}" + LIBUSB_LIBS="${LIBS}" fi CFLAGS="${CFLAGS_ORIG}" - LDFLAGS="${LDFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" fi @@ -7684,54 +7854,75 @@ if test -z "${nut_have_libhal_seen}"; then nut_have_libhal_seen=yes CFLAGS_ORIG="${CFLAGS}" - LDFLAGS_ORIG="${LDFLAGS}" + 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` - if test "$?" = "0"; then - if pkg-config --atleast-version=0.5.8 hal; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_VERSION} found" >&5 + 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; } - nut_have_libhal=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhal cflags via pkg-config" >&5 -$as_echo_n "checking for libhal cflags via pkg-config... " >&6; } - CFLAGS=`pkg-config --silence-errors --cflags hal dbus-glib-1` - if test "$?" = "0"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 -$as_echo "${CFLAGS}" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - nut_have_libhal=no - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhal ldflags via pkg-config" >&5 -$as_echo_n "checking for libhal ldflags via pkg-config... " >&6; } - LDFLAGS=`pkg-config --silence-errors --libs hal dbus-glib-1` - if test "$?" = "0"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LDFLAGS}" >&5 -$as_echo "${LDFLAGS}" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - nut_have_libhal=no - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_VERSION} is too old" >&5 -$as_echo "${HAL_VERSION} is too old" >&6; } - nut_have_libhal=no - fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - nut_have_libhal=check + { $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 - if test "${nut_have_libhal}" = "check"; then - CFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/hal -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include" - LDFLAGS="-lhal -ldbus-1 -lpthread" + { $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 : @@ -7748,7 +7939,24 @@ fi done - for ac_func in libhal_device_new_changeset + 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 +" +eval as_val=\$$as_ac_Header + if test "x$as_val" = 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" = x""yes; then : @@ -7761,106 +7969,146 @@ else fi done - fi if test "${nut_have_libhal}" = "yes"; then - LIBHAL_CFLAGS="${CFLAGS}" - LIBHAL_LDFLAGS="${LDFLAGS}" + 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" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_G_TIMEOUT_ADD_SECONDS 1 +_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhal user via pkg-config" >&5 -$as_echo_n "checking for libhal user via pkg-config... " >&6; } - HAL_USER=`pkg-config --silence-errors --variable=haluser hal` - if test -n "$HAL_USER"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_USER}" >&5 -$as_echo "${HAL_USER}" >&6; } - else +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" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using default (${HAL_USER})" >&5 -$as_echo "using default (${HAL_USER})" >&6; } 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 hal-${HAL_VERSION} device match key" >&5 -$as_echo_n "checking for hal-${HAL_VERSION} device match key... " >&6; } - HAL_DEVICE_MATCH_KEY=`pkg-config --silence-errors --atleast-version=0.5.11 hal` - if test "$?" != "0"; then + { $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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_DEVICE_MATCH_KEY}" >&5 + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_DEVICE_MATCH_KEY}" >&5 $as_echo "${HAL_DEVICE_MATCH_KEY}" >&6; } -cat >>confdefs.h <<_ACEOF -#define HAL_DEVICE_MATCH_KEY "${HAL_DEVICE_MATCH_KEY}" -_ACEOF - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhal Callouts path" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhal Callouts path" >&5 $as_echo_n "checking for libhal Callouts path... " >&6; } - HAL_CALLOUTS_PATH=`pkg-config --silence-errors --variable=libexecdir hal` - if test -n "$HAL_CALLOUTS_PATH"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_CALLOUTS_PATH}" >&5 -$as_echo "${HAL_CALLOUTS_PATH}" >&6; } - else - # fallback to detecting the right path - if (test -d "${libdir}/hal"); then - # For Debian - HAL_CALLOUTS_PATH="${libdir}/hal" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_CALLOUTS_PATH}" >&5 -$as_echo "${HAL_CALLOUTS_PATH}" >&6; } - elif (test -d "/usr/libexec"); then - # For RedHat - HAL_CALLOUTS_PATH="${libexecdir}" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_CALLOUTS_PATH}" >&5 -$as_echo "${HAL_CALLOUTS_PATH}" >&6; } - elif (test -d "/usr/lib/hal"); then - # For OpenSUSE - HAL_CALLOUTS_PATH="${libdir}/hal" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_CALLOUTS_PATH}" >&5 -$as_echo "${HAL_CALLOUTS_PATH}" >&6; } - else - # FIXME - HAL_CALLOUTS_PATH="${libdir}/hal" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using default (${HAL_CALLOUTS_PATH})" >&5 -$as_echo "using default (${HAL_CALLOUTS_PATH})" >&6; } - fi + +# 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhal Device Information path" >&5 +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; } - HAL_FDI_PATH=`pkg-config --silence-errors --variable=hal_fdidir hal` - if test -n "$HAL_FDI_PATH"; then - HAL_FDI_PATH="${HAL_FDI_PATH}/information/20thirdparty" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_FDI_PATH}" >&5 -$as_echo "${HAL_FDI_PATH}" >&6; } - else - # seems supported everywhere + +# 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" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_FDI_PATH}" >&5 -$as_echo "${HAL_FDI_PATH}" >&6; } fi - fi - CFLAGS="${CFLAGS_ORIG}" - LDFLAGS="${LDFLAGS_ORIG}" +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if GLib is version 2.14.0 or newer" >&5 -$as_echo_n "checking if GLib is version 2.14.0 or newer... " >&6; } - if pkg-config --silence-errors --atleast-version=2.14.0 glib-2.0; then - -$as_echo "#define HAVE_GLIB_2_14 1" >>confdefs.h - - { $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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_FDI_PATH}" >&5 +$as_echo "${HAL_FDI_PATH}" >&6; } fi @@ -7878,27 +8126,34 @@ if test -z "${nut_have_libnetsnmp_seen}"; then nut_have_libnetsnmp_seen=yes CFLAGS_ORIG="${CFLAGS}" - LDFLAGS_ORIG="${LDFLAGS}" + 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"; then - { $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: not found" >&5 -$as_echo "not found" >&6; } + 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; CFLAGS="${withval}" + 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 --cflags 2>/dev/null`" + CFLAGS="`net-snmp-config --base-cflags 2>/dev/null`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 @@ -7909,13 +8164,22 @@ $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; LDFLAGS="${withval}" + 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 - LDFLAGS="`net-snmp-config --libs 2>/dev/null`" + LIBS="`net-snmp-config --libs 2>/dev/null`" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LDFLAGS}" >&5 -$as_echo "${LDFLAGS}" >&6; } + { $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 : @@ -7948,11 +8212,11 @@ done if test "${nut_have_libnetsnmp}" = "yes"; then LIBNETSNMP_CFLAGS="${CFLAGS}" - LIBNETSNMP_LDFLAGS="${LDFLAGS}" + LIBNETSNMP_LIBS="${LIBS}" fi CFLAGS="${CFLAGS_ORIG}" - LDFLAGS="${LDFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" fi @@ -7970,27 +8234,34 @@ if test -z "${nut_have_neon_seen}"; then nut_have_neon_seen=yes CFLAGS_ORIG="${CFLAGS}" - LDFLAGS_ORIG="${LDFLAGS}" + LIBS_ORIG="${LIBS}" { $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` - if test "$?" = "0"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${NEON_VERSION} found" >&5 -$as_echo "${NEON_VERSION} found" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&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 +$as_echo "${NEON_VERSION} found" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libneon cflags" >&5 $as_echo_n "checking for libneon cflags... " >&6; } # Check whether --with-neon-includes was given. if test "${with_neon_includes+set}" = set; then : - withval=$with_neon_includes; CFLAGS="${withval}" + withval=$with_neon_includes; + case "${withval}" in + yes|no) + as_fn_error "invalid option --with(out)-neon-includes - see docs/configure.txt" "$LINENO" 5 + ;; + *) + CFLAGS="${withval}" + ;; + esac + else - CFLAGS="`pkg-config --silence-errors --cflags neon`" + CFLAGS="`pkg-config --silence-errors --cflags neon 2>/dev/null`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 @@ -8001,13 +8272,22 @@ $as_echo_n "checking for libneon ldflags... " >&6; } # Check whether --with-neon-libs was given. if test "${with_neon_libs+set}" = set; then : - withval=$with_neon_libs; LDFLAGS="${withval}" + withval=$with_neon_libs; + case "${withval}" in + yes|no) + as_fn_error "invalid option --with(out)-neon-libs - see docs/configure.txt" "$LINENO" 5 + ;; + *) + LIBS="${withval}" + ;; + esac + else - LDFLAGS="`pkg-config --silence-errors --libs neon`" + LIBS="`pkg-config --silence-errors --libs neon 2>/dev/null`" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LDFLAGS}" >&5 -$as_echo "${LDFLAGS}" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 +$as_echo "${LIBS}" >&6; } for ac_header in ne_xmlreq.h do : @@ -8053,11 +8333,11 @@ fi done LIBNEON_CFLAGS="${CFLAGS}" - LIBNEON_LDFLAGS="${LDFLAGS}" + LIBNEON_LIBS="${LIBS}" fi CFLAGS="${CFLAGS_ORIG}" - LDFLAGS="${LDFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" fi @@ -8075,16 +8355,25 @@ if test -z "${nut_have_libpowerman_seen}"; then nut_have_libpowerman_seen=yes CFLAGS_ORIG="${CFLAGS}" - LDFLAGS_ORIG="${LDFLAGS}" + LIBS_ORIG="${LIBS}" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpowerman cflags" >&5 $as_echo_n "checking for libpowerman cflags... " >&6; } # Check whether --with-powerman-includes was given. if test "${with_powerman_includes+set}" = set; then : - withval=$with_powerman_includes; CFLAGS="${withval}" + withval=$with_powerman_includes; + case "${withval}" in + yes|no) + as_fn_error "invalid option --with(out)-powerman-includes - see docs/configure.txt" "$LINENO" 5 + ;; + *) + CFLAGS="${withval}" + ;; + esac + else - CFLAGS="`pkg-config --silence-errors --cflags libpowerman`" + CFLAGS="`pkg-config --silence-errors --cflags libpowerman 2>/dev/null`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 @@ -8095,13 +8384,22 @@ $as_echo_n "checking for libpowerman libs... " >&6; } # Check whether --with-powerman-libs was given. if test "${with_powerman_libs+set}" = set; then : - withval=$with_powerman_libs; LDFLAGS="${withval}" + withval=$with_powerman_libs; + case "${withval}" in + yes|no) + as_fn_error "invalid option --with(out)-powerman-libs - see docs/configure.txt" "$LINENO" 5 + ;; + *) + LIBS="${withval}" + ;; + esac + else - LDFLAGS="`pkg-config --silence-errors --libs libpowerman`" + LIBS="`pkg-config --silence-errors --libs libpowerman 2>/dev/null`" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LDFLAGS}" >&5 -$as_echo "${LDFLAGS}" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 +$as_echo "${LIBS}" >&6; } for ac_header in libpowerman.h do : @@ -8134,11 +8432,11 @@ done if test "${nut_have_libpowerman}" = "yes"; then LIBPOWERMAN_CFLAGS="${CFLAGS}" - LIBPOWERMAN_LDFLAGS="${LDFLAGS}" + LIBPOWERMAN_LIBS="${LIBS}" fi CFLAGS="${CFLAGS_ORIG}" - LDFLAGS="${LDFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" fi @@ -8203,7 +8501,7 @@ if test "$ac_res" != no; then : fi - LIBUSB_LDFLAGS="-R/usr/sfw/lib ${LIBUSB_LDFLAGS}" + LIBUSB_LIBS="-R/usr/sfw/lib ${LIBUSB_LIBS}" $as_echo "#define SUN_LIBUSB 1" >>confdefs.h @@ -8213,6 +8511,163 @@ esac +if test "${nut_with_serial}" != "no"; then + nut_with_serial="yes" +fi + if test "${nut_with_serial}" = "yes"; then + WITH_SERIAL_TRUE= + WITH_SERIAL_FALSE='#' +else + WITH_SERIAL_TRUE='#' + WITH_SERIAL_FALSE= +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build serial drivers" >&5 +$as_echo_n "checking whether to build serial drivers... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_serial}" >&5 +$as_echo "${nut_with_serial}" >&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 -e "Configuration summary:\n======================" >> conf_nut_report_feature + fi + echo "build serial drivers: ${nut_with_serial}" >> conf_nut_report_feature + + + + +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_with_usb}" != "no"; then + nut_with_usb="${nut_have_libusb}" +fi + + if test "${nut_with_usb}" = "yes"; then + WITH_USB_TRUE= + WITH_USB_FALSE='#' +else + WITH_USB_TRUE='#' + WITH_USB_FALSE= +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}" >&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" + echo > conf_nut_report_feature + echo -e "Configuration summary:\n======================" >> conf_nut_report_feature + fi + echo "build USB drivers: ${nut_with_usb}" >> conf_nut_report_feature + + + + +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 + + if test "${nut_with_snmp}" = "yes"; then + WITH_SNMP_TRUE= + WITH_SNMP_FALSE='#' +else + WITH_SNMP_TRUE='#' + WITH_SNMP_FALSE= +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 -e "Configuration summary:\n======================" >> conf_nut_report_feature + fi + echo "build SNMP drivers: ${nut_with_snmp}" >> conf_nut_report_feature + + + + +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 +fi + +if test "${nut_with_neon}" != "no"; then + nut_with_neon="${nut_have_neon}" +fi + + if test "${nut_with_neon}" = "yes"; then + WITH_NEONXML_TRUE= + WITH_NEONXML_FALSE='#' +else + WITH_NEONXML_TRUE='#' + WITH_NEONXML_FALSE= +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build neon based XML driver" >&5 +$as_echo_n "checking whether to build neon based XML driver... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_neon}" >&5 +$as_echo "${nut_with_neon}" >&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 -e "Configuration summary:\n======================" >> conf_nut_report_feature + fi + echo "build neon based XML driver: ${nut_with_neon}" >> conf_nut_report_feature + + + + + +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 +fi + +if test "${nut_with_powerman}" != "no"; then + nut_with_powerman="${nut_have_libpowerman}" +fi + + if test "${nut_with_powerman}" = "yes"; then + WITH_LIBPOWERMAN_TRUE= + WITH_LIBPOWERMAN_FALSE='#' +else + WITH_LIBPOWERMAN_TRUE='#' + WITH_LIBPOWERMAN_FALSE= +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build Powerman PDU client driver" >&5 +$as_echo_n "checking whether to build Powerman PDU client driver... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_powerman}" >&5 +$as_echo "${nut_with_powerman}" >&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 -e "Configuration summary:\n======================" >> conf_nut_report_feature + fi + echo "build Powerman PDU client driver: ${nut_with_powerman}" >> conf_nut_report_feature + + + + + # Check whether --with-ssl was given. if test "${with_ssl+set}" = set; then : withval=$with_ssl; nut_with_ssl="${withval}" @@ -8229,29 +8684,37 @@ if test -z "${nut_have_libssl_seen}"; then nut_have_libssl_seen=yes CFLAGS_ORIG="${CFLAGS}" - LDFLAGS_ORIG="${LDFLAGS}" + LIBS_ORIG="${LIBS}" { $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` - if test "$?" = "0"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${OPENSSL_VERSION} found" >&5 -$as_echo "${OPENSSL_VERSION} found" >&6; } - CFLAGS="`pkg-config --silence-errors --cflags openssl`" - LDFLAGS="`pkg-config --silence-errors --libs openssl`" + 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } + OPENSSL_VERSION="none" CFLAGS="" - LDFLAGS="-lssl -lcrypto" + LIBS="-lssl -lcrypto" fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${OPENSSL_VERSION} found" >&5 +$as_echo "${OPENSSL_VERSION} found" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl cflags" >&5 $as_echo_n "checking for openssl cflags... " >&6; } # Check whether --with-ssl-includes was given. if test "${with_ssl_includes+set}" = set; then : - withval=$with_ssl_includes; CFLAGS="${withval}" + withval=$with_ssl_includes; + case "${withval}" in + yes|no) + as_fn_error "invalid option --with(out)-ssl-includes - see docs/configure.txt" "$LINENO" 5 + ;; + *) + CFLAGS="${withval}" + ;; + esac + fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 @@ -8262,11 +8725,20 @@ $as_echo_n "checking for openssl ldflags... " >&6; } # Check whether --with-ssl-libs was given. if test "${with_ssl_libs+set}" = set; then : - withval=$with_ssl_libs; LDFLAGS="${withval}" + withval=$with_ssl_libs; + case "${withval}" in + yes|no) + as_fn_error "invalid option --with(out)-ssl-libs - see docs/configure.txt" "$LINENO" 5 + ;; + *) + LIBS="${withval}" + ;; + esac + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LDFLAGS}" >&5 -$as_echo "${LDFLAGS}" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 +$as_echo "${LIBS}" >&6; } for ac_header in openssl/ssl.h do : @@ -8302,11 +8774,11 @@ done $as_echo "#define HAVE_SSL 1" >>confdefs.h LIBSSL_CFLAGS="${CFLAGS}" - LIBSSL_LDFLAGS="${LDFLAGS}" + LIBSSL_LIBS="${LIBS}" fi CFLAGS="${CFLAGS_ORIG}" - LDFLAGS="${LDFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" fi fi @@ -8336,7 +8808,7 @@ $as_echo "${nut_with_ssl}" >&6; } 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 -e "Configuration summary:\n======================" >> conf_nut_report_feature fi echo "enable SSL development code: ${nut_with_ssl}" >> conf_nut_report_feature @@ -8498,7 +8970,7 @@ rm -f core conftest.err conftest.$ac_objext \ $as_echo "#define HAVE_WRAP 1" >>confdefs.h LIBWRAP_CFLAGS="" - LIBWRAP_LDFLAGS="${LIBS}" + LIBWRAP_LIBS="${LIBS}" fi LIBS="${LIBS_ORIG}" @@ -8531,7 +9003,7 @@ $as_echo "${nut_with_wrap}" >&6; } 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 -e "Configuration summary:\n======================" >> conf_nut_report_feature fi echo "enable libwrap (tcp-wrappers) support: ${nut_with_wrap}" >> conf_nut_report_feature @@ -8539,125 +9011,6 @@ $as_echo "${nut_with_wrap}" >&6; } -# Check whether --with-ipv6 was given. -if test "${with_ipv6+set}" = set; then : - withval=$with_ipv6; nut_with_ipv6="${withval}" -else - nut_with_ipv6="auto" - -fi - - - -if test "${nut_with_ipv6}" != "no"; then - -if test -z "${nut_check_ipv6_seen}"; then - nut_check_ipv6_seen=yes - - for ac_func in getaddrinfo freeaddrinfo -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" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - nut_have_ipv6=yes -else - nut_have_ipv6=no -fi -done - - - ac_fn_c_check_type "$LINENO" "struct addrinfo" "ac_cv_type_struct_addrinfo" "#include -" -if test "x$ac_cv_type_struct_addrinfo" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_ADDRINFO 1 -_ACEOF - - -else - nut_have_ipv6=no -fi - - - ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" "#include -" -if test "x$ac_cv_type_struct_sockaddr_storage" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SOCKADDR_STORAGE 1 -_ACEOF - - -else - nut_have_ipv6=no -fi - - - ac_fn_c_check_type "$LINENO" "struct sockaddr_in6" "ac_cv_type_struct_sockaddr_in6" "#include -" -if test "x$ac_cv_type_struct_sockaddr_in6" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SOCKADDR_IN6 1 -_ACEOF - - -else - nut_have_ipv6=no -fi -ac_fn_c_check_type "$LINENO" "struct in6_addr" "ac_cv_type_struct_in6_addr" "#include -" -if test "x$ac_cv_type_struct_in6_addr" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_IN6_ADDR 1 -_ACEOF - - -else - nut_have_ipv6=no -fi - - - if test "${nut_have_ipv6}" = "yes"; then - -$as_echo "#define HAVE_IPV6 1" >>confdefs.h - - fi -fi - -fi - -if test "${nut_with_ipv6}" = "yes" -a "${nut_have_ipv6}" != "yes"; then - as_fn_error "\"Some feature required for IPv6 support is missing\"" "$LINENO" 5 -fi - -if test "${nut_with_ipv6}" != "no"; then - nut_with_ipv6="${nut_have_ipv6}" -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable IPv6 support" >&5 -$as_echo_n "checking whether to enable IPv6 support... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_ipv6}" >&5 -$as_echo "${nut_with_ipv6}" >&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 - fi - echo "enable IPv6 support: ${nut_with_ipv6}" >> conf_nut_report_feature - - - - - # Check whether --with-cgi was given. if test "${with_cgi+set}" = set; then : withval=$with_cgi; nut_with_cgi="${withval}" @@ -8684,17 +9037,14 @@ if test -z "${nut_have_libgd_seen}"; 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"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${GD_VERSION}" >&5 -$as_echo "${GD_VERSION}" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } - GD_VERSION="unknown" + 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; } case "${GD_VERSION}" in - unknown) + 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 @@ -8703,9 +9053,9 @@ $as_echo "$as_me: WARNING: gd ${GD_VERSION} detected, unable to use gdlib-config $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`" - LDFLAGS="`gdlib-config --ldflags`" - LIBS="`gdlib-config --libs`" + CFLAGS="`gdlib-config --includes 2>/dev/null`" + LDFLAGS="`gdlib-config --ldflags 2>/dev/null`" + LIBS="`gdlib-config --libs 2>/dev/null`" ;; esac @@ -8714,7 +9064,16 @@ $as_echo_n "checking for gd include flags... " >&6; } # Check whether --with-gd-includes was given. if test "${with_gd_includes+set}" = set; then : - withval=$with_gd_includes; CFLAGS="${withval}" + withval=$with_gd_includes; + case "${withval}" in + yes|no) + as_fn_error "invalid option --with(out)-gd-includes - see docs/configure.txt" "$LINENO" 5 + ;; + *) + CFLAGS="${withval}" + ;; + esac + fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 @@ -8725,7 +9084,17 @@ $as_echo_n "checking for gd library flags... " >&6; } # Check whether --with-gd-libs was given. if test "${with_gd_libs+set}" = set; then : - withval=$with_gd_libs; LDFLAGS="${withval}" LIBS="" + withval=$with_gd_libs; + case "${withval}" in + yes|no) + as_fn_error "invalid option --with(out)-gd-libs - see docs/configure.txt" "$LINENO" 5 + ;; + *) + LDFLAGS="${withval}" + LIBS="" + ;; + esac + fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LDFLAGS} ${LIBS}" >&5 @@ -8847,71 +9216,533 @@ $as_echo "${nut_with_cgi}" >&6; } 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 -e "Configuration summary:\n======================" >> conf_nut_report_feature fi echo "build CGI programs: ${nut_with_cgi}" >> conf_nut_report_feature -if test "${nut_with_dev}" != "no"; then - nut_with_dev="yes" +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 + +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 - # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=no + WITH_HAL_TRUE='#' + WITH_HAL_FALSE= fi - - - - - - - -fi - if test "${nut_with_dev}" = "yes"; then - WITH_DEV_TRUE= - WITH_DEV_FALSE='#' -else - WITH_DEV_TRUE='#' - WITH_DEV_FALSE= -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build and install the development files" >&5 -$as_echo_n "checking whether to build and install the development files... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_dev}" >&5 -$as_echo "${nut_with_dev}" >&6; } + { $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 -e "Configuration summary:\n======================" >> conf_nut_report_feature fi - echo "build and install the development files: ${nut_with_dev}" >> conf_nut_report_feature + echo "enable HAL support: ${nut_with_hal}" >> conf_nut_report_feature + + + +if test -z "${nut_have_asciidoc_seen}"; then + nut_have_asciidoc_seen=yes + + 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 test "${ac_cv_path_ASCIIDOC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $ASCIIDOC in + [\\/]* | ?:[\\/]*) + ac_cv_path_ASCIIDOC="$ASCIIDOC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 +done + done +IFS=$as_save_IFS + + ;; +esac +fi +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 "$ASCIIDOC" && break +done + + if test -n "${ASCIIDOC}"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for asciiDoc version" >&5 +$as_echo_n "checking for asciiDoc version... " >&6; } + ASCIIDOC_VERSION="`${ASCIIDOC} --version 2>/dev/null`" + ASCIIDOC_VERSION="${ASCIIDOC_VERSION##* }" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ASCIIDOC_VERSION} found" >&5 +$as_echo "${ASCIIDOC_VERSION} found" >&6; } + fi + + 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 test "${ac_cv_path_A2X+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $A2X in + [\\/]* | ?:[\\/]*) + ac_cv_path_A2X="$A2X" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 +done + done +IFS=$as_save_IFS + + ;; +esac +fi +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 "$A2X" && break +done + + if test -n "${A2X}"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a2x version" >&5 +$as_echo_n "checking for a2x version... " >&6; } + A2X_VERSION="`${A2X} --version 2>/dev/null`" + A2X_VERSION="${A2X_VERSION##* }" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${A2X_VERSION} found" >&5 +$as_echo "${A2X_VERSION} found" >&6; } + fi + + for ac_prog in dblatex +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 test "${ac_cv_path_DBLATEX+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $DBLATEX in + [\\/]* | ?:[\\/]*) + ac_cv_path_DBLATEX="$DBLATEX" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_DBLATEX="$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 +DBLATEX=$ac_cv_path_DBLATEX +if test -n "$DBLATEX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DBLATEX" >&5 +$as_echo "$DBLATEX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DBLATEX" && break +done + + if test -n "${DBLATEX}"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dblatex version" >&5 +$as_echo_n "checking for dblatex version... " >&6; } + DBLATEX_VERSION="`${DBLATEX} --version 2>/dev/null`" + DBLATEX_VERSION="${DBLATEX_VERSION##* }" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${DBLATEX_VERSION} found" >&5 +$as_echo "${DBLATEX_VERSION} found" >&6; } + fi + + fi + + +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) + { $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; } + + + + # 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; } + 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 + + ;; + + 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; } + + + + # 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; } + 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 + + ;; + + 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 "\"Asciidoc is required for documentation support and missing\"" "$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 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 +$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 whether to build and install documentation" >&5 +$as_echo_n "checking whether to build and install documentation... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_doc}" >&5 +$as_echo "${nut_with_doc}" >&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 -e "Configuration summary:\n======================" >> conf_nut_report_feature + fi + echo "build and install documentation: ${nut_with_doc}" >> conf_nut_report_feature + + + +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 -e "Configuration summary:\n======================" >> conf_nut_report_feature + fi + echo "only build specific documentation format: ${DOC_BUILD_LIST}" >> conf_nut_report_feature + +fi + + case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 @@ -8920,8 +9751,8 @@ esac -macro_version='2.2.6' -macro_revision='1.3012' +macro_version='2.2.6b' +macro_revision='1.3017' @@ -9391,13 +10222,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:9394: $ac_compile\"" >&5) + (eval echo "\"\$as_me:10225: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:9397: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:10228: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:9400: output\"" >&5) + (eval echo "\"\$as_me:10231: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -9863,7 +10694,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be Linux ELF. -linux* | k*bsd*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -10602,7 +11433,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 10605 "configure"' > conftest.$ac_ext + echo '#line 11436 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -11405,6 +12236,36 @@ fi + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + # Check whether --with-pic was given. @@ -11834,11 +12695,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11837: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12698: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11841: \$? = $ac_status" >&5 + echo "$as_me:12702: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12003,7 +12864,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_static='-non_shared' ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -12173,11 +13034,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12176: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13037: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12180: \$? = $ac_status" >&5 + echo "$as_me:13041: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12278,11 +13139,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12281: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13142: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12285: \$? = $ac_status" >&5 + echo "$as_me:13146: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12333,11 +13194,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12336: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13197: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12340: \$? = $ac_status" >&5 + echo "$as_me:13201: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12476,6 +13337,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie fi supports_anon_versioning=no 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 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... @@ -12567,7 +13429,7 @@ _LT_EOF 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) + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in @@ -14029,7 +14891,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be Linux ELF. -linux* | k*bsd*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -14716,7 +15578,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 14719 "configure" +#line 15581 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14812,7 +15674,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 14815 "configure" +#line 15677 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15040,215 +15902,78 @@ CC="$lt_save_CC" - -if test "${nut_with_serial}" != "no"; then - nut_with_serial="yes" -fi - if test "${nut_with_serial}" = "yes"; then - WITH_SERIAL_TRUE= - WITH_SERIAL_FALSE='#' +if test "${nut_with_dev}" != "no"; then + nut_with_dev="yes" else - WITH_SERIAL_TRUE='#' - WITH_SERIAL_FALSE= + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=no fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build serial drivers" >&5 -$as_echo_n "checking whether to build serial drivers... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_serial}" >&5 -$as_echo "${nut_with_serial}" >&6; } + + + + +fi + if test "${nut_with_dev}" = "yes"; then + WITH_DEV_TRUE= + WITH_DEV_FALSE='#' +else + WITH_DEV_TRUE='#' + WITH_DEV_FALSE= +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build and install the development files" >&5 +$as_echo_n "checking whether to build and install the development files... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_dev}" >&5 +$as_echo "${nut_with_dev}" >&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 -e "Configuration summary:\n======================" >> conf_nut_report_feature fi - echo "build serial drivers: ${nut_with_serial}" >> conf_nut_report_feature + echo "build and install the development files: ${nut_with_dev}" >> conf_nut_report_feature -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 - - if test "${nut_with_snmp}" = "yes"; then - WITH_SNMP_TRUE= - WITH_SNMP_FALSE='#' -else - WITH_SNMP_TRUE='#' - WITH_SNMP_FALSE= -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 - fi - echo "build SNMP drivers: ${nut_with_snmp}" >> conf_nut_report_feature - - - - -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_with_usb}" != "no"; then - nut_with_usb="${nut_have_libusb}" -fi - - if test "${nut_with_usb}" = "yes"; then - WITH_USB_TRUE= - WITH_USB_FALSE='#' -else - WITH_USB_TRUE='#' - WITH_USB_FALSE= -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}" >&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" - echo > conf_nut_report_feature - echo "Configuration summary:" >> conf_nut_report_feature - fi - echo "build USB drivers: ${nut_with_usb}" >> conf_nut_report_feature - - - - -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 - -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 - 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 - fi - echo "enable HAL support: ${nut_with_hal}" >> conf_nut_report_feature - - - - -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 -fi - -if test "${nut_with_neon}" != "no"; then - nut_with_neon="${nut_have_neon}" -fi - - if test "${nut_with_neon}" = "yes"; then - WITH_NEONXML_TRUE= - WITH_NEONXML_FALSE='#' -else - WITH_NEONXML_TRUE='#' - WITH_NEONXML_FALSE= -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build neon based XML driver" >&5 -$as_echo_n "checking whether to build neon based XML driver... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_neon}" >&5 -$as_echo "${nut_with_neon}" >&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 - fi - echo "build neon based XML driver: ${nut_with_neon}" >> conf_nut_report_feature - - - - - -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 -fi - -if test "${nut_with_powerman}" != "no"; then - nut_with_powerman="${nut_have_libpowerman}" -fi - - if test "${nut_with_powerman}" = "yes"; then - WITH_LIBPOWERMAN_TRUE= - WITH_LIBPOWERMAN_FALSE='#' -else - WITH_LIBPOWERMAN_TRUE='#' - WITH_LIBPOWERMAN_FALSE= -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build Powerman PDU client driver" >&5 -$as_echo_n "checking whether to build Powerman PDU client driver... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_powerman}" >&5 -$as_echo "${nut_with_powerman}" >&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 - fi - echo "build Powerman PDU client driver: ${nut_with_powerman}" >> conf_nut_report_feature - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking state path" >&5 $as_echo_n "checking state path... " >&6; } # Check whether --with-statepath was given. if test "${with_statepath+set}" = set; then : - withval=$with_statepath; case "${withval}" in + withval=$with_statepath; + case "${withval}" in yes|no) + as_fn_error "invalid option --with(out)-statepath - see docs/configure.txt" "$LINENO" 5 ;; *) STATEPATH="${withval}" ;; esac + fi @@ -15265,16 +15990,19 @@ $as_echo_n "checking alt pid path... " >&6; } # Check whether --with-altpidpath was given. if test "${with_altpidpath+set}" = set; then : - withval=$with_altpidpath; case "${withval}" in + withval=$with_altpidpath; + case "${withval}" in yes|no) - ALTPIDPATH="${STATEPATH}" + as_fn_error "invalid option --with(out)-altpidpath - see docs/configure.txt" "$LINENO" 5 ;; *) ALTPIDPATH="${withval}" ;; esac + else - ALTPIDPATH="${STATEPATH}" + + ALTPIDPATH="${STATEPATH}" fi @@ -15291,13 +16019,16 @@ $as_echo_n "checking driver path... " >&6; } # Check whether --with-drvpath was given. if test "${with_drvpath+set}" = set; then : - withval=$with_drvpath; case "${withval}" in + withval=$with_drvpath; + case "${withval}" in yes|no) + as_fn_error "invalid option --with(out)-drvpath - see docs/configure.txt" "$LINENO" 5 ;; *) driverexecdir="${withval}" ;; esac + fi conftemp="${driverexecdir}" @@ -15316,13 +16047,16 @@ $as_echo_n "checking cgi path... " >&6; } # Check whether --with-cgipath was given. if test "${with_cgipath+set}" = set; then : - withval=$with_cgipath; case "${withval}" in + withval=$with_cgipath; + case "${withval}" in yes|no) + as_fn_error "invalid option --with(out)-cgipath - see docs/configure.txt" "$LINENO" 5 ;; *) cgiexecdir="${withval}" ;; esac + fi conftemp="${cgiexecdir}" @@ -15341,13 +16075,16 @@ $as_echo_n "checking html path... " >&6; } # Check whether --with-htmlpath was given. if test "${with_htmlpath+set}" = set; then : - withval=$with_htmlpath; case "${withval}" in + withval=$with_htmlpath; + case "${withval}" in yes|no) + as_fn_error "invalid option --with(out)-htmlpath - see docs/configure.txt" "$LINENO" 5 ;; *) htmldir="${withval}" ;; esac + fi conftemp="${htmldir}" @@ -15366,13 +16103,16 @@ $as_echo_n "checking pidpath... " >&6; } # Check whether --with-pidpath was given. if test "${with_pidpath+set}" = set; then : - withval=$with_pidpath; case "${withval}" in + withval=$with_pidpath; + case "${withval}" in yes|no) + as_fn_error "invalid option --with(out)-pidpath - see docs/configure.txt" "$LINENO" 5 ;; *) PIDPATH="${withval}" ;; esac + fi @@ -15388,16 +16128,19 @@ $as_echo_n "checking network port number... " >&6; } # Check whether --with-port was given. if test "${with_port+set}" = set; then : - withval=$with_port; case "${withval}" in + withval=$with_port; + case "${withval}" in yes|no) - PORT="3493" + as_fn_error "invalid option --with(out)-port - see docs/configure.txt" "$LINENO" 5 ;; *) PORT="${withval}" ;; esac + else - PORT="3493" + + PORT="3493" fi @@ -15409,20 +16152,26 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${PORT}" >&5 $as_echo "${PORT}" >&6; } -nut_user_given= { $as_echo "$as_me:${as_lineno-$LINENO}: checking user to run as" >&5 $as_echo_n "checking user to run as... " >&6; } # Check whether --with-user was given. if test "${with_user+set}" = set; then : - withval=$with_user; case "${withval}" in + withval=$with_user; + case "${withval}" in yes|no) + as_fn_error "invalid option --with(out)-user - see docs/configure.txt" "$LINENO" 5 ;; *) RUN_AS_USER="${withval}" nut_user_given=yes ;; esac + +else + + nut_user_given=no + fi @@ -15433,20 +16182,26 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${RUN_AS_USER}" >&5 $as_echo "${RUN_AS_USER}" >&6; } -nut_group_given= { $as_echo "$as_me:${as_lineno-$LINENO}: checking group membership of user to run as" >&5 $as_echo_n "checking group membership of user to run as... " >&6; } # Check whether --with-group was given. if test "${with_group+set}" = set; then : - withval=$with_group; case "${withval}" in + withval=$with_group; + case "${withval}" in yes|no) + as_fn_error "invalid option --with(out)-group - see docs/configure.txt" "$LINENO" 5 ;; *) RUN_AS_GROUP="${withval}" nut_group_given=yes ;; esac + +else + + nut_group_given=no + fi @@ -15457,10 +16212,10 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${RUN_AS_GROUP}" >&5 $as_echo "${RUN_AS_GROUP}" >&6; } -if test -n "$nut_user_given" -a -z "$nut_group_given"; then - as_fn_error "\"If you specify --with-user, you also must specify --with-group\"" "$LINENO" 5 -elif test -z "$nut_user_given" -a -n "$nut_group_given"; then - as_fn_error "\"If you specify --with-group, you also must specify --with-user\"" "$LINENO" 5 +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 +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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking facility for syslog" >&5 @@ -15468,16 +16223,19 @@ $as_echo_n "checking facility for syslog... " >&6; } # Check whether --with-logfacility was given. if test "${with_logfacility+set}" = set; then : - withval=$with_logfacility; case "${withval}" in + withval=$with_logfacility; + case "${withval}" in yes|no) - LOGFACILITY="LOG_DAEMON" + as_fn_error "invalid option --with(out)-logfacility - see docs/configure.txt" "$LINENO" 5 ;; *) LOGFACILITY="${withval}" ;; esac + else - LOGFACILITY="LOG_DAEMON" + + LOGFACILITY="LOG_DAEMON" fi @@ -15494,11 +16252,10 @@ $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) - DRIVER_BUILD_LIST="all" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: all available" >&5 -$as_echo "all available" >&6; } + 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"` @@ -15513,7 +16270,6 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: all available" >&5 $as_echo "all available" >&6; } - fi if test "${DRIVER_BUILD_LIST}" != "all"; then @@ -15526,11 +16282,11 @@ fi if test "${DRIVER_BUILD_LIST}" != "all"; then - if test -z "${nut_report_feature_flag}"; 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 -e "Configuration summary:\n======================" >> conf_nut_report_feature fi echo "only build specific drivers: ${DRIVER_BUILD_LIST}" >> conf_nut_report_feature @@ -15539,17 +16295,17 @@ 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 "${DRIVER_BUILD_LIST}" = "all"; then - DRIVER_MAN_LIST=all - { $as_echo "$as_me:${as_lineno-$LINENO}: result: all available" >&5 + 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}/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 + 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 @@ -15559,50 +16315,49 @@ $as_echo_n "checking whether to strip debug symbols... " >&6; } if test "${enable_strip+set}" = set; then : enableval=$enable_strip; case "${withval}" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + 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 "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="${CFLAGS} -s" + CFLAGS="${CFLAGS} -s" ;; esac 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; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install pkg-config *.pc files" >&5 $as_echo_n "checking whether to install pkg-config *.pc files... " >&6; } # Check whether --with-pkgconfig-dir was given. if test "${with_pkgconfig_dir+set}" = set; then : withval=$with_pkgconfig_dir; - case "${withval}" in - yes|auto) - ;; - no) - pkgconfigdir="" - ;; - *) - pkgconfigdir="${withval}" - ;; - esac + case "${withval}" in + yes|auto) + ;; + no) + pkgconfigdir="" + ;; + *) + pkgconfigdir="${withval}" + ;; + esac fi -echo ${pkgconfigdir} if test -n "${pkgconfigdir}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using ${pkgconfigdir}" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using ${pkgconfigdir}" >&5 $as_echo "using ${pkgconfigdir}" >&6; } 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; } fi if test -n "${pkgconfigdir}"; then @@ -15620,31 +16375,31 @@ $as_echo_n "checking whether to install hotplug rules... " >&6; } # Check whether --with-hotplug-dir was given. if test "${with_hotplug_dir+set}" = set; then : withval=$with_hotplug_dir; - case "${withval}" in - yes) - if test -z "${hotplugdir}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + case "${withval}" in + yes) + 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 - fi - ;; - auto) - ;; - no) - hotplugdir="" - ;; - *) - hotplugdir="${withval}" - ;; - esac + as_fn_error "\"hotplug directory requested but not found\"" "$LINENO" 5 + fi + ;; + auto) + ;; + no) + hotplugdir="" + ;; + *) + hotplugdir="${withval}" + ;; + esac fi if test -n "${hotplugdir}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using ${hotplugdir}" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using ${hotplugdir}" >&5 $as_echo "using ${hotplugdir}" >&6; } 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; } fi if test -n "${hotplugdir}"; then @@ -15662,31 +16417,31 @@ $as_echo_n "checking whether to install udev rules... " >&6; } # Check whether --with-udev-dir was given. if test "${with_udev_dir+set}" = set; then : withval=$with_udev_dir; - case "${withval}" in - yes) - if test -z "${udevdir}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + case "${withval}" in + yes) + 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 - ;; - auto) - ;; - no) - udevdir="" - ;; - *) - udevdir="${withval}" - ;; - esac + as_fn_error "\"udev directory requested but not found\"" "$LINENO" 5 + fi + ;; + auto) + ;; + no) + udevdir="" + ;; + *) + udevdir="${withval}" + ;; + esac fi if test -n "${udevdir}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using ${udevdir}" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using ${udevdir}" >&5 $as_echo "using ${udevdir}" >&6; } 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; } fi if test -n "${udevdir}"; then @@ -15698,6 +16453,107 @@ else fi +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 test "${ac_cv_path_ASCIIDOC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $ASCIIDOC in + [\\/]* | ?:[\\/]*) + ac_cv_path_ASCIIDOC="$ASCIIDOC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 +done + done +IFS=$as_save_IFS + + ;; +esac +fi +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 "$ASCIIDOC" && break +done +test -n "$ASCIIDOC" || ASCIIDOC="none" + + if test "x$ASCIIDOC" != "xnone"; then + MANUALUPDATE_TRUE= + MANUALUPDATE_FALSE='#' +else + MANUALUPDATE_TRUE='#' + MANUALUPDATE_FALSE= +fi + +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 test "${ac_cv_path_A2X+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $A2X in + [\\/]* | ?:[\\/]*) + ac_cv_path_A2X="$A2X" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 +done + done +IFS=$as_save_IFS + + ;; +esac +fi +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 "$A2X" && break +done +test -n "$A2X" || A2X="none" + + conftemp="${sysconfdir}" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" @@ -15767,7 +16623,7 @@ _ACEOF -ac_config_files="$ac_config_files clients/Makefile common/Makefile conf/Makefile conf/upssched.conf.sample data/html/header.html data/html/Makefile data/Makefile docs/Makefile drivers/Makefile include/Makefile lib/libupsclient-config lib/libupsclient.pc lib/Makefile man/Makefile scripts/hal/Makefile scripts/hal/ups-nut-device.fdi scripts/hotplug/Makefile scripts/hotplug/libhidups scripts/python/Makefile scripts/udev/Makefile scripts/udev/nut-usbups.rules scripts/Makefile server/Makefile tools/Makefile Makefile" +ac_config_files="$ac_config_files clients/Makefile common/Makefile conf/Makefile 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/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/hal/Makefile scripts/hal/ups-nut-device.fdi scripts/hotplug/Makefile scripts/hotplug/libhidups scripts/python/Makefile scripts/udev/Makefile scripts/udev/nut-usbups.rules scripts/Makefile server/Makefile tools/Makefile Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -15891,6 +16747,26 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then 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_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_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 "${WITH_NEONXML_TRUE}" && test -z "${WITH_NEONXML_FALSE}"; then + as_fn_error "conditional \"WITH_NEONXML\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${WITH_LIBPOWERMAN_TRUE}" && test -z "${WITH_LIBPOWERMAN_FALSE}"; then + 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_SSL_TRUE}" && test -z "${WITH_SSL_FALSE}"; then as_fn_error "conditional \"WITH_SSL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -15903,32 +16779,16 @@ 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 "${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 "${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_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 "${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_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_NEONXML_TRUE}" && test -z "${WITH_NEONXML_FALSE}"; then - as_fn_error "conditional \"WITH_NEONXML\" 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_LIBPOWERMAN_TRUE}" && test -z "${WITH_LIBPOWERMAN_FALSE}"; then - as_fn_error "conditional \"WITH_LIBPOWERMAN\" was never defined. +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 @@ -15947,6 +16807,10 @@ 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 "${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 : ${CONFIG_STATUS=./config.status} ac_write_fail=0 @@ -16355,8 +17219,8 @@ 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.4.3, which was -generated by GNU Autoconf 2.64. Invocation command line was +This file was extended by nut $as_me 2.6.0, which was +generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -16396,6 +17260,7 @@ Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit + --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files @@ -16418,10 +17283,11 @@ 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.4.3 -configured by $0, generated by GNU Autoconf 2.64, - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" +nut config.status 2.6.0 +configured by $0, generated by GNU Autoconf 2.65, + with options \\"\$ac_cs_config\\" Copyright (C) 2009 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation @@ -16459,6 +17325,8 @@ do ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) @@ -16558,10 +17426,10 @@ ac_cv_type_intmax_t="$ac_cv_type_intmax_t" sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' -enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' +enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' @@ -16824,13 +17692,24 @@ do "data/html/header.html") CONFIG_FILES="$CONFIG_FILES data/html/header.html" ;; "data/html/Makefile") CONFIG_FILES="$CONFIG_FILES data/html/Makefile" ;; "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/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/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; - "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; + "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" ;; + "scripts/augeas/nutupsschedconf.aug") CONFIG_FILES="$CONFIG_FILES scripts/augeas/nutupsschedconf.aug" ;; + "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/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" ;; @@ -16945,7 +17824,7 @@ s/'"$ac_delim"'$// t delim :nl h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p @@ -16959,7 +17838,7 @@ s/.\{148\}// t nl :delim h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p @@ -18038,9 +18917,6 @@ available_tags="" # ### BEGIN LIBTOOL CONFIG -# Whether or not to build static libraries. -build_old_libs=$enable_static - # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision @@ -18048,6 +18924,9 @@ macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared +# Whether or not to build static libraries. +build_old_libs=$enable_static + # What type of objects to build. pic_mode=$pic_mode diff --git a/configure.in b/configure.in index 2c1795f..7af73e4 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ dnl | Network UPS Tools: configure.in | dnl +------------------------------------------------------------------+ dnl NUT version number is defined here and *only* here (no more include/version) -AC_INIT(nut, 2.4.3) +AC_INIT(nut, 2.6.0) AC_CONFIG_SRCDIR(server/upsd.c) AC_CONFIG_MACRO_DIR([m4]) echo "Network UPS Tools version ${PACKAGE_VERSION}" @@ -13,9 +13,14 @@ AC_CONFIG_HEADER(include/config.h) AC_PREFIX_DEFAULT(/usr/local/ups) AM_INIT_AUTOMAKE -dnl Require Autoconf 2.60 or better and enable features of Posix that are extensions to C -AC_PREREQ([2.60]) -AC_USE_SYSTEM_EXTENSIONS +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. @@ -83,7 +88,8 @@ 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) +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, [], [ @@ -92,7 +98,7 @@ AC_CHECK_FUNCS(vsnprintf snprintf, [], [ AC_TYPE_LONG_LONG_INT ]) -AC_REPLACE_FUNCS(setenv inet_aton strerror atexit) +AC_REPLACE_FUNCS(setenv strerror atexit) dnl dnl Only use these when compiling with gcc @@ -149,24 +155,26 @@ dnl ---------------------------------------------------------------------- dnl check for --with-all (or --without-all, or --with-all=auto) flag AC_MSG_CHECKING(for --with-all) -AC_ARG_WITH(all, -AC_HELP_STRING([--with-all], [enable serial, usb, snmp, hal, cgi, dev, neon, powerman]), -[ if test -n "${withval}"; then +AC_ARG_WITH(all, + AS_HELP_STRING([--with-all], [enable serial, usb, snmp, hal, cgi, dev, neon, powerman]), +[ + 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_cgi}"; then with_cgi="${withval}"; fi - if test -z "${with_dev}"; then with_dev="${withval}"; fi if test -z "${with_serial}"; then with_serial="${withval}"; fi - if test -z "${with_snmp}"; then with_snmp="${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_hal}"; then with_hal="${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 AC_MSG_RESULT("${withval}") else AC_MSG_RESULT(not given) fi -], [ AC_MSG_RESULT(not given) +], [ + AC_MSG_RESULT(not given) ]) dnl ---------------------------------------------------------------------- @@ -176,9 +184,20 @@ 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]) + +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]) @@ -194,7 +213,7 @@ case ${target_os} in solaris2.1* ) echo Checking for Solaris 10 / 11 specific configuration for usb drivers AC_SEARCH_LIBS(nanosleep, rt) - LIBUSB_LDFLAGS="-R/usr/sfw/lib ${LIBUSB_LDFLAGS}" + 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 reconnexion AC_DEFINE(SUN_LIBUSB, 1, [Define to 1 for Sun version of the libusb.]) @@ -202,6 +221,78 @@ case ${target_os} in ;; 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 +AM_CONDITIONAL(WITH_SERIAL, test "${nut_with_serial}" = "yes") +NUT_REPORT_FEATURE([build serial drivers], [${nut_with_serial}]) + +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 + +AM_CONDITIONAL(WITH_USB, test "${nut_with_usb}" = "yes") +NUT_REPORT_FEATURE([build USB drivers], [${nut_with_usb}]) + +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 + +AM_CONDITIONAL(WITH_SNMP, test "${nut_with_snmp}" = "yes") +NUT_REPORT_FEATURE([build SNMP drivers], [${nut_with_snmp}]) + +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 + +AM_CONDITIONAL(WITH_NEONXML, test "${nut_with_neon}" = "yes") +NUT_REPORT_FEATURE([build neon based XML driver], [${nut_with_neon}]) + +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 + +AM_CONDITIONAL(WITH_LIBPOWERMAN, test "${nut_with_powerman}" = "yes") +NUT_REPORT_FEATURE([build Powerman PDU client driver], [${nut_with_powerman}]) + dnl ---------------------------------------------------------------------- dnl Check for --with-ssl @@ -246,27 +337,6 @@ fi AM_CONDITIONAL(WITH_WRAP, test "${nut_with_wrap}" = "yes") NUT_REPORT_FEATURE([enable libwrap (tcp-wrappers) support], [${nut_with_wrap}]) -dnl ---------------------------------------------------------------------- -dnl check whether to compile IPv6 features - -NUT_ARG_WITH([ipv6], [enable IPv6 support], [auto]) - -dnl ${nut_with_ipv6}: any value except "yes" or "no" is treated as "auto". -if test "${nut_with_ipv6}" != "no"; then - dnl check for IPv6 prerequisites - NUT_CHECK_IPV6 -fi - -if test "${nut_with_ipv6}" = "yes" -a "${nut_have_ipv6}" != "yes"; then - AC_MSG_ERROR(["Some feature required for IPv6 support is missing"]) -fi - -if test "${nut_with_ipv6}" != "no"; then - nut_with_ipv6="${nut_have_ipv6}" -fi - -NUT_REPORT_FEATURE([enable IPv6 support], [${nut_with_ipv6}]) - dnl ---------------------------------------------------------------------- dnl checks related to --with-cgi @@ -289,61 +359,6 @@ fi AM_CONDITIONAL(WITH_CGI, test "${nut_with_cgi}" = "yes") NUT_REPORT_FEATURE([build CGI programs], [${nut_with_cgi}]) -dnl ---------------------------------------------------------------------- -dnl checks related to --with-dev - -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}]) - -dnl We only init libtool there to allow AC_DISABLE_STATIC -AC_PROG_LIBTOOL - -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 -AM_CONDITIONAL(WITH_SERIAL, test "${nut_with_serial}" = "yes") -NUT_REPORT_FEATURE([build serial drivers], [${nut_with_serial}]) - -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 - -AM_CONDITIONAL(WITH_SNMP, test "${nut_with_snmp}" = "yes") -NUT_REPORT_FEATURE([build SNMP drivers], [${nut_with_snmp}]) - -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 - -AM_CONDITIONAL(WITH_USB, test "${nut_with_usb}" = "yes") -NUT_REPORT_FEATURE([build USB drivers], [${nut_with_usb}]) - dnl ---------------------------------------------------------------------- dnl checks related to --with-hal @@ -368,88 +383,178 @@ AM_CONDITIONAL(WITH_HAL, test "${nut_with_hal}" = "yes") NUT_REPORT_FEATURE([enable HAL support], [${nut_with_hal}]) 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"]) +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(["Asciidoc is required for documentation support and missing"]) + 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" +]) + +AM_CONDITIONAL([HAVE_ASCIIDOC], [test "${nut_have_asciidoc}" = "yes"]) +NUT_REPORT_FEATURE([build and install documentation], [${nut_with_doc}]) + +if test "${nut_with_doc}" = "yes"; then + NUT_REPORT([only build specific documentation format], [${DOC_BUILD_LIST}]) fi -if test "${nut_with_neon}" != "no"; then - nut_with_neon="${nut_have_neon}" -fi +dnl ---------------------------------------------------------------------- +dnl checks related to --with-dev -AM_CONDITIONAL(WITH_NEONXML, test "${nut_with_neon}" = "yes") -NUT_REPORT_FEATURE([build neon based XML driver], [${nut_with_neon}]) +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}]) 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 - -AM_CONDITIONAL(WITH_LIBPOWERMAN, test "${nut_with_powerman}" = "yes") -NUT_REPORT_FEATURE([build Powerman PDU client driver], [${nut_with_powerman}]) - -dnl ---------------------------------------------------------------------- AC_MSG_CHECKING(state path) AC_ARG_WITH(statepath, -AC_HELP_STRING([--with-statepath=PATH], [path for ups state files (/var/state/ups)]), -[ case "${withval}" in + 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]) + 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 won't be able to write to the usual +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, -AC_HELP_STRING([--with-altpidpath=PATH], [path for driver/upsd .pid files ()]), -[ case "${withval}" in + AS_HELP_STRING([--with-altpidpath=PATH], [path for driver/upsd .pid files ()]), +[ + case "${withval}" in yes|no) - ALTPIDPATH="${STATEPATH}" + AC_MSG_ERROR(invalid option --with(out)-altpidpath - see docs/configure.txt) ;; *) ALTPIDPATH="${withval}" ;; - esac], + esac +], [ ALTPIDPATH="${STATEPATH}" -) -AC_DEFINE_UNQUOTED(ALTPIDPATH, "${ALTPIDPATH}", - [Path for pid files of drivers and upsd (usually 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, -AC_HELP_STRING([--with-drvpath=PATH], [where to install ups drivers (EPREFIX/bin)]), -[ case "${withval}" in + 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], -) + esac +], []) conftemp="${driverexecdir}" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" @@ -458,15 +563,17 @@ AC_MSG_RESULT(${driverexecdir}) AC_MSG_CHECKING(cgi path) AC_ARG_WITH(cgipath, -AC_HELP_STRING([--with-cgipath=PATH], [where to install CGI programs (EPREFIX/cgi-bin)]), -[ case "${withval}" in + 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], -) + esac +], []) conftemp="${cgiexecdir}" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" @@ -475,15 +582,17 @@ AC_MSG_RESULT(${cgiexecdir}) AC_MSG_CHECKING(html path) AC_ARG_WITH(htmlpath, -AC_HELP_STRING([--with-htmlpath=PATH], [where to install HTML files (PREFIX/html)]), -[ case "${withval}" in + 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], -) + esac +], []) conftemp="${htmldir}" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" @@ -492,276 +601,283 @@ AC_MSG_RESULT(${htmldir}) AC_MSG_CHECKING(pidpath) AC_ARG_WITH(pidpath, -AC_HELP_STRING([--with-pidpath=PATH], [path for .pid files (/var/run)]), -[ case "${withval}" in + 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], -) + 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, -AC_HELP_STRING([--with-port=PORT], [port for network communications (3493)]), -[ case "${withval}" in + AS_HELP_STRING([--with-port=PORT], [port for network communications (3493)]), +[ + case "${withval}" in yes|no) - PORT="3493" + AC_MSG_ERROR(invalid option --with(out)-port - see docs/configure.txt) ;; *) PORT="${withval}" ;; - esac], + esac +], [ PORT="3493" -) +]) AC_DEFINE_UNQUOTED(PORT, ${PORT}, [Port for network communications]) AC_MSG_RESULT(${PORT}) -nut_user_given= AC_MSG_CHECKING(user to run as) AC_ARG_WITH(user, -AC_HELP_STRING([--with-user=username], [user for programs started as root (nobody)]), -[ case "${withval}" in + 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], -) -AC_DEFINE_UNQUOTED(RUN_AS_USER, "${RUN_AS_USER}", - [User to switch to if started as root]) + 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}) -nut_group_given= AC_MSG_CHECKING(group membership of user to run as) AC_ARG_WITH(group, -AC_HELP_STRING([--with-group=groupname], [group membership of user for programs started as root (nogroup)]), -[ case "${withval}" in + 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], -) -AC_DEFINE_UNQUOTED(RUN_AS_GROUP, "${RUN_AS_GROUP}", - [Group membership of user to switch to if started as root]) + 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 iff --with-group is given. -if test -n "$nut_user_given" -a -z "$nut_group_given"; then - AC_MSG_ERROR(["If you specify --with-user, you also must specify --with-group"]) -elif test -z "$nut_user_given" -a -n "$nut_group_given"; then - AC_MSG_ERROR(["If you specify --with-group, you also must specify --with-user"]) +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, -AC_HELP_STRING([--with-logfacility=FACILITY], [facility for log messages (LOG_DAEMON)]), -[ case "${withval}" in + AS_HELP_STRING([--with-logfacility=FACILITY], [facility for log messages (LOG_DAEMON)]), +[ + case "${withval}" in yes|no) - LOGFACILITY="LOG_DAEMON" + AC_MSG_ERROR(invalid option --with(out)-logfacility - see docs/configure.txt) ;; *) LOGFACILITY="${withval}" ;; - esac], + esac +], [ LOGFACILITY="LOG_DAEMON" -) -AC_DEFINE_UNQUOTED(LOG_FACILITY, ${LOGFACILITY}, - [Desired syslog facility - see syslog(3)]) +]) +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, -AC_HELP_STRING([[[[--with-drivers=driver@<:@,driver...@:>@]]]], [Only use specific drivers (all)]), -[ case "${withval}" in - yes | no) - dnl ignore calls without any arguments - DRIVER_BUILD_LIST="all" - AC_MSG_RESULT(all available) + AS_HELP_STRING([m4_version_prereq(2.62, + [@<:@--with-drivers=driver@<:@,driver@:>@@:>@], + [[[[--with-drivers=driver@<:@,driver@:>@]]]])], + [Only use 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}]) + 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) + DRIVER_MAN_LIST=all + AC_MSG_RESULT(all available) else - DRIVER_MAN_LIST="" - for i in ${DRIVER_BUILD_LIST}; do - if test -f ${srcdir}/man/$i.8; then - DRIVER_MAN_LIST="${DRIVER_MAN_LIST} $i.8" - fi - done - AC_MSG_RESULT(${DRIVER_MAN_LIST}) + 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, -[ --enable-strip Strip debugging symbols from binaries [no]], + AS_HELP_STRING([--enable-strip], [Strip debugging symbols from binaries (no)]), [ case "${withval}" in - no) - AC_MSG_RESULT(no) + no) + AC_MSG_RESULT(no) ;; - *) - AC_MSG_RESULT(yes) - CFLAGS="${CFLAGS} -s" + *) + AC_MSG_RESULT(yes) + CFLAGS="${CFLAGS} -s" ;; esac -], -[ AC_MSG_RESULT(no) +], [ + AC_MSG_RESULT(no) ]) - AC_MSG_CHECKING(whether to install pkg-config *.pc files) AC_ARG_WITH(pkgconfig-dir, - AC_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 - ], - ) -echo ${pkgconfigdir} + 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}) + AC_MSG_RESULT(using ${pkgconfigdir}) else - AC_MSG_RESULT(no) + AC_MSG_RESULT(no) fi AM_CONDITIONAL(WITH_PKG_CONFIG, test -n "${pkgconfigdir}") AC_MSG_CHECKING(whether to install hotplug rules) AC_ARG_WITH(hotplug-dir, - AC_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 - ], - ) + 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}) + AC_MSG_RESULT(using ${hotplugdir}) else - AC_MSG_RESULT(no) + 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, - AC_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 - ], - ) + 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}) + AC_MSG_RESULT(using ${udevdir}) else - AC_MSG_RESULT(no) + 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 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]) +AC_DEFINE_UNQUOTED(CONFPATH, "${conftemp}", [Default path for configuration files]) dnl same for datadir conftemp="${datadir}" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" -AC_DEFINE_UNQUOTED(DATADIR, "${conftemp}", - [Default path for data files]) +AC_DEFINE_UNQUOTED(DATADIR, "${conftemp}", [Default path for data files]) dnl same for bindir conftemp="${bindir}" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" -AC_DEFINE_UNQUOTED(BINDIR, "${conftemp}", - [Default path for user executables]) +AC_DEFINE_UNQUOTED(BINDIR, "${conftemp}", [Default path for user executables]) AC_SUBST(OS_NAME) AC_SUBST(LIBSSL_CFLAGS) -AC_SUBST(LIBSSL_LDFLAGS) +AC_SUBST(LIBSSL_LIBS) AC_SUBST(LIBGD_CFLAGS) AC_SUBST(LIBGD_LDFLAGS) AC_SUBST(LIBNETSNMP_CFLAGS) -AC_SUBST(LIBNETSNMP_LDFLAGS) +AC_SUBST(LIBNETSNMP_LIBS) AC_SUBST(LIBUSB_CFLAGS) -AC_SUBST(LIBUSB_LDFLAGS) +AC_SUBST(LIBUSB_LIBS) AC_SUBST(LIBNEON_CFLAGS) -AC_SUBST(LIBNEON_LDFLAGS) +AC_SUBST(LIBNEON_LIBS) AC_SUBST(LIBPOWERMAN_CFLAGS) -AC_SUBST(LIBPOWERMAN_LDFLAGS) +AC_SUBST(LIBPOWERMAN_LIBS) +AC_SUBST(DOC_BUILD_LIST) AC_SUBST(LIBWRAP_CFLAGS) -AC_SUBST(LIBWRAP_LDFLAGS) +AC_SUBST(LIBWRAP_LIBS) AC_SUBST(HAL_USER) AC_SUBST(HAL_DEVICE_MATCH_KEY) AC_SUBST(HAL_FDI_PATH) AC_SUBST(HAL_CALLOUTS_PATH) -AC_SUBST(HAVE_GLIB_2_14) AC_SUBST(LIBHAL_CFLAGS) -AC_SUBST(LIBHAL_LDFLAGS) +AC_SUBST(LIBHAL_LIBS) AC_SUBST(DRIVER_BUILD_LIST) AC_SUBST(DRIVER_MAN_LIST) AC_SUBST(DRIVER_INSTALL_TARGET) @@ -789,13 +905,24 @@ AC_OUTPUT([ 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/Makefile - man/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/hal/Makefile scripts/hal/ups-nut-device.fdi scripts/hotplug/Makefile diff --git a/data/Makefile.am b/data/Makefile.am index 2b0e953..4b67782 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -2,7 +2,6 @@ SUBDIRS = html -dist_data_DATA = cmdvartab driver.list -EXTRA_DIST = evolution500.dev - -DATA_FILES = cmdvartab driver.list +dist_data_DATA = cmdvartab +nodist_data_DATA = driver.list +EXTRA_DIST = evolution500.seq epdu-managed.dev diff --git a/data/Makefile.in b/data/Makefile.in index 364b18a..fb8e69a 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -39,14 +39,15 @@ host_triplet = @host@ target_triplet = @target@ subdir = data DIST_COMMON = $(dist_data_DATA) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in + $(srcdir)/Makefile.in $(srcdir)/driver.list.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -56,6 +57,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -63,7 +65,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = driver.list CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = @@ -95,8 +97,8 @@ am__nobase_list = $(am__nobase_strip_setup); \ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(datadir)" -DATA = $(dist_data_DATA) +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=) \ @@ -131,9 +133,11 @@ am__relativize = \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -146,8 +150,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -164,7 +170,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -175,22 +180,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ @@ -287,9 +292,9 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ SUBDIRS = html -dist_data_DATA = cmdvartab driver.list -EXTRA_DIST = evolution500.dev -DATA_FILES = cmdvartab driver.list +dist_data_DATA = cmdvartab +nodist_data_DATA = driver.list +EXTRA_DIST = evolution500.seq epdu-managed.dev all: all-recursive .SUFFIXES: @@ -323,6 +328,8 @@ $(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): +driver.list: $(top_builddir)/config.status $(srcdir)/driver.list.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo @@ -349,6 +356,26 @@ uninstall-dist_dataDATA: test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(datadir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(datadir)" && rm -f $$files +install-nodist_dataDATA: $(nodist_data_DATA) + @$(NORMAL_INSTALL) + test -z "$(datadir)" || $(MKDIR_P) "$(DESTDIR)$(datadir)" + @list='$(nodist_data_DATA)'; test -n "$(datadir)" || list=; \ + 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)$(datadir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(datadir)" || exit $$?; \ + done + +uninstall-nodist_dataDATA: + @$(NORMAL_UNINSTALL) + @list='$(nodist_data_DATA)'; test -n "$(datadir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(datadir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(datadir)" && rm -f $$files # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -357,7 +384,7 @@ uninstall-dist_dataDATA: # (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): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -382,7 +409,7 @@ $(RECURSIVE_TARGETS): fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -548,7 +575,7 @@ check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(datadir)"; do \ + for dir in "$(DESTDIR)$(datadir)" "$(DESTDIR)$(datadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive @@ -596,7 +623,7 @@ info: info-recursive info-am: -install-data-am: install-dist_dataDATA +install-data-am: install-dist_dataDATA install-nodist_dataDATA install-dvi: install-dvi-recursive @@ -640,7 +667,7 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-dist_dataDATA +uninstall-am: uninstall-dist_dataDATA uninstall-nodist_dataDATA .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive @@ -653,12 +680,13 @@ uninstall-am: uninstall-dist_dataDATA 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-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 + 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 # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/data/driver.list b/data/driver.list deleted file mode 100644 index 15089c8..0000000 --- a/data/driver.list +++ /dev/null @@ -1,725 +0,0 @@ -# Network UPS Tools driver.list -# -# This file is used to build the compat.html on the web server. Any line -# with exactly 4 arguments will be turned into an entry on there. -# Naturally, it is read by parseconf, so the usual escaping tricks are -# allowed if you need to insert something unusual. -# -# If you write a new driver, modify an existing one to add more support, -# or just know about some equipment that isn't listed but should be, -# please send me a patch to update this file. -# -# The format: -# -# -# -# Note that the "upstype=nn" format must be used for genericups entries, -# as they will be parsed by new configuration helper software. -# -# 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" "MS-RT" "" "megatec" -"Ablerex" "625L" "USB" "megatec_usb" -"Ablerex" "Hope Office 400/600" "" "megatec" - -"ActivePower" "400VA" "" "megatec" -"ActivePower" "1400VA" "" "megatec" -"ActivePower" "2000VA" "" "megatec" - -"Advice" "TopGuard 2000" "" "megatec" - -"AEC" "MiniGuard UPS 700" "Megatec M2501 cable" "genericups upstype=21" - -"APC" "Back-UPS Pro" "" "apcsmart" -"APC" "Matrix-UPS" "" "apcsmart" -"APC" "Smart-UPS" "" "apcsmart" -"APC" "Back-UPS Pro USB" "USB" "usbhid-ups" -"APC" "Back-UPS USB" "USB" "usbhid-ups" -"APC" "Back-UPS RS USB" "USB" "usbhid-ups" -"APC" "Back-UPS LS USB" "USB" "usbhid-ups" -"APC" "Back-UPS ES/CyberFort 350" "USB" "usbhid-ups" -"APC" "Back-UPS BF500" "USB" "usbhid-ups" -"APC" "BACK-UPS XS LCD" "USB" "usbhid-ups" -"APC" "Smart-UPS USB" "USB" "usbhid-ups" -"APC" "Back-UPS" "940-0095A/C cables" "genericups upstype=1" -"APC" "Back-UPS" "940-0020B/C cables" "genericups upstype=2" -"APC" "Back-UPS" "940-0023A cable" "genericups upstype=9" -"APC" "Back-UPS Office" "940-0119A cable" "genericups upstype=12" -"APC" "Back-UPS RS 500" "custom non-USB cable" "genericups upstype=20" -"APC" "Masterswitch" "Not a UPS - 940-0020 cable" "genericups upstype=12" -"APC" "AP9210" "8 outlets" "powerman-pdu (experimental)" -"APC" "AP79xx" "8 to 24 outlets" "powerman-pdu (experimental)" -"APC" "(various)" "SNMP monitoring card" "snmp-ups (experimental)" - -"Aphel" "PDU" "no report, but various models should be supported" "snmp-ups (experimental)" - -"Apollo" "1000A" "" "genericups upstype=4" -"Apollo" "1000F" "" "genericups upstype=4" - -"Appro" "SWPDU" "48 outlets" "powerman-pdu (experimental)" - -"Atlantis Land" "A03-P826" "" "megatec" - -"Baytech" "RPC3" "8 outlets" "powerman-pdu (experimental)" -"Baytech" "RPC3-20NC" "8 outlets" "powerman-pdu (experimental)" -"Baytech" "RPC28-30NC" "20 outlets" "powerman-pdu (experimental)" -"Baytech" "various RPC" "" "snmp-ups" - -"Belkin" "Active Battery Backup BU30 series" "USB" "megatec_usb" -"Belkin" "Home Office F6H350-SER" "" "genericups upstype=7" -"Belkin" "Home Office F6H500-SER" "" "genericups upstype=7" -"Belkin" "Home Office F6H650-SER" "" "genericups upstype=7" -"Belkin" "F6H375-USB" "USB (<= 2005 models, vendor id: 050d)" "usbhid-ups" -"Belkin" "F6H375-USB" "USB (2007 models, vendor id: 0665)" "megatec_usb" -"Belkin" "Office Series F6C550-AVR" "USB" "usbhid-ups" -"Belkin" "Regulator Pro" "F6C525-SER, F6C625-SER" "belkin" -"Belkin" "Resource" "" "genericups upstype=4" -"Belkin" "Small Enterprise F6C1500-TW-RK" "serial port" "belkin" -"Belkin" "Small Enterprise F6C1500-TW-RK" "USB" "usbhid-ups" -"Belkin" "Universal UPS F6C100-UNV" "USB" "usbhid-ups" -"Belkin" "Universal UPS F6C120-UNV" "serial port" "belkinunv" -"Belkin" "Universal UPS F6C120-UNV" "USB" "usbhid-ups" -"Belkin" "Universal UPS F6C800-UNV" "serial port" "belkinunv" -"Belkin" "Universal UPS F6C800-UNV" "USB" "usbhid-ups" -"Belkin" "Universal UPS F6C1100-UNV" "serial port (<= 2005 models)" "belkinunv" -"Belkin" "Universal UPS F6C1100-UNV" "USB (<= 2005 models, vendor id: 050d)" "usbhid-ups" -"Belkin" "Universal UPS F6C1100-UNV" "USB (2007 models, vendor id: 0665)" "megatec_usb" -"Belkin" "Universal UPS F6C1200-UNV" "USB (<= 2005 models, vendor id: 050d)" "usbhid-ups" -"Belkin" "Universal UPS F6C1200-UNV" "USB (2007 models, vendor id: 0665)" "megatec_usb" -"Belkin" "Universal UPS F6H350deUNV" "serial port" "megatec" -"Belkin" "Universal UPS F6H350ukUNV" "serial port" "megatec" -"Belkin" "Universal UPS F6H500ukUNV" "serial port" "megatec" -"Belkin" "Universal UPS F6H650ukUNV" "serial port" "megatec" - -"Best Power" "Fortress (old)" "" "bestfortress" -"Best Power" "Fortress (newer)" "" "bestups" -"Best Power" "Fortress Telecom" "" "bestups" -"Best Power" "Axxium Rackmount" "" "bestups" -"Best Power" "Patriot Pro" "" "bestups" -"Best Power" "Patriot Pro II" "" "bestups" -"Best Power" "Patriot" "INT51 cable" "genericups upstype=6" -"Best Power" "Micro-Ferrups" "" "bestuferrups" -"Best Power" "Fortress/Ferrups" "f-command support" "bestfcom" - -"Chloride" "Desk Power 650" "serial port" "megatec" - -"Cito Power" "CPG-SR1000" "" "megatec" - -"Clary" "ST-800" "" "gamatronic" - -"Compaq" "T1500h" "" "upscode2 use_pre_lf" -"Compaq" "R3000h" "" "upscode2" -"Compaq" "R3000 XR" "" "bcmxcp" -"Compaq" "R5500 XR" "" "bcmxcp" - -"Cyber Power Systems" "320AVR" "" "powerpanel or cyberpower" -"Cyber Power Systems" "500AVR" "" "powerpanel or cyberpower" -"Cyber Power Systems" "650AVR" "" "powerpanel or cyberpower" -"Cyber Power Systems" "700AVR" "" "powerpanel or cyberpower" -"Cyber Power Systems" "800AVR" "" "powerpanel or cyberpower" -"Cyber Power Systems" "850AVR" "" "powerpanel or cyberpower" -"Cyber Power Systems" "900AVR" "" "powerpanel or cyberpower" -"Cyber Power Systems" "1250AVR" "" "powerpanel or cyberpower" -"Cyber Power Systems" "1500AVR" "" "powerpanel or cyberpower" -"Cyber Power Systems" "Power99" "" "genericups upstype=7" -"Cyber Power Systems" "550SL" "" "genericups upstype=7" -"Cyber Power Systems" "725SL" "" "genericups upstype=7" -"Cyber Power Systems" "CPS825VA" "" "powerpanel" -"Cyber Power Systems" "1100AVR" "" "powerpanel" -"Cyber Power Systems" "1200AVR" "" "powerpanel" -"Cyber Power Systems" "1500AVR-HO" "" "powerpanel" -"Cyber Power Systems" "PR2200" "" "powerpanel" -"Cyber Power Systems" "PR3000E" "" "powerpanel (experimental)" -"Cyber Power Systems" "685AVR" "USB" "usbhid-ups" -"Cyber Power Systems" "800AVR" "USB" "usbhid-ups" -"Cyber Power Systems" "AE550" "USB" "usbhid-ups" -"Cyber Power Systems" "CP 1500C" "USB" "usbhid-ups" -"Cyber Power Systems" "OR2200LCDRM2U" "USB" "usbhid-ups" -"Cyber Power Systems" "Value 400E" "USB" "usbhid-ups" -"Cyber Power Systems" "Value 600E" "USB" "usbhid-ups" -"Cyber Power Systems" "Value 800E" "USB" "usbhid-ups" - -"Cyclades" "PM8" "8 outlets" "powerman-pdu (experimental)" -"Cyclades" "PM10" "10 outlets" "powerman-pdu (experimental)" - -"Dell" "Dell UPS Tower 500W LV / HV" "USB port" "usbhid-ups" -"Dell" "Dell UPS Tower 500W LV / HV" "Serial port" "newmge-shut" -"Dell" "Dell UPS Rack/Tower 1000W LV / HV" "USB port" "usbhid-ups" -"Dell" "Dell UPS Rack/Tower 1000W LV / HV" "Serial port" "newmge-shut" -"Dell" "Dell UPS Rack/Tower 1500W LV" "USB port" "usbhid-ups" -"Dell" "Dell UPS Rack/Tower 1500W LV" "Serial port" "newmge-shut" -"Dell" "Dell UPS Rack/Tower 1920W LV / HV" "USB port" "usbhid-ups" -"Dell" "Dell UPS Rack/Tower 1920W LV / HV" "Serial port" "newmge-shut" -"Dell" "Dell UPS Rack/Tower 2300W LV" "USB port" "usbhid-ups" -"Dell" "Dell UPS Rack/Tower 2300W LV" "Serial port" "newmge-shut" -"Dell" "Dell UPS Rack/Tower 2700W LV / HV" "USB port" "usbhid-ups" -"Dell" "Dell UPS Rack/Tower 2700W LV / HV" "Serial port" "newmge-shut" -"Dell" "Dell UPS Short Depth Rack 2700W High Efficiency Online LV / HV" "USB port" "usbhid-ups" -"Dell" "Dell UPS Short Depth Rack 2700W High Efficiency Online LV / HV" "Serial port" "newmge-shut" -"Dell" "Dell UPS Rack 3750W High Efficiency Online HV" "USB port" "usbhid-ups" -"Dell" "Dell UPS Rack 3750W High Efficiency Online HV" "Serial port" "newmge-shut" -"Dell" "Dell UPS Rack 4200W High Efficiency Online HV" "USB port" "usbhid-ups" -"Dell" "Dell UPS Rack 4200W High Efficiency Online HV" "Serial port" "newmge-shut" -"Dell" "Dell UPS Rack 5600W HV" "USB port" "usbhid-ups" -"Dell" "Dell UPS Rack 5600W HV" "Serial port" "newmge-shut" - -"Delta" "GES602N" "" "belkin" - -"Deltec" "PowerRite Pro II" "" "genericups upstype=15" - -"Digital Loggers" "LPC, EPCR2, DIN" "8 outlets" "powerman-pdu (experimental)" - -"Digitus" "DN-170020" "" "megatec" - -"Dynamix" "UPS1700D" "" "megatec" -"Dynamix" "UPS-650VA" "" "megatec ignoreoff" - -"Dynex" "975AVR" "" "genericups upstype=7" -"Dynex" "DX-800U" "USB" "usbhid-ups" - -"Eaton" "Protection Station 500/650/800 VA" "USB" "usbhid-ups" -"Eaton" "Ellipse ASR USBS 600/750/1000/1500 VA" "USB cable" "usbhid-ups" -"Eaton" "Ellipse MAX USBS 600/850/1100/1500 VA" "USB cable" "usbhid-ups" -"Eaton" "Evolution 650/850/1150/1550/2000 VA" "USB port" "usbhid-ups" -"Eaton" "Evolution S 1250/1750/2500/3000 VA" "USB port" "usbhid-ups" -"Eaton" "EX 700/1000/1500 VA" "USB port" "usbhid-ups" -"Eaton" "EX 2200/3000/3000 XL VA" "USB port" "usbhid-ups" -"Eaton" "EX 1000 RT2U / 1500 RT2U" "USB port" "usbhid-ups" -"Eaton" "MX 5/8/10/15/20 kVA" "USB port" "usbhid-ups" -"Eaton" "Nova AVR 625/1250" "USB" "usbhid-ups" -"Eaton" "E Series NV UPS 400-2000 VA" "" "megatec_usb" -"Eaton" "E Series DX UPS 1-20 kVA" "" "mge-utalk" -"Eaton" "Ellipse ASR USBS 600/750/1000/1500 VA" "Serial cable" "mge-shut or newmge-shut" -"Eaton" "Ellipse MAX USBS 600/850/1100/1500 VA" "Serial cable" "mge-shut or newmge-shut" -"Eaton" "Evolution 650/850/1150/1550/2000 VA" "Serial port" "mge-shut or newmge-shut" -"Eaton" "Evolution S 1250/1750/2500/3000 VA" "Serial port" "mge-shut or newmge-shut" -"Eaton" "EX 700/1000/1500 VA" "Serial port" "mge-shut or newmge-shut" -"Eaton" "EX 2200/3000/3000 XL VA" "Serial port" "mge-shut or newmge-shut" -"Eaton" "EX 1000 RT2U / 1500 RT2U" "Serial port" "mge-shut or newmge-shut" -"Eaton" "MX 5/8/10/15/20 kVA" "Serial port" "mge-shut or newmge-shut" -"Eaton" "EX RT 1:1 7/11 kVA" "" "mge-shut or newmge-shut" -"Eaton" "EX RT 3:1 5/7/11 kVA" "" "mge-shut or newmge-shut" -"Eaton" "EX RT (XML/HTTP)" "NMC Transverse card (ref 66074)" "netxml-ups (experimental)" -"Eaton" "EX RT (SNMP)" "NMC Transverse card (ref 66074)" "snmp-ups (experimental)" -"Eaton" "BladeUPS (SNMP)" "ConnectUPS Web/SNMP Card" "snmp-ups (experimental)" -"Eaton" "various models (XML/HTTP mode)" "NMC Minislot (Ref 66102)" "netxml-ups (experimental)" -"Eaton" "various models (SNMP mode)" "NMC Minislot (Ref 66102)" "snmp-ups (experimental)" -"Eaton" "various models (XML/HTTP mode)" "SNMP/Web Minislot card (ref 66244)" "netxml-ups (experimental)" -"Eaton" "various models (SNMP mode)" "SNMP/Web Minislot card (ref 66244)" "snmp-ups (experimental)" -"Eaton" "ePDU Managed" "" "snmp-ups (experimental)" -"Eaton" "ePDU Monitored" "" "snmp-ups or netxml-ups" -"Eaton" "Powerware 9130" "" "bcmxcp or usbhid-ups" - -"Effekta" "MI/MT/MH" "2502 cable" "megatec" -"Effekta" "RM2000MH" "" "megatec" - -"Energy Sistem" "(various)" "" "megatec" - -"ETA" "mini+UPS" "WinNT/Upsoft cable" "genericups upstype=7" -"ETA" "mini+UPS PRO" "UPS Explorer cable" "etapro" - -"Ever UPS" "NET *-DPC" "" "everups" -"Ever UPS" "AP *-PRO" "" "everups" - -"Ever-Power" "625/1000" "" "safenet" - -"Exide" "NetUPS SE" "" "genericups upstype=15" - -"Fenton Technologies" "PowerPal" "P-series" "safenet" -"Fenton Technologies" "PowerPal" "L-series" "megatec" -"Fenton Technologies" "PowerOn" "" "megatec" -"Fenton Technologies" "PowerPure" "" "megatec" - -"Fairstone" "L525/L625/L750" "" "safenet" - -"Fideltronik" "Ares 700 and larger" "" "genericups upstype=6" -"Fideltronik" "Other Ares models" "" "genericups upstype=19" - -"Fiskars" "PowerRite MAX" "" "upscode2" -"Fiskars" "PowerServer 10" "" "upscode2" -"Fiskars" "PowerServer 30" "" "upscode2" -"Fiskars" "9200" "UPS Information Unit" "upscode2" - -"Forza Power Technologies" "SL-1001" "USB" "megatec_usb" - -"Gamatronic" "All models with alarm interface" "" "genericups upstype=22" -"Gamatronic" "G-SmartCompact 2000" "" "megatec" -"Gamatronic" "MP110/210" "" "gamatronic" -"Gamatronic" "MS-T" "" "gamatronic" -"Gamatronic" "MS" "" "gamatronic" -"Gamatronic" "µPS3/1" "" "gamatronic" - -"Geek Squad" "GS1285U" "USB" "usbhid-ups" - -"Gemini" "UPS625/UPS1000" "" "safenet" - -"HP" "PowerTrust 2997A" "HP 5061-2575 cable" "apcsmart" -"HP" "R3000 XR" "" "bcmxcp" -"HP" "R5500 XR" "" "bcmxcp" -"HP" "R1500 G2" "" "bcmxcp" -"HP" "R/T 2200 G2" "" "usbhid-ups" -"HP" "T500" "older models" "bcmxcp_usb" -"HP" "T750 INTL" "" "usbhid-ups" -"HP" "T750" "older models" "bcmxcp_usb" -"HP" "HP3488 Switch/Control Unit" "" "powerman-pdu (experimental)" - -"IBM" "Blade Center Management Module" "15 outlets" "powerman-pdu (experimental)" - -"ICS" "8064 Ethernet Relay Interface" "16 outlets" "powerman-pdu (experimental)" - -"INELT" "Monolith 1000LT" "" "megatec" - -"Inform" "GUARD" "Line Interactive AP model" "powercom" -"Inform" "Guard S 1500AP" "" "megatec" -"Inform" "Informer Compact 1000VA" "" "megatec or blazer_ser" - -"Infosec" "iPEL 350" "" "megatec" -"Infosec" "iPEL 500" "" "megatec" -"Infosec" "iPEL 750" "" "megatec" -"Infosec" "iPEL 1000" "" "megatec" -"Infosec" "500XP" "" "megatec" -"Infosec" "XP 500" "USB" "megatec_usb" -"Infosec" "XP 1000" "" "megatec" - -"IPMI" "" "" "powerman-pdu (experimental)" - -"Ippon" "Back Power Pro 400/500/600/700/800" "" "blazer_ser or megatec" -"Ippon" "Back Power Pro 400/500/600/700/800" "USB" "blazer_usb (experimental)" -"Ippon" "Back Comfo Pro 600/800" "" "blazer_ser or megatec" -"Ippon" "Back Comfo Pro 600/800" "USB" "blazer_usb (experimental)" -"Ippon" "Smart Power Pro 1000/1400/2000" "" "blazer_ser or megatec" -"Ippon" "Smart Power Pro 1000/1400/2000" "USB" "blazer_usb (experimental)" -"Ippon" "Smart Winner 750/1000/1500/2000/3000" "" "blazer_ser or megatec" -"Ippon" "Smart Winner 750/1000/1500/2000/3000" "USB" "blazer_usb (experimental)" -"Ippon" "(various)" "" "blazer_ser or megatec" -"Ippon" "(various)" "USB" "blazer_usb" - -"IVT" "SCD series" "" "ivtscd" - -"Jageson Technology" "Jasuny USPS" "" "genericups upstype=4" - -"Kebo" "1200D/D Series" "" "megatec" - -"Krauler" "UP-D1200VA" "USB" "megatec_usb ignoreoff" -"Krauler" "UP-M500VA" "USB" "megatec_usb" - -"Lestar" "MD-800E" "" "megatec" - -"Liebert" "ITON 600VA" "" "megatec" -"Liebert" "UPStation GXT2" "contact-closure cable" "liebert" -"Liebert" "GXT2-3000RT230" "" "liebertgxt2 (experimental)" -"Liebert" "PowerSure Personal XT" "USB" "usbhid-ups" -"Liebert" "PowerSure PSA" "USB" "usbhid-ups" - -"LNXI" "Icebox" "10 outlets" "powerman-pdu (experimental)" - -"Masterguard" "(various)" "" "masterguard" - -"Maxxtro" "UPS 600 VA" "serial port" "megatec" - -"Mecer" "ME-2000" "" "megatec" - -"Meta System" "HF Line" "1..4 boards" "metasys" -"Meta System" "HF Line \/2" "5..8 boards" "metasys" -"Meta System" "HF Millennium 810" "" "metasys" -"Meta System" "HF Millennium 820" "" "metasys" -"Meta System" "HF TOP Line 910" "" "metasys" -"Meta System" "HF TOP Line 920" "" "metasys" -"Meta System" "HF TOP Line 930" "" "metasys" -"Meta System" "HF TOP Line 940" "" "metasys" -"Meta System" "HF TOP Line 950" "" "metasys" -"Meta System" "HF TOP Line 960" "" "metasys" -"Meta System" "HF TOP Line 970" "" "metasys" -"Meta System" "HF TOP Line 980" "" "metasys" -"Meta System" "ECO Network 750" "" "metasys" -"Meta System" "ECO Network 1000" "" "metasys" -"Meta System" "ECO Network 1050" "" "metasys" -"Meta System" "ECO Network 1500" "" "metasys" -"Meta System" "ECO Network 1800" "" "metasys" -"Meta System" "ECO Network 2000" "" "metasys" -"Meta System" "ECO Network 2100" "" "metasys" -"Meta System" "ECO Network 2500" "" "metasys" -"Meta System" "ECO Network 3000" "" "metasys" -"Meta System" "ECO 305" "" "metasys" -"Meta System" "ECO 308" "" "metasys" -"Meta System" "ECO 311" "" "metasys" -"Meta System" "ECO 511" "" "metasys" -"Meta System" "ECO 516" "" "metasys" -"Meta System" "ECO 519" "" "metasys" -"Meta System" "ECO 522" "" "metasys" -"Meta System" "ally HF 800" "" "metasys" -"Meta System" "ally HF 1000" "" "metasys" -"Meta System" "ally HF 1250" "" "metasys" -"Meta System" "ally HF 1600" "" "metasys" -"Meta System" "ally HF 2000" "" "metasys" -"Meta System" "ally HF 2500" "" "metasys" -"Meta System" "Megaline 1250" "" "metasys" -"Meta System" "Megaline 2500" "" "metasys" -"Meta System" "Megaline 3750" "" "metasys" -"Meta System" "Megaline 5000" "" "metasys" -"Meta System" "Megaline 6250" "" "metasys" -"Meta System" "Megaline 7500" "" "metasys" -"Meta System" "Megaline 8750" "" "metasys" -"Meta System" "Megaline 10000" "" "metasys" - -"MGE Office Protection Systems" "Protection Center 500/675 VA" "USB" "usbhid-ups" -"MGE Office Protection Systems" "Protection Station 500/650/800 VA" "USB" "usbhid-ups" -"MGE Office Protection Systems" "Ellipse ASR USBS 600/750/1000/1500 VA" "USB cable" "usbhid-ups" -"MGE Office Protection Systems" "Ellipse MAX USBS 600/850/1100/1500 VA" "USB cable" "usbhid-ups" -"MGE Office Protection Systems" "Evolution 650/850/1150/1550/2000 VA" "USB port" "usbhid-ups" -"MGE Office Protection Systems" "Evolution S 1250/1750/2500/3000 VA" "USB port" "usbhid-ups" -"MGE Office Protection Systems" "Pulsar 700/1000/1500 VA" "USB port" "usbhid-ups" -"MGE Office Protection Systems" "Pulsar M 2200/3000 VA" "USB port" "usbhid-ups" -"MGE Office Protection Systems" "Pulsar MX 5/8/10/15/20 kVA" "USB port" "usbhid-ups" -"MGE Office Protection Systems" "Ellipse ASR USBS 600/750/1000/1500 VA" "Serial cable" "mge-shut or newmge-shut" -"MGE Office Protection Systems" "Ellipse MAX USBS 600/850/1100/1500 VA" "Serial cable" "mge-shut or newmge-shut" -"MGE Office Protection Systems" "Evolution 650/850/1150/1550/2000 VA" "Serial port" "mge-shut or newmge-shut" -"MGE Office Protection Systems" "Evolution S 1250/1750/2500/3000 VA" "Serial port" "mge-shut or newmge-shut" -"MGE Office Protection Systems" "Pulsar 700/1000/1500 VA" "Serial port" "mge-shut or newmge-shut" -"MGE Office Protection Systems" "Pulsar M 2200/3000 VA" "Serial port" "mge-shut or newmge-shut" -"MGE Office Protection Systems" "Pulsar MX 5/8/10/15/20 kVA" "Serial port" "mge-shut or newmge-shut" -"MGE Office Protection Systems" "Comet EX RT 1:1 7/11 kVA" "" "mge-shut or newmge-shut" -"MGE Office Protection Systems" "Comet EX RT 3:1 5/7/11 kVA" "" "mge-shut or newmge-shut" -"MGE Office Protection Systems" "Comet EX RT (XML/HTTP)" "NMC Transverse card (ref 66074)" "netxml-ups (experimental)" -"MGE Office Protection Systems" "Comet EX RT (SNMP)" "NMC Transverse card (ref 66074)" "snmp-ups (experimental)" -"MGE Office Protection Systems" "various models (XML/HTTP mode)" "NMC Minislot (Ref 66102)" "netxml-ups (experimental)" -"MGE Office Protection Systems" "various models (SNMP mode)" "NMC Minislot (Ref 66102)" "snmp-ups (experimental)" -"MGE Office Protection Systems" "various models (XML/HTTP mode)" "SNMP/Web Minislot card (ref 66244)" "netxml-ups (experimental)" -"MGE Office Protection Systems" "various models (SNMP mode)" "SNMP/Web Minislot card (ref 66244)" "snmp-ups (experimental)" - -"MGE UPS SYSTEMS" "Comet EX RT" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Comet EX RT 3:1" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Protection Center 420" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Protection Center 500" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Protection Center 675" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "NOVA AVR 600 USB" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "NOVA AVR 1100 USB" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar Ellipse USBS" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar Ellipse USB" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar Ellipse Premium USBS" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar Ellipse Premium USB" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Ellipse Office 600" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Ellipse Office 750" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Ellipse Office 1000" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Ellipse Office 1500" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Ellipse MAX 600" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Ellipse MAX 850" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Ellipse MAX 1100" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Ellipse MAX 1500" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar Evolution" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Evolution 650" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Evolution 850" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Evolution 1150" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Evolution S 1250" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Evolution 1550" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Evolution S 1750" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Evolution 2000" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Evolution S 2500" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Evolution S 3000" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar M 2200" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar M 3000" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar M 3000 XL" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar 700" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar 1000" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar 1500" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar 1000 RT2U" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar 1500 RT2U" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar MX 4000 RT" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Pulsar MX 5000 RT" "USB" "usbhid-ups" -"MGE UPS SYSTEMS" "Comet / Galaxy (USB)" "USB Card (ref 66067)" "usbhid-ups" -"MGE UPS SYSTEMS" "NOVA AVR 600 Serial" "" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "NOVA AVR 1100 Serial" "" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar Ellipse USBS" "Serial cable" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar Ellipse S" "" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar Ellipse Premium USBS" "Serial cable" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar Ellipse Premium S" "" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Ellipse Office 600" "Serial cable" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Ellipse Office 750" "Serial cable" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Ellipse Office 1000" "Serial cable" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Ellipse Office 1500" "Serial cable" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Ellipse MAX 600" "Serial cable" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Ellipse MAX 850" "Serial cable" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Ellipse MAX 1100" "Serial cable" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Ellipse MAX 1500" "Serial cable" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar EXtreme C / EX RT" "" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Comet EX RT" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Comet EX RT 3:1" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar Esprit" "" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Evolution 650" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Evolution 850" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Evolution 1150" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Evolution S 1250" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Evolution 1550" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Evolution S 1750" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Evolution 2000" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Evolution S 2500" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Evolution S 3000" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar M 2200" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar M 3000" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar M 3000 XL" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar 700" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar 1000" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar 1500" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar 1000 RT2U" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar 1500 RT2U" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar MX 4000 RT" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar MX 5000 RT" "Serial port" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar Evolution" "Serial port" "mge-shut or newmge-shut or mge-utalk" -"MGE UPS SYSTEMS" "Pulsar EXtreme C" "" "mge-shut or newmge-shut or mge-utalk" -"MGE UPS SYSTEMS" "Pulsar ES+" "" "mge-utalk" -"MGE UPS SYSTEMS" "Pulsar ESV+" "" "mge-utalk" -"MGE UPS SYSTEMS" "Pulsar SV" "" "mge-utalk" -"MGE UPS SYSTEMS" "Pulsar ESV" "" "mge-utalk" -"MGE UPS SYSTEMS" "Pulsar EX" "" "mge-utalk" -"MGE UPS SYSTEMS" "Pulsar EXL" "" "mge-utalk" -"MGE UPS SYSTEMS" "Pulsar PSX" "" "mge-utalk" -"MGE UPS SYSTEMS" "Pulsar SX" "" "mge-utalk" -"MGE UPS SYSTEMS" "Pulsar EXtreme" "" "mge-utalk" -"MGE UPS SYSTEMS" "Comet EXtreme" "" "mge-utalk" -"MGE UPS SYSTEMS" "Comet / Galaxy (Serial)" "Utalk Serial Card (ref 66060)" "mge-utalk" -"MGE UPS SYSTEMS" "Comet / Galaxy (Serial)" "HID COM Serial Card (ref 66066)" "mge-shut or newmge-shut" -"MGE UPS SYSTEMS" "Pulsar / Comet / Galaxy (SNMP)" "SNMP/Web Transverse card (ref 66074)" "snmp-ups (experimental)" -"MGE UPS SYSTEMS" "various models (XML/HTTP mode)" "NMC Minislot (Ref 66102)" "netxml-ups (experimental)" -"MGE UPS SYSTEMS" "various models (SNMP mode)" "NMC Minislot (Ref 66102)" "snmp-ups (experimental)" -"MGE UPS SYSTEMS" "Pulsar (XML/HTTP mode)" "SNMP/Web Minislot card (ref 66244)" "netxml-ups (experimental)" -"MGE UPS SYSTEMS" "Pulsar (SNMP mode)" "SNMP/Web Minislot card (ref 66244)" "snmp-ups (experimental)" -"MGE UPS SYSTEMS" "Pulsar / Comet / Galaxy (SNMP)" "SNMP card (ref 66062)" "snmp-ups (experimental)" -"MGE UPS SYSTEMS" "Pulsar (SNMP)" "SNMP card (ref 66045)" "snmp-ups (experimental)" -"MGE UPS SYSTEMS" "UM-Link (SNMP)" "Not a UPS (ref 66850)" "snmp-ups (experimental)" - -"MicroDowell" "B.Box BP 500" "" "powerpanel" -"MicroDowell" "B.Box BP 750" "" "powerpanel" -"MicroDowell" "B.Box BP 1000" "" "powerpanel" -"MicroDowell" "B.Box BP 1500" "" "powerpanel" -"MicroDowell" "Enterprise B8" "" "microdowell" -"MicroDowell" "Enterprise B10" "" "microdowell" -"MicroDowell" "Enterprise N8" "" "microdowell" -"MicroDowell" "Enterprise N11" "" "microdowell" -"MicroDowell" "Enterprise N15" "" "microdowell" -"MicroDowell" "Enterprise N20" "" "microdowell" -"MicroDowell" "Enterprise N22" "" "microdowell" -"MicroDowell" "Enterprise N30" "" "microdowell" -"MicroDowell" "Enterprise N40" "" "microdowell" -"MicroDowell" "Enterprise N50" "" "microdowell" -"MicroDowell" "Enterprise N60" "" "microdowell" -"MicroDowell" "Enterprise HiBox ST" "" "microdowell" - -"Microsol" "Solis 1.0" "1000VA" "solis" -"Microsol" "Solis 1.5" "1500VA" "solis" -"Microsol" "Solis 2.0" "2000VA" "solis" -"Microsol" "Solis 3.0" "3000VA" "solis" -"Microsol" "Rhino 6.0" "6000VA" "rhino" -"Microsol" "Rhino 7.5" "7500VA" "rhino" -"Microsol" "Rhino 10.0" "10000VA" "rhino" -"Microsol" "Rhino 20.0" "20000VA" "rhino" - -"Mustek" "Powermust" "400VA Plus" "megatec" -"Mustek" "Powermust" "600VA Plus" "megatec" -"Mustek" "Powermust" "800VA Pro" "megatec" -"Mustek" "Powermust" "1000VA Plus" "megatec" -"Mustek" "Powermust" "1400VA Plus" "megatec" -"Mustek" "Powermust" "2000VA USB" "megatec" -"Mustek" "Powermust Office 650" "USB" "megatec_usb" -"Mustek" "PowerMust 424 / 636 / 848" "USB" "blazer_usb" -"Mustek" "Various" "" "megatec" - -"Neus" "400va / 600va" "" "megatec" - -"Nitram" "Elite 500" "" "genericups upstype=8" -"Nitram" "Elite 2002" "" "genericups upstype=16" -"Nitram" "Elite 2005" "" "powerpanel" - -"Oneac" "ON400" "advanced interface" "oneac" -"Oneac" "ON600" "advanced interface" "oneac" -"Oneac" "ON900" "advanced interface" "oneac" -"Oneac" "ON1300" "advanced interface" "oneac" -"Oneac" "EG Series" "advanced interface" "oneac" -"Oneac" "ON700" "advanced interface" "oneac" -"Oneac" "ON700XAU" "advanced interface" "oneac" -"Oneac" "ON700XIU" "advanced interface" "oneac" -"Oneac" "ON1000" "advanced interface" "oneac" -"Oneac" "ON1000XAU" "advanced interface" "oneac" -"Oneac" "ON1000XIU" "advanced interface" "oneac" -"Oneac" "ON1500" "advanced interface" "oneac" -"Oneac" "ON1500XAU" "advanced interface" "oneac" -"Oneac" "ON1500XIU" "advanced interface" "oneac" -"Oneac" "ON2000" "advanced interface" "oneac" -"Oneac" "ON2000XAU" "advanced interface" "oneac" -"Oneac" "ON2000XIU" "advanced interface" "oneac" - -"Online" "P-Series" "" "genericups upstype=14" -"Online" "Zinto D" "" "optiups" - -"OnLite" "AQUA" "50" "megatec" - -"Opti-UPS" "PowerES" "420E" "optiups" - -"Orvaldi Power Protection" "various" "not 400 or 600" "megatec" - -"Phasak" "400VA / 600VA" "" "megatec" - -"Plexus" "500VA" "USB" "megatec_usb ignoreoff" -"Plexus" "1000VA Pro" "USB" "megatec_usb ignoreoff" - -"Powercom" "SMK" "" "megatec" -"Powercom" "SXL" "" "megatec" -"Powercom" "ULT" "" "megatec" -"Powercom" "Trust 425/625" "" "powercom" -"Powercom" "Advice Partner/King Pr750" "" "powercom" -"Powercom" "Black Knight PRO" "" "powercom" -"Powercom" "Black Knight PRO" "USB (2009 models, product id: 00a6)" "usbhid-ups (experimental)" -"Powercom" "Smart KING Pro (all Smart series)" "powercom" -"Powercom" "Smart KING Pro (all Smart series)" "USB (2009 models, product id: 00a3)" "usbhid-ups (experimental)" -"Powercom" "Imperial" "" "powercom" -"Powercom" "Imperial" "USB (2009 models, product id: 00a2)" "usbhid-ups (experimental)" -"Powercom" "Vanguard" "" "megatec" -"Powercom" "Vanguard" "USB (2009 models, product id: 00a5)" "usbhid-ups (experimental)" -"Powercom" "WOW" "USB (<= 2009 models, product id: 0002)" "powercom (requires 'usbserial' kernel module)" -"Powercom" "WOW" "USB (2009 models, product id: 00a4)" "usbhid-ups (experimental)" -"Powercom" "(various)" "USB (<= 2009 models, product id: 0002)" "powercom (requires 'usbserial' kernel module)" -"Powercom" "(various)" "USB (2009 models, product id: 00a?)" "usbhid-ups (experimental)" - -"PowerGuard" "PG-600" "" "megatec" - -"PowerKinetics" "9001" "" "genericups upstype=17" -"PowerKinetics" "BlackOut Buster" "" "megatec" - -"PowerMan" "RealSmart 800" "" "megatec" -"PowerMan" "RealSmart 1000" "" "megatec" -"PowerMan" "BackPro" "" "genericups upstype=4" - -"PowerTech" "Comp1000" "DTR cable power" "genericups upstype=3" -"PowerTech" "SMK-800" "" "megatec" - -"PowerWalker" "Line-Interactive VI 1000" "" "megatec" -"PowerWalker" "Line-Interactive VI 400/800" "" "megatec" -"PowerWalker" "Line-Interactive VI 600" "" "megatec battvolts=9:13" - -"Powerware" "3110" "" "genericups upstype=7" -"Powerware" "3115" "" "genericups upstype=11" -"Powerware" "5119, 5125" "" "genericups upstype=15" -"Powerware" "5119 RM" "" "genericups upstype=20" -"Powerware" "PW3105" "" "bcmxcp_usb" -"Powerware" "PW5110" "" "bcmxcp_usb" -"Powerware" "PW5115" "Serial port" "bcmxcp" -"Powerware" "PW5115" "USB port" "bcmxcp_usb" -"Powerware" "PW5125" "" "bcmxcp" -"Powerware" "PW9120" "Serial port" "bcmxcp" -"Powerware" "PW9120" "USB port" "bcmxcp_usb" -"Powerware" "PW9125" "" "bcmxcp" -"Powerware" "PW9315" "3-phase" "bcmxcp" -"Powerware" "9110" "" "upscode2" -"Powerware" "9120" "" "upscode2" -"Powerware" "9150" "" "upscode2" -"Powerware" "9305" "" "upscode2" -"Powerware" "BladeUPS (SNMP)" "ConnectUPS Web/SNMP Card" "snmp-ups (experimental)" -"Powerware" "(various)" "ConnectUPS Web/SNMP card" "snmp-ups (experimental)" - -"Powerwell" "PM525A/-625A/-800A/-1000A/-1250A" "" "safenet" - -"Phantom" "Rackable Systems" "1 outlets" "powerman-pdu (experimental)" - -"Raritan" "Intelligent PDU - Dominion PX" "no report, but should be supported" "snmp-ups (experimental)" -"Raritan" "Metered PDU - Raritan PM" "no report, but should be supported" "snmp-ups (experimental)" -"Raritan" "Switched PDU - Raritan RPC" "no report, but should be supported" "snmp-ups (experimental)" - -"Repotec" "RPF525/625/800/1000" "" "safenet" -"Repotec" "RPT-800A" "" "genericups upstype=13" -"Repotec" "RPT-162A" "" "genericups upstype=13" - -"SmartLabs" "2412S Power Line Modem" "for X10/Insteon" "powerman-pdu (experimental)" - -"SMS (Brazil)" "Manager III" "" "megatec" - -"SOLA" "305" "cable INT-0025C" "genericups upstype=7" -"SOLA" "325" "" "bestups" -"SOLA" "520" "" "bestups" -"SOLA" "610" "use ID= in ups.conf" "bestups" -"SOLA" "620" "" "bestups" -"SOLA" "330" "" "megatec" - -"SOLA/BASIC Mexico" "various" "ISBMEX protocol" "isbmex" - -"Socomec" "NeTYS-PE 600VA" "megatec" -"Socomec Sicon" "Egys" "420 VA" "powercom" -"Socomec Sicon" "Netvision" "UPS equipped with Netvision WEB/SNMP card/external box" "snmp-ups (experimental)" - -"Soltec" "Winmate 525/625/800/1000" "" "safenet" - -"Soyntec" "Sekury C 500" "" "megatec" -"Soyntec" "Sekury C 800" "" "megatec" - -"SquareOne Power" "QP1000" "" "megatec" - -"Sun" "ILOM Management Module" "1 outlet" "powerman-pdu (experimental)" - -"SuperPower" "HP360, Hope-550" "" "megatec" - -"SVEN" "Power Pro+ series" "USB" "megatec_usb" -"SVEN" "Power Smart RM 2000" "USB" "megatec_usb" - -"Sweex" "500/1000" "smart - shipped with SafeNet" "safenet" -"Sweex" "500/1000" "" "genericups upstype=7" -"Sweex" "1000" "USB" "richcomm_usb" -"Sweex" "(various)" "" "megatec" - -"Sysgration" "UPGUARDS Pro650" "" "megatec" - -"Tecnoware" "Easy Power 1200" "" "megatec" - -"Tripp-Lite" "INTERNETOFFICE700" "USB" "tripplite_usb" -"Tripp-Lite" "OMNIVS1000" "USB" "tripplite_usb" -"Tripp-Lite" "OMNIVS1500XL" "USB" "tripplite_usb" -"Tripp-Lite" "SMART700USB" "USB" "tripplite_usb" -"Tripp-Lite" "SMART1500RM2U" "USB" "tripplite_usb" -"Tripp-Lite" "SMART550USB" "USB" "tripplite_usb" -"Tripp-Lite" "SMART2200RMXL2U" "USB, older models" "tripplite_usb (experimental)" -"Tripp-Lite" "SmartUPS" "" "tripplite" -"Tripp-Lite" "SmartOnline" "" "tripplitesu" -"Tripp-Lite" "(various)" "Lan 2.2 interface - black 73-0844 cable" "genericups upstype=5" -"Tripp-Lite" "OMNI1000LCD" "USB" "usbhid-ups" -"Tripp-Lite" "OMNI900LCD" "USB" "usbhid-ups" -"Tripp-Lite" "OMNI650LCD" "USB" "usbhid-ups" -"Tripp-Lite" "1500 LCD" "USB" "usbhid-ups" -"Tripp-Lite" "AVR550U" "USB" "usbhid-ups" -"Tripp-Lite" "AVR750U" "USB" "usbhid-ups" -"Tripp-Lite" "ECO550UPS" "USB" "usbhid-ups" -"Tripp-Lite" "SmartOnline SU1500RTXL2ua" "USB" "usbhid-ups" -"Tripp-Lite" "smart2200RMXL2U" "USB, newer models" "usbhid-ups" - -"Trust" "UPS 1000 Management PW-4105" "" "megatec" -"Trust" "UPS 1200VA Management PW-4120M" "" "megatec" -"Trust" "UPS 1300VA Management PW-4130M" "" "megatec" - -"UNITEK" "ALPHA 500 IC" "" "megatec dtr=0 rts=1" -"UNITEK" "Alpha 1000is" "" "megatec" -"UNITEK" "Alpha 500" "" "megatec" -"UNITEK" "Alpha 500 ipE" "" "megatec" -"UNITEK" "Alpha 2600" "" "megatec" -"UNITEK" "Alpha 1200Sx" "USB" "megatec_usb" -"UNITEK" "Alpha 1250xD" "USB" "megatec_usb" - -"UPSonic" "CXR1000" "" "megatec" -"UPSonic" "LAN Saver 600" "" "genericups upstype=0" -"UPSonic" "Power Guardian" "" "genericups upstype=7" -"UPSonic" "PrOffice 650" "USB" "megatec_usb" -"UPSonic" "DS-800" "USB" "megatec_usb" - -"Various" "(various)" "SEC protocol" "gamatronic" -"Various" "(various)" "Generic RUPS model" "genericups upstype=4" -"Various" "(various)" "Generic RUPS 2000 (Megatec M2501 cable)" "genericups upstype=21" -"Various" "(various)" "Q1 / Megatec protocol" "megatec" -"Various" "(various)" "PhoenixTec protocol" "bestups" -"Various" "(various)" "SNMP - RFC 1628" "snmp-ups (experimental)" -"Various" "(various)" "Safenet software" "safenet" - -"Victron/IMV" "(various)" "" "victronups" -"Victron/IMV" "Lite" "crack cable" "genericups upstype=10" - -"Viewsonic" "PowerES" "420E" "optiups" - -"WinPower" "CPM-800" "" "megatec" - -"WTI" "RPS-10" "10 outlets" "powerman-pdu (experimental)" -"WTI" "NPS" "8 outlets" "powerman-pdu (experimental)" diff --git a/data/driver.list.in b/data/driver.list.in new file mode 100644 index 0000000..f5501c7 --- /dev/null +++ b/data/driver.list.in @@ -0,0 +1,761 @@ +# Network UPS Tools - @PACKAGE_VERSION@ - Hardware Compatibility List +# version=2 +# +# This file is used for various purposes, like building the HTML compatibility +# list or displaying information in NUT configuration tools. +# +# If you write a new driver, modify an existing one to add more support, +# or just know about some equipment that isn't listed but should be, +# please send us a patch to update this file. +# +# Format: +# ======= +# +# +# Details: +# ======== +# - device type: +# "ups" for Uninterruptible Power Supply +# "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 +# ** based on fragments of publicly available protocol +# *** based on publicly available protocol +# **** vendor provided protocol +# ***** 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 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" + +"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" + +"AEC" "ups" "1" "MiniGuard UPS 700" "Megatec M2501 cable" "genericups upstype=21" + +"APC" "ups" "1" "Back-UPS Pro" "" "apcsmart" +"APC" "ups" "1" "Matrix-UPS" "" "apcsmart" +"APC" "ups" "1" "Smart-UPS" "" "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 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" "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" +"APC" "ups" "1" "Back-UPS Office" "940-0119A cable" "genericups upstype=12" +"APC" "ups" "1" "Back-UPS RS 500" "custom non-USB cable" "genericups upstype=20" +"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)" "SNMP monitoring card" "snmp-ups (experimental)" + +"Aphel" "pdu" "3" "various PDU" "" "snmp-ups (experimental)" + +"Apollo" "ups" "1" "1000A" "" "genericups upstype=4" +"Apollo" "ups" "1" "1000F" "" "genericups upstype=4" + +"Appro" "pdu" "1" "SWPDU" "48 outlets" "powerman-pdu (experimental)" + +"Atlantis Land" "ups" "2" "A03-P826" "" "blazer_ser" + +"Baytech" "pdu" "1" "RPC3" "8 outlets" "powerman-pdu (experimental)" +"Baytech" "pdu" "1" "RPC3-20NC" "8 outlets" "powerman-pdu (experimental)" +"Baytech" "pdu" "1" "RPC28-30NC" "20 outlets" "powerman-pdu (experimental)" +"Baytech" "pdu" "3" "various RPC" "" "snmp-ups" + +"Belkin" "ups" "2" "Active Battery Backup BU30 series" "USB" "blazer_usb" +"Belkin" "ups" "1" "Home Office F6H350-SER" "" "genericups upstype=7" +"Belkin" "ups" "1" "Home Office F6H500-SER" "" "genericups upstype=7" +"Belkin" "ups" "1" "Home Office F6H650-SER" "" "genericups upstype=7" +"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" "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" +"Belkin" "ups" "2" "Small Enterprise F6C1500-TW-RK" "USB" "usbhid-ups" +"Belkin" "ups" "2" "Universal UPS F6C100-UNV" "USB" "usbhid-ups" +"Belkin" "ups" "1" "Universal UPS F6C120-UNV" "serial port" "belkinunv" +"Belkin" "ups" "2" "Universal UPS F6C120-UNV" "USB" "usbhid-ups" +"Belkin" "ups" "1" "Universal UPS F6C800-UNV" "serial port" "belkinunv" +"Belkin" "ups" "2" "Universal UPS F6C800-UNV" "USB" "usbhid-ups" +"Belkin" "ups" "1" "Universal UPS F6C1100-UNV" "serial port (<= 2005 models)" "belkinunv" +"Belkin" "ups" "2" "Universal UPS F6C1100-UNV" "USB (<= 2005 models, vendor id: 050d)" "usbhid-ups" +"Belkin" "ups" "2" "Universal UPS F6C1100-UNV" "USB (2007 models, vendor id: 0665)" "blazer_usb" +"Belkin" "ups" "2" "Universal UPS F6C1200-UNV" "USB (<= 2005 models, vendor id: 050d)" "usbhid-ups" +"Belkin" "ups" "2" "Universal UPS F6C1200-UNV" "USB (2007 models, vendor id: 0665)" "blazer_usb" +"Belkin" "ups" "2" "Universal UPS F6H350deUNV" "serial port" "blazer_ser" +"Belkin" "ups" "2" "Universal UPS F6H350ukUNV" "serial port" "blazer_ser" +"Belkin" "ups" "2" "Universal UPS F6H500ukUNV" "serial port" "blazer_ser" +"Belkin" "ups" "2" "Universal UPS F6H650ukUNV" "serial port" "blazer_ser" + +"Best Power" "ups" "1" "Fortress (older)" "" "bestfortress" +"Best Power" "ups" "1" "Fortress (newer)" "" "bestups" +"Best Power" "ups" "1" "Fortress Telecom" "" "bestups" +"Best Power" "ups" "1" "Axxium Rackmount" "" "bestups" +"Best Power" "ups" "1" "Patriot Pro" "" "bestups" +"Best Power" "ups" "1" "Patriot Pro II" "" "bestups" +"Best Power" "ups" "1" "Patriot" "INT51 cable" "genericups upstype=6" +"Best Power" "ups" "1" "Micro-Ferrups" "" "bestuferrups" +"Best Power" "ups" "1" "Fortress/Ferrups" "f-command support" "bestfcom" + +"Chloride" "ups" "2" "Desk Power 650" "serial port" "blazer_ser" + +"Cito Power" "ups" "2" "CPG-SR1000" "" "blazer_ser" + +"Clary" "ups" "4" "ST-800" "" "gamatronic" + +"Compaq" "ups" "4" "T1500h" "" "upscode2 use_pre_lf" +"Compaq" "ups" "4" "R3000h" "" "upscode2" +"Compaq" "ups" "4" "R3000 XR" "" "bcmxcp" +"Compaq" "ups" "4" "R5500 XR" "" "bcmxcp" + +"Cyber Power Systems" "ups" "1" "320AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "500AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "650AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "700AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "800AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "850AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "900AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "1250AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "1500AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "Power99" "" "genericups upstype=7" +"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" "1100AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "1200AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "1500AVR-HO" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "PR2200" "" "powerpanel" +"Cyber Power Systems" "ups" "2" "PR3000E" "" "powerpanel" +"Cyber Power Systems" "ups" "2" "685AVR" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "2" "800AVR" "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" "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" "2" "CP1350AVRLCD" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "2" "CP1500AVRLCD" "USB" "usbhid-ups" + +"Cyclades" "pdu" "1" "PM8" "8 outlets" "powerman-pdu (experimental)" +"Cyclades" "pdu" "1" "PM10" "10 outlets" "powerman-pdu (experimental)" + +"Dell" "ups" "5" "Tower 500W LV / HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Tower 500W LV / HV" "Serial port" "newmge-shut" +"Dell" "ups" "5" "Rack/Tower 1000W LV / HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack/Tower 1000W LV / HV" "Serial port" "newmge-shut" +"Dell" "ups" "5" "Rack/Tower 1500W LV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack/Tower 1500W LV" "Serial port" "newmge-shut" +"Dell" "ups" "5" "Rack/Tower 1920W LV / HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack/Tower 1920W LV / HV" "Serial port" "newmge-shut" +"Dell" "ups" "5" "Rack/Tower 2300W LV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack/Tower 2300W LV" "Serial port" "newmge-shut" +"Dell" "ups" "5" "Rack/Tower 2700W LV / HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack/Tower 2700W LV / HV" "Serial port" "newmge-shut" +"Dell" "ups" "5" "Short Depth Rack 2700W Online LV / HV" "High Efficiency, USB port" "usbhid-ups" +"Dell" "ups" "5" "Short Depth Rack 2700W Online LV / HV" "High Efficiency, Serial port" "newmge-shut" +"Dell" "ups" "5" "Rack 3750W High Efficiency Online HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack 3750W High Efficiency Online HV" "Serial port" "newmge-shut" +"Dell" "ups" "5" "Rack 4200W High Efficiency Online HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack 4200W High Efficiency Online HV" "Serial port" "newmge-shut" +"Dell" "ups" "5" "Rack 5600W HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack 5600W HV" "Serial port" "newmge-shut" + +"Delta" "ups" "1" "GES602N" "" "belkin" + +"Deltec" "ups" "1" "PowerRite Pro II" "" "genericups upstype=15" + +"Digital Loggers" "pdu" "1" "LPC, EPCR2, DIN" "8 outlets" "powerman-pdu (experimental)" + +"Digitus" "ups" "2" "DN-170020" "" "blazer_ser" + +"Dynamix" "ups" "2" "UPS1700D" "" "blazer_ser" +"Dynamix" "ups" "2" "UPS-650VA" "" "blazer_ser" + +"Dynex" "ups" "1" "975AVR" "" "genericups upstype=7" +"Dynex" "ups" "2" "DX-800U" "USB" "usbhid-ups" + +"Eaton" "ups" "5" "Protection Station 500/650/800 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" "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" +"Eaton" "ups" "5" "EX 2200/3000/3000 XL VA" "USB port" "usbhid-ups" +"Eaton" "ups" "5" "EX 1000 RT2U / 1500 RT2U" "USB port" "usbhid-ups" +"Eaton" "ups" "5" "MX 5/8/10/15/20 kVA" "USB port" "usbhid-ups" +"Eaton" "ups" "5" "Nova AVR 625/1250" "USB" "usbhid-ups" +"Eaton" "ups" "5" "Ellipse ASR USBS 600/750/1000/1500 VA" "Serial cable" "mge-shut or newmge-shut" +"Eaton" "ups" "5" "Ellipse MAX USBS 600/850/1100/1500 VA" "Serial cable" "mge-shut or newmge-shut" +"Eaton" "ups" "5" "Evolution 650/850/1150/1550/2000 VA" "Serial port" "mge-shut or newmge-shut" +"Eaton" "ups" "5" "Evolution S 1250/1750/2500/3000 VA" "Serial port" "mge-shut or newmge-shut" +"Eaton" "ups" "5" "EX 700/1000/1500 VA" "Serial port" "mge-shut or newmge-shut" +"Eaton" "ups" "5" "EX 2200/3000/3000 XL VA" "Serial port" "mge-shut or newmge-shut" +"Eaton" "ups" "5" "EX 1000 RT2U / 1500 RT2U" "Serial port" "mge-shut or newmge-shut" +"Eaton" "ups" "5" "MX 5/8/10/15/20 kVA" "Serial port" "mge-shut or newmge-shut" +"Eaton" "ups" "5" "EX RT 1:1 7/11 kVA" "" "mge-shut or newmge-shut" +"Eaton" "ups" "5" "EX RT 3:1 5/7/11 kVA" "" "mge-shut or newmge-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" "" "mge-utalk" +"Eaton" "ups" "5" "BladeUPS (SNMP)" "ConnectUPS Web/SNMP 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)" +"Eaton" "ups" "5" "various models (SNMP mode)" "SNMP/Web Minislot card (ref 66244)" "snmp-ups (experimental)" +"Eaton" "pdu" "5" "ePDU Managed" "" "snmp-ups (experimental)" +"Eaton" "pdu" "5" "ePDU Monitored" "" "snmp-ups or netxml-ups" +"Eaton" "ups" "5" "Powerware 9130" "" "bcmxcp or usbhid-ups" +"Eaton" "ups" "5" "Powerware 5130" "" "usbhid-ups" +"Eaton" "ups" "5" "9395" "Serial port" "bcmxcp" +"Eaton" "ups" "5" "Best Ferrups" "older ConnectUPS" "snmp-ups" +"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" + +"Effekta" "ups" "2" "MI/MT/MH" "2502 cable" "blazer_ser" +"Effekta" "ups" "2" "RM2000MH" "" "blazer_ser" + +"Energy Sistem" "ups" "2" "(various)" "" "blazer_ser" + +"ETA" "ups" "1" "mini+UPS" "WinNT/Upsoft cable" "genericups upstype=7" +"ETA" "ups" "1" "mini+UPS PRO" "UPS Explorer cable" "etapro" + +"Ever UPS" "ups" "1" "NET *-DPC" "" "everups" +"Ever UPS" "ups" "1" "AP *-PRO" "" "everups" + +"Ever-Power" "ups" "1" "625/1000" "" "safenet" + +"Exide" "ups" "1" "NetUPS SE" "" "genericups upstype=15" + +"Fenton Technologies" "ups" "1" "PowerPal" "P-series" "safenet" +"Fenton Technologies" "ups" "5" "PowerPal" "L-series" "blazer_ser" +"Fenton Technologies" "ups" "5" "PowerOn" "" "blazer_ser" +"Fenton Technologies" "ups" "5" "PowerPure" "" "blazer_ser" + +"Fairstone" "ups" "1" "L525/L625/L750" "" "safenet" + +"Fideltronik" "ups" "1" "Ares 700 and larger" "" "genericups upstype=6" +"Fideltronik" "ups" "1" "Other Ares models" "" "genericups upstype=19" + +"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" + +"Forza Power Technologies" "ups" "2" "SL-1001" "USB" "blazer_usb" + +"FSP" "ups" "2" "EP650" "USB" "blazer_usb" + +"Gamatronic" "ups" "5" "All models with alarm interface" "" "genericups upstype=22" +"Gamatronic" "ups" "2" "G-SmartCompact 2000" "" "blazer_ser" +"Gamatronic" "ups" "5" "MP110/210" "" "gamatronic" +"Gamatronic" "ups" "5" "MS-T" "" "gamatronic" +"Gamatronic" "ups" "5" "MS" "" "gamatronic" +"Gamatronic" "ups" "5" "µPS3/1" "" "gamatronic" + +"Geek Squad" "ups" "2" "GS1285U" "USB" "usbhid-ups" + +"Gemini" "ups" "1" "UPS625/UPS1000" "" "safenet" + +"HP" "ups" "1" "PowerTrust 2997A" "HP 5061-2575 cable" "apcsmart" +"HP" "ups" "4" "R3000 XR" "" "bcmxcp" +"HP" "ups" "4" "R5500 XR" "" "bcmxcp" +"HP" "ups" "2" "R1500 G2" "" "bcmxcp" +"HP" "ups" "2" "R/T 2200 G2" "" "usbhid-ups" +"HP" "ups" "2" "T500" "older models" "bcmxcp_usb" +"HP" "ups" "2" "T750 INTL" "" "usbhid-ups" +"HP" "ups" "2" "T750" "older models" "bcmxcp_usb" +"HP" "ups" "2" "T1000 INTL" "" "usbhid-ups" +"HP" "ups" "2" "T1500 INTL" "" "usbhid-ups" +"HP" "ups" "2" "T750 G2" "" "usbhid-ups" +"HP" "ups" "2" "R1500 G2 INTL" "" "usbhid-ups" +"HP" "pdu" "1" "HP3488 Switch/Control Unit" "" "powerman-pdu (experimental)" + +"IBM" "pdu" "1" "Blade Center Management Module" "15 outlets" "powerman-pdu (experimental)" + +"ICS" "pdu" "1" "8064 Ethernet Relay Interface" "16 outlets" "powerman-pdu (experimental)" + +"iDowell" "ups" "2" "iBox UPS" "" "usbhid-ups" + +"INELT" "ups" "2" "Monolith 1000LT" "" "blazer_ser" +"INELT" "ups" "2" "Monolith 3000RT" "" "blazer_ser" + +"Inform" "ups" "1" "GUARD" "Line Interactive AP model" "powercom" +"Inform" "ups" "2" "Guard S 1500AP" "" "blazer_ser" +"Inform" "ups" "2" "Informer Compact 1000VA" "" "blazer_ser" + +"Infosec" "ups" "2" "iPEL 350" "" "blazer_ser" +"Infosec" "ups" "2" "iPEL 500" "" "blazer_ser" +"Infosec" "ups" "2" "iPEL 750" "" "blazer_ser" +"Infosec" "ups" "2" "iPEL 1000" "" "blazer_ser" +"Infosec" "ups" "2" "500XP" "" "blazer_ser" +"Infosec" "ups" "2" "XP 500" "USB" "blazer_usb" +"Infosec" "ups" "2" "XP 1000" "" "blazer_ser" + +"IPMI" "pdu" "1" "" "" "powerman-pdu (experimental)" + +"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" "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" +"Ippon" "ups" "2" "Smart Winner 750/1000/1500/2000/3000" "USB" "blazer_usb (experimental)" +"Ippon" "ups" "2" "(various)" "" "blazer_ser" +"Ippon" "ups" "2" "(various)" "USB" "blazer_usb" + +"IVT" "scd" "1" "SCD series" "" "ivtscd" + +"Jageson Technology" "ups" "1" "Jasuny USPS" "" "genericups upstype=4" + +"Kebo" "ups" "2" "1200D/D Series" "" "blazer_ser" + +"Krauler" "ups" "2" "UP-D1200VA" "USB" "blazer_usb" +"Krauler" "ups" "2" "UP-M500VA" "USB" "blazer_usb" + +"Lestar" "ups" "2" "MD-800E" "" "blazer_ser" + +"Liebert" "ups" "2" "ITON 600VA" "" "blazer_ser" +"Liebert" "ups" "5" "UPStation GXT2" "contact-closure cable" "liebert" +"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" + +"LNXI" "pdu" "1" "Icebox" "10 outlets" "powerman-pdu (experimental)" + +"Masterguard" "ups" "1" "(various)" "" "masterguard" + +"Maxxtro" "ups" "2" "UPS 600 VA" "serial port" "blazer_ser" + +"Mecer" "ups" "2" "ME-2000" "" "blazer_ser" + +"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" +"MGE Office Protection Systems" "ups" "5" "Ellipse ASR USBS 600/750/1000/1500 VA" "USB cable" "usbhid-ups" +"MGE Office Protection Systems" "ups" "5" "Ellipse MAX USBS 600/850/1100/1500 VA" "USB cable" "usbhid-ups" +"MGE Office Protection Systems" "ups" "5" "Evolution 650/850/1150/1550/2000 VA" "USB port" "usbhid-ups" +"MGE Office Protection Systems" "ups" "5" "Evolution S 1250/1750/2500/3000 VA" "USB port" "usbhid-ups" +"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 or newmge-shut" +"MGE Office Protection Systems" "ups" "5" "Ellipse MAX USBS 600/850/1100/1500 VA" "Serial cable" "mge-shut or newmge-shut" +"MGE Office Protection Systems" "ups" "5" "Evolution 650/850/1150/1550/2000 VA" "Serial port" "mge-shut or newmge-shut" +"MGE Office Protection Systems" "ups" "5" "Evolution S 1250/1750/2500/3000 VA" "Serial port" "mge-shut or newmge-shut" +"MGE Office Protection Systems" "ups" "5" "Pulsar 700/1000/1500 VA" "Serial port" "mge-shut or newmge-shut" +"MGE Office Protection Systems" "ups" "5" "Pulsar M 2200/3000 VA" "Serial port" "mge-shut or newmge-shut" +"MGE Office Protection Systems" "ups" "5" "Pulsar MX 5/8/10/15/20 kVA" "Serial port" "mge-shut or newmge-shut" +"MGE Office Protection Systems" "ups" "5" "Comet EX RT 1:1 7/11 kVA" "" "mge-shut or newmge-shut" +"MGE Office Protection Systems" "ups" "5" "Comet EX RT 3:1 5/7/11 kVA" "" "mge-shut or newmge-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)" +"MGE Office Protection Systems" "ups" "5" "various models (SNMP mode)" "NMC Minislot (Ref 66102)" "snmp-ups (experimental)" +"MGE Office Protection Systems" "ups" "5" "various models (XML/HTTP mode)" "SNMP/Web Minislot card (ref 66244)" "netxml-ups (experimental)" +"MGE Office Protection Systems" "ups" "5" "various models (SNMP mode)" "SNMP/Web Minislot card (ref 66244)" "snmp-ups (experimental)" + +"MGE UPS SYSTEMS" "ups" "5" "Comet EX RT" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Comet EX RT 3:1" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Protection Center 420" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Protection Center 500" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Protection Center 675" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "NOVA AVR 600 USB" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "NOVA AVR 1100 USB" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse USBS" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse USB" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse Premium USBS" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse Premium USB" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 600" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 750" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 1000" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 1500" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 600" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 850" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 1100" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 1500" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Evolution" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 650" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 850" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 1150" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Evolution S 1250" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 1550" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Evolution S 1750" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 2000" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Evolution S 2500" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Evolution S 3000" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar M 2200" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar M 3000" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar M 3000 XL" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 700" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1000" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1500" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1000 RT2U" "USB" "usbhid-ups" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1500 RT2U" "USB" "usbhid-ups" +"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 or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "NOVA AVR 1100 Serial" "" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse USBS" "Serial cable" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse S" "" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse Premium USBS" "Serial cable" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse Premium S" "" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 600" "Serial cable" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 750" "Serial cable" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 1000" "Serial cable" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 1500" "Serial cable" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 600" "Serial cable" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 850" "Serial cable" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 1100" "Serial cable" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 1500" "Serial cable" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar EXtreme C / EX RT" "" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Comet EX RT" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Comet EX RT 3:1" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Esprit" "" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 650" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 850" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 1150" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution S 1250" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 1550" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution S 1750" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 2000" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution S 2500" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution S 3000" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar M 2200" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar M 3000" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar M 3000 XL" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 700" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1000" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1500" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1000 RT2U" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1500 RT2U" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar MX 4000 RT" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar MX 5000 RT" "Serial port" "mge-shut or newmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Evolution" "Serial port" "mge-shut or newmge-shut or mge-utalk" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar EXtreme C" "" "mge-shut or newmge-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" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar ESV" "" "mge-utalk" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar EX" "" "mge-utalk" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar EXL" "" "mge-utalk" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar PSX" "" "mge-utalk" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar SX" "" "mge-utalk" +"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 or newmge-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)" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar (XML/HTTP mode)" "SNMP/Web Minislot card (ref 66244)" "netxml-ups (experimental)" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar (XML/HTTP mode)" "SNMP/Web Minislot card (ref 66244)" "netxml-ups (experimental)" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar (SNMP mode)" "SNMP/Web Minislot card (ref 66244)" "snmp-ups (experimental)" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar / Comet / Galaxy (SNMP)" "SNMP card (ref 66062)" "snmp-ups (experimental)" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar (SNMP)" "SNMP card (ref 66045)" "snmp-ups (experimental)" +"MGE UPS SYSTEMS" "ups" "5" "UM-Link (SNMP)" "Not a UPS (ref 66850)" "snmp-ups (experimental)" + +"MicroDowell" "ups" "1" "B.Box BP 500" "" "powerpanel" +"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" "5" "Enterprise B8" "" "microdowell" +"MicroDowell" "ups" "5" "Enterprise B10" "" "microdowell" +"MicroDowell" "ups" "5" "Enterprise N8" "" "microdowell" +"MicroDowell" "ups" "5" "Enterprise N11" "" "microdowell" +"MicroDowell" "ups" "5" "Enterprise N15" "" "microdowell" +"MicroDowell" "ups" "5" "Enterprise N20" "" "microdowell" +"MicroDowell" "ups" "5" "Enterprise N22" "" "microdowell" +"MicroDowell" "ups" "5" "Enterprise N30" "" "microdowell" +"MicroDowell" "ups" "5" "Enterprise N40" "" "microdowell" +"MicroDowell" "ups" "5" "Enterprise N50" "" "microdowell" +"MicroDowell" "ups" "5" "Enterprise N60" "" "microdowell" +"MicroDowell" "ups" "5" "Enterprise HiBox ST" "" "microdowell" + +"Microsol" "ups" "4" "Solis 1.0" "1000VA" "solis" +"Microsol" "ups" "4" "Solis 1.5" "1500VA" "solis" +"Microsol" "ups" "4" "Solis 2.0" "2000VA" "solis" +"Microsol" "ups" "4" "Solis 3.0" "3000VA" "solis" +"Microsol" "ups" "5" "Rhino 6.0" "6000VA" "rhino" +"Microsol" "ups" "5" "Rhino 7.5" "7500VA" "rhino" +"Microsol" "ups" "5" "Rhino 10.0" "10000VA" "rhino" +"Microsol" "ups" "5" "Rhino 20.0" "20000VA" "rhino" + +"Mustek" "ups" "2" "Powermust" "400VA Plus" "blazer_ser" +"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" "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" "Various" "" "blazer_ser" + +"Neus" "ups" "2" "400va / 600va" "" "blazer_ser" + +"Nitram" "ups" "1" "Elite 500" "" "genericups upstype=8" +"Nitram" "ups" "1" "Elite 2002" "" "genericups upstype=16" +"Nitram" "ups" "1" "Elite 2005" "" "powerpanel" + +"Oneac" "ups" "1" "ON400" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON600" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON900" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON1300" "advanced interface" "oneac" +"Oneac" "ups" "1" "EG Series" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON700" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON700XAU" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON700XIU" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON1000" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON1000XAU" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON1000XIU" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON1500" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON1500XAU" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON1500XIU" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON2000" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON2000XAU" "advanced interface" "oneac" +"Oneac" "ups" "1" "ON2000XIU" "advanced interface" "oneac" + +"Online" "ups" "1" "P-Series" "" "genericups upstype=14" +"Online" "ups" "1" "Zinto D" "" "optiups" + +"OnLite" "ups" "2" "AQUA" "50" "blazer_ser" + +"Opti-UPS" "ups" "1" "PowerES" "420E" "optiups" + +"Orvaldi Power Protection" "ups" "2" "various" "not 400 or 600" "blazer_ser" + +"Phasak" "ups" "2" "400VA / 600VA" "" "blazer_ser" + +"Plexus" "ups" "2" "500VA" "USB" "blazer_usb" +"Plexus" "ups" "2" "1000VA Pro" "USB" "blazer_usb" + +"Powercom" "ups" "4" "SMK" "" "blazer_ser" +"Powercom" "ups" "4" "SXL" "" "blazer_ser" +"Powercom" "ups" "4" "ULT" "" "blazer_ser" +"Powercom" "ups" "4" "Trust 425/625" "" "powercom" +"Powercom" "ups" "4" "Advice Partner/King Pr750" "" "powercom" +"Powercom" "ups" "4" "Black Knight PRO" "" "powercom" +"Powercom" "ups" "5" "Black Knight PRO" "USB (2009 models, product id: 00a6)" "usbhid-ups (experimental)" +"Powercom" "ups" "4" "Smart KING Pro (all Smart series)" "" "powercom" +"Powercom" "ups" "5" "Smart KING Pro (all Smart series)" "USB (2009 models, product id: 00a3)" "usbhid-ups (experimental)" +"Powercom" "ups" "4" "Imperial" "" "powercom" +"Powercom" "ups" "5" "Imperial" "USB (2009 models, product id: 00a2)" "usbhid-ups (experimental)" +"Powercom" "ups" "4" "Vanguard" "" "blazer_ser" +"Powercom" "ups" "5" "Vanguard" "USB (2009 models, product id: 00a5)" "usbhid-ups (experimental)" +"Powercom" "ups" "4" "WOW" "USB (<= 2009 models, product id: 0002)" "powercom (requires 'usbserial' kernel module)" +"Powercom" "ups" "5" "WOW" "USB (2009 models, product id: 00a4)" "usbhid-ups (experimental)" +"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)" + +"PowerGuard" "ups" "2" "PG-600" "" "blazer_ser" + +"PowerKinetics" "ups" "1" "9001" "" "genericups upstype=17" +"PowerKinetics" "ups" "2" "BlackOut Buster" "" "blazer_ser" + +"PowerMan" "ups" "2" "RealSmart 800" "" "blazer_ser" +"PowerMan" "ups" "2" "RealSmart 1000" "" "blazer_ser" +"PowerMan" "ups" "1" "BackPro" "" "genericups upstype=4" + +"PowerTech" "ups" "1" "Comp1000" "DTR cable power" "genericups upstype=3" +"PowerTech" "ups" "2" "SMK-800" "" "blazer_ser" + +"PowerWalker" "ups" "2" "Line-Interactive VI 1000" "" "blazer_ser" +"PowerWalker" "ups" "2" "Line-Interactive VI 400/800" "" "blazer_ser" +"PowerWalker" "ups" "2" "Line-Interactive VI 600" "" "blazer_ser" +"PowerWalker" "ups" "2" "Line-Interactive VI 1400" "" "blazer_usb" + +"Powerware" "ups" "4" "3110" "" "genericups upstype=7" +"Powerware" "ups" "4" "3115" "" "genericups upstype=11" +"Powerware" "ups" "4" "5119, 5125" "" "genericups upstype=15" +"Powerware" "ups" "4" "5119 RM" "" "genericups upstype=20" +"Powerware" "ups" "5" "5119 RM" "" "upscode2" +"Powerware" "ups" "5" "PW3105" "" "bcmxcp_usb" +"Powerware" "ups" "5" "PW5110" "" "bcmxcp_usb" +"Powerware" "ups" "5" "PW5115" "Serial port" "bcmxcp" +"Powerware" "ups" "5" "PW5115" "USB port" "bcmxcp_usb" +"Powerware" "ups" "5" "PW5125" "" "bcmxcp" +"Powerware" "ups" "5" "PW9120" "Serial port" "bcmxcp" +"Powerware" "ups" "5" "PW9120" "USB port" "bcmxcp_usb" +"Powerware" "ups" "5" "PW9125" "" "bcmxcp" +"Powerware" "ups" "5" "PW9315" "3-phase" "bcmxcp" +"Powerware" "ups" "5" "9110" "" "upscode2" +"Powerware" "ups" "5" "9120" "" "upscode2" +"Powerware" "ups" "5" "9150" "" "upscode2" +"Powerware" "ups" "5" "9305" "" "upscode2" +"Powerware" "ups" "5" "BladeUPS (SNMP)" "ConnectUPS Web/SNMP Card" "snmp-ups (experimental)" +"Powerware" "ups" "5" "(various)" "ConnectUPS Web/SNMP card" "snmp-ups (experimental)" + +"Powerwell" "ups" "1" "PM525A/-625A/-800A/-1000A/-1250A" "" "safenet" + +"Phantom" "pdu" "1" "Rackable Systems" "1 outlets" "powerman-pdu (experimental)" + +"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)" + +"Repotec" "ups" "1" "RPF525/625/800/1000" "" "safenet" +"Repotec" "ups" "1" "RPT-800A" "" "genericups upstype=13" +"Repotec" "ups" "1" "RPT-162A" "" "genericups upstype=13" + +"Rocketfish" "ups" "2" "RF-1000VA / RF-1025VA" "" "usbhid-ups" + +"SmartLabs" "pdu" "1" "2412S Power Line Modem" "for X10/Insteon" "powerman-pdu (experimental)" + +"SMS (Brazil)" "ups" "2" "Manager III" "" "blazer_ser" + +"SOLA" "ups" "1" "305" "cable INT-0025C" "genericups upstype=7" +"SOLA" "ups" "1" "325" "" "bestups" +"SOLA" "ups" "1" "520" "" "bestups" +"SOLA" "ups" "1" "610" "use ID= in ups.conf" "bestups" +"SOLA" "ups" "1" "620" "" "bestups" +"SOLA" "ups" "4" "330" "" "blazer_ser" + +"SOLA/BASIC Mexico" "ups" "1" "various" "ISBMEX protocol" "isbmex" + +"Socomec" "ups" "2" "NeTYS-PE 600VA" "" "blazer_ser" +"Socomec Sicon" "ups" "1" "Egys" "420 VA" "powercom" +"Socomec Sicon" "ups" "3" "Netvision" "UPS equipped with Netvision WEB/SNMP card/external box" "snmp-ups (experimental)" + +"Soltec" "ups" "1" "Winmate 525/625/800/1000" "" "safenet" + +"Soyntec" "ups" "2" "Sekury C 500" "" "blazer_ser" +"Soyntec" "ups" "2" "Sekury C 800" "" "blazer_ser" + +"SquareOne Power" "ups" "2" "QP1000" "" "blazer_ser" + +"Sun" "pdu" "1" "ILOM Management Module" "1 outlet" "powerman-pdu (experimental)" + +"SuperPower" "ups" "2" "HP360, Hope-550" "" "blazer_ser" + +"SVEN" "ups" "2" "Power Pro+ series" "USB" "blazer_usb" +"SVEN" "ups" "2" "Power Smart RM 2000" "USB" "blazer_usb" + +"Sweex" "ups" "1" "500/1000" "smart - shipped with SafeNet" "safenet" +"Sweex" "ups" "1" "500/1000" "" "genericups upstype=7" +"Sweex" "ups" "1" "1000" "USB" "richcomm_usb" +"Sweex" "ups" "2" "(various)" "" "blazer_ser" + +"Sysgration" "ups" "2" "UPGUARDS Pro650" "" "blazer_ser" + +"Tecnoware" "ups" "2" "Easy Power 1200" "" "blazer_ser" + +"Tripp-Lite" "ups" "1" "INTERNETOFFICE700" "USB" "tripplite_usb" +"Tripp-Lite" "ups" "2" "OMNIVS1000" "USB" "tripplite_usb" +"Tripp-Lite" "ups" "1" "OMNIVS1500XL" "USB" "tripplite_usb" +"Tripp-Lite" "ups" "1" "SMART700USB" "USB" "tripplite_usb" +"Tripp-Lite" "ups" "1" "SMART1500RM2U" "USB" "tripplite_usb" +"Tripp-Lite" "ups" "1" "SMART550USB" "USB" "tripplite_usb" +"Tripp-Lite" "ups" "1" "SMART2200RMXL2U" "USB, older models" "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" "OMNI1000LCD" "USB" "usbhid-ups" +"Tripp-Lite" "ups" "2" "OMNI900LCD" "USB" "usbhid-ups" +"Tripp-Lite" "ups" "2" "OMNI650LCD" "USB" "usbhid-ups" +"Tripp-Lite" "ups" "2" "1500 LCD" "USB" "usbhid-ups" +"Tripp-Lite" "ups" "2" "AVR550U" "USB" "usbhid-ups" +"Tripp-Lite" "ups" "2" "AVR750U" "USB" "usbhid-ups" +"Tripp-Lite" "ups" "2" "ECO550UPS" "USB" "usbhid-ups" +"Tripp-Lite" "ups" "2" "SmartOnline SU1500RTXL2ua" "USB" "usbhid-ups" +"Tripp-Lite" "ups" "2" "smart2200RMXL2U" "USB, newer models" "usbhid-ups" + +"Trust" "ups" "2" "UPS 1000 Management PW-4105" "" "blazer_ser" +"Trust" "ups" "2" "UPS 1200VA Management PW-4120M" "" "blazer_ser" +"Trust" "ups" "2" "UPS 1300VA Management PW-4130M" "" "blazer_ser" + +"UNITEK" "ups" "2" "ALPHA 500 IC" "" "blazer_ser" +"UNITEK" "ups" "2" "Alpha 1000is" "" "blazer_ser" +"UNITEK" "ups" "2" "Alpha 500" "" "blazer_ser" +"UNITEK" "ups" "2" "Alpha 500 ipE" "" "blazer_ser" +"UNITEK" "ups" "2" "Alpha 2600" "" "blazer_ser" +"UNITEK" "ups" "2" "Alpha 1200Sx" "USB" "blazer_usb" +"UNITEK" "ups" "2" "Alpha 1250xD" "USB" "blazer_usb" + +"UPSonic" "ups" "2" "CXR1000" "" "blazer_ser" +"UPSonic" "ups" "1" "LAN Saver 600" "" "genericups upstype=0" +"UPSonic" "ups" "1" "Power Guardian" "" "genericups upstype=7" +"UPSonic" "ups" "2" "PrOffice 650" "USB" "blazer_usb" +"UPSonic" "ups" "2" "DS-800" "USB" "blazer_usb" + +"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" +"Various" "ups" "2" "(various)" "Q1 / Megatec protocol" "blazer_ser" +"Various" "ups" "2" "(various)" "PhoenixTec protocol" "bestups" +"Various" "ups" "3" "(various)" "SNMP - RFC 1628" "snmp-ups (experimental)" +"Various" "ups" "1" "(various)" "Safenet software" "safenet" + +"Victron/IMV" "ups" "1" "(various)" "" "victronups" +"Victron/IMV" "ups" "1" "Lite" "crack cable" "genericups upstype=10" + +"Viewsonic" "ups" "1" "PowerES" "420E" "optiups" + +"WinPower" "ups" "2" "CPM-800" "" "blazer_ser" + +"WTI" "pdu" "1" "RPS-10" "10 outlets" "powerman-pdu (experimental)" +"WTI" "pdu" "1" "NPS" "8 outlets" "powerman-pdu (experimental)" diff --git a/data/epdu-managed.dev b/data/epdu-managed.dev new file mode 100644 index 0000000..731b738 --- /dev/null +++ b/data/epdu-managed.dev @@ -0,0 +1,70 @@ +# dummy-ups example device definition file +# +# Generated using: +# $ upsc ups@host > epdu-managed.dev + +device.mfr: EATON | Powerware +device.model: DBQ10634/5 +device.serial: ADO6750531 +device.type: pdu +driver.name: snmp-ups +driver.parameter.pollinterval: 2 +driver.parameter.port: somewhere.org +driver.version: 2.3.0-1540MS +driver.version.internal: 0.44 (mib: aphel_revelation 0.2) +outlet.1.current: 0.00 +outlet.1.current.maximum: 0.00 +outlet.1.desc: Outlet 1 +outlet.1.id: 1 +outlet.1.power: 0.00 +outlet.1.powerfactor: 0.05 +outlet.1.realpower: 0.00 +outlet.1.status: on +outlet.1.switchable: 0.00 +outlet.1.voltage: 247.00 +outlet.2.current: 0.00 +outlet.2.current.maximum: 0.16 +outlet.2.desc: Outlet 2 +outlet.2.id: 2 +outlet.2.power: 0.00 +outlet.2.powerfactor: 0.01 +outlet.2.realpower: 0.00 +outlet.2.status: on +outlet.2.switchable: 1.00 +outlet.2.voltage: 247.00 +outlet.3.current: 0.00 +outlet.3.current.maximum: 0.16 +outlet.3.desc: Outlet 3 +outlet.3.id: 3 +outlet.3.power: 0.00 +outlet.3.powerfactor: 0.13 +outlet.3.realpower: 0.00 +outlet.3.status: on +outlet.3.switchable: 2.00 +outlet.3.voltage: 247.00 +outlet.4.current: 0.19 +outlet.4.current.maximum: 0.56 +outlet.4.desc: Outlet 4 +outlet.4.id: 2 +outlet.4.power: 46.00 +outlet.4.powerfactor: 0.60 +outlet.4.realpower: 28.00 +outlet.4.status: on +outlet.4.switchable: 3.00 +outlet.4.voltage: 247.00 +outlet.count: 4.00 +outlet.current: 0.19 +outlet.desc: All outlets +outlet.id: 0 +outlet.power: 46.00 +outlet.realpower: 28.00 +outlet.voltage: 247.00 +ups.firmware: 01.01.00 +ups.id: my_device234 +ups.macaddr: +ups.mfr: EATON | Powerware +ups.model: DBQ10634/5 +ups.serial: ADO6750531 +ups.status: +ups.temperature: 49.00 +device.type: pdu diff --git a/data/evolution500.dev b/data/evolution500.seq similarity index 86% rename from data/evolution500.dev rename to data/evolution500.seq index 697d2a1..60e7966 100644 --- a/data/evolution500.dev +++ b/data/evolution500.seq @@ -1,4 +1,9 @@ -# dummy-ups example definition file ; generated with "upsc ups@host > evolution500.dev" +# dummy-ups example power sequence file +# +# Base is the same as .dev files, generated using: +# $ upsc ups@host > evolution500.seq +# +# TIMER have then been added to generate power events. battery.charge: 90 battery.charge.low: 30 diff --git a/data/html/Makefile.in b/data/html/Makefile.in index 09ccc72..7685a37 100644 --- a/data/html/Makefile.in +++ b/data/html/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -39,12 +39,13 @@ 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_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -54,6 +55,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -90,9 +92,11 @@ am__base_list = \ am__installdirs = "$(DESTDIR)$(htmldir)" "$(DESTDIR)$(htmldir)" DATA = $(dist_html_DATA) $(nodist_html_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -105,8 +109,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -123,7 +129,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -134,22 +139,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ diff --git a/docs/FAQ b/docs/FAQ deleted file mode 100644 index 0a48607..0000000 --- a/docs/FAQ +++ /dev/null @@ -1,822 +0,0 @@ -Desc: Frequently Asked Questions -File: FAQ -Date: 20 January 2006 -Auth: Russell Kroll - Arnaud Quette - ------------------------------------------------------------------------------ - - Q: I just upgraded, and ... - - A: You have read 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. - ------------------------------------------------------------------------------ - - Q: upsstats says "Error: can't open template file (upsstats.html)". - How do I fix this? - - A: 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-cgi-conf' and can - also be found inside the source distribution in the conf directory. - ------------------------------------------------------------------------------ - - Q: upsmon fails the login and says "username required" now. - - A: Go read the UPGRADING file again. - ------------------------------------------------------------------------------ - - Q: My 1.4 CGI programs won't talk to my 2.0 upsd. What should I do? - - A: Upgrade the CGI programs to 2.0. While 1.4 was intended as a - compatibility tree that used the new protocol by default, the CGI - programs were not upgraded at the same time. The 1.4 versions - still use the old REQ protocol, and your 2.0 upsd expects GET. - ------------------------------------------------------------------------------ - - Q: I just upgraded from 1.2 and upsmon now fails to start, saying - "Fatal error: insufficient power configured!". Why? - - A: You didn't read the top of the error, where upsmon says that it - ignored the invalid MONITOR line because UPS directives now require - a UPS name. It also means you didn't see the same warning in - UPGRADING. - - At least you saw this in the FAQ before asking the list. - ------------------------------------------------------------------------------ - - Q: My UPS driver now says it's "broken", and won't start. What now? - - Q: My favorite UPS driver disappeared after an upgrade. What now? - - A: Drivers are occasionally removed from the tree if they are no longer - receiving maintenance, or sometimes renamed to better reflect their - hardware support scope or replaced by a more generic driver. - There have been several architectural changes to the driver code - in recent times, and drivers which were not converted by someone - are eventually dropped. - - This is called progress. We do this in order to avoid a situation - where someone believes that a driver is being maintained when it is - actually rotting slowly in the tree. It also keeps the tree free of - old compatibility hacks for code that nobody actually uses anyway. - - To get a driver back into current releases, you need to convert it - yourself or get someone to do it for you. This is not difficult. - The hardest part of any driver is decoding the protocol, and that's - already been done in the old version. - ------------------------------------------------------------------------------ - - Q: I just upgraded and now I can't talk to older versions. - - A: Version 2.0 can't communicate with anything before 1.4 due to the - protocol changes. Version 1.4 can communicate with both 2.0 and - most older versions since it was a transitional release and has - compatibility code for both protocols. - ------------------------------------------------------------------------------ - - Q: My UPS driver program won't work. I'm starting it as root, and root - owns the device, so what's the problem? - - A: 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 - may be changed at compile-time by using configure --with-user. - - Read the error message. If you have a permissions mismatch, then - 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 - 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 - account (perhaps called "ups" or "nut"), and use that instead. - - Also, scroll down to the "security domains" question to see an - even better way of restricting privileged operations. Neither the - drivers nor upsd ever need root powers, and that answer tells you - how to make it work. - - A: You can also specify a user with "user=" in the global part of - ups.conf. Just define it before any of your [sections]: - - user = nut - - [myups] - driver = mge-shut - port = /dev/ttyS0 - ------------------------------------------------------------------------------ - - Q: upsc, upsstats, and the other clients say "access denied". The device - communication port (serial, USB or network) permissions are fine, so what - gives? - - A: In this case, "access denied" means the access to upsd, not the device - communication port. You're being denied since the system has no - permission to speak to upsd according to the access controls. - - There can be various reasons. To fix it, check: - - the LISTEN directive in upsd.conf. It should allow your local or remote - access method, - - your firewall rules. Port 3493/tcp must be opened to incoming connexions, - - your tcp-wrappers configuration (hosts.allow and hosts.deny). - - Refer to the upsd(8) and upsd.conf(5) manpages for more information. - ------------------------------------------------------------------------------ - - Q: I have an APC Smart-UPS connected with a grey APC 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? - - A: The problem lies in your choice of cable. APC's grey cables - 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. - - Note that the 940-0095B happens to be a grey cable, but it is actually - a dual mode cable and can be used in smart mode. If you have - this cable, you need to edit your ups.conf to look like this: - - [myups] - driver = apcsmart - port = /dev/whatever - cable = 940-0095B - - All other grey cables from APC are assumed to be "dumb". - - 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. - - See this URL for a handy diagram: - - http://random.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 - you to build a good clone of APC's 940-0024C cable. - - There are simpler solutions involving 3 wires that work just fine - too, but Powerchute won't find the loopback DTR-DCD and RTS-CTS and - will be annoyed. If you don't ever plan to use Powerchute, 3 wires - (RxD, TxD, GND) are sufficient. - - It should also be noted that the genericups driver has no way to - detect the UPS, so it will fire up quite happily if it can open the - serial port. Merely having it start up is not necessarily an - indication of success. You should start it and then check the - status with upsc or similar to be sure that it's reading the - hardware properly. - ------------------------------------------------------------------------------ - - Q: Why does configure fail to find gd? - - A: Recent versions of gd should be detected automatically through the - gdlib-config script. Note that gd 2.0.5 through 2.0.7 have an - unusable script, so upgrade to the newest version if you have one - of those installed. - - If you're stuck with an older version of gd, you can use it if you - specify the flags manually. Look in gd's Makefile for "LIBS=", - then use that value when you call configure: - - ./configure --with-gd-libs="" --with-cgi - - If you don't have gd's Makefile available for some reason, you're - in for a lot of trial and error. - ------------------------------------------------------------------------------ - - Q: Why PNG? You used to generate GIF bars with upsimage back in 1998 - or 1999... - - A: http://www.burnallgifs.org/ - ------------------------------------------------------------------------------ - - Q: Why doesn't upsd implement the functionality of upsmon? I have to - run THREE programs to monitor my UPS! - - A: 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. - - Yes, the machine with the UPS attached will generally have 3 - processes (driver, upsd, upsmon) running, but this design allows a - much bigger setup. Imagine a data room with a bunch of machines - all drawing power from the same UPS. The rest of them just run - upsmon. - - 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 data-room.txt for more configuration ideas and explanations. - - A: 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. - - This is also a good option to consider if you can't use networked - monitoring code for security or safety reasons. - - See ideas.txt for more on this and other related topics. - ------------------------------------------------------------------------------ - - Q: Why isn't upssched part of upsmon? - - A: Most users will never have any reason to use upssched. It's - complicated, and getting it right for your situation can be tricky. - Having it live in a separate program saves resources and lets most - people avoid it completely. - ------------------------------------------------------------------------------ - - Q: Why doesn't upsmon send a SIGPWR signal to init so it can deal with - power events? - - A: New versions of the init man page taken from the sysvinit package - are saying that usage of SIGPWR is discouraged, since /dev/initctl - control channel is the preferred way of communication. - - A: The name of the game is portability. Not everyone's init handles - that kind of signalling gracefully. What's more, some admins - might want to do things differently even if they have that kind of - init running. - - So, to be compatible, upsmon just invokes a shell command. If you - want to use init's SIGPWR stuff, just put the right "kill" line in - a shell script and make upsmon call it. Everyone wins. - ------------------------------------------------------------------------------ - - Q: Why can't upsset read my upsset.passwd file? - - A: You have an old version of upsset installed, since the current - version doesn't use that file. Install a new version and then try - it again. - - Be sure to secure your CGI directory as instructed in the - upsset.conf. - ------------------------------------------------------------------------------ - - Q: Why won't bestups talk to my Best Fortress UPS? - - A: 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. - - 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. - ------------------------------------------------------------------------------ - - Q: What's this about "data stale"? - - A: It means your UPS driver hasn't updated things in a little while. - upsd refuses to serve up data that isn't fresh, so you get the - errors about staleness. - - 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. - - 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 - intervals. Use caution when adjusting this number, since it - 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 - are temporarily marked stale even though everything is fine. This - 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. - ------------------------------------------------------------------------------ - - Q: Why do the client programs say "Driver not connected" when I try - to run them? - - A: 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 - 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 - document, you probably started upsd by itself. You have to run - 'upsdrvctl start' to start the drivers after configuring ups.conf. - ------------------------------------------------------------------------------ - - Q: Everything works perfectly during the shutdown, and the UPS comes - back on, but my system stays off. What's happening? - - A: Assuming you don't have the problem in the next question, then you - probably have an ATX motherboard, have APM or ACPI enabled in your - kernel (assuming Linux here), and are reaching the 'halt' at the - bottom of your shutdown scripts. - - Your machine obeys and shuts down, and stays down, since it - remembers the 'last state' when the UPS restarts. - - One solution is to change your shutdown scripts so you never reach - 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 ...) - - if (test -f /etc/killpower) - then - /usr/local/ups/bin/upsdrvctl shutdown - - sleep 600 # this should never return - - # uh oh, we never got shut down! (power race?) - reboot - fi - - halt -p - - The other solution is to change your BIOS setting to "always power - on" instead of "last state", assuming that's possible. - ------------------------------------------------------------------------------ - - Q: My system has an ATX power supply. It will power off just fine, but - it doesn't turn back on. What can I do to fix this? - - A: This depends on how clueful your motherboard manufacturer is, and - isn't a matter of the OS. You have to do one of the following - 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 - - - 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 - when the outage is over. - - This might work, but it creates high produce bills. - - If you can't use one of the first two options, give the board to - an enemy. Let them worry about it. - ------------------------------------------------------------------------------ - - Q: My PowerMac G4 won't power back up by itself (into Linux) after the - UPS shuts down. What can I do about this? - - A: This is about the same situation as the ATX question above, only - worse. Earlier Macs apparently supported a hack where you could - 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 - - Unfortunately, the hardware has evolved and there is no good - equivalent for this hack on today's systems. - - If you find out how to do this, please send me some mail, since - this affects one of my systems and my stop-gap solution is getting - cranky. - - Note: this question has been in the FAQ for over a year and - there's still no 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. - - 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 - solution. - - A: If you're on OS X, this is relatively simple to fix. Go to system - preferences, click on energy saver, click on the options tab, check - "Restart automatically after a power failure". - - If you're on some other OS, hope they've figured out how to duplicate - the above in a non-simian manner. - ------------------------------------------------------------------------------ - - Q: I want to keep the drivers and upsd in their own security domains. - How can this be accomplished? - - A: Using a few role accounts and a common group, you can limit access - to resources such as the serial port(s) leading to the UPS - hardware. - - This is just an example. Change the values to suit your systems. - - Create a user called 'nutdev' and another called 'nutsrv'. Put - them both in a group called 'nut'. - - Change the owner of any serial ports that will be used to nutdev, - and set the mode to 0600. Then change the ownership of your state - directory (usually /var/state/ups) to nutdev.nut. - - For my development system this yields the following /dev entries: - - 0 crw------- 1 nutdev tty 4, 64 Sep 3 17:11 /dev/ttyS0 - 0 crw------- 1 nutdev tty 4, 65 Sep 3 17:11 /dev/ttyS1 - - Switch to root, then start the drivers: - - # /usr/local/ups/bin/upsdrvctl -u nutdev start - - The listing for /var/state/ups then looks like this: - - 4 drwxrwx--- 2 nutdev nut 4096 Aug 20 18:37 . - 4 drwxr-xr-x 4 root root 4096 May 14 21:20 .. - 4 srw-rw---- 1 nutdev nut 0 Sep 3 17:10 apcsmart-ttyS0 - 4 srw-rw---- 1 nutdev nut 0 Sep 3 17:10 megatec-ttyS1 - - You may have to remove old socket or state files first if you are - changing to this security scheme from an older version. The drivers - will create new files with the right owners and modes. - - Note that /var/state/ups is group writable since upsd will - place the upsd.pid file here. - - You may have to change the groups of upsd.conf and upsd.users to - make them readable. These files should not be owned by nutsrv, - since someone could compromise the daemon and change the config - files. Instead, put nutsrv in a group ("nut" in this example), then - make the files owned by root.nut, with mode 0640. - - Once the config files are ready, start upsd: - - # /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 chroot.txt for more details. - ------------------------------------------------------------------------------ - - Q: What's the point of that 'security domains' concept above? - - A: The point is limiting your losses. If someone should happen to - break into upsd in that environment, they should only gain access - 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.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 - run the programs this way locally. You should definitely consider - using this technique. - ------------------------------------------------------------------------------ - - Q: How can I make upsmon shut down my system after some fixed interval? - - A: 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 upssched.txt or the upssched man - page for some ideas. - ------------------------------------------------------------------------------ - - Q: Why doesn't upsmon shut down my system? I pulled the plug and nothing - happened. - - A: Wait. upsmon doesn't consider a UPS to be critical until it's both - 'on battery' and 'low battery' at the same time. This is by design. - Nearly every UPS supports the notion of detecting the low battery - all by itself. When the voltage drops below a certain point, it - _will_ let you know about it. - - If your system has a really complicated shutdown procedure, you - might need to shut down before the UPS raises the low battery flag. - For most users, however, the default behavior is adequate. - - Ask yourself this: why buy a nice big UPS with the matching battery - and corresponding runtime and then shutdown early? If anything, I'd - rather have a few more minutes running on battery during which the - power might return. Once the power's back, it's business as usual - with no visible interruption in service. - - If you purposely shut down early, you guarantee an interruption in - service by bringing down the box. - - See upssched.txt for information on how you can shutdown early if - this is what you really want to do. - ------------------------------------------------------------------------------ - - Q: The CGI programs report "access to that host is not authorized" - - what's going on? - - A: 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 - 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. - - 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. - ------------------------------------------------------------------------------ - - Q: upsd is running, so why can't I connect to it? - - A: 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. - ------------------------------------------------------------------------------ - - Q: How do you make upsmon reload the config file? - - Q: How do you make upsd reload the config file? - - A: 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 upsmons, and you - should only send signals to one of them. To be safe, read the pid - file. - ------------------------------------------------------------------------------ - - Q: I just bought a new WhizBang UPS that has a USB connector. How do - I monitor it? - - A: There are several driver to support USB models. - - - usbhid-ups supports various manufacturers complying to the HID standard, - - tripplite_usb supports various Tripp-Lite units, - - bcmxcp_usb supports various Powerware units. - - Refer to the "driver-name" (8) manpage for more information. - ------------------------------------------------------------------------------ - - Q: What is this usbhid-ups (formerly newhidups) about? - - A: 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). - - As of NUT 2.2, usbhid-ups completely replaces the legacy hidups driver - and provide support for various manufacturers. At that time, it will - be renamed to usbhid-ups. - - usbhid-ups is built automatically if possible (libusb development files - need to be installed) and installed by the "make install" command. - ------------------------------------------------------------------------------ - - Q: Why doesn't my package work? - - Q: I can't run this because there's no package for it. Why isn't this - in a package yet? - - A: Sorry, can't help you there. All official releases are source code - and are posted on http://www.networkupstools.org/ along with PGP - signatures for verification. - - 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. - ------------------------------------------------------------------------------ - - Q: Why are there two copies of upsmon running? - - A: It's not really two complete copies if your OS forks efficiently. - - By default, upsmon runs most of the grunt work as an unprivileged - user and keeps a stub process around with root powers that can - only shut down the system when necessary. This should make it much - harder to gain root in the event a hole is ever discovered in - upsmon. - - If this really bothers you and you like running lots of code as - root, start upsmon with -p and it will go back to being one big - process. This is not recommended, so don't blame me if something - bad happens in this mode. - ------------------------------------------------------------------------------ - - Q: I have with ... - - A: 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 - long time ago. - - If that doesn't work, try the latest development version. - - If your problem is STILL there, then contact the mailing lists. - - Hint: check the release date on the version you have. If it's more - than about 6 months old, there's probably a newer stable tree - version out there. - ------------------------------------------------------------------------------ - - Q: Do you have to use a serial connection to monitor the UPS? - What about direct network connections (SNMP or otherwise)? - - A: No. NUT currently support USB communication through usbhid-ups, - tripplite_usb and bcmxcp_usb, and SNMP communication through snmp-ups. - - 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 - - turn an owner into a developer or vice-versa. - ------------------------------------------------------------------------------ - - Q: What happened to the patch I sent? - - A: 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, send it again. - ------------------------------------------------------------------------------ - - Q: I'm not much of a programmer. How can I help? - - A: There's always work to be done outside of the realm of code bashing. - 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. - - Fielding questions on the mailing lists is also helpful. This - lets other people to focus on coding issues while allowing the - original poster to get some information at the same time. It's - quite a relief to open that mailbox and find that someone else - has already handled it successfully. - ------------------------------------------------------------------------------ - - Q: 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? - - Q: My APC UPS keeps reporting "OL LB", even after it's been charging - for many hours. What can I do about this? - - A: This happened to me, and some other people too. The combination of - our experiences should prove useful to you. - - First, you need to realize that the UPS apparently stores data about - the battery, load, and runtime. After replacing the battery, it - needs to be clued in to the new situation. If the traditional - runtime calibration doesn't work, you have to try something a - little more drastic. - - You need to *completely* drain the UPS while it has a good ground. - This means you can't just pull the plug. You also have to - 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 - power strip that doesn't switch the ground line or an outlet that - you can switch off at your panel. - - Once the UPS is up at 100% charge (this is important), disconnect - the power. It _must_ remain connected to the ground, or the - results may not be accurate. Ignore the sounds it makes, and go - away until it's done. Don't do anything to the front panel while - this is happening. - - After all of this, put things back the way they should be and let - it charge up. You should find that it again gives reasonable - values and behavior, as it was when it was new. - - Thanks to Matthew Dharm for helping me nail down this procedure. - ------------------------------------------------------------------------------ - - Q: multimon.cgi seems to be stuck at an old version, even though I - just installed a new one. - - A: multimon was removed during the 1.1 development cycle. upsstats - now does everything it used to do, and then some. You should just - delete those files and start using upsstats directly. - ------------------------------------------------------------------------------ - - Q: OK, I switched to upsstats. Now it's giving me Celsius. I like - Fahrenheit. Where's the config file to switch it back? - - A: Temperature scales are handled by the template files, so edit your - upsstats.html and change it from TEMPC to TEMPF. - ------------------------------------------------------------------------------ - - Q: Why is the mailing list ignoring me? - - A: 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. - - Convincing the other subscribers that you've actually read down this - far might be useful. You might mention "queequeg" for better results. - - This URL may also be helpful: - - http://www.catb.org/~esr/faqs/smart-questions.html - ------------------------------------------------------------------------------ - - Q: 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? - - A: 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. - ------------------------------------------------------------------------------ - - Q: How can you answer questions to situations that nobody's encountered - yet? Isn't this a frequently asked questions file? - - A: Magic. - - A: 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. - ------------------------------------------------------------------------------ diff --git a/docs/FAQ.txt b/docs/FAQ.txt new file mode 100644 index 0000000..fb913e4 --- /dev/null +++ b/docs/FAQ.txt @@ -0,0 +1,735 @@ +ifndef::external_title[] +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? + +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... + +== My favorite UPS driver disappeared after an upgrade. What now? + +Drivers are occasionally removed from the tree if they are no longer +receiving maintenance, or sometimes renamed to better reflect their +hardware support scope or replaced by a more generic driver. +There have been several architectural changes to the driver code +in recent times, and drivers which were not converted by someone +are eventually dropped. + +This is called progress. We do this in order to avoid a situation +where someone believes that a driver is being maintained when it is +actually rotting slowly in the tree. It also keeps the tree free of +old compatibility hacks for code that nobody actually uses anyway. + +To get a driver back into current releases, you need to convert it +yourself or get someone to do it for you. This is not difficult. +The hardest part of any driver is decoding the protocol, and that's +already been done in the old version. + +== My UPS driver program won't work. I'm starting it as root, and root owns the device, so what's the problem? + +*Answer 1* + +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 +may be changed at compile-time by using configure --with-user. + +Read the error message. If you have a permissions mismatch, then +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 + 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 +account (perhaps called "ups" or "nut"), and use that instead. + +Also, scroll down to the "security domains" question to see an +even better way of restricting privileged operations. Neither the +drivers nor upsd ever need root powers, and that answer tells you +how to make it work. + +*Answer 2* + +You can also specify a user with "user=" in the global part of +ups.conf. Just define it before any of your [sections]: + + user = nut + + [myups] + driver = mge-shut + port = /dev/ttyS0 + +== upsc, upsstats, and the other clients say 'access denied'. The device communication port (serial, USB or network) permissions are fine, so what gives? + +In this case, "access denied" means the access to upsd, not the device +communication port. You're being denied since the system has no +permission to speak to upsd according to the access controls. + +There can be various reasons. To fix it, check: + +- the LISTEN directive in upsd.conf. It should allow your local or remote +access method, +- your firewall rules. Port 3493/tcp must be opened to incoming connexions, +- your tcp-wrappers configuration (hosts.allow and hosts.deny). + +Refer to the upsd(8) and upsd.conf(5) manpages for more information. + +== 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 +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. + +Note that the 940-0095B happens to be a grey cable, but it is actually +a dual mode cable and can be used in smart mode. If you have +this cable, you need to edit your ups.conf to look like this: + + [myups] + driver = apcsmart + port = /dev/whatever + cable = 940-0095B + +All other grey cables from APC are assumed to be "dumb". + +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. + +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 +you to build a good clone of APC's 940-0024C cable. + +There are simpler solutions involving 3 wires that work just fine +too, but Powerchute won't find the loopback DTR-DCD and RTS-CTS and +will be annoyed. If you don't ever plan to use Powerchute, 3 wires +(RxD, TxD, GND) are sufficient. + +It should also be noted that the genericups driver has no way to +detect the UPS, so it will fire up quite happily if it can open the +serial port. Merely having it start up is not necessarily an +indication of success. You should start it and then check the +status with upsc or similar to be sure that it's reading the +hardware properly. + +== Why doesn't upsd implement the functionality of upsmon? I have to run THREE programs to monitor my UPS! + +*Answer 1* + +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. + +Yes, the machine with the UPS attached will generally have 3 +processes (driver, upsd, upsmon) running, but this design allows a +much bigger setup. Imagine a data room with a bunch of machines +all drawing power from the same UPS. The rest of them just run +upsmon. + +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 data-room.txt for more configuration ideas and explanations. + +*Answer 2* + +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. + +This is also a good option to consider if you can't use networked +monitoring code for security or safety reasons. + +See ideas.txt for more on this and other related topics. + +== Why isn't upssched part of upsmon? + +Most users will never have any reason to use upssched. It's +complicated, and getting it right for your situation can be tricky. +Having it live in a separate program saves resources and lets most +people avoid it completely. + +It is also coherent with the answer to the previous question. + +== Why doesn't upsmon send a SIGPWR signal to init so it can deal with power events? + +*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 +control channel is the preferred way of communication. + +*Answer 2* + +The name of the game is portability. Not everyone's init handles +that kind of signalling gracefully. What's more, some admins +might want to do things differently even if they have that kind of +init running. + +So, to be compatible, upsmon just invokes a shell command. If you +want to use init's SIGPWR stuff, just put the right "kill" line in +a shell script and make upsmon call it. Everyone wins. + +== Why won't bestups talk to my Best Fortress UPS? + +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. + +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'? + +It means your UPS driver hasn't updated things in a little while. +upsd refuses to serve up data that isn't fresh, so you get the +errors about staleness. + +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. + +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 +intervals. Use caution when adjusting this number, since it +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 +are temporarily marked stale even though everything is fine. This +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 +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 +document, you probably started upsd by itself. You have to run +'upsdrvctl start' to start the drivers after configuring ups.conf. + +== 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 +probably have an ATX motherboard, have APM or ACPI enabled in your +kernel (assuming Linux here), and are reaching the 'halt' at the +bottom of your shutdown scripts. + +Your machine obeys and shuts down, and stays down, since it +remembers the 'last state' when the UPS restarts. + +One solution is to change your shutdown scripts so you never reach +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 ...) + + if (test -f /etc/killpower) + then + /usr/local/ups/bin/upsdrvctl shutdown + + sleep 600 # this should never return + + # uh oh, we never got shut down! (power race?) + reboot + fi + + halt -p + +The other solution is to change your BIOS setting to "always power +on" instead of "last state", assuming that's possible. + +== My system has an ATX power supply. It will power off just fine, but it doesn't turn back on. What can I do to fix this? + +This depends on how clueful your motherboard manufacturer is, and +isn't a matter of the OS. You have to do one of the following +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 +- 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 + when the outage is over. + + This might work, but it creates high produce bills. + +If you can't use one of the first two options, give the board to +an enemy. Let them worry about it. + +== My PowerMac G4 won't power back up by itself (into Linux) after the UPS shuts down. What can I do about this? + +*Answer 1* + +This is about the same situation as the ATX question above, only +worse. Earlier Macs apparently supported a hack where you could +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 + +Unfortunately, the hardware has evolved and there is no good +equivalent for this hack on today's systems. + +If you find out how to do this, please send me some mail, since +this affects one of my systems and my stop-gap solution is getting +cranky. + +Note: this question has been in the FAQ for over a year and +there's still no 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. + +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 +solution. + +*Answer 2* + +If you're on OS X, this is relatively simple to fix. Go to system +preferences, click on energy saver, click on the options tab, check +"Restart automatically after a power failure". + +If you're on some other OS, hope they've figured out how to duplicate +the above in a non-simian manner. + +== I want to keep the drivers and upsd in their own security domains. How can this be accomplished? + +Using a few role accounts and a common group, you can limit access +to resources such as the serial port(s) leading to the UPS +hardware. + +This is just an example. Change the values to suit your systems. + +- Create a user called 'nutdev' and another called 'nutsrv'. Put +them both in a group called 'nut'. + +- Change the owner of any serial ports that will be used to nutdev, +and set the mode to 0600. Then change the ownership of your state +directory (usually /var/state/ups) to nutdev.nut. + +For my development system this yields the following /dev entries: + + 0 crw------- 1 nutdev tty 4, 64 Sep 3 17:11 /dev/ttyS0 + 0 crw------- 1 nutdev tty 4, 65 Sep 3 17:11 /dev/ttyS1 + +- Switch to root, then start the drivers: + + # /usr/local/ups/bin/upsdrvctl -u nutdev start + +- The listing for /var/state/ups then looks like this: + + 4 drwxrwx--- 2 nutdev nut 4096 Aug 20 18:37 . + 4 drwxr-xr-x 4 root root 4096 May 14 21:20 .. + 4 srw-rw---- 1 nutdev nut 0 Sep 3 17:10 apcsmart-ups1 + 4 srw-rw---- 1 nutdev nut 0 Sep 3 17:10 blazer_ser-ups2 + +You may have to remove old socket or state files first if you are +changing to this security scheme from an older version. The drivers +will create new files with the right owners and modes. + +Note that /var/state/ups is group writable since upsd will +place the upsd.pid file here. + +You may have to change the groups of upsd.conf and upsd.users to +make them readable. These files should not be owned by nutsrv, +since someone could compromise the daemon and change the config +files. Instead, put nutsrv in a group ("nut" in this example), then +make the files owned by root.nut, with mode 0640. + +Once the config files are ready, start upsd: + + # /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 security.txt for more details. + +== What's the point of that 'security domains' concept above? + +The point is limiting your losses. If someone should happen to +break into upsd in that environment, they should only gain access +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.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 +run the programs this way locally. You should definitely consider +using this technique. + +== How can I make upsmon shut down my system after some fixed interval? + +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 scheduling.txt or the upssched(8) man +page for some ideas. + +///////////////////////////////////////////////////////////////// +TODO: figure out how to link to the upssched man page above. +///////////////////////////////////////////////////////////////// + + +== Why doesn't upsmon shut down my system? I pulled the plug and nothing happened. + +Wait. upsmon doesn't consider a UPS to be critical until it's both +'on battery' and 'low battery' at the same time. This is by design. +Nearly every UPS supports the notion of detecting the low battery +all by itself. When the voltage drops below a certain point, it +_will_ let you know about it. + +If your system has a really complicated shutdown procedure, you +might need to shut down before the UPS raises the low battery flag. +For most users, however, the default behavior is adequate. + +Ask yourself this: why buy a nice big UPS with the matching battery +and corresponding runtime and then shutdown early? If anything, I'd +rather have a few more minutes running on battery during which the +power might return. Once the power's back, it's business as usual +with no visible interruption in service. + +If you purposely shut down early, you guarantee an interruption in +service by bringing down the box. + +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? + +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 +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. + +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. + +== 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 probably have some sort of firewall +blocking the connection. + +upsd listens on TCP port 3493 by default. + +== How do you make upsmon reload the config file? + +Or a variation like... + +== How do you make upsd reload the config file? + +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 upsmons, and you +should only send signals to one of them. To be safe, read the pid +file. + +== I just bought a new WhizBang UPS that has a USB connector. How do I monitor it? + +There are several driver to support USB models. + +- 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. + +Refer to the 'driver-name' (8) manpage for more information. + +== What is this usbhid-ups (formerly newhidups) about? + +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). + +As of NUT 2.2, usbhid-ups completely replaces the legacy hidups driver +and provide support for various manufacturers. At that time, it will +be renamed to usbhid-ups. + +usbhid-ups is built automatically if possible (libusb development files +need to be installed) and installed by the "make install" command. + +== Why doesn't my package work? + +Or a variation like... + +== I can't run this because there's no package for it. Why isn't this in a package yet? + +Sorry, can't help you there. All official releases are source code +and are posted on http://www.networkupstools.org/ along with PGP +signatures for verification. + +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. + +== Why are there two copies of upsmon running? + +It's not really two complete copies if your OS forks efficiently. + +By default, upsmon runs most of the grunt work as an unprivileged +user and keeps a stub process around with root powers that can +only shut down the system when necessary. This should make it much +harder to gain root in the event a hole is ever discovered in +upsmon. + +If this really bothers you and you like running lots of code as +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 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 +long time ago. + +If that doesn't work, try the latest development 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 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)? + +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 - +turn an owner into a developer or vice-versa. + +== What happened to the patch I sent? + +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, 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 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. + +Fielding questions on the mailing lists is also helpful. This +lets other people to focus on coding issues while allowing the +original poster to get some information at the same time. It's +quite a relief to open that mailbox and find that someone else +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 +our experiences should prove useful to you. + +First, you need to realize that the UPS apparently stores data about +the battery, load, and runtime. After replacing the battery, it +needs to be clued in to the new situation. If the traditional +runtime calibration doesn't work, you have to try something a +little more drastic. + +You need to *completely* drain the UPS while it has a good ground. +This means you can't just pull the plug. You also have to +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 +power strip that doesn't switch the ground line or an outlet that +you can switch off at your panel. + +Once the UPS is up at 100% charge (this is important), disconnect +the power. It _must_ remain connected to the ground, or the +results may not be accurate. Ignore the sounds it makes, and go +away until it's done. Don't do anything to the front panel while +this is happening. + +After all of this, put things back the way they should be and let +it charge up. You should find that it again gives reasonable +values and behavior, as it was when it was new. + +Thanks to Matthew Dharm for helping us nail down this procedure. + +== upsstats returns temperatures in Celsius. I like Fahrenheit. Where's the config file to switch it back? + +Temperature scales are handled by the template files, so edit your +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 +for you. + +Convincing the other subscribers that you've actually read down this +far might be useful. You might mention "queequeg" for better results. + +This URL may also be helpful: + +http://www.catb.org/~esr/faqs/smart-questions.html + +== 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. + +== How can you answer questions to situations that nobody's encountered yet? Isn't this a frequently asked questions file? + +*Answer 1* + +It's a kind of Magic. + +*Answer 2* + +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. + +== My UPS powers up immediately after a power failure instead of waiting for the batteries to recharge! + +You can rig up a little hack to handle this issue in software. + +Essentially, you need to test for the POWERDOWNFLAG in your *startup* scripts +while the filesystems are still read-only. If it's there, you know your last +shutdown was caused by a power failure and the UPS battery is probably still +quite weak. + +In this situation, your best bet is to sleep it off. Pausing in your startup +script to let the batteries recharge with the filesystems in a safe state is +recommended. This way, if the power goes out again, you won't face a situation +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. + +== I'm facing a power race +Or a variation like... + +== The power came back during the shutdown, but before the UPS power off. Now the UPS does not reboot, and my computer stays off. How can I fix that? + +There is a situation where the power may return during the shutdown process. +This is known as a race. Here's how we handle it. + +"Smart" UPSes typically handle this by using a command that forces the UPS to +power the load off and back on. This way, you are assured that the systems will +restart even if the power returns at the worst possible moment. + +Contact closure units (ala genericups), on the other hand, have the potential +for a race when feeding multiple systems. This is due to the design of most +contact closure UPSes. Typically, the "kill power" line only functions when +running on battery. As a result, if the line power returns during the shutdown +process, there is no way to power down the load. + +The workaround is to force your systems to reboot after some interval. This way, +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: + + if (test -f /etc/killpower) + then + /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 18f67de..c14f090 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,13 +1,108 @@ -# nothing to build here, but still need a Makefile to define which -# files to distribute +SHARED_DEPS = nut-names.txt asciidoc.conf -EXTRA_DIST = acpi.txt big-servers.txt chroot.txt \ - commands.txt config-files.txt configure.txt contact-closure.txt \ - data-room.txt design.txt developers.txt FAQ hid-subdrivers.txt \ - ideas.txt macros.txt megatec.txt new-drivers.txt new-names.txt \ - nut-hal.txt osd-notify.txt \ - pager.txt powersaving.txt protocol.txt README shutdown.txt snmp.txt \ - sock-protocol.txt ssl.txt upssched.txt cables/apc-rs500-serial.txt \ +IMAGE_FILES = images/asciidoc.png \ + images/eaton-logo.png \ + images/nut_layering.png \ + images/note.png \ + images/warning.png \ + images/blue-arrow.png \ + images/simple.png \ + images/advanced.png \ + images/bigbox.png \ + images/bizarre.png \ + images/old-cgi.png + +USER_MANUAL_DEPS = acknowledgements.txt cables.txt config-notes.txt \ + configure.txt download.txt documentation.txt features.txt history.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 new-drivers.txt net-protocol.txt sock-protocol.txt + +CABLES_DEPS = cables/apc-rs500-serial.txt \ cables/apc.txt cables/ge-imv-victron.txt cables/imv.txt \ cables/mgeups.txt cables/powerware.txt cables/repotec.txt \ cables/sms.txt + +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/SOLA-330.png + +EXTRA_DIST = $(SHARED_DEPS) $(USER_MANUAL_DEPS) $(DEVELOPER_GUIDE_DEPS) \ + $(CABLES_DEPS) FAQ.txt nut-hal.txt nut-qa.txt packager-guide.txt snmp.txt \ + $(IMAGE_FILES) $(CABLES_IMAGES) docinfo.xml + +ASCIIDOC_HTML_SINGLE = user-manual.html \ + developer-guide.html \ + packager-guide.html \ + FAQ.html + +ASCIIDOC_HTML_CHUNKED = user-manual.chunked \ + developer-guide.chunked \ + packager-guide.chunked \ + FAQ.html + +ASCIIDOC_PDF = user-manual.pdf \ + developer-guide.pdf \ + packager-guide.pdf \ + FAQ.pdf + +# Force build in ./ and man/ before website +SUBDIRS = . man website +SUFFIXES = .txt .html .pdf + +all: doc + +doc: @DOC_BUILD_LIST@ + +pdf: $(ASCIIDOC_PDF) +# also build the HTML manpages with these targets +html-single: $(ASCIIDOC_HTML_SINGLE) +html-chunked: $(ASCIIDOC_HTML_CHUNKED) + +if HAVE_ASCIIDOC +website: html-chunked pdf +else !HAVE_ASCIIDOC +website: + @echo "Not building website documentation since 'asciidoc' was not found." +endif !HAVE_ASCIIDOC + +clean-local: + rm -rf *.pdf *.html *.chunked docbook-xsl.css + +### TODO: automatic dependency generation +FULL_USER_MANUAL_DEPS = $(USER_MANUAL_DEPS) $(SHARED_DEPS) ../README \ + ../INSTALL cables.txt ../UPGRADING ../TODO +FULL_DEVELOPER_GUIDE_DEPS = $(DEVELOPER_GUIDE_DEPS) $(SHARED_DEPS) \ + ../scripts/augeas/README + +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 + +# 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 \ + --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 \ + -a toc -a numbered --destination-dir=. + +.txt.html: + $(A2X) $(A2X_COMMON_OPTS) --attribute=xhtml11_format --format=xhtml $< + +.txt.chunked: + $(A2X) $(A2X_COMMON_OPTS) --attribute=chunked_format --format=chunked $< + +.txt.pdf: docinfo.xml + $(A2X) $(A2X_COMMON_OPTS) --attribute=pdf_format --format=pdf -a docinfo1 $< + +.PHONY: html html-single pdf website diff --git a/docs/Makefile.in b/docs/Makefile.in index 849a6ce..d39db23 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -14,9 +14,6 @@ # PARTICULAR PURPOSE. @SET_MAKE@ - -# nothing to build here, but still need a Makefile to define which -# files to distribute VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -38,14 +35,15 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = docs -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -55,6 +53,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -66,10 +65,52 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = +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 +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) 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@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -82,8 +123,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -100,7 +143,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -111,22 +153,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ @@ -222,20 +264,87 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -EXTRA_DIST = acpi.txt big-servers.txt chroot.txt \ - commands.txt config-files.txt configure.txt contact-closure.txt \ - data-room.txt design.txt developers.txt FAQ hid-subdrivers.txt \ - ideas.txt macros.txt megatec.txt new-drivers.txt new-names.txt \ - nut-hal.txt osd-notify.txt \ - pager.txt powersaving.txt protocol.txt README shutdown.txt snmp.txt \ - sock-protocol.txt ssl.txt upssched.txt cables/apc-rs500-serial.txt \ +SHARED_DEPS = nut-names.txt asciidoc.conf +IMAGE_FILES = images/asciidoc.png \ + images/eaton-logo.png \ + images/nut_layering.png \ + images/note.png \ + images/warning.png \ + images/blue-arrow.png \ + images/simple.png \ + images/advanced.png \ + images/bigbox.png \ + images/bizarre.png \ + images/old-cgi.png + +USER_MANUAL_DEPS = acknowledgements.txt cables.txt config-notes.txt \ + configure.txt download.txt documentation.txt features.txt history.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 new-drivers.txt net-protocol.txt sock-protocol.txt + +CABLES_DEPS = cables/apc-rs500-serial.txt \ cables/apc.txt cables/ge-imv-victron.txt cables/imv.txt \ cables/mgeups.txt cables/powerware.txt cables/repotec.txt \ cables/sms.txt -all: all-am +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/SOLA-330.png + +EXTRA_DIST = $(SHARED_DEPS) $(USER_MANUAL_DEPS) $(DEVELOPER_GUIDE_DEPS) \ + $(CABLES_DEPS) FAQ.txt nut-hal.txt nut-qa.txt packager-guide.txt snmp.txt \ + $(IMAGE_FILES) $(CABLES_IMAGES) docinfo.xml + +ASCIIDOC_HTML_SINGLE = user-manual.html \ + developer-guide.html \ + packager-guide.html \ + FAQ.html + +ASCIIDOC_HTML_CHUNKED = user-manual.chunked \ + developer-guide.chunked \ + packager-guide.chunked \ + FAQ.html + +ASCIIDOC_PDF = user-manual.pdf \ + developer-guide.pdf \ + packager-guide.pdf \ + FAQ.pdf + + +# Force build in ./ and man/ before website +SUBDIRS = . man website +SUFFIXES = .txt .html .pdf + +### TODO: automatic dependency generation +FULL_USER_MANUAL_DEPS = $(USER_MANUAL_DEPS) $(SHARED_DEPS) ../README \ + ../INSTALL cables.txt ../UPGRADING ../TODO + +FULL_DEVELOPER_GUIDE_DEPS = $(DEVELOPER_GUIDE_DEPS) $(SHARED_DEPS) \ + ../scripts/augeas/README + + +# 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 \ + --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 \ + -a toc -a numbered --destination-dir=. + +all: all-recursive .SUFFIXES: +.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 \ @@ -272,12 +381,141 @@ 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. +$(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//`; \ + list='$(SUBDIRS)'; 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" + +$(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 + +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: tags-recursive $(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; \ + 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; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi ctags: 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 +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -309,19 +547,48 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + 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 check-am: all-am -check: check-am +check: check-recursive all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -installcheck: installcheck-am +installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ @@ -338,86 +605,119 @@ 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." -clean: clean-am +clean: clean-recursive -clean-am: clean-generic clean-libtool mostlyclean-am +clean-am: clean-generic clean-libtool clean-local mostlyclean-am -distclean: distclean-am +distclean: distclean-recursive -rm -f Makefile -distclean-am: clean-am distclean-generic +distclean-am: clean-am distclean-generic distclean-tags -dvi: dvi-am +dvi: dvi-recursive dvi-am: -html: html-am +html: html-recursive html-am: -info: info-am +info: info-recursive info-am: install-data-am: -install-dvi: install-dvi-am +install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: -install-html: install-html-am +install-html: install-html-recursive install-html-am: -install-info: install-info-am +install-info: install-info-recursive install-info-am: install-man: -install-pdf: install-pdf-am +install-pdf: install-pdf-recursive install-pdf-am: -install-ps: install-ps-am +install-ps: install-ps-recursive install-ps-am: installcheck-am: -maintainer-clean: maintainer-clean-am +maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic -mostlyclean: mostlyclean-am +mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool -pdf: pdf-am - pdf-am: -ps: ps-am +ps: ps-recursive ps-am: uninstall-am: -.MAKE: install-am install-strip +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive -.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 \ +.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 uninstall uninstall-am + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am +all: doc + +doc: @DOC_BUILD_LIST@ + +pdf: $(ASCIIDOC_PDF) +# also build the HTML manpages with these targets +html-single: $(ASCIIDOC_HTML_SINGLE) +html-chunked: $(ASCIIDOC_HTML_CHUNKED) + +@HAVE_ASCIIDOC_TRUE@website: html-chunked pdf +@HAVE_ASCIIDOC_FALSE@website: +@HAVE_ASCIIDOC_FALSE@ @echo "Not building website documentation since 'asciidoc' was not found." + +clean-local: + rm -rf *.pdf *.html *.chunked docbook-xsl.css + +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 + +.txt.html: + $(A2X) $(A2X_COMMON_OPTS) --attribute=xhtml11_format --format=xhtml $< + +.txt.chunked: + $(A2X) $(A2X_COMMON_OPTS) --attribute=chunked_format --format=chunked $< + +.txt.pdf: docinfo.xml + $(A2X) $(A2X_COMMON_OPTS) --attribute=pdf_format --format=pdf -a docinfo1 $< + +.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. .NOEXPORT: diff --git a/docs/README b/docs/README deleted file mode 100644 index 7d65e67..0000000 --- a/docs/README +++ /dev/null @@ -1,9 +0,0 @@ -When creating files in here, use the following 4 headers: - -Desc: A brief description of the document -File: The filename (this is for tracking which one is the original) -Date: The date of last modification -Auth: The author, i.e. "First Last ". - -Note: anything in the form <.*@.*> will be removed when converted to HTML -to reduce the number of e-mail addresses harvested from the web servers. diff --git a/docs/acknowledgements.txt b/docs/acknowledgements.txt new file mode 100644 index 0000000..01afa7f --- /dev/null +++ b/docs/acknowledgements.txt @@ -0,0 +1,150 @@ +ifndef::external_title[] +Acknowledgements +================ +endif::external_title[] + +This project is the result of years of work by many individuals and companies. + +Many people have written or tweaked the software; the drivers, clients, server +and documentation have all received valuable attention from numerous sources. + +Many of them are listed within the source code, AUTHORS file, release notes, and +mailing list archives, but some prefer to be anonymous. +This software would not be possible without their help. + + +The NUT Team +------------ + +Active members +~~~~~~~~~~~~~~ + +- Arnaud Quette: project leader (since 2005), Debian packager and jack of all trades +- Arjen de Korte: senior lieutenant +- Charles Lepple: senior lieutenant +- Kjell Claesson: senior developer +- Alexander Gordeev: junior developer +- David Goncalves: Python developer +- Eric S. Raymond: Documentation consultant +- Oden Eriksson: Mandriva packager +- Stanislav Brabec: Novell / Suse packager +- Michal Hlavinka: Redhat packager + +Retired members +~~~~~~~~~~~~~~~ + +- Russell Kroll: Founder, and project leader from 1996 to 2005 +- 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 +- 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) +- Dominique Lallement: Consultant (chairman of the USB/HID PDC Forum) +- Julius Malkiewicz: junior developer +- Tomas Smetana: former Redhat packager (2007-2008) + +[[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, +- 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 +------------------------ + +UPS manufacturers +~~~~~~~~~~~~~~~~~ + +- link:http://powerquality.eaton.com[Eaton], our main supporter, as presented in +the <>. + +- 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: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:ups-protocol.html[extensive information] on its USB/HID devices, along +with development units. + +Appliances manufacturers +~~~~~~~~~~~~~~~~~~~~~~~~ + +- link:http://www.opengear.com[OpenGear] has worked with NUT's leader to +successfully develop and integrate PDU support. Opengear, through Scott Burns, +and Robert Waldie, has submitted several patches. + +Other contributors +------------------ + +- Pavel Korensky's original apcd provided the inspiration for pursuing APC's +smart protocol in 1996 +- Eric Lawson provided scans of the OneAC protocol +- John Marley used OCR software to transform the SEC protocol scans into a HTML +document +- Chris McKinnon scanned and converted the Fortress protocol documentation +- Tank provided documentation on the Belkin/Delta protocol +- Potrans provided a Fenton PowerPal 600 (P series) for development of the +safenet driver. + +Older entries (before 2005) +--------------------------- + +- 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. +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 +making the development of the fentonups driver possible. +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. + +- 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. + +- link:http://www.cyberpowersystems.com[Cyber Power Systems] contributed a +700AVR model for testing and development of the cyberpower driver. + +- link:http://www.liebert.com[Liebert Corporation] supplied serial test boxes +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 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/acpi.txt b/docs/acpi.txt deleted file mode 100644 index 9cd9371..0000000 --- a/docs/acpi.txt +++ /dev/null @@ -1,32 +0,0 @@ -Desc: Equivalence between ACPI and NUT variable naming -File: acpi.txt -Date: 30 September 2005 -Auth: Arnaud Quette - -This document presents an equivalence table between ACPI data -and NUT variable naming. - - -+-------------------------------------------------------+---------------------------------------+ -|PowerSummary.CapacityMode | percent | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.DesignCapacity | 100 | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.FullChargeCapacity | 100 | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.Rechargeable | true / yes / 1 | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.ConfigVoltage | output.voltage.nominal | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.WarningCapacityLimit | ? battery.charge.low | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.RemainingCapacityLimit | battery.charge.low | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.CapacityGranularity1 | ? | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.CapacityGranularity2 | ? | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.iProduct | ups.model | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.iSerialNumber | ups.serial | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.iDeviceChemistry | battery.type | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.iOEMInformation | ? | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.Discharging | ups.status = DISCHRG | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.Charging | ups.status = CHRG | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.BelowRemainingCapacityLimit | ups.status = LB | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.Current | ? output.current | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.RemainingCapacity | battery.charge | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.Voltage | output.voltage | +-------------------------------------------------------+---------------------------------------+ -|PowerSummary.RemainingCapacityLimit | battery.charge.low | +-------------------------------------------------------+---------------------------------------+ -| PowerSummary.ACPresent | ups.status = OL | -+-------------------------------------------------------+---------------------------------------+ \ No newline at end of file diff --git a/docs/asciidoc.conf b/docs/asciidoc.conf new file mode 100644 index 0000000..fedf952 --- /dev/null +++ b/docs/asciidoc.conf @@ -0,0 +1,55 @@ +## NUT macros: linkman, linkdoc +# +# Usage: linkman:command[manpage-section] +# This macro allows to handle variable manpage location, depending on the +# document type +# +# Note, {0} is the manpage section, while {target} is the command. +# +# Example: linkman:ups.conf[5] +# +# Show NUT link as: (
); if section is defined, else just show +# the command. +# +################################################################################ +# +# Usage: linkdoc:document[display title,[anchor]] +# This macro allows to handle variable NUT documentation location, depending +# on the document type +# +# Note, {1} is the display title, {2} is the optional anchor name, +# {0} is the whole set of args ({1}...{n}) and {target} is the +# base document name. +# Example: +# linkdoc:user-manual[user manual,NUT_Security] +# linkdoc:developer-guide[developer guide,_status_data] + +[macros] +(?su)[\\]?(?Plinkman):(?P\S*?)\[(?P.*?)\]= +(?su)[\\]?(?Plinkdoc):(?P\S*?)\[(?P.*?)\]= + +ifdef::basebackend-docbook[] +ifdef::xhtml11_format[] +[linkman-inlinemacro] +{target}{0?({0})} +[linkdoc-inlinemacro] +{1} +endif::xhtml11_format[] + +# FIXME: linkdoc does not support 'anchor' +ifdef::chunked_format[] +[linkman-inlinemacro] +{target}{0?({0})} +[linkdoc-inlinemacro] +{1} +endif::chunked_format[] + +# PDF output points online versions +# FIXME: linkdoc does not support 'anchor' +ifdef::pdf_format[] +[linkman-inlinemacro] +{target}{0?({0})} +[linkdoc-inlinemacro] +{1} +endif::pdf_format[] +endif::basebackend-docbook[] diff --git a/docs/big-servers.txt b/docs/big-servers.txt deleted file mode 100644 index 525a424..0000000 --- a/docs/big-servers.txt +++ /dev/null @@ -1,68 +0,0 @@ -Desc: Typical setups for big servers -File: big-servers.txt -Date: 14 March 2004 -Auth: Russell Kroll - -By using multiple MONITOR statements in upsmon.conf, you can configure -an environment where a large machine with redundant power monitors -multiple separate UPSes. For the examples in this document, I will use -a HP NetServer LH4 in the stock configuration with 3 of the 4 power -supplies installed. - -Compared to some systems, the LH4 is unusual because it has common power -cords for multiple power supplies. One cord feeds two supplies. As a -result, each UPS drives two of the power supplies, so losing that UPS -affects both at the same time. - -For our examples, UPS "Alpha" is connected to the cord that drives the -two power supplies, and ups "Beta" is connected to the other with just a -single power supply. - -Since the server needs two supplies to stay alive, we can lose "Beta" at -any time, but losing "Alpha" is a showstopper. We make a note of them -when configuring upsmon: - - MONITOR ups-alpha@myhost 2 monuser mypass master - MONITOR ups-beta@myhost 1 monuser mypass master - MINSUPPLIES 2 - -With that configuration, upsmon will only shut down when Alpha reaches -a critical (on battery + low battery) condition, since Beta by itself -is not enough to keep the system running. Beta, on the other hand, -can go up and down as much as it wants and nothing will happen as long -as the other one keeps working. - -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). - -Adding redundancy -================= - -The above example assumed the stock hardware configuration. Let's say -we have successfully cajoled the boss into providing the money for a -fourth power supply. Now both power cords run two power supplies, and -the system is maxed out in terms of redundancy. - -The upsmon.conf must be updated to reflect this: - - MONITOR ups-alpha@myhost 2 monuser mypass master - MONITOR ups-beta@myhost 2 monuser mypass master - MINSUPPLIES 2 - -Beta is now driving two power supplies, so we upgrade its power value. -This means that either Alpha *or* Beta can totally shut down and the -server will be able to keep running. - -As an added bonus, this means you can move a running server from one UPS -to another without bringing it down since the minimum power will be -provided at all times. - -Other configurations -==================== - -There are a lot of ways to handle this and they all come down to how many -power supplies, power cords and independent UPS connections you have. A -system with a 1:1 cord:supply ratio has more wires stuffed behind it, but -it's much easier to move things around since any given UPS drives a smaller -percentage of the overall power. diff --git a/docs/cables.txt b/docs/cables.txt new file mode 100644 index 0000000..976bd57 --- /dev/null +++ b/docs/cables.txt @@ -0,0 +1,120 @@ +ifdef::website[] +Cables +====== +endif::website[] + +APC +--- + +940-0024C clone +~~~~~~~~~~~~~~~ + +*From D. Stimits* + +image::images/cables/940-0024C.jpg[APCC 940-0024C clone diagram] + +NOTE: The original 940-0024C diagram was contributed by Steve Draper. + +940-0024C clone for Macs +~~~~~~~~~~~~~~~~~~~~~~~~ + +*From Miguel Howard* + +image::images/cables/mac-940-0024C.png[APCC 940-0024C clone cable for Macs] + +Belkin +------ + +OmniGuard F6C***-RKM +~~~~~~~~~~~~~~~~~~~~ + +*From "Daniel"* + +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 + +image::images/cables/belkin-f6cx-rkm-xu-cable.jpg[Belkin OmniGuard F6C***-RKM cable] + +Eaton +----- + +Documents in this section are provided courtesy of Eaton. + +MGE Office Protection Systems +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The two first cables also applies to MGE UPS SYSTEMS. + +DB9-DB9 cable (ref 66049) +^^^^^^^^^^^^^^^^^^^^^^^^^ + +This is the standard serial cable, used on most units. + +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, ... + +image::images/cables/mge-db9-rj45.jpg[DB9-RJ45 cable] + +DB9-RJ12 cable +^^^^^^^^^^^^^^ + +This cable is used on some older Ellipse models. + +image::images/cables/mge-db9-rj12.jpg[DB9-RJ12 cable] + +Powerware LanSafe +~~~~~~~~~~~~~~~~~ + +image::images/cables/Lansafecable.jpg[Powerware LanSafe cable] + +SOLA-330 +~~~~~~~~ + +Just uses a normal serial cable, with pin 1-1 through to 9-9. + +image::images/cables/SOLA-330.png[SOLA-330 cable] + + +HP - Compaq +----------- + +Older Compaq UPS Family +~~~~~~~~~~~~~~~~~~~~~~~ + +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. + +UPS PC 9 pin connector + + 1 --------- 3 + 2 --------- 2 + 4 -\ + 4 --------- 5 | + 6 -/ + 6 --------- 7 + +Contributed by Kjell Claesson and Arnaud Quette. + + +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). + +image::images/cables/73-0724.png[73-0724 cable] diff --git a/docs/cables/ge-imv-victron.txt b/docs/cables/ge-imv-victron.txt index db2f76f..bffed19 100644 --- a/docs/cables/ge-imv-victron.txt +++ b/docs/cables/ge-imv-victron.txt @@ -10,7 +10,7 @@ Data cable 1 for UPS: Driver: victronups (newvictronups) -UPS PC 9 pin [2~connector +UPS PC 9 pin connector 1 --------- 3 2 --------- 2 5 --------- 5 GND diff --git a/docs/cables/sms.txt b/docs/cables/sms.txt index b81e517..6d7ab73 100644 --- a/docs/cables/sms.txt +++ b/docs/cables/sms.txt @@ -13,4 +13,4 @@ FEMEA DB9 MACHO DB9 - 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 megatec driver from Nut Package +- Use NUT blazer_ser driver diff --git a/docs/chroot.txt b/docs/chroot.txt deleted file mode 100644 index 41dce61..0000000 --- a/docs/chroot.txt +++ /dev/null @@ -1,110 +0,0 @@ -Desc: chrooting and other forms of paranoia -File: chroot.txt -Date: 24 August 2003 -Auth: Russell Kroll - -It has been possible to run the drivers and upsd in a chrooted jail for -some time, but it involved a number of evil hacks. The 1.3 series adds -much saner chroot behavior, using BIND 9 as an inspiration. - -The old way involved creating an entire tree, complete with libraries, a -shell (!), and many auxiliary files. This was hard to maintain and -could have become an interesting playground for an intruder. The new -way is minimal, and leaves little in the way of usable materials within -the jail. - -This document assumes that you already have created at least one user -account for the software to use. If you're still letting it fall back -on "nobody", stop right here and go figure that out first. It also -assumes that you have everything else configured and running happily all -by itself. - -Essentially, you need to create your configuration directory and state -path in their own little world, plus a special device or two. - -For the purposes of this example, the chroot jail is /chroot/nut. The -programs have been built with the default prefix, so they are using -/usr/local/ups. First, create the confpath and bring over a few files. - - mkdir -p /chroot/nut/usr/local/ups/etc - cd /chroot/nut/usr/local/ups/etc - cp -a /usr/local/ups/etc/upsd.users . - cp -a /usr/local/ups/etc/upsd.conf . - cp -a /usr/local/ups/etc/ups.conf . - -I'm using 'cp -a' to maintain the permissions on those files. - -Now bring over your state path, maintaining the same permissions as -before. - - mkdir -p /chroot/nut/var/state - cp -a /var/state/ups /chroot/nut/var/state - -Next we must put /etc/localtime inside the jail, or you may get very -strange readings in your syslog. You'll know you have this problem if -upsd shows up as UTC in the syslog while the rest of the system doesn't. - - mkdir -p /chroot/nut/etc - cp /etc/localtime /chroot/nut/etc - -Note that this is not "cp -a", since we want to copy the *content*, not -the symlink that it may be on some systems. - -Finally, create a tiny bit of /dev so the programs can enter the -background properly - they redirect fds into the bit bucket to make sure -nothing else grabs 0-2. - - mkdir -p /chroot/nut/dev - cp -a /dev/null /chroot/nut/dev - -Try to start your driver(s) and make sure everything fires up as before. - - upsdrvctl -r /chroot/nut -u nutdev start - -Once your drivers are running properly, try starting upsd. - - upsd -r /chroot/nut -u nutsrv - -Check your syslog. If nothing is complaining, try running clients like -upsc and upsmon. If they seem happy, then you're done. - -symlinks --------- - -After you do this, you will have two copies of many things, like the -confpath and the state path. I recommend deleting the 'real' -/var/state/ups, replacing it with a symlink to -/chroot/nut/var/state/ups. That will let other programs reference the -.pid files without a lot of hassle. - -You can also do this with your confpath and point /usr/local/ups/etc at -/chroot/nut/usr/local/ups/etc unless you're worried about something -hurting the files inside that directory. In that case, you should -maintain a 'master' copy and push it into the chroot path after -making changes. - -upsdrvctl itself does not chroot, so the ups.conf still needs to be in -the usual confpath. - -upsmon ------- - -This has not yet been applied to upsmon, since it can be quite -complicated when there are notifiers that need to be run. One -possibility would be for upsmon to have three instances: - - - privileged root parent that listens for a shutdown command - - - unprivileged child that listens for notify events - - - unprivileged chrooted child that does network I/O - -This one is messy, and may not happen for some time, if ever. - -Config files ------------- - -You may now set chroot= and user= in the global section of ups.conf. - -upsd chroots before opening any config files, so there is no way to -add support for that in upsd.conf at the present time. diff --git a/docs/commands.txt b/docs/commands.txt deleted file mode 100644 index a6af1b8..0000000 --- a/docs/commands.txt +++ /dev/null @@ -1,62 +0,0 @@ -Desc: Commands sent to the UPS drivers -File: commands.txt -Date: 9 January 2004 -Auth: Russell Kroll - -upsd can call drivers to store values in read/write variables and to kick -off instant commands. This is how you register handlers for those events. - -The driver core (drivers/main.c) has a structure called upsh. You -should populate it with function pointers in your upsdrv_initinfo() -function. Right now, there are only two possibilities: - - - setvar = setting UPS variables (SET VAR protocol command) - - instcmd = instant UPS commands (INSTCMD protocol command) - -SET ---- - -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 - -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 -added at some point in the future. - -INSTCMD -------- - -This works just like the set process, with slightly different values -arriving from the server. - - upsh.instcmd = my_ups_cmd; - -Your function will receive two args: - - 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. - -Notes ------ - -Use strcasecmp. The command names arriving from upsd should be treated -without regards to case. - -Responses ---------- - -Drivers will eventually be expected to send responses to commands. -Right now, there is no channel to get these back through upsd to -the client, so this is not implemented. - -This will probably be implemented with a polling scheme in the clients. diff --git a/docs/config-files.txt b/docs/config-files.txt deleted file mode 100644 index 98c6b61..0000000 --- a/docs/config-files.txt +++ /dev/null @@ -1,64 +0,0 @@ -Desc: Details about the configuration files -File: config-files.txt -Date: 30 April 2003 -Auth: Russell Kroll - -All configuration files within this package are parsed with a common -state machine, which means they all can use a number of extras described -in this file. - -First, most of the programs use an uppercase word to declare a -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. - -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. -That is, you want to use something like this: - - SHUTDOWNCMD "/sbin/shutdown -h +0" - -Without the quotes, it would only see the first word on the line. - -OK, so let's say you really need to embed that kind of quote within your -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 ". - -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. - -# 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 -escape it. - - identity = my\#1ups - -Much better. - -Line spanning -============= - -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 -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. diff --git a/docs/config-notes.txt b/docs/config-notes.txt new file mode 100644 index 0000000..e8a3299 --- /dev/null +++ b/docs/config-notes.txt @@ -0,0 +1,798 @@ +Configuration notes +=================== + +This chapter describe most of the configuration and use aspects of NUT, +including establishing communication with the device and configuring safe +shutdowns when the UPS battery runs out of power. + +There are many programs and <> in this +package. You should check out the <> +and other accompanying documentation to see how it all works. + +NOTE: NUT does not currently provide proper graphical configuration tools. +However, there is now support for linkdoc:developer-guide[Augeas,augeas_user]. + +Details about the configuration files +------------------------------------- + +Generalities +~~~~~~~~~~~~ + +All configuration files within this package are parsed with a common +state machine, which means they all can use a number of extras described here. + +First, most of the programs use an uppercase word to declare a +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. + +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. +That is, you want to use something like this: + + SHUTDOWNCMD "/sbin/shutdown -h +0" + +Without the quotes, it would only see the first word on the line. + +OK, so let's say you really need to embed that kind of quote within your +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 ". + +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. + +# 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 +escape it. + + identity = my\#1ups + +Much better. + +Line spanning +~~~~~~~~~~~~~ + +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 +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. + + +Basic configuration +------------------- + +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 +configure <>. + +image:images/simple.png[] + +[[Driver_configuration]] +Driver configuration +~~~~~~~~~~~~~~~~~~~~ + +Create one section per UPS in /usr/local/ups/etc/ups.conf + +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 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 your UPS is supporting. + +A typical device without any extra settings looks like this: + + [mydevice] + driver = mydriver + port = /dev/ttyS1 + desc = "Workstation" + +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 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:richcomm_usb[8], +linkman:tripplite_usb[8], +linkman:usbhid-ups[8] + + +[[Starting_drivers]] +Starting the driver(s) +~~~~~~~~~~~~~~~~~~~~~~ + +Start the driver(s) for your hardware: + + /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: + + # /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 + Detected EATON - Ellipse MAX 1100 [ADKK22008] + +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. + +Be sure to check the driver's man page to see if it needs any extra +settings in ups.conf to detect your hardware. + +If it says "can't bind /var/state/ups/..." or similar, then your +state path probably isn't writable by the driver. Check the +<>. + +After making changes, try the <> step again. + +References: man pages: linkman:nutupsdrv[8], linkman:upsdrvctl[8] + + +Data server configuration (upsd) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +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 +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. + + LISTEN 127.0.0.1 3493 + LISTEN ::1 3493 + +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. + +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 +group you created, then make it readable by the group. + + chown root:nut upsd.conf upsd.users + chmod 0640 upsd.conf upsd.users + +References: man pages: linkman:upsd.conf[5], +linkman:upsd.users[5], +linkman:upsd[8] + +[[Starting_upsd]] +Starting the data server +~~~~~~~~~~~~~~~~~~~~~~~~ + +Start the network data server: + + /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: + + # /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 +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 +have a driver that isn't working properly. You must fix this before +going on to the next step. + +Reference: man page: linkman:upsd[8] + +Check the UPS data +~~~~~~~~~~~~~~~~~~ + +Status data +^^^^^^^^^^^ + +Make sure that the UPS is providing good status data. + + /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 +probably misconfigured during the <> +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] + + +All data +^^^^^^^^ + +Look at all of the status data which is being monitored. + + /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 a UPS (Eaton Ellipse MAX 1100) looks like this: + + battery.charge: 100 + battery.charge.low: 20 + battery.runtime: 2525 + battery.type: PbAc + device.mfr: EATON + device.model: Ellipse MAX 1100 + device.serial: ADKK22008 + device.type: ups + driver.name: usbhid-ups + driver.parameter.pollfreq: 30 + driver.parameter.pollinterval: 2 + driver.parameter.port: auto + driver.version: 2.4.1-1988:1990M + driver.version.data: MGE HID 1.12 + driver.version.internal: 0.34 + input.sensitivity: normal + input.transfer.boost.low: 185 + input.transfer.high: 285 + input.transfer.low: 165 + input.transfer.trim.high: 265 + input.voltage.extended: no + outlet.1.desc: PowerShare Outlet 1 + outlet.1.id: 2 + outlet.1.status: on + outlet.1.switchable: no + outlet.desc: Main Outlet + outlet.id: 1 + outlet.switchable: no + output.frequency.nominal: 50 + output.voltage: 230.0 + output.voltage.nominal: 230 + ups.beeper.status: enabled + ups.delay.shutdown: 20 + ups.delay.start: 30 + ups.firmware: 5102AH + ups.load: 0 + ups.mfr: EATON + ups.model: Ellipse MAX 1100 + ups.power.nominal: 1100 + ups.productid: ffff + ups.serial: ADKK22008 + ups.status: OL CHRG + ups.timer.shutdown: -1 + ups.timer.start: -1 + ups.vendorid: 0463 + +Reference: man page: linkman:upsc[8], +<> + +Startup scripts +~~~~~~~~~~~~~~~ + +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 +------------------------------------------------------ + +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 +additional configuration and run upsmon. Here are the basics. + +[[Shutdown_design]] +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. + +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) + +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. ++ +(If you have no slaves, skip to step 6) + +4. upsmon slave systems see "FSD" and: + + - 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. + +6. The upsmon master: + + - generates a NOTIFY_SHUTDOWN event + - waits FINALDELAY seconds - typically 5 + - creates the POWERDOWNFLAG file - usually /etc/killpower + - calls the SHUTDOWNCMD + +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. + +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. + + +How you set it up +~~~~~~~~~~~~~~~~~ + +[[NUT_user_creation]] +NUT user creation +^^^^^^^^^^^^^^^^^ + +Create a upsd user for upsmon to use while monitoring this UPS. + +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 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 upsd: + + /usr/local/ups/sbin/upsd -c reload + +If that doesn't work (check the syslog), just restart it: + + /usr/local/ups/sbin/upsd -c stop + /usr/local/ups/sbin/upsd + +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. + +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. + + POWERDOWNFLAG /etc/killpower + +References: man pages: linkman:upsmon[8], +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 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. + + +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 master or slave setting. + +If it's the master (i.e., it's connected to this UPS directly): + + MONITOR myupsname@mybox 1 monuser mypass master + +If it's just monitoring this UPS over the network, and some other system is the +master: + + 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: + +- <>, +- <>. + +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: + + SHUTDOWNCMD "/sbin/shutdown -h +0" + +Notice the presence of "quotes" here to keep it together. + +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 +^^^^^^^^^^^^ + + /usr/local/ups/sbin/upsmon + +If it complains about something, then check your configuration. + +Checking upsmon +^^^^^^^^^^^^^^^ + +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 + logged into UPS [myupsname] + +Any errors seen here are probably due to an error in the config files of either +`upsmon` or `upsd`. You should fix them before continuing. + + +Startup scripts +^^^^^^^^^^^^^^^ + +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. 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 +necessary. `upsmon` will clear that file for you when it starts. + +NOTE: Init script examples are provide in the 'scripts' directory of +the NUT source tree, and in the various <<_binary_packages,packages>> +that exist. + +Shutdown scripts +^^^^^^^^^^^^^^^^ + +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: + +-------------------------------------------------------------------------------- + + if (test -f /etc/killpower) + then + echo "Killing the power, bye!" + /usr/local/ups/bin/upsdrvctl shutdown + + sleep 120 + + # uh oh... the UPS power-off failed + # you probably want to reboot here so you don't get stuck! + # *** see also the section on power races in the FAQ! *** + fi + +-------------------------------------------------------------------------------- + +[WARNING] +================================================================================ +- 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, 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]] +Testing shutdowns +^^^^^^^^^^^^^^^^^ + +UPS equipment varies from manufacturer to manufacturer and even within +model lines. You should test the shutdown sequence 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 +power. To do so, use the '-t' argument: + + /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: + + /usr/local/ups/sbin/upsmon -c fsd + +This will execute a full shutdown sequence, as presented in +<>, starting from the 3rd step. + +If everything works correctly, the computer will be forcibly powered +off, may remain off for a few seconds to a few minutes (depending on +the driver and UPS type), then will power on again. + +If your UPS just sits there and never resets the load, you are vulnerable +to a power race and should add the "reboot after timeout" hack at the very +least. + +Also refer to the section on power races in the link:FAQ.html[FAQ]. + +Using suspend to disk +~~~~~~~~~~~~~~~~~~~~~ + +Support for suspend to RAM and suspend to disk has been available in +the Linux kernel for a while now. For obvious reasons, suspending to +RAM isn't particularly useful when the UPS battery is getting low, +but suspend to disk may be an interesting concept. + +This approach minimizes the amount of disruption which would be caused +by an extended outage. The UPS goes on battery, then reaches low +battery, and the system takes a snapshot of itself and halts. Then it +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. + +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 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. + +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 +happen after your shutdown scripts have remounted the filesystems. + +On hardware RAID or other kernels, you have to do some detective work. It may +be necessary to contact the vendor or the author of your driver to find out +how to put the array in a state where a power loss won't leave it "dirty". + +Our understanding is that most if not all RAID devices on Linux will be fine +unless there are pending writes. Make sure your filesystems are remounted +read-only and you should be covered. + + +[[DataRoom]] +Typical setups for enterprise networks and data rooms +----------------------------------------------------- + +The split nature of this UPS monitoring software allows a wide variety of +power connections. This chapter will help you identify how things should +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. +2. This system depends on a UPS for power. + +You can play "mix and match" with those two to arrive at these descriptions +for individual hosts: + +- A: 1 but not 2 +- 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) +which depend on that same UPS for power, but aren't directly connected to +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. + +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 (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. + +NOTE: NUT can also serve as a data proxy to increase the number of clients, +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 +properly. + +[[BigServers]] +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 +separate UPSes. + +image:images/bigbox.png[] + +Example configuration +~~~~~~~~~~~~~~~~~~~~~ + +For the examples in this section, we will use a server with four power supplies +installed. + +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 that reflect this is the following: + + MONITOR ups-alpha@myhost 2 monuser mypass master + MONITOR ups-beta@myhost 2 monuser mypass master + MINSUPPLIES 2 + +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 power will be provided at all times. + +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). + +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 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +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. + +To set the order in which your UPSes receive the shutdown commands, define +the 'sdorder' value in your ups.conf. + + [bigone] + driver = usbhid-ups + port = auto + sdorder = 2 + + [littleguy] + driver = mge-shut + port = /dev/ttyS0 + sdorder = 1 + + [misc] + driver = blazer_ser + port = /dev/ttyS1 + 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'. + +NOTE: If you have a UPS that shouldn't be shutdown when running 'upsdrvctl +shutdown', set the *sdorder* to *-1*. + + +Other redundancy configurations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are a lot of ways to handle redundancy and they all come down to how many +power supplies, power cords and independent UPS connections you have. A +system with a 1:1 cord:supply ratio has more wires stuffed behind it, but +it's much easier to move things around since any given UPS drives a smaller +percentage of the overall power. + +More information can be found in the linkdoc:user-manual[NUT user manual], +and the various link:man/index.html[user manual pages]. diff --git a/docs/configure.txt b/docs/configure.txt index 44cdf88..31ffed3 100644 --- a/docs/configure.txt +++ b/docs/configure.txt @@ -1,327 +1,345 @@ -Desc: Configure options -File: configure.txt -Date: 24 December 2008 -Auth: Russell Kroll -Auth: Peter Selinger -Auth: Arnaud Quette +ifdef::website[] +Configure options +================= +endif::website[] -There are a few options that can be given to configure to tweak compiles. +There are a few options that can be given to configure to tweak compiles. See also "./configure --help" for a current and complete listing. -Contents: -========= +Driver selection +---------------- -1. Driver selection -2. Optional features -3. Other configuration options -4. Installation directories -5. Directories used by NUT at run-time -6. Things the compiler might need to find + --with-serial -1. Driver selection: -==================== +Build and install the serial drivers (default: yes) - --with-serial + --with-usb - Build and install the serial drivers (default: yes) +Build and install the USB drivers (default: auto-detect) +Note that you need to install the libusb development package or files. - --with-usb + --with-snmp - Build and install the USB drivers (default: auto-detect) - Note that you need to install the libusb development package or files. +Build and install the SNMP drivers (default: auto-detect) +Note that you need to install libsnmp development package or files. - --with-snmp + --with-neon - Build and install the SNMP drivers (default: auto-detect) - Note that you need to install libsnmp development package or files. +Build and install the XML drivers (default: auto-detect) +Note that you need to install neon development package or files. - --with-neon + --with-drivers=,,... - Build and install the XML drivers (default: auto-detect) - Note that you need to install neon development package or files. +Specify exactly which driver or drivers to build and install (this +works for serial, usb, and snmp drivers, and overrides the +preceding three options). - --with-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. - 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 this writing (2006), there are 47 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. - To select apcsmart and usbhid-ups, you'd do this: +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. +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. +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. -2. Optional features: -===================== + --with-doc= (default: no) - --with-cgi (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 - 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 data/html/README for additional - information on how to set up CGI programs. +This feature requires AsciiDoc 8.6.3 (http://www.methods.co.nz/asciidoc). - --with-lib (default: no) - Build and install the upsclient library and header files. +Optional features +----------------- - --with-all (no default) + --with-cgi (default: no) - Build and install all of the above (the serial, USB, and SNMP - drivers, the CGI programs and HTML files, and the upsclient - library). +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 data/html/README for additional +information on how to set up CGI programs. - --with-ssl (default: auto-detect) + --with-lib (default: no) - Enable SSL development code. Read docs/ssl.txt for instructions on - SSL support. +Build and install the upsclient library and header files. - --with-wrap (default: auto-detect) + --with-all (no default) - Enable libwrap (tcp-wrappers) support. Refer to upsd man page for - more information. +Build and install all of the above (the serial, USB, and SNMP +drivers, the CGI programs and HTML files, and the upsclient +library). - --with-ipv6 (default: auto-detect) + --with-ssl (default: auto-detect) - Enable IPv6 support. +Enable SSL development code. Read the section "Configuring SSL" in +docs/security.txt for instructions on SSL support. - --with-hal (default: no) + --with-wrap (default: auto-detect) - 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. +Enable libwrap (tcp-wrappers) support. Refer to upsd man page for +more information. - --with-powerman (default: auto-detect) + --with-ipv6 (default: auto-detect) - Build and install Powerman PDU client driver. - This allows to interact with the Powerman daemon, and the numerous - Power Distribution Units (PDU) supported by the project. +Enable IPv6 support. -3. Other configuration options: -=============================== + --with-hal (default: no) - --with-port=PORT +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-powerman (default: auto-detect) - Change the TCP port used by the network code. Default is 3493. +Build and install Powerman PDU client driver. +This allows to interact with the Powerman daemon, and the numerous +Power Distribution Units (PDU) supported by the project. - 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. +Other configuration options +--------------------------- - --with-user= - --with-group= + --with-port=PORT - 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. +Change the TCP port used by the network code. Default is 3493. - 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 - (separate) process as the new user. +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. - 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. +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. - 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 - hack for NFS access. You should create at least one separate user - for this software. + --with-user= + --with-group= - If you use one of the --with-user and --with-group options, then - you have to use the other one too. +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. - See the INSTALL document and the FAQ for more on this topic. +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 +(separate) process as the new user. - --with-logfacility=FACILITY +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. - 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. +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 +hack for NFS access. You should create at least one separate user +for this software. -4. Installation directories: -============================ +If you use one of the --with-user and --with-group options, then +you have to use the other one too. - --prefix=PATH +See the INSTALL document and the FAQ for more on this topic. - 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. + --with-logfacility=FACILITY - 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. +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. - --exec_prefix=PATH - This sets the base path for architecture dependent files. By - default, it is the same as . +Installation directories +------------------------ - --sysconfdir=PATH + --prefix=PATH - Changes the location where NUT's configuration files are stored. - By default this path is /etc. Setting this to /etc or - /etc/ups might be useful. +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. - The NUT_CONFPATH environment variable overrides this at run time. +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. - --bindir=PATH - --sbindir=PATH + --exec_prefix=PATH - Where executable files will be installed. Files that are normally - executed by root (upsd, upsmon, upssched) go to sbindir, all others - to bindir. The defaults are /bin and /sbin. +This sets the base path for architecture dependent files. By +default, it is the same as . - --datadir=PATH + --sysconfdir=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. +Changes the location where NUT's configuration files are stored. +By default this path is /etc. Setting this to /etc or +/etc/ups might be useful. - --mandir=PATH +The NUT_CONFPATH environment variable overrides this at run time. - Sets the base directories for the man pages. The default is - /man, i.e., /usr/local/ups/man. + --bindir=PATH + --sbindir=PATH - --includedir=PATH +Where executable files will be installed. Files that are normally +executed by root (upsd, upsmon, upssched) go to sbindir, all others +to bindir. The defaults are /bin and /sbin. - 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. + --datadir=PATH - --libdir=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. - Sets the installation path for libraries. This is just the - upsclient library for now. The default is /lib. + --mandir=PATH - --with-drvpath=PATH +Sets the base directories for the man pages. The default is +/man, i.e., /usr/local/ups/man. - The UPS drivers will be installed to this path. By default they - install to "/bin", i.e., /usr/local/ups/bin. + --includedir=PATH - The "driverpath" global directive in the ups.conf file overrides this - at run time. +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. - --with-cgipath=PATH + --libdir=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. +Sets the installation path for libraries. This is just the +upsclient library for now. The default is /lib. - 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. + --with-drvpath=PATH - The CGI programs are not built or installed by default. Use - "./configure --with-cgi" to request that they are built and - installed. +The UPS drivers will be installed to this path. By default they +install to "/bin", i.e., /usr/local/ups/bin. - --with-htmlpath=PATH +The "driverpath" global directive in the ups.conf file overrides this +at run time. - 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. + --with-cgipath=PATH - --with-pkgconfig-dir=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. - 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. +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. - Use --without-pkgconfig-dir to disable this feature altogether. +The CGI programs are not built or installed by default. Use +"./configure --with-cgi" to request that they are built and +installed. - --with-hotplug-dir=PATH + --with-htmlpath=PATH - 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 - non-root user, you may have to override this option. +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. - Use --without-hotplug-dir to disable this feature altogether. + --with-pkgconfig-dir=PATH - --with-udev-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. - Where to install Linux 2.6 hotplugging rules, for kernels that have - 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-pkgconfig-dir to disable this feature altogether. - Use --without-udev-dir to disable this feature altogether. + --with-hotplug-dir=PATH -5. Directories used by NUT at run-time: -======================================= +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 +non-root user, you may have to override this option. - --with-pidpath=PATH +Use --without-hotplug-dir to disable this feature altogether. - Changes the directory where pid files are stored. By default this is - /var/run. Certain programs like upsmon will leave files here. + --with-udev-dir=PATH - --with-altpidpath=PATH +Where to install Linux 2.6 hotplugging rules, for kernels that have +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. - 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. +Use --without-udev-dir to disable this feature altogether. - --with-statepath=PATH - Change the default location of the state sockets created by the - drivers. +Directories used by NUT at run-time +----------------------------------- - The NUT_STATEPATH environment variable overrides this at run time. + --with-pidpath=PATH - Default is /var/state/ups. +Changes the directory where pid files are stored. By default this is +/var/run. Certain programs like upsmon will leave files here. -6. Things the compiler might need to find: -========================================== + --with-altpidpath=PATH - --with-gd-includes="-I/foo/bar" +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. - 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-statepath=PATH - --with-gd-libs="-L/foo/bar -labcd -lxyz" +Change the default location of the state sockets created by the +drivers. - 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. +The NUT_STATEPATH environment variable overrides this at run time. - 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. +Default is /var/state/ups. - --with-ssl-includes, --with-usb-includes, --with-snmp-includes, - --with-neon-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. +Things the compiler might need to find +-------------------------------------- - --with-ssl-libs, --with-usb-libs, --with-snmp-libs, - --with-neon-libs, --with-powerman-libs="-L/foo/bar -labcd -lxyz" + --with-gd-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 linker flags that are needed. +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 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 will be +detected and used by default in that situation. + + --with-ssl-includes, --with-usb-includes, --with-snmp-includes, + --with-neon-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. + + --with-ssl-libs, --with-usb-libs, --with-snmp-libs, + --with-neon-libs, --with-powerman-libs="-L/foo/bar -labcd -lxyz" + +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 cbaba7b..deba8b9 100644 --- a/docs/contact-closure.txt +++ b/docs/contact-closure.txt @@ -1,13 +1,11 @@ -Desc: Contact closure hardware -File: contact-closure.txt -Date: 14 March 2004 -Auth: Russell Kroll +Contact closure hardware information +------------------------------------ This is a collection of notes that apply to contact closure UPS hardware, specifically those monitored by the genericups driver. Definitions ------------ +~~~~~~~~~~~ "Contact closure" refers to a situation where one line is connected to another inside UPS hardware to indicate some sort of situation. These @@ -25,7 +23,7 @@ not require cable power. These signals just appear on the right lines without any special configuration on the PC side. Bad levels ----------- +~~~~~~~~~~ Some evil cabling and UPS equipment uses the transmit or receive lines as their reference points for these signals. This is not sufficient to @@ -34,7 +32,7 @@ reading certain signals on your system, make sure your UPS isn't trying to do this. Signals -------- +~~~~~~~ Unlike their smarter cousins, this kind of UPS can only give you very simple yes/no answers. Due to the limited number of serial port lines @@ -53,7 +51,7 @@ a way that it only works when running on battery. Most hardware or cabling will ignore the shutdown signal when running on line power. New genericups types --------------------- +~~~~~~~~~~~~~~~~~~~~ If none of the existing types in the genericups driver work completely, make a note of which ones (if any) manage to work partially. This can @@ -76,15 +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_sd = what to set to make the UPS shut down the load +- 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_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,14 +93,15 @@ the result will be 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 +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 upsdrv_updateinfo() to see how it really works. Custom definitions ------------------- +~~~~~~~~~~~~~~~~~~ Late in the 1.3 cycle, a feature was merged which allows you to create custom monitoring settings without editing the model table. Just set upstype to something close, then use settings in ups.conf to adjust the -rest. See the genericups man page for more details. +rest. See the linkman:genericups[8] man page for more +details. diff --git a/docs/data-room.txt b/docs/data-room.txt deleted file mode 100644 index 574050d..0000000 --- a/docs/data-room.txt +++ /dev/null @@ -1,54 +0,0 @@ -Desc: Typical setups for data rooms -File: data-room.txt -Date: 27 May 2002 -Auth: Russell Kroll - -The split nature of this UPS monitoring software allows a wide variety of -power connections. This document will help you identify how things should -be configured using some general descriptions. - -There are two main elements: - -1. There's a UPS attached to a serial 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 -for individual hosts: - -A: 1 but not 2 -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) -which depend on that same UPS for power, but aren't directly connected to -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. - -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 (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. - -Multi-power supply boxes -======================== - -If you are running large server-class systems that have more than one -power feed, see big-servers.txt for information on how to handle it -properly. diff --git a/docs/design.txt b/docs/design.txt index f4c32fe..dfaeae8 100644 --- a/docs/design.txt +++ b/docs/design.txt @@ -1,34 +1,21 @@ -Desc: Network UPS Tools design document -File: design.txt -Date: 14 March 2004 -Auth: Russell Kroll +NUT design document +=================== 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. The layering -============ +------------ - CLIENTS: upsmon, upsc, upsrw, upsstats, upsset, etc. (via upsclient) - - < network: TCP sockets, typically on port 3493 > +image:images/nut_layering.png[NUT layering] - SERVER: upsd - - < Unix domain sockets with text-based messages > - - DRIVERS: apcsmart, bestups, powercom, etc. - - < serial communications, SNMP, USB, etc. > - -EQUIPMENT: Smart-UPS 700, Fenton PowerPal 660, etc. (actual UPS hardware) How information gets around -=========================== +--------------------------- From the equipment ------------------- +~~~~~~~~~~~~~~~~~~ DRIVERS talk to the EQUIPMENT and receive updates. For most hardware this is polled (DRIVER asks EQUIPMENT about a variable), but forced updates are @@ -36,7 +23,7 @@ also possible. The exact method is not important, as it is abstracted by the driver. 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 @@ -55,7 +42,7 @@ It continues to listen on the socket for additional updates. This protocol is documented in sock-protocol.txt. From the server ---------------- +~~~~~~~~~~~~~~~ The SERVER's internal storage maintains a complete copy of the data which is in the DRIVER, so it is capable of answering any request @@ -66,7 +53,7 @@ requested data if it is available. 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 something happening to the UPS. Some of the common ones are @@ -86,7 +73,7 @@ timing issues. Remember that upsd services clients in a round-robin fashion, so all queries must be lightweight and speedy. Setting variables -================= +----------------- Some variables in the DRIVER or EQUIPMENT can be changed, and carry the FLAG_RW flag. Upon receiving a SET command from the CLIENT, the SERVER @@ -102,7 +89,7 @@ command's completion from the DRIVER. This, too, is planned for a future release. Example data path -================= +----------------- Here's the path a piece of data might take through this architecture. The event is a UPS going on battery, and the final result is a pager @@ -171,13 +158,12 @@ This scenario requires some configuration, obviously: CMDSCRIPT /path/to/upssched-cmd -8. upssched-cmd knows what to do with "upsonbatt" as its first argument +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 diff --git a/docs/developer-guide.txt b/docs/developer-guide.txt new file mode 100644 index 0000000..b3fc2c8 --- /dev/null +++ b/docs/developer-guide.txt @@ -0,0 +1,115 @@ +:titles.underlines: "__","==","--","~~","^^" + +Network UPS Tools Developer Guide +_________________________________ +:Author: Russell_Kroll,_Arnaud_Quette,_Charles_Lepple_and_Peter_Selinger +:Author Initials: RK, AQ, CL & PS + +Introduction +============ + +NUT is both a powerful toolkit and framework that provides support for Power +Devices, such as Uninterruptible Power Supplies, Power Distribution Units +and Solar Controllers. + +This document intend to describe how NUT is designed, and the way to +develop new device drivers and client applications. + + +[[design]] + +include::design.txt[] + + +[[developers]] + +include::developers.txt[] + + +[[new-drivers]] + +include::new-drivers.txt[] + + +[[sock-protocol]] + +include::sock-protocol.txt[] + + +[[augeas]] + +include::../scripts/augeas/README[] + +[[new-clients]] + +include::new-clients.txt[] + + +[[net-protocol]] + +include::net-protocol.txt[] + + +[[dev-tools]] + +NUT developers tools +==================== + +NUT provides several tools for clients and core developers, and QA people. + +Device simulation +----------------- + +The dummy-ups driver propose a simulation mode, also known as 'Dummy Mode'. +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. + +For more information, refer to linkman:dummy-ups[8] +manual page. + + +[[dev-recording]] + +Device recording +---------------- + +To complete dummy-ups, NUT provides a device recorder script called +'device-recorder.sh' and located in the 'tools/' directory of the +NUT source tree. + +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: + + Usage: dummy-recorder.sh [output-file] [interval] + +For example, to record information from the device 'myups' every 10 seconds: + + tools/device-recorder.sh myups@localhost myups.seq 10 + + + +NUT core development and maintenance +==================================== + +This section is intended to people who want to develop new core features, +or to do some maintenance. + + +include::macros.txt[] + + +[[roadmap]] + +include::../TODO[] + + +[[nut-names]] +Appendix A: NUT command and variable naming scheme +================================================== + +include::nut-names.txt[] diff --git a/docs/developers.txt b/docs/developers.txt index 86990de..f26dd17 100644 --- a/docs/developers.txt +++ b/docs/developers.txt @@ -1,16 +1,14 @@ -Desc: Information for developers -File: developers.txt -Date: 18 February 2004 -Auth: Russell Kroll +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 -=================================== +----------------------------------- String handling ---------------- +~~~~~~~~~~~~~~~ Use snprintf. It's even provided with a compatibility module if the target host doesn't have it natively. @@ -24,7 +22,7 @@ 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(). They may write to the syslog, stderr, or both as appropriate. This @@ -38,21 +36,21 @@ fatal_with_errno and fatalx work the same way, but they exit(EXIT_FAILURE) afterwards. Don't call exit() directly. Debugging information ---------------------- +~~~~~~~~~~~~~~~~~~~~~ upsdebug_with_errno(), upsdebugx() and upsdebug_hex() use the global nut_debug_level so you don't have to mess around with printfs 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. Config file parsing -------------------- +~~~~~~~~~~~~~~~~~~~ The configuration parser, called parseconf, is now up to its fourth major version. It has multiple entry points, and can handle many @@ -67,7 +65,7 @@ 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 +NOTE: this does not apply to drivers. Driver authors should use the upsdrv_makevartable() scheme to pick up values from ups.conf. Drivers should not have their own config files. @@ -78,56 +76,63 @@ under normal circumstances. This technique might be used to add more 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. -UPS drivers - main.c -==================== +Device drivers - main.c +----------------------- -The UPS drivers use main.c as their core. The only exception is -dummycons, which only looks like a driver by using the same dstate -function calls. +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 -with "upsdrv_", and they will be called at different times by main +with `upsdrv_`, and they will be called at different times by main depending on what needs to happen. -See new-drivers.txt for information on writing drivers, and also refer -to the skeletal driver in skel.c. +See the <> for information on writing +drivers, and also refer to the skeletal driver in skel.c. Portability -=========== +----------- Avoid things that will break on other systems. All the world is not an x86 Linux box. There are still older systems out there that don't do C++ style comments. -That means you have to comment /* like this */, and // this is right out. + +-------------------------------------- +/* Comments look like this. */ +// Not like this. +-------------------------------------- Newer versions of gcc allow you to declare a variable inside a function somewhat like the way C++ operates, like this: - function do_stuff(void) - { - check_something(); +-------------------------------------------------------------------------------- +function do_stuff(void) +{ + check_something(); - int a; + int a; - a = do_something_else(); - } + 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. Coding style -============ +------------ -This is how I do things. +This is how we do things: +-------------------------------------------------------------------------------- int open_subspace(char *ship, int privacy) { if (!privacy) @@ -138,8 +143,7 @@ int open_subspace(char *ship, int privacy) return secure_channel(ship); } - -(The example that used to be in this file wasn't particularly clear) +-------------------------------------------------------------------------------- The basic idea is that I try to group things into functions, and then find ways to drop out of them when we can't go any further. There's @@ -159,7 +163,7 @@ easier to read, and it enables tools (such as indent and emacs) to display the source code correctly. Indenting with tabs vs. spaces ------------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Another thing to notice is that the indenting happens with tabs instead of spaces. This lets everyone have their personal tab-width setting @@ -180,7 +184,7 @@ kernel - Documentation/CodingStyle. He's done a far better job of explaining this. 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 @@ -193,13 +197,17 @@ long when there is a better alternative (see the note on pretentiousVariableNamingSchemes above). Certainly there should not be more than one statement per line. Please do not use - if (condition) break; +-------------------------------------------------------------------------------- +if (condition) break; +-------------------------------------------------------------------------------- but use the following: - if (condition) { - break; - } +-------------------------------------------------------------------------------- +if (condition) { + break; +} +-------------------------------------------------------------------------------- Miscellaneous coding style tools -------------------------------- @@ -207,12 +215,12 @@ Miscellaneous coding style tools You can go a long way towards converting your source code to the NUT coding style by piping it through the following command: - indent -kr -i8 -T FILE -l1000 -nhnl + indent -kr -i8 -T FILE -l1000 -nhnl This next command does a reasonable job of converting most C++ style comments (but not URLs and DOCTYPE strings): - sed 's#\(^\|[ \t]\)//[ \t]*\(.*\)[ \t]*#/* \2 */#' + sed 's#\(^\|[ \t]\)//[ \t]*\(.*\)[ \t]*#/* \2 */#' Emacs users can adjust how tabs are displayed. For example, it is possible to set a tab stop to be 3 spaces, rather than the usual 8. @@ -222,25 +230,27 @@ rendered on screen). It is even possible to set this on a per-directory basis, by putting something like this into your .emacs file: - ;; NUT style +-------------------------------------------------------------------------------- +;; NUT style - (defun nut-c-mode () - "C mode with adjusted defaults for use with the NUT sources." - (interactive) - (c-mode) - (c-set-style "K&R") - (setq c-basic-offset 3) ;; 3 spaces C-indentation - (setq tab-width 3)) ;; 3 spaces per tab +(defun nut-c-mode () + "C mode with adjusted defaults for use with the NUT sources." + (interactive) + (c-mode) + (c-set-style "K&R") + (setq c-basic-offset 3) ;; 3 spaces C-indentation + (setq tab-width 3)) ;; 3 spaces per tab - ;; apply NUT style to all C source files in all subdirectories of nut/ +;; apply NUT style to all C source files in all subdirectories of nut/ - (setq auto-mode-alist (cons '(".*/nut/.*\\.[ch]$". nut-c-mode) - auto-mode-alist)) +(setq auto-mode-alist (cons '(".*/nut/.*\\.[ch]$". nut-c-mode) + auto-mode-alist)) +-------------------------------------------------------------------------------- Finishing touches ------------------ +~~~~~~~~~~~~~~~~~ -I like code that uses const and static liberally. If you don't need to +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. @@ -250,25 +260,23 @@ 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. -Spaghetti ---------- -If you use a goto, expect me to drop it when my head stops spinning. -It gives me flashbacks to the BASIC code I wrote on the 8 bit systems of -the 80s. I've tried to clean up my act, and you should make the effort +Spaghetti +~~~~~~~~~ + +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. -I'm not making a blanket statement about gotos, since everything +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 is more efficient than any other approach, but you probably won't -encounter them in this software. +encounter them very often in this software. -Hint: there *was* a good use of a goto in upsd until the 1.3 series. At -this point we are back to zero gotos since that code was replaced by -another technique that doesn't need it. Legacy code ------------ +~~~~~~~~~~~ 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 @@ -278,74 +286,94 @@ since then. Don't worry - it'll get cleaned up the next time something in the vicinity gets a visit. Memory leak checking --------------------- +~~~~~~~~~~~~~~~~~~~~ -I can't say enough good things about valgrind. If you do anything with +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 -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. - http://valgrind.kde.org/ +For more information, refer to the link:http://valgrind.kde.org[Valgrind] +project. Conclusion ----------- +~~~~~~~~~~ -The summary: please be kind to my eyes. There's a lot of stuff in here. +The summary: please be kind to our eyes. There's a lot of stuff in here, +and many people have put a lot of time and energy to improve it. Submitting patches -================== +------------------ -Patches that arrive in unified format (diff -u) as plain text with no -HTML, no attachments and a brief summary at the top are the easiest to -handle. They show the context, explain what's going on, and get saved as -one message. Everything stays together until it's time to merge. +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. -Patches that arrive as attachments have to be moved around as separate -files - the body of the message is one, and the patch is in another. -This is not my preferred mode of operation. +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 +link:https://alioth.debian.org/tracker/?atid=411544&group_id=30602&func=browse[ticket on Alioth]. -When sending patches to the lists, be sure to add me as an explicit -recipient to make sure it is considered for merging. A patch which only -goes to a list is generally treated as a RFC and is relatively low -priority. +This 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 the tracker is fair +game. -If your mailer is brain dead and rewrites tabs into spaces, wraps your -patch body, or anything else like that, just attach the patch. I'd -rather deal with an attachment instead of a patch that has tab damage, -rewrapped lines, or worse. Patch cohesion -============== +-------------- Patches should have some kind of unifying element. One patch set is one message, and it should all touch similar things. If you have to edit 6 files to add support for neutrino detection in UPS hardware, that's fine. -However, sending one huge patch that does massive separate changes -all over the tree is not recommended. That kind of patch has to be -split up and evaluated separately, assuming I care enough to do that +However, sending one huge patch that does massive separate changes all over +the tree is not recommended. That kind of patch has to be split up and +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. -Man pages -========= +The completion touch: manual pages and device entry in HCL +---------------------------------------------------------- If you change something that involves an argument to a program or configuration file parsing, the man page is probably now out of date. -If you don't update it, I have to, and I have enough to do as it is. +If you don't update it, we have to, and we have enough to do as it is. -If you write a new driver, send in the man page when you send me the -source code for your driver. Otherwise, I will be forced to write a +If you write a new driver, send in the man page when you send us the +source code for your driver. Otherwise, we will be forced to write a 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, +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 Subversion (SVN) repository hosted at Alioth to track +changes to the NUT source code. To obtain permission to commit to the SVN +repository, you must be prepared to spend a fair amount of time contributing to +the NUT codebase. For occasional contributions over time, you may wish to +investigate one of the <<_distributed_scm_systems,distributed SCM tools>> +listed below. + +Anonymous SVN checkouts are possible: + + svn co svn://svn.debian.org/nut/trunk nut-svn-readonly + +If you change a file in the SVN working copy, you can use `svn diff` to +generate a patch to send to the nut-upsdev mailing list. + Repository etiquette and quality assurance -========================================== +------------------------------------------ Please keep the SVN trunk in working condition at all times. The trunk may be used to generate daily tarballs, and should not contain broken @@ -353,22 +381,103 @@ code if possible. 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 to the trunk once they are complete. -Before committing, please remember to: +Before committing, 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. -* update the ChangeLog, if appropriate. Dates are listed in UTC - ("date --utc"). - -* 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 SVN does not mean it will be -distributed. To distribute a file, you must update the corresponding -Makefile.am. +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 SVN 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, but will not work unless you have all the optional libraries and features installed. +Distributed SCM systems +----------------------- + +Git and Mercurial (Hg) are two popular distributed SCM tools which provide a +bridge to a SVN repository. This makes it possible for a new developer to stay +synchronized with the latest changes to NUT, while keeping a local version +history of their changes before they are merged by the core NUT developers. + +A complete introduction to either Git or Mercurial is beyond the scope of this +document, but many others have written excellent tutorials on both the DSCM +tools, and their SVN interfaces. + +Git and SVN +~~~~~~~~~~~ + +The `git svn` tool synchronizes a Git repository with a +link:http://www.kernel.org/pub/software/scm/git/docs/git-svn.html[SVN repository]. + +In many cases, NUT developers will not need access to the entire repository +history - a snapshot starting at the most recent revision will work nicely: + + git svn clone --revision HEAD svn://svn.debian.org/nut/trunk nut-git + +From the resulting nut-git directory, you may use all of the Git commands to +record your changes, and even create new branches for working on different +aspects of the code. + +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`). + +To import the new SVN revisions, simply run the following command from any +directory under your Git checkout (`nut-git` in the example above). Note that +this only changes the history stored in your repository - it does not touch +your checked-out files. + + git svn fetch + +Initially, the Git `master` branch tracks the SVN `trunk`. The `git svn` +command updates the `remotes/trunk` reference every time you run `git svn +fetch`, but it does not adjust the `master` branch automatically. To update +your master branch with new SVN revisions, you can run the following commands: + + git checkout master + git svn fetch # (optional; this gets commits other than on your current branch) + git svn rebase + +You may create as many branches as you like in your local Git repository. When +using `git svn`, the preferred way to combine your changes with SVN changes is +to use `git rebase` on your local branch. This re-applies your branch's changes +to the new SVN changes, much as though your branch were a series of patches. + +-------------------------------------------------------------------------------- + git checkout master + git branch my-new-feature + git checkout my-new-feature + + # Hack away + + git add changed-file.c + git commit + + # Someone committed something to SVN. Fetch it. + + git svn fetch + git rebase remotes/trunk +-------------------------------------------------------------------------------- + +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 Tracker, or the nut-upsdev list. + +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. + + +Mercurial and SVN +~~~~~~~~~~~~~~~~~ + +Synchronizing a Mercurial repository against the NUT SVN repository should be +similar in spirit to the Git method discussed above. +link:http://mercurial.selenic.com/wiki/WorkingWithSubversion[This wiki page] +discusses your options. + +We would welcome any feedback about this process on the nut-upsdev mailing list. 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/documentation.txt b/docs/documentation.txt new file mode 100644 index 0000000..2d21868 --- /dev/null +++ b/docs/documentation.txt @@ -0,0 +1,70 @@ +ifdef::website[] +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:cables.pdf[PDF]) +- link:docs/man/index.html#User_man[User manual pages] +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] +endif::website[] + +Developer Documentation +----------------------- + +ifdef::website[] +- NUT Developer Guide (link:docs/developer-guide.chunked/index.html[online]) (link:docs/developer-guide.pdf[PDF]) +- NUT Packager Guide (link:docs/packager-guide.chunked/index.html[online]) (link:docs/packager-guide.pdf[PDF]) +- link:ups-protocols.html[UPS protocols library] +- link:docs/man/index.html#Developer_man[Developer manual pages] +- link:nut-qa.html[NUT Quality Assurance] +endif::website[] +ifndef::website[] +- linkdoc:developer-guide[NUT Developer Guide] +- linkdoc:packager-guide[NUT Packager Guide] +- link:ups-protocols.html[UPS protocols library] +- link:../man/index.html#Developer_man[Developer manual pages] +- link:nut-qa.html[NUT Quality Assurance] +endif::website[] + +Offsite Links +------------- + +[[general_powerdev_info]] +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: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://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:http://boxster.ghz.cc/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)' +- link:http://www.usebox.net/jjm/ups-obsd/[Gestionando un SAI desde OpenBSD con NUT] '(Juan J. Martinez, spanish)' +- link:http://forums.gentoo.org/viewtopic-p-2663684.html[HOWTO: MGE Ellipse 300 on gentoo] '(nielchiano)' +- 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)' + +News articles and Press releases +-------------------------------- + +- 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 new file mode 100644 index 0000000..c551902 --- /dev/null +++ b/docs/download.txt @@ -0,0 +1,117 @@ +Download information +==================== + +This section presents the different methods to download NUT. + +Source code +----------- + +[NOTE] +================================================================================ +You should always use PGP/GPG to verify the signatures before using any source code. + +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. +================================================================================ + +Stable tree: 2.6 +~~~~~~~~~~~~~~~~ + +link:http://www.networkupstools.org/source/2.6/nut-2.6.0.tar.gz[nut-2.6.0.tar.gz] +link:http://www.networkupstools.org/source/2.6/nut-2.6.0.tar.gz.sig[signature] +link:http://www.networkupstools.org/source/2.6/new-2.6.0.txt[release notes] +link:http://www.networkupstools.org/source/2.6/ChangeLog[ChangeLog] + +You can also browse the link:http://www.networkupstools.org/source/2.6/[stable source directory]. + + +Testing tree: 2.6.x-pre +~~~~~~~~~~~~~~~~~~~~~~~ + +There is currently no testing release. + + +Development tree: 2.7 +~~~~~~~~~~~~~~~~~~~~~ + +Code repository +^^^^^^^^^^^^^^^ + +The development tree is available through a Subversion repository hosted on the +link:http://alioth.debian.org/[Debian Alioth server]. + +To retrieve the current development tree, use the following command: + + $ svn co svn://svn.debian.org/nut/trunk + +To generate the build scripts, you must call, from the 'trunk' directory: + + $ ./autogen.sh + +Then refer to the +ifdef::website[] +link:docs/user-manual.chunked/index.html[NUT user manual] +endif::website[] +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 <>. + +Browse code +^^^^^^^^^^^ + +You can also browse the code with link:http://svn.debian.org/wsvn/nut/trunk/?rev=0&sc=0[WebSvn]. + +Or through the link:http://boxster.ghz.cc/projects/nut[Trac mirror], +kindly hosted and maintained by Charles Lepple. + +[[Snapshots]] +Snapshots +^^^^^^^^^ + +The latest Subversion developments are available through link:http://buildbot.networkupstools.org/public/nut/waterfall?branch=trunk&builder=Debian-etch-x86&reload=none[snapshots on the Buildbot]. +Look for the latest *[tarball]* link on the top of the page. + +Older versions +~~~~~~~~~~~~~~ + +link:http://www.networkupstools.org/source/[Browse source directory] + + +Binary packages +--------------- + +NOTE: The only official releases from this project are source code. + +NUT is already available in the following systems: + +- 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/search[Novell Suse / openSUSE], +link:https://forum.openwrt.org/viewtopic.php?id=26269[OpenWrt] +link:http://packages.ubuntu.com/nut[Ubuntu]. + +- BSD systems: +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]. + +- Mac OS X: +link:http://pdb.finkproject.org/pdb/package.php/nut[Fink], +link:http://trac.macports.org/browser/trunk/dports/sysutils/nut/Portfile[MacPorts] + +- Windows (client side only): +link:http://csociety.ecn.purdue.edu/~delpha/winnut/[WinNUT] diff --git a/docs/features.txt b/docs/features.txt new file mode 100644 index 0000000..5e49483 --- /dev/null +++ b/docs/features.txt @@ -0,0 +1,239 @@ +Features +======== + +NUT provides many features, and is always improving. +Thus this list may lag behind the current code. + +Features frequently appear during the development cycles, so be sure to look at +the link:http://www.networkupstools.org/download.html[release notes and change logs] +to see the latest additions. + +//////////////////////////////////////////////////////////////////////////////// +*FIXME* statement that NUT is *the* de facto standard on Opensource system. +all Linux distributors have standardized the Power Devices support using NUT. +More and more appliances manufacturers are bundling NUT... +=> add an Appendix NUT Device Integration in the User Manual +//////////////////////////////////////////////////////////////////////////////// + +Multiple manufacturer and device support +---------------------------------------- + +- 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 are supported with the same common interface: + * serial, + * USB, + * network (SNMP, Eaton / MGE XML/HTTP). + +Multiple architecture support +----------------------------- + +- 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, 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. + +- Your system will probably run it too. You just need a good C compiler and +possibly some more packages to gain access to the serial ports. +Other features, such as USB / SNMP / whatever, will also need extra software +installed. + +Layered and modular design with multiple processes +-------------------------------------------------- + +- Three layers: drivers, server, clients. + +- Drivers run on the same host as the server, and clients communicate with the +server over the network. + +- This means clients can monitor any UPS anywhere as long as there is a network +path between them. + +WARNING: Be sure to plug your network's physical hardware (switches, hubs, +routers, bridges, ...) into the UPS! + + +//////////////////////////////////////////////////////////////////////////////// +*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. + +- upsmon won't initiate a shutdown until the total power situation across all +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. + +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. + +- The drivers, server, and monitoring client (upsmon) can all run as separate +user IDs if this is desired for privilege separation. + +- Only one tiny part of one program has root powers. +upsmon starts as root and forks an unprivileged process which does the actual +monitoring over the network. +They remain connected over a pipe. When a shutdown is necessary, a single +character is sent to the privileged process. It then calls the predefined +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. + +- IP-based access control relies on the local firewall and +link:http://en.wikipedia.org/wiki/TCP_Wrapper[TCP Wrapper]. + +- SSL is available as a build option ("--with-ssl"). +It encrypts sessions with upsd and can also be used to authenticate servers. + +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. + +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. + +UPS management and control +-------------------------- + +- Writable variables may be edited on higher end equipment for local customizations + +- 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. + +- 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 + +- 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 +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 variants on these four. + +NOTE: these examples show serial communications for simplicity, but USB or SNMP +or any other monitoring is also possible. + +"Simple" configuration +~~~~~~~~~~~~~~~~~~~~~~ + +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. + +"Advanced" configuration +~~~~~~~~~~~~~~~~~~~~~~~~ + +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. The Master system runs the driver, +upsd, and upsmon in master mode. The Slave systems only run upsmon in slave 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. + +//////////////////////////////////////////////////////////////////////////////// +*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. + +- "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. + +- 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 +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 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 power from some other UPS. This is not a problem. + +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 +------------- + +Thanks to Luc Descotils and Arnaud Quette at Eaton for providing shiny +cleaned-up graphics. diff --git a/docs/hid-subdrivers.txt b/docs/hid-subdrivers.txt index fe5b621..b625b02 100644 --- a/docs/hid-subdrivers.txt +++ b/docs/hid-subdrivers.txt @@ -1,10 +1,8 @@ -Desc: How to make a new subdriver to support another USB/HID UPS -File: hid-subdrivers.txt -Date: 08 January 2007 -Auth: Peter Selinger +How to make a new subdriver to support another USB/HID UPS +---------------------------------------------------------- Overall concept -=============== +~~~~~~~~~~~~~~~ USB (Universal Serial Port) devices can be divided into several different classes (audio, imaging, mass storage etc). Almost all UPS @@ -15,7 +13,7 @@ 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 +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 talking to the USB hardware, and several sub-drivers to handle specific UPS manufacturers (MGE, APC, and Belkin are currently @@ -31,7 +29,7 @@ add support for such a device, read new-drivers.txt and see the tripplite_usb driver for inspiration. HID Usage Tree -============== +~~~~~~~~~~~~~~ From the point of view of writing a HID subdriver, a HID device consists of a bunch of variables. Some variables (such as the current @@ -44,14 +42,17 @@ for a typical APC device. Variable components are separated by ".". Typical values for each variable are also shown for illustrative purposes. -UPS.Battery.Voltage 11.4 V -UPS.Battery.ConfigVoltage 12 V -UPS.Input.Voltage 117 V -UPS.Input.ConfigVoltage 120 V -UPS.AudibleAlarmControl 2 (=enabled) -UPS.PresentStatus.Charging 1 (=yes) -UPS.PresentStatus.Discharging 0 (=no) -UPS.PresentStatus.ACPresent 1 (=yes) +[width="35%"] +|================================================ +|UPS.Battery.Voltage | 11.4 V +|UPS.Battery.ConfigVoltage | 12 V +|UPS.Input.Voltage | 117 V +|UPS.Input.ConfigVoltage | 120 V +|UPS.AudibleAlarmControl | 2 (=enabled) +|UPS.PresentStatus.Charging | 1 (=yes) +|UPS.PresentStatus.Discharging | 0 (=no) +|UPS.PresentStatus.ACPresent | 1 (=yes) +|================================================ As you can see, variables that describe the battery status might be grouped together under "Battery", variables that describe the input @@ -78,10 +79,11 @@ strings, but as numbers (called "usages" in HID terminology). These numbers are defined in the "HID Usage Tables", available from http://www.usb.org/developers/hidpage/. The standard usages for UPS devices are defined in a document called "Usage Tables for HID Power -Devices". +Devices" (the Power Device Class [PDC] specification). -For example, +For example: +-------------------------------------------------------------------------------- 0x00840010 = UPS 0x00840012 = Battery 0x00840030 = Voltage @@ -89,25 +91,28 @@ For example, 0x0084001a = Input 0x0084005a = AudibleAlarmControl 0x00840002 = PresentStatus - 0x00850044 = Charging + 0x00850044 = Charging 0x00850045 = Discharging 0x008500d0 = ACPresent +-------------------------------------------------------------------------------- -Thus, the above usage tree is internally represented as +Thus, the above usage tree is internally represented as: -00840010.00840012.00840030 -00840010.00840012.00840040 -00840010.0084001a.00840030 -00840010.0084001a.00840040 -00840010.0084005a -00840010.00840002.00850044 -00840010.00840002.00850045 -00840010.00840002.008500d0 +-------------------------------------------------------------------------------- + 00840010.00840012.00840030 + 00840010.00840012.00840040 + 00840010.0084001a.00840030 + 00840010.0084001a.00840040 + 00840010.0084005a + 00840010.00840002.00850044 + 00840010.00840002.00850045 + 00840010.00840002.008500d0 +-------------------------------------------------------------------------------- To make matters worse, most manufacturers define their own additional usages, even in cases where standard usages could have been used. for -example Belkin defines 00860040 = ConfigVoltage (which is incidentally -a violation of the USB specification, as 00860040 is reserved for +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: @@ -120,8 +125,9 @@ such as custom implementations of specific instant commands (load.off, shutdown.restart), and conversions of manufacturer specific data formats. + Writing a subdriver -=================== +~~~~~~~~~~~~~~~~~~~ In preparation for writing a subdriver for a device that is currently unsupported, run usbhid-ups with the following command line: @@ -143,7 +149,7 @@ CUSTOMIZATION below). Use the script as follows: - scripts/subdriver/path-to-subdriver.sh < /tmp/info + scripts/subdriver/path-to-subdriver.sh < /tmp/info where /tmp/info is the file where you previously saved the debugging information. @@ -168,16 +174,22 @@ attempts to monitor some UPS variables. To make this driver useful, 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 +how to do this. Please look at the files to see how the currently implemented +subdrivers are written.: -mge-hid.c/h -apc-hid.c/h -belkin-hid.c/h +- apc-hid.c/h +- belkin-hid.c/h +- cps-hid.c/h +- explore-hid.c/h +- libhid.c/h +- liebert-hid.c/h +- mge-hid.c/h +- powercom-hid.c/h +- tripplite-hid.c/h -to see how the currently implemented subdrivers are written. Shutting down the UPS -===================== +~~~~~~~~~~~~~~~~~~~~~ It is desireable to support shutting down the UPS. Usually (for devices that follow the HID Power Device Class specification), this @@ -191,31 +203,31 @@ commands to the UPS in response to sending one NUT command to the driver, this is handled by the driver. In order to make this work, you need to define the following four NUT values: - ups.delay.start (variable, R/W) - ups.delay.shutdown (variable, R/W) - load.off.delay (command) - load.on.delay (command) + ups.delay.start (variable, R/W) + ups.delay.shutdown (variable, R/W) + load.off.delay (command) + load.on.delay (command) If the UPS supports it, the following variables can be used to show the countdown to start/shutdown: - ups.timer.start (variable, R/O) - ups.timer.shutdown (variable, R/O) + ups.timer.start (variable, R/O) + ups.timer.shutdown (variable, R/O) -The 'load.on' and 'load.off' commands will be defined implicitly by +The `load.on` and `load.off` commands will be defined implicitly by the driver (using a delay value of '0'). Define these commands yourself, if your UPS requires a different value to switch on/off the load without delay. -Note that the driver expects the 'load.off.delay' and 'load.on.delay' +Note that the driver expects the `load.off.delay` and `load.on.delay` to follow the HID Power Device Class specification, which means that -the 'load.on.delay' command should NOT switch on the load in the +the `load.on.delay` command should NOT switch on the load in the absence of mains power. If your UPS switches on the load regardless of the mains status, DO NOT define this command. You probably want to -define the 'shutdown.return' and/or 'shutdown.stayoff' commands in +define the `shutdown.return` and/or `shutdown.stayoff` commands in that case. Commands defined in the subdriver will take precedence over the ones that are composed in the driver. When running the driver with the '-k' flag, it will first attempt to -send a 'shutdown.return' command and if that fails, will fallback to -'shutdown.reboot'. +send a `shutdown.return` command and if that fails, will fallback to +`shutdown.reboot`. diff --git a/docs/history.txt b/docs/history.txt new file mode 100644 index 0000000..da66cec --- /dev/null +++ b/docs/history.txt @@ -0,0 +1,335 @@ +ifdef::website[] +Project history +=============== +endif::website[] + +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). + +Prototypes and experiments +-------------------------- + +May 1996: early status hacks +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +APC's Powerchute was running on kadets.d20.co.edu (a BSD/OS box) with +SCO binary emulation. Early test versions ran in cron, pulled status +from the log files and wrote them to a .plan file. You could see the +results by fingering `pwrchute@kadets.d20.co.edu` while it lasted: + +------------------------------------------------------------------------ + + Last login Sat May 11 21:33 (MDT) on ttyp0 from intrepid.rmi.net + Plan: + Welcome to the UPS monitor service at kadets.d20.co.edu. + The Smart-UPS attached to kadets generated a report at 14:24:01 on 05/17/96. + During the measured period, the following data points were taken: + Voltage ranged from 115.0 VAC to 116.3 VAC. + The UPS generated 116.3 VAC at 60.00 Hz. + The battery level was at 27.60 volts. + The load placed on the UPS was 024.9 percent. + UPS temperature was measured at 045.0 degrees Celsius. + Measurements are taken every 10 minutes by the upsd daemon. + This report is generated by a script written by Russell Kroll. + Modified for compatibility with the BSD/OS cron daemon by Neil Schroeder + +------------------------------------------------------------------------ + +This same status data could also be seen with a web browser, since we +had rigged up a CGI wrapper script which called finger. + + +January 1997: initial protocol tests +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Initial tests with a freestanding non-daemon program provided a few +basic status registers from the UPS. The 940-0024C cable was not yet +understood, so this happened over the [attachment:apcevilhack.jpg evil +two-wire serial hack]. + +------------------------------------------------------------------------ + Communicating with SMART-UPS 700 S/N WS9643050926 [10/17/96] + Input voltage range: 117.6 VAC - 118.9 VAC + Load is 010.9% of capacity, battery is charged to 100.0% of capacity +------------------------------------------------------------------------ + +Note that today's apcsmart driver still displays the serial number when +it starts, since it is derived from this original code. + +September 1997: first client/server code +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The first split daemon/client code was written. upsd spoke directly to +the UPS (APC Smart models only) and communicated with upsc by sending +binary structures in UDP datagrams. + +The first CGI interface existed, but it was all implemented with shell +scripts. The main script would call upsc to retrieve status values. Then +it would cat a template file through sed to plug them into the page. + +image::images/old-cgi.png[Old CGI screenshot] + +upsstats actually has since returned to using templates, despite having +a period in the middle when it used hardcoded HTML. + +The images were also created with shell scripts. Each script would call +upsc to get the right value (utility, upsload, battcap). It then took +the value, plugged it into a command file with sed, and passed that into +'fly', a program which used an interpreted language to create images. +fly actually uses gd, just like upsimage does today. + +This code later evolved into Smart UPS Tools 0.10. + +Smart UPS Tools +--------------- + +March 1998: first public release +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Version 0.10 was released on March 10, 1998. It used the same design as +the pre-release prototype. This made expansion difficult as the binary +structure used for network communications would break any time a new +variable was added. Due to byte-ordering and struct alignment issues, +the code usually couldn't talk over the network to a system with a +different architecture. It was also hopelessly bound to one type of UPS +hardware. + +Five more releases followed with this design followed. The last was +0.34, released October 27, 1998. + +June 1999: Redesigned, rewritten +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Following a long period of inactivity and two months of prerelease +testing versions, 0.40.0 was released on June 5, 1999. It featured a +complete redesign and rewrite of all of the code. The layering was now +in three pieces, with the single driver (smartups) separate from the +server (upsd). + +Clients remained separate as before and still used UDP to talk to the +server, but they now used a text-based protocol instead of the brittle +binary structs. A typical request like "REQ UTILITY" would be answered +with "ANS UTILITY 120.0". + +The ups-trust425-625 driver appeared shortly after the release of +0.40.0, marking the first expansion beyond APC hardware. + +Over the months that followed, the backupspro driver would be forked +from the smartups driver to handle the APC Back-UPS Pro line. Then the +backups driver was written to handle the APC Back-UPS contact-closure +models. These drivers would later be renamed and recombined, with +smartups and backupspro becoming apcsmart, and backups became genericups. + +The drivers stored status data in an array. At first, they passed this data to +upsd by saving it to a file. upsd would reread this file every few seconds to +keep a copy for itself. This was later expanded to allow shared memory mode, +where only a stub would remain on the disk. The drivers and server then passed +data through the shared memory space. + +upsd picked up the ability to monitor multiple drivers on the system, and the +"upsname@hostname" scheme was born. Access controls were added, and then the +network code was expanded to allow TCP communications, which at this point were +on port 3305. + + +Network UPS Tools +----------------- + +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. + +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 "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. + +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 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 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. + +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. + +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 +--------------------- + +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. + +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 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. + +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. + +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. + +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. + +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. + +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. + +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 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. + +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. + +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 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. + +Second major version +-------------------- + +March 2004: NUT 2.0.0 +~~~~~~~~~~~~~~~~~~~~~ + +NUT 2.0.0 arrived on March 23, 2004. The jump to version 2 shows the difference +in the protocols and naming that happened during the 1.3 and 1.5 development +series. 2.0 no longer ships with backwards compatibility code, so it's smaller +and cleaner than 1.4. + + +The change of leadership +------------------------ + +February 2005: NUT 2.0.1 +~~~~~~~~~~~~~~~~~~~~~~~~ + +The year 2004 was marked by a release slowdown, since Russell was busy with +personal subjects. But the patches queue was still growing quickly. + +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. + +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. + +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]. +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. + + +//////////////////////////////////////////////////////////////////////// +*sandbox* + +TO BE COMPLETED + ADD A LINK TO IDEA / FUTURE + +link on the team + history + +mention: +- MGE supporting officially, +- USB / SNMP / XML drivers (first non serial drivers), +- Power Management (HAL) bridging, +- PDU support, +- perl / python support... +- client history and evolution (wmnut: 01/01/2002) + +release history +
  • July 7, 2008: Client activity: new client NUT-Monitor +
  • June 27, 2008: Client activity: new Python class PyNUT +
  • June 19, 2008: Client activity: KNutClient 0.9.4 +
  • May 7, 2008: 2.2.2 released +
  • December 21, 2007: 2.2.1 released +
  • August 31, 2007: Client activity: UPS Monitor link update +
  • August 31, 2007: Client activity: Windows NUT client 1.5.0 +
  • July 5, 2007: 2.2.0 released +
  • June 5, 2007: Client activity: collectd NUT plugin +
  • April 10, 2007: Client activity: KNutClient 0.9.3 +
  • January 15, 2007: 2.0.5 released +
  • January 8, 2007: Client activity: Windows NUT client + + + + +
    +
    +
    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] + +
    +
    + +ifdef::analytics[] + + + + +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/drivers/Makefile.am b/drivers/Makefile.am index 843ffe7..2391963 100644 --- a/drivers/Makefile.am +++ b/drivers/Makefile.am @@ -1,8 +1,9 @@ # Network UPS Tools: drivers -# by default, link programs in this directory with libcommon.a +# 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 = ../common/libcommon.a ../common/libparseconf.la +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 @@ -31,16 +32,16 @@ endif SERIAL_DRIVERLIST = apcsmart bcmxcp belkin belkinunv bestfcom \ bestfortress bestuferrups bestups dummy-ups etapro everups \ - gamatronic genericups isbmex liebert liebertgxt2 masterguard megatec metasys \ + gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys \ mge-shut mge-utalk microdowell newmge-shut oneac optiups powercom rhino \ safenet skel solis tripplite tripplitesu upscode2 victronups powerpanel \ blazer_ser clone clone-outlet ivtscd SNMP_DRIVERLIST = snmp-ups -USB_LIBUSB_DRIVERLIST = usbhid-ups bcmxcp_usb tripplite_usb megatec_usb \ +USB_LIBUSB_DRIVERLIST = usbhid-ups bcmxcp_usb tripplite_usb \ blazer_usb richcomm_usb USB_DRIVERLIST = $(USB_LIBUSB_DRIVERLIST) HAL_DRIVERLIST = hald-addon-usbhid-ups hald-addon-bcmxcp_usb \ - hald-addon-tripplite_usb hald-addon-megatec_usb + hald-addon-tripplite_usb hald-addon-blazer_usb NEONXML_DRIVERLIST = netxml-ups # distribute all drivers, even ones that are not built by default @@ -87,6 +88,7 @@ upsdrvctl_LDADD = $(LDADD_COMMON) # serial drivers: all of them use standard LDADD and CFLAGS apcsmart_SOURCES = apcsmart.c bcmxcp_SOURCES = bcmxcp.c bcmxcp_ser.c +bcmxcp_LDADD = $(LDADD) -lm belkin_SOURCES = belkin.c belkinunv_SOURCES = belkinunv.c bestfcom_SOURCES = bestfcom.c @@ -102,9 +104,8 @@ isbmex_SOURCES = isbmex.c isbmex_LDADD = $(LDADD) -lm ivtscd_SOURCES = ivtscd.c liebert_SOURCES = liebert.c -liebertgxt2_SOURCES = liebertgxt2.c +liebert_esp2_SOURCES = liebert-esp2.c masterguard_SOURCES = masterguard.c -megatec_SOURCES = megatec.c metasys_SOURCES = metasys.c mge_shut_SOURCES = mge-shut.c hidparser.c mge_utalk_SOURCES = mge-utalk.c @@ -134,7 +135,7 @@ dummy_ups_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/clients dummy_ups_LDADD = $(LDADD_DRIVERS) ../clients/libupsclient.la if WITH_SSL dummy_ups_CFLAGS += $(LIBSSL_CFLAGS) - dummy_ups_LDADD += $(LIBSSL_LDFLAGS) + dummy_ups_LDADD += $(LIBSSL_LIBS) endif # Clone drivers @@ -148,26 +149,22 @@ skel_LDADD = $(LDADD_DRIVERS) # USB 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 + liebert-hid.c mge-hid.c powercom-hid.c tripplite-hid.c idowell-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_LDFLAGS) +usbhid_ups_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) tripplite_usb_SOURCES = tripplite_usb.c libusb.c usb-common.c -tripplite_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LDFLAGS) -lm +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_LDFLAGS) - -megatec_usb_SOURCES = megatec.c megatec_usb.c libusb.c usb-common.c -megatec_usb_CFLAGS = $(AM_CFLAGS) -DMEGATEC_SUBDRV -megatec_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LDFLAGS) +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_LDFLAGS) -lm +blazer_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm richcomm_usb_SOURCES = richcomm_usb.c usb-common.c -richcomm_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LDFLAGS) +richcomm_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) # HID-over-serial newmge_shut_SOURCES = usbhid-ups.c libshut.c libhid.c hidparser.c mge-hid.c @@ -177,31 +174,31 @@ newmge_shut_LDADD = $(LDADD) # SNMP 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 -snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LDFLAGS) + ietf-mib.c mge-mib.c netvision-mib.c powerware-mib.c raritan-pdu-mib.c \ + bestpower-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_LDFLAGS) $(LIBHAL_LDFLAGS) +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_LDFLAGS) $(LIBHAL_LDFLAGS) -lm +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_LDFLAGS) $(LIBHAL_LDFLAGS) +hald_addon_bcmxcp_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) -hald_addon_megatec_usb_SOURCES = megatec.c megatec_usb.c libusb.c -hald_addon_megatec_usb_CFLAGS = $(AM_CFLAGS) -DMEGATEC_SUBDRV -hald_addon_megatec_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LDFLAGS) $(LIBHAL_LDFLAGS) +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 # NEON XML/HTTP netxml_ups_SOURCES = netxml-ups.c mge-xml.c -netxml_ups_LDADD = $(LDADD_DRIVERS) $(LIBNEON_LDFLAGS) +netxml_ups_LDADD = $(LDADD_DRIVERS) $(LIBNEON_LIBS) # Powerman powerman_pdu_SOURCES = powerman-pdu.c -powerman_pdu_LDADD = $(LDADD) $(LIBPOWERMAN_LDFLAGS) +powerman_pdu_LDADD = $(LDADD) $(LIBPOWERMAN_LIBS) # ---------------------------------------------------------------------- # List of header files. The purpose of this list is not dependency @@ -209,14 +206,14 @@ powerman_pdu_LDADD = $(LDADD) $(LIBPOWERMAN_LDFLAGS) # distributed by "make dist". dist_noinst_HEADERS = apc-mib.h apc-hid.h apcsmart.h baytech-mib.h bcmxcp.h \ - bcmxcp_io.h belkin.h belkin-hid.h blazer.h cps-hid.h dstate.h dstate-hal.h \ - dummy-ups.h eaton-mib.h explore-hid.h gamatronic.h genericups.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 megatec.h mge-hid.h mge-mib.h mge-shut.h mge-utalk.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 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 + upshandler.h usb-common.h usbhid-ups.h powercom-hid.h compaq-mib.h idowell-hid.h # Define a dummy library so that Automake builds rules for the # corresponding object files. This library is not actually built, diff --git a/drivers/Makefile.in b/drivers/Makefile.in index 277adb3..841c3e6 100644 --- a/drivers/Makefile.in +++ b/drivers/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -62,17 +62,18 @@ EXTRA_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_4) \ @SOME_DRIVERS_FALSE@@WITH_NEONXML_TRUE@am__append_9 = $(NEONXML_DRIVERLIST) @SOME_DRIVERS_FALSE@@WITH_LIBPOWERMAN_TRUE@am__append_10 = powerman-pdu @WITH_SSL_TRUE@am__append_11 = $(LIBSSL_CFLAGS) -@WITH_SSL_TRUE@am__append_12 = $(LIBSSL_LDFLAGS) +@WITH_SSL_TRUE@am__append_12 = $(LIBSSL_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_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -82,6 +83,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -107,18 +109,18 @@ am__EXEEXT_1 = apcsmart$(EXEEXT) bcmxcp$(EXEEXT) belkin$(EXEEXT) \ bestuferrups$(EXEEXT) bestups$(EXEEXT) dummy-ups$(EXEEXT) \ etapro$(EXEEXT) everups$(EXEEXT) gamatronic$(EXEEXT) \ genericups$(EXEEXT) isbmex$(EXEEXT) liebert$(EXEEXT) \ - liebertgxt2$(EXEEXT) masterguard$(EXEEXT) megatec$(EXEEXT) \ - metasys$(EXEEXT) mge-shut$(EXEEXT) mge-utalk$(EXEEXT) \ - microdowell$(EXEEXT) newmge-shut$(EXEEXT) oneac$(EXEEXT) \ - optiups$(EXEEXT) powercom$(EXEEXT) rhino$(EXEEXT) \ - safenet$(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) + liebert-esp2$(EXEEXT) masterguard$(EXEEXT) metasys$(EXEEXT) \ + mge-shut$(EXEEXT) mge-utalk$(EXEEXT) microdowell$(EXEEXT) \ + newmge-shut$(EXEEXT) oneac$(EXEEXT) optiups$(EXEEXT) \ + powercom$(EXEEXT) rhino$(EXEEXT) safenet$(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) am__EXEEXT_2 = snmp-ups$(EXEEXT) am__EXEEXT_3 = usbhid-ups$(EXEEXT) bcmxcp_usb$(EXEEXT) \ - tripplite_usb$(EXEEXT) megatec_usb$(EXEEXT) \ - blazer_usb$(EXEEXT) richcomm_usb$(EXEEXT) + tripplite_usb$(EXEEXT) blazer_usb$(EXEEXT) \ + richcomm_usb$(EXEEXT) am__EXEEXT_4 = $(am__EXEEXT_3) am__EXEEXT_5 = netxml-ups$(EXEEXT) @SOME_DRIVERS_FALSE@@WITH_SERIAL_TRUE@am__EXEEXT_6 = $(am__EXEEXT_1) @@ -131,7 +133,7 @@ am__installdirs = "$(DESTDIR)$(driverexecdir)" \ am__EXEEXT_11 = hald-addon-usbhid-ups$(EXEEXT) \ hald-addon-bcmxcp_usb$(EXEEXT) \ hald-addon-tripplite_usb$(EXEEXT) \ - hald-addon-megatec_usb$(EXEEXT) + hald-addon-blazer_usb$(EXEEXT) PROGRAMS = $(driverexec_PROGRAMS) $(halexec_PROGRAMS) am_apcsmart_OBJECTS = apcsmart.$(OBJEXT) apcsmart_OBJECTS = $(am_apcsmart_OBJECTS) @@ -141,8 +143,8 @@ am__DEPENDENCIES_2 = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) serial.o apcsmart_DEPENDENCIES = $(am__DEPENDENCIES_2) am_bcmxcp_OBJECTS = bcmxcp.$(OBJEXT) bcmxcp_ser.$(OBJEXT) bcmxcp_OBJECTS = $(am_bcmxcp_OBJECTS) -bcmxcp_LDADD = $(LDADD) -bcmxcp_DEPENDENCIES = $(am__DEPENDENCIES_2) +am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2) +bcmxcp_DEPENDENCIES = $(am__DEPENDENCIES_3) am_bcmxcp_usb_OBJECTS = bcmxcp_usb.$(OBJEXT) bcmxcp.$(OBJEXT) \ usb-common.$(OBJEXT) bcmxcp_usb_OBJECTS = $(am_bcmxcp_usb_OBJECTS) @@ -173,7 +175,6 @@ bestups_LDADD = $(LDADD) bestups_DEPENDENCIES = $(am__DEPENDENCIES_2) am_blazer_ser_OBJECTS = blazer.$(OBJEXT) blazer_ser.$(OBJEXT) blazer_ser_OBJECTS = $(am_blazer_ser_OBJECTS) -am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2) blazer_ser_DEPENDENCIES = $(am__DEPENDENCIES_3) am_blazer_usb_OBJECTS = blazer.$(OBJEXT) blazer_usb.$(OBJEXT) \ libusb.$(OBJEXT) usb-common.$(OBJEXT) @@ -216,17 +217,11 @@ am_hald_addon_bcmxcp_usb_OBJECTS = bcmxcp_usb.$(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_megatec_usb_OBJECTS = \ - hald_addon_megatec_usb-megatec.$(OBJEXT) \ - hald_addon_megatec_usb-megatec_usb.$(OBJEXT) \ - hald_addon_megatec_usb-libusb.$(OBJEXT) -hald_addon_megatec_usb_OBJECTS = $(am_hald_addon_megatec_usb_OBJECTS) -hald_addon_megatec_usb_DEPENDENCIES = $(LDADD_HAL_DRIVERS) \ +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) -hald_addon_megatec_usb_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(hald_addon_megatec_usb_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ am_hald_addon_tripplite_usb_OBJECTS = tripplite_usb.$(OBJEXT) \ libusb.$(OBJEXT) hald_addon_tripplite_usb_OBJECTS = \ @@ -236,7 +231,7 @@ hald_addon_tripplite_usb_DEPENDENCIES = $(LDADD_HAL_DRIVERS) \ am__objects_1 = apc-hid.$(OBJEXT) belkin-hid.$(OBJEXT) \ cps-hid.$(OBJEXT) explore-hid.$(OBJEXT) liebert-hid.$(OBJEXT) \ mge-hid.$(OBJEXT) powercom-hid.$(OBJEXT) \ - tripplite-hid.$(OBJEXT) + tripplite-hid.$(OBJEXT) idowell-hid.$(OBJEXT) am_hald_addon_usbhid_ups_OBJECTS = usbhid-ups.$(OBJEXT) \ libhid.$(OBJEXT) libusb.$(OBJEXT) hidparser.$(OBJEXT) \ $(am__objects_1) @@ -254,26 +249,14 @@ am_liebert_OBJECTS = liebert.$(OBJEXT) liebert_OBJECTS = $(am_liebert_OBJECTS) liebert_LDADD = $(LDADD) liebert_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_liebertgxt2_OBJECTS = liebertgxt2.$(OBJEXT) -liebertgxt2_OBJECTS = $(am_liebertgxt2_OBJECTS) -liebertgxt2_LDADD = $(LDADD) -liebertgxt2_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_liebert_esp2_OBJECTS = liebert-esp2.$(OBJEXT) +liebert_esp2_OBJECTS = $(am_liebert_esp2_OBJECTS) +liebert_esp2_LDADD = $(LDADD) +liebert_esp2_DEPENDENCIES = $(am__DEPENDENCIES_2) am_masterguard_OBJECTS = masterguard.$(OBJEXT) masterguard_OBJECTS = $(am_masterguard_OBJECTS) masterguard_LDADD = $(LDADD) masterguard_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_megatec_OBJECTS = megatec.$(OBJEXT) -megatec_OBJECTS = $(am_megatec_OBJECTS) -megatec_LDADD = $(LDADD) -megatec_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_megatec_usb_OBJECTS = megatec_usb-megatec.$(OBJEXT) \ - megatec_usb-megatec_usb.$(OBJEXT) megatec_usb-libusb.$(OBJEXT) \ - megatec_usb-usb-common.$(OBJEXT) -megatec_usb_OBJECTS = $(am_megatec_usb_OBJECTS) -megatec_usb_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) -megatec_usb_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(megatec_usb_CFLAGS) \ - $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_metasys_OBJECTS = metasys.$(OBJEXT) metasys_OBJECTS = $(am_metasys_OBJECTS) metasys_LDADD = $(LDADD) @@ -336,7 +319,8 @@ skel_DEPENDENCIES = $(LDADD_DRIVERS) 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) + powerware-mib.$(OBJEXT) raritan-pdu-mib.$(OBJEXT) \ + bestpower-mib.$(OBJEXT) snmp_ups_OBJECTS = $(am_snmp_ups_OBJECTS) snmp_ups_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) am_solis_OBJECTS = solis.$(OBJEXT) @@ -390,12 +374,11 @@ SOURCES = $(libdummy_a_SOURCES) $(libnuthalmain_a_SOURCES) \ $(clone_outlet_SOURCES) $(dummy_ups_SOURCES) $(etapro_SOURCES) \ $(everups_SOURCES) $(gamatronic_SOURCES) $(genericups_SOURCES) \ $(hald_addon_bcmxcp_usb_SOURCES) \ - $(hald_addon_megatec_usb_SOURCES) \ + $(hald_addon_blazer_usb_SOURCES) \ $(hald_addon_tripplite_usb_SOURCES) \ $(hald_addon_usbhid_ups_SOURCES) $(isbmex_SOURCES) \ - $(ivtscd_SOURCES) $(liebert_SOURCES) $(liebertgxt2_SOURCES) \ - $(masterguard_SOURCES) $(megatec_SOURCES) \ - $(megatec_usb_SOURCES) $(metasys_SOURCES) $(mge_shut_SOURCES) \ + $(ivtscd_SOURCES) $(liebert_SOURCES) $(liebert_esp2_SOURCES) \ + $(masterguard_SOURCES) $(metasys_SOURCES) $(mge_shut_SOURCES) \ $(mge_utalk_SOURCES) $(microdowell_SOURCES) \ $(netxml_ups_SOURCES) $(newmge_shut_SOURCES) $(oneac_SOURCES) \ $(optiups_SOURCES) $(powercom_SOURCES) $(powerman_pdu_SOURCES) \ @@ -413,12 +396,11 @@ DIST_SOURCES = $(libdummy_a_SOURCES) $(libnuthalmain_a_SOURCES) \ $(clone_outlet_SOURCES) $(dummy_ups_SOURCES) $(etapro_SOURCES) \ $(everups_SOURCES) $(gamatronic_SOURCES) $(genericups_SOURCES) \ $(hald_addon_bcmxcp_usb_SOURCES) \ - $(hald_addon_megatec_usb_SOURCES) \ + $(hald_addon_blazer_usb_SOURCES) \ $(hald_addon_tripplite_usb_SOURCES) \ $(hald_addon_usbhid_ups_SOURCES) $(isbmex_SOURCES) \ - $(ivtscd_SOURCES) $(liebert_SOURCES) $(liebertgxt2_SOURCES) \ - $(masterguard_SOURCES) $(megatec_SOURCES) \ - $(megatec_usb_SOURCES) $(metasys_SOURCES) $(mge_shut_SOURCES) \ + $(ivtscd_SOURCES) $(liebert_SOURCES) $(liebert_esp2_SOURCES) \ + $(masterguard_SOURCES) $(metasys_SOURCES) $(mge_shut_SOURCES) \ $(mge_utalk_SOURCES) $(microdowell_SOURCES) \ $(netxml_ups_SOURCES) $(newmge_shut_SOURCES) $(oneac_SOURCES) \ $(optiups_SOURCES) $(powercom_SOURCES) $(powerman_pdu_SOURCES) \ @@ -432,9 +414,11 @@ HEADERS = $(dist_noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -447,8 +431,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -465,7 +451,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -476,22 +461,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ @@ -588,9 +573,10 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -# by default, link programs in this directory with libcommon.a +# 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 = ../common/libcommon.a ../common/libparseconf.la +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 @@ -604,18 +590,18 @@ AM_CFLAGS = -I$(top_srcdir)/include $(am__append_1) $(am__append_2) \ $(am__append_3) $(am__append_4) $(am__append_5) SERIAL_DRIVERLIST = apcsmart bcmxcp belkin belkinunv bestfcom \ bestfortress bestuferrups bestups dummy-ups etapro everups \ - gamatronic genericups isbmex liebert liebertgxt2 masterguard megatec metasys \ + gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys \ mge-shut mge-utalk microdowell newmge-shut oneac optiups powercom rhino \ safenet skel solis tripplite tripplitesu upscode2 victronups powerpanel \ blazer_ser clone clone-outlet ivtscd SNMP_DRIVERLIST = snmp-ups -USB_LIBUSB_DRIVERLIST = usbhid-ups bcmxcp_usb tripplite_usb megatec_usb \ +USB_LIBUSB_DRIVERLIST = usbhid-ups bcmxcp_usb tripplite_usb \ blazer_usb richcomm_usb USB_DRIVERLIST = $(USB_LIBUSB_DRIVERLIST) HAL_DRIVERLIST = hald-addon-usbhid-ups hald-addon-bcmxcp_usb \ - hald-addon-tripplite_usb hald-addon-megatec_usb + hald-addon-tripplite_usb hald-addon-blazer_usb NEONXML_DRIVERLIST = netxml-ups @SOME_DRIVERS_FALSE@@WITH_HAL_TRUE@halexecdir = $(HAL_CALLOUTS_PATH) @@ -630,6 +616,7 @@ upsdrvctl_LDADD = $(LDADD_COMMON) # serial drivers: all of them use standard LDADD and CFLAGS apcsmart_SOURCES = apcsmart.c bcmxcp_SOURCES = bcmxcp.c bcmxcp_ser.c +bcmxcp_LDADD = $(LDADD) -lm belkin_SOURCES = belkin.c belkinunv_SOURCES = belkinunv.c bestfcom_SOURCES = bestfcom.c @@ -645,9 +632,8 @@ isbmex_SOURCES = isbmex.c isbmex_LDADD = $(LDADD) -lm ivtscd_SOURCES = ivtscd.c liebert_SOURCES = liebert.c -liebertgxt2_SOURCES = liebertgxt2.c +liebert_esp2_SOURCES = liebert-esp2.c masterguard_SOURCES = masterguard.c -megatec_SOURCES = megatec.c metasys_SOURCES = metasys.c mge_shut_SOURCES = mge-shut.c hidparser.c mge_utalk_SOURCES = mge-utalk.c @@ -688,23 +674,20 @@ skel_LDADD = $(LDADD_DRIVERS) # USB 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 + liebert-hid.c mge-hid.c powercom-hid.c tripplite-hid.c idowell-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_LDFLAGS) +usbhid_ups_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) tripplite_usb_SOURCES = tripplite_usb.c libusb.c usb-common.c -tripplite_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LDFLAGS) -lm +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_LDFLAGS) -megatec_usb_SOURCES = megatec.c megatec_usb.c libusb.c usb-common.c -megatec_usb_CFLAGS = $(AM_CFLAGS) -DMEGATEC_SUBDRV -megatec_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LDFLAGS) +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_LDFLAGS) -lm +blazer_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm richcomm_usb_SOURCES = richcomm_usb.c usb-common.c -richcomm_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LDFLAGS) +richcomm_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) # HID-over-serial newmge_shut_SOURCES = usbhid-ups.c libshut.c libhid.c hidparser.c mge-hid.c @@ -714,44 +697,44 @@ newmge_shut_LDADD = $(LDADD) # SNMP 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 + ietf-mib.c mge-mib.c netvision-mib.c powerware-mib.c raritan-pdu-mib.c \ + bestpower-mib.c -snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LDFLAGS) +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_LDFLAGS) $(LIBHAL_LDFLAGS) +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_LDFLAGS) $(LIBHAL_LDFLAGS) -lm +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_LDFLAGS) $(LIBHAL_LDFLAGS) -hald_addon_megatec_usb_SOURCES = megatec.c megatec_usb.c libusb.c -hald_addon_megatec_usb_CFLAGS = $(AM_CFLAGS) -DMEGATEC_SUBDRV -hald_addon_megatec_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LDFLAGS) $(LIBHAL_LDFLAGS) +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 # NEON XML/HTTP netxml_ups_SOURCES = netxml-ups.c mge-xml.c -netxml_ups_LDADD = $(LDADD_DRIVERS) $(LIBNEON_LDFLAGS) +netxml_ups_LDADD = $(LDADD_DRIVERS) $(LIBNEON_LIBS) # Powerman powerman_pdu_SOURCES = powerman-pdu.c -powerman_pdu_LDADD = $(LDADD) $(LIBPOWERMAN_LDFLAGS) +powerman_pdu_LDADD = $(LDADD) $(LIBPOWERMAN_LIBS) # ---------------------------------------------------------------------- # 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-hid.h apcsmart.h baytech-mib.h bcmxcp.h \ - bcmxcp_io.h belkin.h belkin-hid.h blazer.h cps-hid.h dstate.h dstate-hal.h \ - dummy-ups.h eaton-mib.h explore-hid.h gamatronic.h genericups.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 megatec.h mge-hid.h mge-mib.h mge-shut.h mge-utalk.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 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 + upshandler.h usb-common.h usbhid-ups.h powercom-hid.h compaq-mib.h idowell-hid.h # Define a dummy library so that Automake builds rules for the @@ -951,9 +934,9 @@ genericups$(EXEEXT): $(genericups_OBJECTS) $(genericups_DEPENDENCIES) hald-addon-bcmxcp_usb$(EXEEXT): $(hald_addon_bcmxcp_usb_OBJECTS) $(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-megatec_usb$(EXEEXT): $(hald_addon_megatec_usb_OBJECTS) $(hald_addon_megatec_usb_DEPENDENCIES) - @rm -f hald-addon-megatec_usb$(EXEEXT) - $(hald_addon_megatec_usb_LINK) $(hald_addon_megatec_usb_OBJECTS) $(hald_addon_megatec_usb_LDADD) $(LIBS) +hald-addon-blazer_usb$(EXEEXT): $(hald_addon_blazer_usb_OBJECTS) $(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-tripplite_usb$(EXEEXT): $(hald_addon_tripplite_usb_OBJECTS) $(hald_addon_tripplite_usb_DEPENDENCIES) @rm -f hald-addon-tripplite_usb$(EXEEXT) $(LINK) $(hald_addon_tripplite_usb_OBJECTS) $(hald_addon_tripplite_usb_LDADD) $(LIBS) @@ -969,18 +952,12 @@ ivtscd$(EXEEXT): $(ivtscd_OBJECTS) $(ivtscd_DEPENDENCIES) liebert$(EXEEXT): $(liebert_OBJECTS) $(liebert_DEPENDENCIES) @rm -f liebert$(EXEEXT) $(LINK) $(liebert_OBJECTS) $(liebert_LDADD) $(LIBS) -liebertgxt2$(EXEEXT): $(liebertgxt2_OBJECTS) $(liebertgxt2_DEPENDENCIES) - @rm -f liebertgxt2$(EXEEXT) - $(LINK) $(liebertgxt2_OBJECTS) $(liebertgxt2_LDADD) $(LIBS) +liebert-esp2$(EXEEXT): $(liebert_esp2_OBJECTS) $(liebert_esp2_DEPENDENCIES) + @rm -f liebert-esp2$(EXEEXT) + $(LINK) $(liebert_esp2_OBJECTS) $(liebert_esp2_LDADD) $(LIBS) masterguard$(EXEEXT): $(masterguard_OBJECTS) $(masterguard_DEPENDENCIES) @rm -f masterguard$(EXEEXT) $(LINK) $(masterguard_OBJECTS) $(masterguard_LDADD) $(LIBS) -megatec$(EXEEXT): $(megatec_OBJECTS) $(megatec_DEPENDENCIES) - @rm -f megatec$(EXEEXT) - $(LINK) $(megatec_OBJECTS) $(megatec_LDADD) $(LIBS) -megatec_usb$(EXEEXT): $(megatec_usb_OBJECTS) $(megatec_usb_DEPENDENCIES) - @rm -f megatec_usb$(EXEEXT) - $(megatec_usb_LINK) $(megatec_usb_OBJECTS) $(megatec_usb_LDADD) $(LIBS) metasys$(EXEEXT): $(metasys_OBJECTS) $(metasys_DEPENDENCIES) @rm -f metasys$(EXEEXT) $(LINK) $(metasys_OBJECTS) $(metasys_LDADD) $(LIBS) @@ -1072,6 +1049,7 @@ distclean-compile: @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@ @@ -1090,26 +1068,19 @@ distclean-compile: @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_megatec_usb-libusb.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hald_addon_megatec_usb-megatec.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hald_addon_megatec_usb-megatec_usb.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)/liebertgxt2.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)/megatec.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/megatec_usb-libusb.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/megatec_usb-megatec.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/megatec_usb-megatec_usb.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/megatec_usb-usb-common.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@ @@ -1186,104 +1157,6 @@ dummy_ups-dummy-ups.obj: dummy-ups.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @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_megatec_usb-megatec.o: megatec.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_megatec_usb_CFLAGS) $(CFLAGS) -MT hald_addon_megatec_usb-megatec.o -MD -MP -MF $(DEPDIR)/hald_addon_megatec_usb-megatec.Tpo -c -o hald_addon_megatec_usb-megatec.o `test -f 'megatec.c' || echo '$(srcdir)/'`megatec.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_megatec_usb-megatec.Tpo $(DEPDIR)/hald_addon_megatec_usb-megatec.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='megatec.c' object='hald_addon_megatec_usb-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_megatec_usb_CFLAGS) $(CFLAGS) -c -o hald_addon_megatec_usb-megatec.o `test -f 'megatec.c' || echo '$(srcdir)/'`megatec.c - -hald_addon_megatec_usb-megatec.obj: megatec.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_megatec_usb_CFLAGS) $(CFLAGS) -MT hald_addon_megatec_usb-megatec.obj -MD -MP -MF $(DEPDIR)/hald_addon_megatec_usb-megatec.Tpo -c -o hald_addon_megatec_usb-megatec.obj `if test -f 'megatec.c'; then $(CYGPATH_W) 'megatec.c'; else $(CYGPATH_W) '$(srcdir)/megatec.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_megatec_usb-megatec.Tpo $(DEPDIR)/hald_addon_megatec_usb-megatec.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='megatec.c' object='hald_addon_megatec_usb-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_megatec_usb_CFLAGS) $(CFLAGS) -c -o hald_addon_megatec_usb-megatec.obj `if test -f 'megatec.c'; then $(CYGPATH_W) 'megatec.c'; else $(CYGPATH_W) '$(srcdir)/megatec.c'; fi` - -hald_addon_megatec_usb-megatec_usb.o: megatec_usb.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_megatec_usb_CFLAGS) $(CFLAGS) -MT hald_addon_megatec_usb-megatec_usb.o -MD -MP -MF $(DEPDIR)/hald_addon_megatec_usb-megatec_usb.Tpo -c -o hald_addon_megatec_usb-megatec_usb.o `test -f 'megatec_usb.c' || echo '$(srcdir)/'`megatec_usb.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_megatec_usb-megatec_usb.Tpo $(DEPDIR)/hald_addon_megatec_usb-megatec_usb.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='megatec_usb.c' object='hald_addon_megatec_usb-megatec_usb.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_megatec_usb_CFLAGS) $(CFLAGS) -c -o hald_addon_megatec_usb-megatec_usb.o `test -f 'megatec_usb.c' || echo '$(srcdir)/'`megatec_usb.c - -hald_addon_megatec_usb-megatec_usb.obj: megatec_usb.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_megatec_usb_CFLAGS) $(CFLAGS) -MT hald_addon_megatec_usb-megatec_usb.obj -MD -MP -MF $(DEPDIR)/hald_addon_megatec_usb-megatec_usb.Tpo -c -o hald_addon_megatec_usb-megatec_usb.obj `if test -f 'megatec_usb.c'; then $(CYGPATH_W) 'megatec_usb.c'; else $(CYGPATH_W) '$(srcdir)/megatec_usb.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_megatec_usb-megatec_usb.Tpo $(DEPDIR)/hald_addon_megatec_usb-megatec_usb.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='megatec_usb.c' object='hald_addon_megatec_usb-megatec_usb.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_megatec_usb_CFLAGS) $(CFLAGS) -c -o hald_addon_megatec_usb-megatec_usb.obj `if test -f 'megatec_usb.c'; then $(CYGPATH_W) 'megatec_usb.c'; else $(CYGPATH_W) '$(srcdir)/megatec_usb.c'; fi` - -hald_addon_megatec_usb-libusb.o: libusb.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_megatec_usb_CFLAGS) $(CFLAGS) -MT hald_addon_megatec_usb-libusb.o -MD -MP -MF $(DEPDIR)/hald_addon_megatec_usb-libusb.Tpo -c -o hald_addon_megatec_usb-libusb.o `test -f 'libusb.c' || echo '$(srcdir)/'`libusb.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_megatec_usb-libusb.Tpo $(DEPDIR)/hald_addon_megatec_usb-libusb.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libusb.c' object='hald_addon_megatec_usb-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_megatec_usb_CFLAGS) $(CFLAGS) -c -o hald_addon_megatec_usb-libusb.o `test -f 'libusb.c' || echo '$(srcdir)/'`libusb.c - -hald_addon_megatec_usb-libusb.obj: libusb.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_megatec_usb_CFLAGS) $(CFLAGS) -MT hald_addon_megatec_usb-libusb.obj -MD -MP -MF $(DEPDIR)/hald_addon_megatec_usb-libusb.Tpo -c -o hald_addon_megatec_usb-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_megatec_usb-libusb.Tpo $(DEPDIR)/hald_addon_megatec_usb-libusb.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libusb.c' object='hald_addon_megatec_usb-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_megatec_usb_CFLAGS) $(CFLAGS) -c -o hald_addon_megatec_usb-libusb.obj `if test -f 'libusb.c'; then $(CYGPATH_W) 'libusb.c'; else $(CYGPATH_W) '$(srcdir)/libusb.c'; fi` - -megatec_usb-megatec.o: megatec.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(megatec_usb_CFLAGS) $(CFLAGS) -MT megatec_usb-megatec.o -MD -MP -MF $(DEPDIR)/megatec_usb-megatec.Tpo -c -o megatec_usb-megatec.o `test -f 'megatec.c' || echo '$(srcdir)/'`megatec.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/megatec_usb-megatec.Tpo $(DEPDIR)/megatec_usb-megatec.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='megatec.c' object='megatec_usb-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) $(megatec_usb_CFLAGS) $(CFLAGS) -c -o megatec_usb-megatec.o `test -f 'megatec.c' || echo '$(srcdir)/'`megatec.c - -megatec_usb-megatec.obj: megatec.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(megatec_usb_CFLAGS) $(CFLAGS) -MT megatec_usb-megatec.obj -MD -MP -MF $(DEPDIR)/megatec_usb-megatec.Tpo -c -o megatec_usb-megatec.obj `if test -f 'megatec.c'; then $(CYGPATH_W) 'megatec.c'; else $(CYGPATH_W) '$(srcdir)/megatec.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/megatec_usb-megatec.Tpo $(DEPDIR)/megatec_usb-megatec.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='megatec.c' object='megatec_usb-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) $(megatec_usb_CFLAGS) $(CFLAGS) -c -o megatec_usb-megatec.obj `if test -f 'megatec.c'; then $(CYGPATH_W) 'megatec.c'; else $(CYGPATH_W) '$(srcdir)/megatec.c'; fi` - -megatec_usb-megatec_usb.o: megatec_usb.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(megatec_usb_CFLAGS) $(CFLAGS) -MT megatec_usb-megatec_usb.o -MD -MP -MF $(DEPDIR)/megatec_usb-megatec_usb.Tpo -c -o megatec_usb-megatec_usb.o `test -f 'megatec_usb.c' || echo '$(srcdir)/'`megatec_usb.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/megatec_usb-megatec_usb.Tpo $(DEPDIR)/megatec_usb-megatec_usb.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='megatec_usb.c' object='megatec_usb-megatec_usb.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) $(megatec_usb_CFLAGS) $(CFLAGS) -c -o megatec_usb-megatec_usb.o `test -f 'megatec_usb.c' || echo '$(srcdir)/'`megatec_usb.c - -megatec_usb-megatec_usb.obj: megatec_usb.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(megatec_usb_CFLAGS) $(CFLAGS) -MT megatec_usb-megatec_usb.obj -MD -MP -MF $(DEPDIR)/megatec_usb-megatec_usb.Tpo -c -o megatec_usb-megatec_usb.obj `if test -f 'megatec_usb.c'; then $(CYGPATH_W) 'megatec_usb.c'; else $(CYGPATH_W) '$(srcdir)/megatec_usb.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/megatec_usb-megatec_usb.Tpo $(DEPDIR)/megatec_usb-megatec_usb.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='megatec_usb.c' object='megatec_usb-megatec_usb.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) $(megatec_usb_CFLAGS) $(CFLAGS) -c -o megatec_usb-megatec_usb.obj `if test -f 'megatec_usb.c'; then $(CYGPATH_W) 'megatec_usb.c'; else $(CYGPATH_W) '$(srcdir)/megatec_usb.c'; fi` - -megatec_usb-libusb.o: libusb.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(megatec_usb_CFLAGS) $(CFLAGS) -MT megatec_usb-libusb.o -MD -MP -MF $(DEPDIR)/megatec_usb-libusb.Tpo -c -o megatec_usb-libusb.o `test -f 'libusb.c' || echo '$(srcdir)/'`libusb.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/megatec_usb-libusb.Tpo $(DEPDIR)/megatec_usb-libusb.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libusb.c' object='megatec_usb-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) $(megatec_usb_CFLAGS) $(CFLAGS) -c -o megatec_usb-libusb.o `test -f 'libusb.c' || echo '$(srcdir)/'`libusb.c - -megatec_usb-libusb.obj: libusb.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(megatec_usb_CFLAGS) $(CFLAGS) -MT megatec_usb-libusb.obj -MD -MP -MF $(DEPDIR)/megatec_usb-libusb.Tpo -c -o megatec_usb-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)/megatec_usb-libusb.Tpo $(DEPDIR)/megatec_usb-libusb.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libusb.c' object='megatec_usb-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) $(megatec_usb_CFLAGS) $(CFLAGS) -c -o megatec_usb-libusb.obj `if test -f 'libusb.c'; then $(CYGPATH_W) 'libusb.c'; else $(CYGPATH_W) '$(srcdir)/libusb.c'; fi` - -megatec_usb-usb-common.o: usb-common.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(megatec_usb_CFLAGS) $(CFLAGS) -MT megatec_usb-usb-common.o -MD -MP -MF $(DEPDIR)/megatec_usb-usb-common.Tpo -c -o megatec_usb-usb-common.o `test -f 'usb-common.c' || echo '$(srcdir)/'`usb-common.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/megatec_usb-usb-common.Tpo $(DEPDIR)/megatec_usb-usb-common.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usb-common.c' object='megatec_usb-usb-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) $(megatec_usb_CFLAGS) $(CFLAGS) -c -o megatec_usb-usb-common.o `test -f 'usb-common.c' || echo '$(srcdir)/'`usb-common.c - -megatec_usb-usb-common.obj: usb-common.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(megatec_usb_CFLAGS) $(CFLAGS) -MT megatec_usb-usb-common.obj -MD -MP -MF $(DEPDIR)/megatec_usb-usb-common.Tpo -c -o megatec_usb-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)/megatec_usb-usb-common.Tpo $(DEPDIR)/megatec_usb-usb-common.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usb-common.c' object='megatec_usb-usb-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) $(megatec_usb_CFLAGS) $(CFLAGS) -c -o megatec_usb-usb-common.obj `if test -f 'usb-common.c'; then $(CYGPATH_W) 'usb-common.c'; else $(CYGPATH_W) '$(srcdir)/usb-common.c'; fi` - newmge_shut-usbhid-ups.o: usbhid-ups.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(newmge_shut_CFLAGS) $(CFLAGS) -MT newmge_shut-usbhid-ups.o -MD -MP -MF $(DEPDIR)/newmge_shut-usbhid-ups.Tpo -c -o newmge_shut-usbhid-ups.o `test -f 'usbhid-ups.c' || echo '$(srcdir)/'`usbhid-ups.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/newmge_shut-usbhid-ups.Tpo $(DEPDIR)/newmge_shut-usbhid-ups.Po diff --git a/drivers/apc-hid.c b/drivers/apc-hid.c index ba20d79..c902462 100644 --- a/drivers/apc-hid.c +++ b/drivers/apc-hid.c @@ -4,7 +4,7 @@ * 2003 - 2009 Arnaud Quette * 2005 John Stamp * 2005 Peter Selinger - * 2009 Arjen de Korte + * 2009 - 2010 Arjen de Korte * * Sponsored by MGE UPS SYSTEMS * and Eaton @@ -36,10 +36,22 @@ /* APC */ #define APC_VENDORID 0x051d +/* Don't use interrupt pipe on 5G models (used by proprietary protocol) */ +static void *disable_interrupt_pipe(void) +{ + if (use_interrupt_pipe == TRUE) { + upslogx(LOG_INFO, "interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of this message)"); + use_interrupt_pipe= FALSE; + } + return NULL; +} + /* USB IDs device table */ static usb_device_id_t apc_usb_device_table[] = { /* various models */ { USB_DEVICE(APC_VENDORID, 0x0002), NULL }, + /* various 5G models */ + { USB_DEVICE(APC_VENDORID, 0x0003), disable_interrupt_pipe }, /* Terminating entry */ { -1, -1, NULL } @@ -47,7 +59,7 @@ static usb_device_id_t apc_usb_device_table[] = { /* returns statically allocated string - must not use it again before done with result! */ -static char *apc_date_conversion_fun(double value) +static const char *apc_date_conversion_fun(double value) { static char buf[20]; int year, month, day; @@ -222,8 +234,11 @@ static hid_info_t apc_hid2nut[] = { { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", 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.charge.warning", 0, 0, "UPS.PowerSummary.WarningCapacityLimit", NULL, "%.0f", 0, NULL }, + { "battery.runtime", 0, 0, "UPS.Battery.RunTimeToEmpty", NULL, "%.0f", 0, NULL }, { "battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", 0, NULL }, + { "battery.runtime.low", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.Battery.RemainingTimeLimit", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "battery.runtime.low", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.PowerSummary.RemainingTimeLimit", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, + { "battery.voltage", 0, 0, "UPS.Battery.Voltage", NULL, "%.1f", 0, NULL }, { "battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.1f", 0, NULL }, { "battery.voltage.nominal", 0, 0, "UPS.Battery.ConfigVoltage", NULL, "%.1f", 0, NULL }, { "battery.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", NULL, "%.1f", 0, NULL }, /* Back-UPS 500 */ @@ -236,21 +251,30 @@ static hid_info_t apc_hid2nut[] = { /* UPS page */ { "ups.load", 0, 0, "UPS.Output.PercentLoad", NULL, "%.1f", 0, NULL }, { "ups.load", 0, 0, "UPS.PowerConverter.PercentLoad", NULL, "%.0f", 0, NULL }, + /* 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.start", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.APCGeneralCollection.APCDelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_FLAG_ABSENT, NULL}, /* APC */ { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.PowerSummary.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_FLAG_ABSENT, NULL}, - { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.APCGeneralCollection.APCDelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_FLAG_ABSENT, NULL}, /* APC */ { "ups.timer.start", 0, 0, "UPS.PowerSummary.DelayBeforeStartup", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, - { "ups.timer.start", 0, 0, "UPS.APCGeneralCollection.APCDelayBeforeStartup", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, /* APC */ { "ups.timer.shutdown", 0, 0, "UPS.PowerSummary.DelayBeforeShutdown", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, - { "ups.timer.shutdown", 0, 0, "UPS.APCGeneralCollection.APCDelayBeforeShutdown", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, /* APC */ { "ups.timer.reboot", 0, 0, "UPS.PowerSummary.DelayBeforeReboot", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, - { "ups.timer.reboot", 0, 0, "UPS.APCGeneralCollection.APCDelayBeforeReboot", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, /* APC */ + /* used by APC SmartUPS RM */ + { "ups.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.Output.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.timer.start", 0, 0, "UPS.Output.DelayBeforeStartup", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, + { "ups.timer.shutdown", 0, 0, "UPS.Output.DelayBeforeShutdown", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, + { "ups.timer.reboot", 0, 0, "UPS.Output.DelayBeforeReboot", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, + /* used by APC BackUPS ES */ + { "ups.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.APCGeneralCollection.APCDelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_FLAG_ABSENT, NULL}, + { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.APCGeneralCollection.APCDelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_FLAG_ABSENT, NULL}, + { "ups.timer.start", 0, 0, "UPS.APCGeneralCollection.APCDelayBeforeStartup", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, + { "ups.timer.shutdown", 0, 0, "UPS.APCGeneralCollection.APCDelayBeforeShutdown", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, + { "ups.timer.reboot", 0, 0, "UPS.APCGeneralCollection.APCDelayBeforeReboot", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, + { "ups.test.result", 0, 0, "UPS.Battery.Test", NULL, "%s", 0, test_read_info }, { "ups.beeper.status", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "%s", 0, beeper_info }, { "ups.mfr.date", 0, 0, "UPS.ManufacturerDate", NULL, "%s", 0, date_conversion }, { "ups.mfr.date", 0, 0, "UPS.PowerSummary.ManufacturerDate", NULL, "%s", 0, date_conversion }, /* Back-UPS 500 */ - + { "ups.realpower.nominal", 0, 0, "UPS.PowerConverter.ConfigActivePower", NULL, "%.0f", 0, NULL }, /* the below one need to be discussed as we might need to complete * the ups.test sub collection @@ -313,11 +337,17 @@ static hid_info_t apc_hid2nut[] = { { "test.panel.start", 0, 0, "UPS.PowerSummary.APCPanelTest", NULL, "1", HU_TYPE_CMD, NULL }, /* Back-UPS 500 */ { "test.panel.stop", 0, 0, "UPS.PowerSummary.APCPanelTest", NULL, "0", HU_TYPE_CMD, NULL }, /* Back-UPS 500 */ + /* 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 }, - /* APC Backups ES */ + /* used by APC SmartUPS RM */ + { "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 }, + /* used by APC BackUPS ES */ { "load.off.delay", 0, 0, "UPS.APCGeneralCollection.APCDelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_TYPE_CMD, NULL }, { "load.on.delay", 0, 0, "UPS.APCGeneralCollection.APCDelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_TYPE_CMD, NULL }, { "shutdown.stop", 0, 0, "UPS.APCGeneralCollection.APCDelayBeforeShutdown", NULL, "-1", HU_TYPE_CMD, NULL }, @@ -333,7 +363,7 @@ static hid_info_t apc_hid2nut[] = { { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } }; -static char *apc_format_model(HIDDevice_t *hd) { +static const char *apc_format_model(HIDDevice_t *hd) { static char model[64]; char *ptr1, *ptr2; @@ -356,11 +386,11 @@ static char *apc_format_model(HIDDevice_t *hd) { return model; } -static char *apc_format_mfr(HIDDevice_t *hd) { +static const char *apc_format_mfr(HIDDevice_t *hd) { return hd->Vendor ? hd->Vendor : "APC"; } -static char *apc_format_serial(HIDDevice_t *hd) { +static const char *apc_format_serial(HIDDevice_t *hd) { return hd->Serial; } diff --git a/drivers/apcsmart.c b/drivers/apcsmart.c index 4a8f574..aad21f8 100644 --- a/drivers/apcsmart.c +++ b/drivers/apcsmart.c @@ -48,7 +48,7 @@ upsdrv_info_t upsdrv_info = { static int ups_status = 0, quirk_capability_overflow = 0; -static struct apc_vartab_t *vartab_lookup_char(char cmdchar) +static apc_vartab_t *vartab_lookup_char(char cmdchar) { int i; @@ -59,7 +59,7 @@ static struct apc_vartab_t *vartab_lookup_char(char cmdchar) return NULL; } -static struct apc_vartab_t *vartab_lookup_name(const char *var) +static apc_vartab_t *vartab_lookup_name(const char *var) { int i; @@ -73,7 +73,7 @@ static struct apc_vartab_t *vartab_lookup_name(const char *var) /* FUTURE: change to use function pointers */ /* convert APC formatting to NUT formatting */ -static char *convert_data(struct apc_vartab_t *cmd_entry, char *upsval) +static const char *convert_data(apc_vartab_t *cmd_entry, char *upsval) { static char tmp[128]; int tval; @@ -202,7 +202,7 @@ static int read_buf(char *buf, size_t buflen) return ret; } -static int poll_data(struct apc_vartab_t *vt) +static int poll_data(apc_vartab_t *vt) { int ret; char tmp[SMALLBUF]; @@ -241,8 +241,9 @@ static int poll_data(struct apc_vartab_t *vt) static int query_ups(const char *var, int first) { int ret; - char temp[256], *ptr; - struct apc_vartab_t *vt; + char temp[256]; + const char *ptr; + apc_vartab_t *vt; vt = vartab_lookup_name(var); @@ -293,7 +294,7 @@ static void do_capabilities(void) const char *ptr, *entptr; char upsloc, temp[512], cmd, loc, etmp[16], *endtemp; int nument, entlen, i, matrix, ret; - struct apc_vartab_t *vt; + apc_vartab_t *vt; upsdebugx(1, "APC - About to get capabilities string"); /* If we can do caps, then we need the Firmware revision which has @@ -914,10 +915,11 @@ static void update_info_all(void) upsdebugx(3, "update_info_all: done"); } -static int setvar_enum(struct apc_vartab_t *vt, const char *val) +static int setvar_enum(apc_vartab_t *vt, const char *val) { int i, ret; - char orig[256], temp[256], *ptr; + char orig[256], temp[256]; + const char *ptr; ret = ser_send_char(upsfd, vt->cmd); @@ -1006,7 +1008,7 @@ static int setvar_enum(struct apc_vartab_t *vt, const char *val) return STAT_SET_HANDLED; } -static int setvar_string(struct apc_vartab_t *vt, const char *val) +static int setvar_string(apc_vartab_t *vt, const char *val) { unsigned int i; int ret; @@ -1088,7 +1090,7 @@ static int setvar_string(struct apc_vartab_t *vt, const char *val) static int setvar(const char *varname, const char *val) { - struct apc_vartab_t *vt; + apc_vartab_t *vt; vt = vartab_lookup_name(varname); @@ -1111,7 +1113,7 @@ static int setvar(const char *varname, const char *val) } /* actually send the instcmd's char to the ups */ -static int do_cmd(struct apc_cmdtab_t *ct) +static int do_cmd(apc_cmdtab_t *ct) { int ret; char buf[SMALLBUF]; @@ -1152,7 +1154,7 @@ static int do_cmd(struct apc_cmdtab_t *ct) } /* some commands must be repeated in a window to execute */ -static int instcmd_chktime(struct apc_cmdtab_t *ct) +static int instcmd_chktime(apc_cmdtab_t *ct) { double elapsed; time_t now; @@ -1176,7 +1178,7 @@ static int instcmd_chktime(struct apc_cmdtab_t *ct) static int instcmd(const char *cmdname, const char *extra) { int i; - struct apc_cmdtab_t *ct; + apc_cmdtab_t *ct; ct = NULL; diff --git a/drivers/apcsmart.h b/drivers/apcsmart.h index f46bba1..41ebbe1 100644 --- a/drivers/apcsmart.h +++ b/drivers/apcsmart.h @@ -101,12 +101,13 @@ #define APC_F_REASON 0x130000 /* Reason of transfer */ #define APC_F_LEAVE 0 /* Just pass this through */ -struct apc_vartab_t { +typedef struct { const char *name; /* the variable name */ unsigned int flags; /* various flags */ char cmd; /* command character */ +} apc_vartab_t; -} apc_vartab[] = { +apc_vartab_t apc_vartab[] = { { "ups.firmware", 0, 'b' }, { "ups.firmware.aux", 0, 'v' }, @@ -213,11 +214,13 @@ struct apc_vartab_t { #define APC_CMD_ON 0x0E /* ^N */ #define APC_CMD_BYPTOGGLE '^' -struct apc_cmdtab_t { +typedef struct { const char *name; int flags; char cmd; -} apc_cmdtab[] = +} apc_cmdtab_t; + +apc_cmdtab_t apc_cmdtab[] = { { "load.off", APC_NASTY|APC_REPEAT, APC_CMD_OFF }, { "load.on", APC_REPEAT, APC_CMD_ON }, @@ -250,8 +253,7 @@ struct { const char *firmware; const char *cmdchars; int flags; -} compat_tab[] = -{ +} compat_tab[] = { /* APC Matrix */ { "0ZI", "79ABCDEFGKLMNOPQRSUVWXYZcefgjklmnopqrsuxz/<>", 0 }, { "5UI", "79ABCDEFGKLMNOPQRSUVWXYZcefgjklmnopqrsuxz/<>", 0 }, diff --git a/drivers/bcmxcp.c b/drivers/bcmxcp.c index 43f8232..13b43bd 100644 --- a/drivers/bcmxcp.c +++ b/drivers/bcmxcp.c @@ -150,13 +150,13 @@ static int init_outlet(unsigned char len); static int instcmd(const char *cmdname, const char *extra); -char *FreqTol[3] = {"+/-2%", "+/-5%", "+/-7"}; -char *ABMStatus[4] = {"Charging", "Discharging", "Floating", "Resting"}; +const char *FreqTol[3] = {"+/-2%", "+/-5%", "+/-7"}; +const char *ABMStatus[4] = {"Charging", "Discharging", "Floating", "Resting"}; /* Standard Authorization Block */ unsigned char AUTHOR[4] = {0xCF, 0x69, 0xE8, 0xD5}; int nphases = 0; int outlet_block_len = 0; -char *cpu_name[5] = {"Cont:", "Inve:", "Rect:", "Netw:", "Disp:"}; +const char *cpu_name[5] = {"Cont:", "Inve:", "Rect:", "Netw:", "Disp:"}; /* get_word function from nut driver metasys.c */ int get_word(const unsigned char *buffer) /* return an integer reading a word in the supplied buffer */ @@ -958,7 +958,7 @@ void init_limit(void) { unsigned char answer[PW_ANSWER_MAX_SIZE]; int value, res; - char *horn_stat[3] = {"disabled", "enabled", "muted"}; + const char *horn_stat[3] = {"disabled", "enabled", "muted"}; res = command_read_sequence(PW_LIMIT_BLOCK_REQ, answer); if (res <= 0) { diff --git a/drivers/bcmxcp.h b/drivers/bcmxcp.h index d91bda0..bb811f4 100644 --- a/drivers/bcmxcp.h +++ b/drivers/bcmxcp.h @@ -330,7 +330,7 @@ #define BCMXCP_ALARM_MAP_MAX 240 /* Max no of entries in BCM/XCP alarm map (adjusted upwards to nearest multi of 8 */ typedef struct { /* Entry in BCM/XCP - UPS - NUT mapping table */ - char *nut_entity; /* The NUT variable name */ + const char *nut_entity; /* The NUT variable name */ unsigned char format; /* The format of the data - float, long etc */ unsigned int meter_block_index; /* The position of this meter in the UPS meter block */ } BCMXCP_METER_MAP_ENTRY_t; @@ -340,7 +340,7 @@ BCMXCP_METER_MAP_ENTRY_t typedef struct { /* Entry in BCM/XCP - UPS mapping table */ int alarm_block_index; /* Index of this alarm in alarm block. -1 = not existing */ - char *alarm_desc; /* Description of this alarm */ + const char *alarm_desc; /* Description of this alarm */ } BCMXCP_ALARM_MAP_ENTRY_t; BCMXCP_ALARM_MAP_ENTRY_t diff --git a/drivers/bcmxcp_usb.c b/drivers/bcmxcp_usb.c index dcc0bf7..ce44abb 100644 --- a/drivers/bcmxcp_usb.c +++ b/drivers/bcmxcp_usb.c @@ -304,7 +304,7 @@ int command_write_sequence(unsigned char *command, int command_length, unsigned } -void upsdrv_comm_good() +void upsdrv_comm_good(void) { nutusb_comm_good(); } @@ -344,7 +344,7 @@ 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() +static usb_dev_handle *open_powerware_usb(void) { struct usb_bus *busses = usb_get_busses(); struct usb_bus *bus; diff --git a/drivers/belkin-hid.c b/drivers/belkin-hid.c index d4a9b2b..d3b294b 100644 --- a/drivers/belkin-hid.c +++ b/drivers/belkin-hid.c @@ -68,7 +68,7 @@ static usb_device_id_t belkin_usb_device_table[] = { /* returns statically allocated string - must not use it again before done with result! */ -static char *belkin_firmware_conversion_fun(double value) +static const char *belkin_firmware_conversion_fun(double value) { static char buf[20]; @@ -81,7 +81,7 @@ static info_lkp_t belkin_firmware_conversion[] = { { 0, NULL, belkin_firmware_conversion_fun } }; -static char *belkin_upstype_conversion_fun(double value) +static const char *belkin_upstype_conversion_fun(double value) { switch ((long)value & 0x0f) { @@ -104,7 +104,7 @@ static info_lkp_t belkin_upstype_conversion[] = { { 0, NULL, belkin_upstype_conversion_fun } }; -static char *belkin_sensitivity_conversion_fun(double value) +static const char *belkin_sensitivity_conversion_fun(double value) { switch ((long)value) { @@ -131,7 +131,7 @@ static info_lkp_t belkin_test_info[] = { { 0, NULL, NULL } }; -static char *belkin_overload_conversion_fun(double value) +static const char *belkin_overload_conversion_fun(double value) { if ((long)value & 0x0010) { return "overload"; @@ -144,7 +144,7 @@ static info_lkp_t belkin_overload_conversion[] = { { 0, NULL, belkin_overload_conversion_fun } }; -static char *belkin_overheat_conversion_fun(double value) +static const char *belkin_overheat_conversion_fun(double value) { if ((long)value & 0x0040) { return "overheat"; @@ -157,7 +157,7 @@ static info_lkp_t belkin_overheat_conversion[] = { { 0, NULL, belkin_overheat_conversion_fun } }; -static char *belkin_commfault_conversion_fun(double value) +static const char *belkin_commfault_conversion_fun(double value) { if ((long)value & 0x0080) { return "commfault"; @@ -170,7 +170,7 @@ static info_lkp_t belkin_commfault_conversion[] = { { 0, NULL, belkin_commfault_conversion_fun } }; -static char *belkin_awaitingpower_conversion_fun(double value) +static const char *belkin_awaitingpower_conversion_fun(double value) { if ((long)value & 0x2000) { return "awaitingpower"; @@ -183,7 +183,7 @@ static info_lkp_t belkin_awaitingpower_conversion[] = { { 0, NULL, belkin_awaitingpower_conversion_fun } }; -static char *belkin_online_conversion_fun(double value) +static const char *belkin_online_conversion_fun(double value) { if ((long)value & 0x0001) { return "!online"; @@ -196,7 +196,7 @@ static info_lkp_t belkin_online_conversion[] = { { 0, NULL, belkin_online_conversion_fun } }; -static char *belkin_lowbatt_conversion_fun(double value) +static const char *belkin_lowbatt_conversion_fun(double value) { if ((long)value & 0x0004) { return "lowbatt"; @@ -209,7 +209,7 @@ static info_lkp_t belkin_lowbatt_conversion[] = { { 0, NULL, belkin_lowbatt_conversion_fun } }; -static char *belkin_depleted_conversion_fun(double value) +static const char *belkin_depleted_conversion_fun(double value) { if ((long)value & 0x0040) { return "depleted"; @@ -222,7 +222,7 @@ static info_lkp_t belkin_depleted_conversion[] = { { 0, NULL, belkin_depleted_conversion_fun } }; -static char *belkin_replacebatt_conversion_fun(double value) +static const char *belkin_replacebatt_conversion_fun(double value) { if ((long)value & 0x0080) { return "replacebatt"; @@ -385,7 +385,7 @@ static hid_info_t belkin_hid2nut[] = { { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } }; -static char *belkin_format_model(HIDDevice_t *hd) { +static const char *belkin_format_model(HIDDevice_t *hd) { if ((hd->Product) && (strlen(hd->Product) > 0)) { return hd->Product; } @@ -393,8 +393,8 @@ static char *belkin_format_model(HIDDevice_t *hd) { return "unknown"; } -static char *belkin_format_mfr(HIDDevice_t *hd) { - char *mfr; +static const char *belkin_format_mfr(HIDDevice_t *hd) { + const char *mfr; mfr = hd->Vendor ? hd->Vendor : "Belkin"; /* trim leading whitespace */ while (*mfr == ' ') { @@ -406,7 +406,7 @@ static char *belkin_format_mfr(HIDDevice_t *hd) { return mfr; } -static char *belkin_format_serial(HIDDevice_t *hd) { +static const char *belkin_format_serial(HIDDevice_t *hd) { char serial[64]; if (hd->Serial) { diff --git a/drivers/belkin.c b/drivers/belkin.c index 2ae4654..ad5a658 100644 --- a/drivers/belkin.c +++ b/drivers/belkin.c @@ -28,7 +28,10 @@ #include "belkin.h" #define DRIVER_NAME "Belkin Smart protocol driver" -#define DRIVER_VERSION "0.22" +#define DRIVER_VERSION "0.24" + +static int init_communication(void); +static int get_belkin_reply(char *buf); /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -41,29 +44,33 @@ upsdrv_info_t upsdrv_info = { static void send_belkin_command(char cmd, const char *subcmd, const char *data) { + ser_flush_io(upsfd); + ser_send(upsfd, "~00%c%03d%s%s", cmd, (int)strlen(data) + 3, subcmd, data); + + upsdebugx(3, "Send Command: %s, %s", subcmd, data); } static int init_communication(void) { - int i; - int res; + int i, res; char temp[SMALLBUF]; - res = -1; - for (i = 1; i <= 10 && res == -1; i++) { - send_belkin_command(STATUS,MANUFACTURER,""); + for (i = 0; i < 10; i++) { + send_belkin_command(STATUS, MANUFACTURER, ""); res = get_belkin_reply(temp); + + if (res > 0) { + /* return the number of retries needed before a valid reply is read (discard contents) */ + return i; + } } - if (res == -1 || strcmp(temp,"BELKIN")) - return res; - - return 0; + /* no valid reply read */ + return -1; } -static char *get_belkin_field(const char *in, char *out, size_t outlen, - size_t num) +static char *get_belkin_field(const char *in, char *out, size_t outlen, size_t num) { size_t i, c = 1; char *ptr; @@ -73,22 +80,26 @@ static char *get_belkin_field(const char *in, char *out, size_t outlen, snprintf(out, outlen, "%s", in); ptr = strchr(out, ';'); - if (ptr) + if (ptr) { *ptr = '\0'; + } return out; - } + } for (i = 0; i < strlen(in); i++) { - if (in[i] == ';') + if (in[i] == ';') { c++; + } if (c == num) { snprintf(out, outlen, "%s", &in[i + 1]); ptr = strchr(out, ';'); - if (ptr) + if (ptr) { *ptr = '\0'; + } + return out; } } @@ -96,204 +107,16 @@ static char *get_belkin_field(const char *in, char *out, size_t outlen, return NULL; } -static int do_status(void) -{ - char temp[SMALLBUF], st[SMALLBUF]; - int res; - - send_belkin_command(STATUS,STAT_STATUS,""); - res = get_belkin_reply(temp); - if (res == -1) { - dstate_datastale(); - return 0; - } - - status_init(); - - get_belkin_field(temp, st, sizeof(st), 6); - if (*st == '1') { - status_set("OFF"); - - } else { /* (OFF) and (OB | OL) are mutually exclusive */ - - get_belkin_field(temp, st, sizeof(st), 2); - if (*st == '1') { - status_set("OB"); - - send_belkin_command(STATUS,STAT_BATTERY,""); - res = get_belkin_reply(temp); - - if (res == -1) { - dstate_datastale(); - return 0; - } - - 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 */ - } - else - status_set("OL"); /* on line */ - } - - status_commit(); - dstate_dataok(); - - return 1; -} - -static int do_broken_rat(char *buf) -{ - int ret, cnt; - char tmp[8]; - - usleep(25000); - - ret = ser_get_buf_len(upsfd, (unsigned char *)tmp, 7, 3, 0); - - if (ret != 7) - return -1; - - tmp[7] = '\0'; - cnt = atoi(tmp + 4); - - if ((cnt < 1) || (cnt > 255)) - return -1; - - 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, 50, cnt, 0); - buf[cnt] = 0; - - return ret; -} - -static int init_ups_data(void) -{ - int res; - double low, high; - char temp[SMALLBUF], st[SMALLBUF]; - - send_belkin_command(STATUS, MODEL, ""); - res = get_belkin_reply(temp); - if (res == -1) - return res; - - dstate_setinfo("ups.model", "%s", temp); - - send_belkin_command(STATUS, VERSION_CMD, ""); - res = get_belkin_reply(temp); - if (res == -1) - return res; - - dstate_setinfo("ups.firmware", "%s", temp); - - /* deal with stupid firmware that breaks RAT */ - - send_belkin_command(STATUS, RATING, ""); - - if (!strcmp(temp, "001")) - res = do_broken_rat(temp); - else - res = get_belkin_reply(temp); - - if (res > 0) { - get_belkin_field(temp, st, sizeof(st), 8); - low = atof(st) / 0.88; - - get_belkin_field(temp, st, sizeof(st), 9); - high = atof(st) * 0.88; - - dstate_setinfo("input.transfer.low", "%03.1f", low); - dstate_setinfo("input.transfer.high", "%03.1f", high); - } - - ser_flush_io(upsfd); - - dstate_addcmd("load.off"); - dstate_addcmd("load.on"); - upsdrv_updateinfo(); - return 0; -} - -/* normal idle loop - keep up with the current state of the UPS */ -void upsdrv_updateinfo(void) -{ - int res; - double val; - char temp[SMALLBUF], st[SMALLBUF]; - - if (!do_status()) - return; - - send_belkin_command(STATUS, STAT_INPUT, ""); - res = get_belkin_reply(temp); - if (res == -1) - return; - - get_belkin_field(temp, st, sizeof(st), 3); - val = atof(st) / 10; - dstate_setinfo("input.voltage", "%05.1f", val); - - get_belkin_field(temp, st, sizeof(st), 2); - val = atof(st) / 10; - dstate_setinfo("input.frequency", "%.1f", val); - - send_belkin_command(STATUS,STAT_BATTERY, ""); - res = get_belkin_reply(temp); - if (res == -1) - return; - - get_belkin_field(temp, st, sizeof(st), 10); - val = atof(st); - dstate_setinfo("battery.charge", "%03.0f", val); - - get_belkin_field(temp, st, sizeof(st), 9); - val = atof(st); - dstate_setinfo("battery.temperature", "%03.0f", val); - - get_belkin_field(temp, st, sizeof(st), 7); - val = atof(st) / 10; - dstate_setinfo("battery.voltage", "%4.1f", val); - - get_belkin_field(temp, st, sizeof(st), 9); - val = atof(st); - dstate_setinfo("ups.temperature", "%03.0f", val); - - send_belkin_command(STATUS, STAT_OUTPUT, ""); - res = get_belkin_reply(temp); - if (res == -1) - return; - - get_belkin_field(temp, st, sizeof(st), 2); - val = atof(st) / 10; - dstate_setinfo("output.frequency", "%.1f", val); - - get_belkin_field(temp, st, sizeof(st), 4); - val = atof(st) / 10; - dstate_setinfo("output.voltage", "%05.1f", val); - - get_belkin_field(temp, st, sizeof(st), 7); - val = atof(st); - dstate_setinfo("ups.load", "%03.0f", val); -} - static int get_belkin_reply(char *buf) { - int ret, cnt; + int ret; + long cnt; char tmp[8]; usleep(25000); - /* pull first 7 bytes to get data length - like ~00S004 */ - ret = ser_get_buf_len(upsfd, (unsigned char *)tmp, 7, 3, 0); + /* pull first 7 bytes to get data length - like ~00D004 */ + ret = ser_get_buf_len(upsfd, (unsigned char *)tmp, 7, 2, 0); if (ret != 7) { ser_comm_fail("Initial read returned %d bytes", ret); @@ -301,21 +124,28 @@ static int get_belkin_reply(char *buf) } tmp[7] = 0; - cnt = atoi(tmp + 4); + cnt = strtol(tmp + 4, NULL, 10); + upsdebugx(3, "Received: %s", tmp); - if ((cnt < 1) || (cnt > 255)) + if (cnt == 0) { /* possible to have ~00R000, return empty response */ + buf[0] = 0; + return 0; + } + + if ((cnt < 0) || (cnt > 255)) { return -1; + } /* give it time to respond to us */ usleep(5000 * cnt); - ret = ser_get_buf_len(upsfd, (unsigned char *)buf, cnt, 3, 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 %d bytes, expected %d", - ret, cnt); + ser_comm_fail("Second read returned %d bytes, expected %ld", ret, cnt); return -1; } @@ -324,14 +154,206 @@ static int get_belkin_reply(char *buf) return ret; } +static int do_broken_rat(char *buf) +{ + int ret; + long cnt; + char tmp[8]; + + usleep(25000); + + /* pull first 7 bytes to get data length - like ~00D004 */ + ret = ser_get_buf_len(upsfd, (unsigned char *)tmp, 7, 2, 0); + + if (ret != 7) { + ser_comm_fail("Initial read returned %d bytes", ret); + return -1; + } + + tmp[7] = 0; + cnt = strtol(tmp + 4, NULL, 10); + upsdebugx(3, "Received: %s", tmp); + + if (cnt == 0) { /* possible to have ~00R000, return empty response */ + buf[0] = 0; + return 0; + } + + if ((cnt < 0) || (cnt > 255)) { + return -1; + } + + /* give it time to respond to us */ + 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, cnt, 2, 0); + + buf[cnt] = 0; + upsdebugx(3, "Received: %s", buf); + + if (ret != cnt) { + ser_comm_fail("Second read returned %d bytes, expected %ld", ret, cnt); + return -1; + } + + ser_comm_good(); + + return ret; +} + +/* normal idle loop - keep up with the current state of the UPS */ +void upsdrv_updateinfo(void) +{ + static int retry = 0; + int res; + char temp[SMALLBUF], st[SMALLBUF]; + + send_belkin_command(STATUS, STAT_STATUS, ""); + res = get_belkin_reply(temp); + if (res < 0) { + if (retry < MAXTRIES) { + upsdebugx(1, "Communications with UPS lost: status read failed!"); + retry++; + } else { /* too many retries */ + upslogx(LOG_WARNING, "Communications with UPS lost: status read failed!"); + dstate_datastale(); + } + return; + } + + if (retry) { /* previous attempt had failed */ + upslogx(LOG_WARNING, "Communications with UPS re-established"); + retry = 0; + } + + if (res == 0) { + upsdebugx(1, "Ignoring empty return value after status query"); + return; + } + + status_init(); + + get_belkin_field(temp, st, sizeof(st), 6); + if (*st == '1') { + status_set("OFF"); + } + + get_belkin_field(temp, st, sizeof(st), 2); + if (*st == '1') { + status_set("OB"); /* on battery */ + } else { + status_set("OL"); /* on line */ + } + + get_belkin_field(temp, st, sizeof(st), 16); + dstate_setinfo("ups.beeper.status", "%s", (*st == '0' ? "disabled" : "enabled")); + + send_belkin_command(STATUS, STAT_BATTERY, ""); + res = get_belkin_reply(temp); + if (res > 0) { + /* report the compiled in battery charge where the driver assumes the battery is low */ + dstate_setinfo("battery.charge.low", "%d", LOW_BAT); + + 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)); + + get_belkin_field(temp, st, sizeof(st), 7); + dstate_setinfo("battery.voltage", "%.1f", strtod(st, NULL) / 10); + + get_belkin_field(temp, st, sizeof(st), 9); + dstate_setinfo("ups.temperature", "%.0f", strtod(st, NULL)); + } + + send_belkin_command(STATUS, STAT_INPUT, ""); + res = get_belkin_reply(temp); + if (res > 0) { + get_belkin_field(temp, st, sizeof(st), 3); + dstate_setinfo("input.voltage", "%.1f", strtod(st, NULL) / 10); + + get_belkin_field(temp, st, sizeof(st), 2); + dstate_setinfo("input.frequency", "%.1f", strtod(st, NULL) / 10); + } + + send_belkin_command(STATUS, STAT_OUTPUT, ""); + res = get_belkin_reply(temp); + if (res > 0) { + get_belkin_field(temp, st, sizeof(st), 2); + dstate_setinfo("output.frequency", "%.1f", strtod(st, NULL) / 10); + + get_belkin_field(temp, st, sizeof(st), 4); + dstate_setinfo("output.voltage", "%.1f", strtod(st, NULL) / 10); + + 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) { + get_belkin_field(temp, st, sizeof(st), 1); + switch (*st) + { + case '0': + dstate_setinfo("ups.test.result", "%s", "No test performed"); + break; + + case '1': + dstate_setinfo("ups.test.result", "%s", "Passed"); + break; + + case '2': + dstate_setinfo("ups.test.result", "%s", "In progress"); + break; + + case '3': + case '4': + dstate_setinfo("ups.test.result", "%s", "10s test failed"); + break; + + case '5': + dstate_setinfo("ups.test.result", "%s", "deep test failed"); + break; + + case '6': + dstate_setinfo("ups.test.result", "%s", "Aborted"); + break; + + default: + upsdebugx(3, "Unhandled test status '%c'", *st); + break; + } + } + + status_commit(); + + dstate_dataok(); +} + /* power down the attached load immediately */ void upsdrv_shutdown(void) { int res; res = init_communication(); - if (res == -1) + if (res < 0) { printf("Detection failed. Trying a shutdown command anyway.\n"); + } /* tested on a F6C525-SER: this works when OL and OB */ @@ -347,6 +369,27 @@ void upsdrv_shutdown(void) send_belkin_command(CONTROL, "SDA", "5"); } +/* handle "beeper.disable" */ +static void do_beeper_off(void) { + int res; + char temp[SMALLBUF]; + const char *arg; + + /* Compare the model name, as the BUZZER_OFF argument depends on it */ + send_belkin_command(STATUS, MODEL, ""); + res = get_belkin_reply(temp); + if (res == -1) + return; + + if (!strcmp(temp, "F6C1400-EUR")) { + arg = BUZZER_OFF2; + } else { + arg = BUZZER_OFF0; + } + + send_belkin_command(CONTROL,BUZZER,arg); +} + /* handle the "load.off" with some paranoia */ static void do_off(void) { @@ -375,6 +418,16 @@ static void do_off(void) static int instcmd(const char *cmdname, const char *extra) { + if (!strcasecmp(cmdname, "beeper.disable")) { + do_beeper_off(); + return STAT_INSTCMD_HANDLED; + } + + if (!strcasecmp(cmdname, "beeper.enable")) { + send_belkin_command(CONTROL,BUZZER,BUZZER_ON); + return STAT_INSTCMD_HANDLED; + } + if (!strcasecmp(cmdname, "load.off")) { do_off(); return STAT_INSTCMD_HANDLED; @@ -385,17 +438,25 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } + if (!strcasecmp(cmdname, "test.battery.start.quick")) { + send_belkin_command(CONTROL,TEST,TEST_10SEC); + return STAT_INSTCMD_HANDLED; + } + + if (!strcasecmp(cmdname, "test.battery.start.deep")) { + send_belkin_command(CONTROL,TEST,TEST_DEEP); + return STAT_INSTCMD_HANDLED; + } + + if (!strcasecmp(cmdname, "test.battery.stop")) { + send_belkin_command(CONTROL,TEST,TEST_CANCEL); + return STAT_INSTCMD_HANDLED; + } + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } -static void set_serialDTR0RTS1(void) -{ - /* set DTR to low and RTS to high */ - ser_set_dtr(upsfd, 0); - ser_set_rts(upsfd, 1); -} - void upsdrv_help(void) { } @@ -409,8 +470,10 @@ void upsdrv_initups(void) { upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B2400); - - set_serialDTR0RTS1(); + + /* set DTR to low and RTS to high */ + ser_set_dtr(upsfd, 0); + ser_set_rts(upsfd, 1); sleep(1); @@ -420,9 +483,10 @@ void upsdrv_initups(void) void upsdrv_initinfo(void) { int res; + char temp[SMALLBUF], st[SMALLBUF]; res = init_communication(); - if (res == -1) { + if (res < 0) { 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 @@ -431,11 +495,42 @@ void upsdrv_initinfo(void) dstate_setinfo("ups.mfr", "BELKIN"); - /* see what's out there */ - init_ups_data(); + send_belkin_command(STATUS, MODEL, ""); + res = get_belkin_reply(temp); + if (res > 0) { + dstate_setinfo("ups.model", "%s", temp); + } - printf("Detected %s on %s\n", dstate_getinfo("ups.model"), - device_path); + send_belkin_command(STATUS, VERSION_CMD, ""); + res = get_belkin_reply(temp); + if (res > 0) { + dstate_setinfo("ups.firmware", "%s", temp); + } + + /* deal with stupid firmware that breaks RAT */ + send_belkin_command(STATUS, RATING, ""); + + if (!strcmp(temp, "001")) { + res = do_broken_rat(temp); + } else { + res = get_belkin_reply(temp); + } + + if (res > 0) { + get_belkin_field(temp, st, sizeof(st), 8); + dstate_setinfo("input.transfer.low", "%.0f", strtod(st, NULL) / 0.88); + + get_belkin_field(temp, st, sizeof(st), 9); + dstate_setinfo("input.transfer.high", "%.0f", strtod(st, NULL) * 0.88); + } + + dstate_addcmd("beeper.disable"); + dstate_addcmd("beeper.enable"); + dstate_addcmd("load.off"); + dstate_addcmd("load.on"); + dstate_addcmd("test.battery.start.quick"); + dstate_addcmd("test.battery.start.deep"); + dstate_addcmd("test.battery.stop"); upsh.instcmd = instcmd; } diff --git a/drivers/belkin.h b/drivers/belkin.h index 47acaeb..4e8e8d8 100644 --- a/drivers/belkin.h +++ b/drivers/belkin.h @@ -32,22 +32,29 @@ #define STAT_OUTPUT "STO" #define STAT_BATTERY "STB" #define STAT_STATUS "STA" +#define TEST_RESULT "TSR" #define POWER_ON "RON" #define POWER_OFF "ROF" #define POWER_SDTYPE "SDT" /* shutdown type? */ #define POWER_CYCLE "SDA" /* shutdown, then restore */ +#define BUZZER "BUZ" +#define BUZZER_ON "1" +#define BUZZER_OFF0 "0" /* Switching the buzzer off can be either 0 or 2 */ +#define BUZZER_OFF2 "2" /* Seems to be used for F6c1400 */ +#define TEST "TST" +#define TEST_10SEC "3" +#define TEST_DEEP "4" +#define TEST_CANCEL "0" /* The UPS Status "low battery" comes up 10s before the UPS actually stops. Therefore a shutdown is done at this battery % */ #define LOW_BAT 20 +/* the maximum allowed number of missed replies */ +#define MAXTRIES 3 + /* dangerous instant commands must be reconfirmed within a 12 second window */ #define CONFIRM_DANGEROUS_COMMANDS 1 #define MINCMDTIME 3 #define MAXCMDTIME 15 - -static int init_communication (void); -static int init_ups_data (void); -static int get_belkin_reply (char*); -static void set_serialDTR0RTS1(void); diff --git a/drivers/bestfcom.c b/drivers/bestfcom.c index c67a5ff..859ea7c 100644 --- a/drivers/bestfcom.c +++ b/drivers/bestfcom.c @@ -528,7 +528,7 @@ Version: 8.07 Released: 08/01/1995 */ -void upsdrv_init_nofc() +void upsdrv_init_nofc(void) { char tmp[256], rstring[1024]; @@ -734,7 +734,7 @@ void upsdrv_init_fc(const char *fcstring) fc.valid = 1; } -void upsdrv_initups () +void upsdrv_initups(void) { char rstring[256]; diff --git a/drivers/bestfortress.c b/drivers/bestfortress.c index 91c98c5..c3d60c4 100644 --- a/drivers/bestfortress.c +++ b/drivers/bestfortress.c @@ -148,7 +148,7 @@ static inline void setinfo_int_minutes (const char *key, const char * s, size_t } /* set info to float value */ -static inline void setinfo_float (const char *key, char * fmt, const char * s, size_t len, double factor) +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; @@ -402,7 +402,7 @@ void upsdrv_makevartable(void) } struct { - char * val; + const char * val; speed_t speed; } speed_table[] = { {"1200", B1200}, diff --git a/drivers/bestpower-mib.c b/drivers/bestpower-mib.c new file mode 100644 index 0000000..d3bcc57 --- /dev/null +++ b/drivers/bestpower-mib.c @@ -0,0 +1,80 @@ +/* bestpower-mib.c - data to monitor Eaton Best Power Ferrups + * using earlier version of the ConnectUPS + * + * Copyright (C) 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 + * 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 "bestpower-mib.h" + +#define BESTPOWER_MIB_VERSION "0.1" +#define BESTPOWER_OID_MODEL_NAME ".1.3.6.1.4.1.2947.1.1.2.0" + +/* + * http://powerquality.eaton.com/Support/Software-Drivers/Downloads/connectivity-firmware/bestpwr2.mib + */ + +static info_lkp_t bestpower_power_status[] = { + { 1, "OL" }, + { 2, "OB" }, + { 0, "NULL" } +} ; + +/* Snmp2NUT lookup table for Best Power MIB */ +static snmp_info_t bestpower_mib[] = { + /* Device page */ + { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "ups", + 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, 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, 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 }, + { "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", "", + 0, NULL }, + + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2947.1.2.1.0", "", + 0 /*SU_STATUS_PWR*/, &bestpower_power_status[0] }, + + /* Battery runtime is expressed in minutes */ + { "battery.runtime", 0, 60.0, ".1.3.6.1.4.1.2947.1.2.3.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.2947.1.2.2.0", "", + 0, NULL }, + { "battery.voltage", 0, 0.1, ".1.3.6.1.4.1.2947.1.2.4.0", "", + 0, NULL }, + { "battery.current", 0, 0.1, ".1.3.6.1.4.1.2947.1.2.5.0", "", + 0, NULL }, + + /* end of structure. */ + { NULL, 0, 0, NULL, NULL, 0, NULL, NULL } +} ; + +mib2nut_info_t bestpower = { "bestpower", BESTPOWER_MIB_VERSION, "", + BESTPOWER_OID_MODEL_NAME, bestpower_mib }; diff --git a/drivers/bestpower-mib.h b/drivers/bestpower-mib.h new file mode 100644 index 0000000..ae9a0a8 --- /dev/null +++ b/drivers/bestpower-mib.h @@ -0,0 +1,9 @@ +#ifndef BESTPOWER_MIB_H +#define BESTPOWER_MIB_H + +#include "main.h" +#include "snmp-ups.h" + +extern mib2nut_info_t bestpower; + +#endif /* BESTPOWER_MIB_H */ diff --git a/drivers/blazer.c b/drivers/blazer.c index 5374c25..4dbbcbd 100644 --- a/drivers/blazer.c +++ b/drivers/blazer.c @@ -211,6 +211,11 @@ static int blazer_status(const char *cmd) dstate_setinfo(status[i].var, status[i].fmt, status[i].conv(val, NULL)); } + if (!val) { + upsdebugx(2, "%s: parsing failed", __func__); + return -1; + } + if (strspn(val, "01") != 8) { upsdebugx(2, "Invalid status [%s]", val); return -1; @@ -517,11 +522,11 @@ static void blazer_initbattery(void) val = getval("runtimecal"); if (val) { - int rh, lh, rl, ll; + double rh, lh, rl, ll; time(&lastpoll); - if (sscanf(val, "%d,%d,%d,%d", &rh, &lh, &rl, &ll) < 4) { + if (sscanf(val, "%lf,%lf,%lf,%lf", &rh, &lh, &rl, &ll) < 4) { fatalx(EXIT_FAILURE, "Insufficient parameters for runtimecal"); } @@ -533,10 +538,10 @@ static void blazer_initbattery(void) fatalx(EXIT_FAILURE, "Parameter out of range (load)"); } - batt.runt.exp = log((double)rl / rh) / log((double)lh / ll); + batt.runt.exp = log(rl / rh) / log(lh / ll); upsdebugx(2, "battery runtime exponent : %.3f", batt.runt.exp); - batt.runt.nom = rh * pow(lh/100, batt.runt.exp); + batt.runt.nom = rh * pow(lh / 100, batt.runt.exp); upsdebugx(2, "battery runtime nominal : %.1f", batt.runt.nom); } else { diff --git a/drivers/cps-hid.c b/drivers/cps-hid.c index 6d75766..e594a59 100644 --- a/drivers/cps-hid.c +++ b/drivers/cps-hid.c @@ -61,7 +61,7 @@ static usb_device_id_t cps_usb_device_table[] = { /* returns statically allocated string - must not use it again before done with result! */ -static char *cps_battvolt_fun(double value) +static const char *cps_battvolt_fun(double value) { static char buf[8]; @@ -161,15 +161,15 @@ static hid_info_t cps_hid2nut[] = { { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } }; -static char *cps_format_model(HIDDevice_t *hd) { +static const char *cps_format_model(HIDDevice_t *hd) { return hd->Product; } -static char *cps_format_mfr(HIDDevice_t *hd) { +static const char *cps_format_mfr(HIDDevice_t *hd) { return hd->Vendor ? hd->Vendor : "CPS"; } -static char *cps_format_serial(HIDDevice_t *hd) { +static const char *cps_format_serial(HIDDevice_t *hd) { return hd->Serial; } diff --git a/drivers/dstate-hal.c b/drivers/dstate-hal.c index b8cab4d..5fcf68f 100644 --- a/drivers/dstate-hal.c +++ b/drivers/dstate-hal.c @@ -95,8 +95,8 @@ static void* battery_type_handler(LibHalChangeSet *cs, char* battery_type); /* Structure to lookup between NUT and HAL data */ typedef struct { - char *nut_name; /* NUT variable name */ - char *hal_name; /* HAL variable name */ + 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. */ diff --git a/drivers/dstate-hal.h b/drivers/dstate-hal.h index 81be05c..06750ed 100644 --- a/drivers/dstate-hal.h +++ b/drivers/dstate-hal.h @@ -20,6 +20,7 @@ #ifndef DSTATE_HAL_H_SEEN #define DSTATE_HAL_H_SEEN 1 +#include "state.h" #include "attribute.h" /*#include "parseconf.h"*/ @@ -45,11 +46,11 @@ gboolean dbus_init_local (void); #define HAL_WARNING /* track client connections */ -/* struct conn_t { +/* typedef struct conn_s { * int fd; * PCONF_CTX_t ctx; - * void *next; - *}; + * struct conn_s *next; + *} conn_t; */ extern struct ups_handler upsh; @@ -67,8 +68,8 @@ 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 struct st_tree_t *dstate_getroot(void); -const struct cmdlist_t *dstate_getcmdlist(void); +const st_tree_t *dstate_getroot(void); +const cmdlist_t *dstate_getcmdlist(void); void dstate_dataok(void); void dstate_datastale(void); diff --git a/drivers/dstate.c b/drivers/dstate.c index dfdeb70..b95cec9 100644 --- a/drivers/dstate.c +++ b/drivers/dstate.c @@ -35,9 +35,9 @@ static int sockfd = -1, stale = 1, alarm_active = 0; static char *sockfn = NULL; static char status_buf[ST_MAX_VALUE_LEN], alarm_buf[ST_MAX_VALUE_LEN]; - static struct st_tree_t *dtree_root = NULL; - static struct conn_t *connhead = NULL; - static struct cmdlist_t *cmdhead = NULL; + static st_tree_t *dtree_root = NULL; + static conn_t *connhead = NULL; + static cmdlist_t *cmdhead = NULL; struct ups_handler upsh; @@ -139,7 +139,7 @@ static int sock_open(const char *fn) return fd; } -static void sock_disconnect(struct conn_t *conn) +static void sock_disconnect(conn_t *conn) { close(conn->fd); @@ -165,7 +165,7 @@ static void send_to_all(const char *fmt, ...) int ret; char buf[ST_SOCK_BUF_LEN]; va_list ap; - struct conn_t *conn, *cnext; + conn_t *conn, *cnext; va_start(ap, fmt); ret = vsnprintf(buf, sizeof(buf), fmt, ap); @@ -190,7 +190,7 @@ static void send_to_all(const char *fmt, ...) } } -static int send_to_one(struct conn_t *conn, const char *fmt, ...) +static int send_to_one(conn_t *conn, const char *fmt, ...) { int ret; va_list ap; @@ -221,7 +221,7 @@ static int send_to_one(struct conn_t *conn, const char *fmt, ...) static void sock_connect(int sock) { int fd, ret; - struct conn_t *conn; + conn_t *conn; struct sockaddr_un sa; socklen_t salen; @@ -266,10 +266,10 @@ static void sock_connect(int sock) upsdebugx(3, "new connection on fd %d", fd); } -static int st_tree_dump_conn(struct st_tree_t *node, struct conn_t *conn) +static int st_tree_dump_conn(st_tree_t *node, conn_t *conn) { int ret; - struct enum_t *etmp; + enum_t *etmp; if (!node) { return 1; /* not an error */ @@ -325,9 +325,9 @@ static int st_tree_dump_conn(struct st_tree_t *node, struct conn_t *conn) return 1; /* everything's OK here ... */ } -static int cmd_dump_conn(struct conn_t *conn) +static int cmd_dump_conn(conn_t *conn) { - struct cmdlist_t *cmd; + cmdlist_t *cmd; for (cmd = cmdhead; cmd; cmd = cmd->next) { if (!send_to_one(conn, "ADDCMD %s\n", cmd->name)) { @@ -338,7 +338,7 @@ static int cmd_dump_conn(struct conn_t *conn) return 1; } -static int sock_arg(struct conn_t *conn, int numarg, char **arg) +static int sock_arg(conn_t *conn, int numarg, char **arg) { if (numarg < 1) { return 0; @@ -415,7 +415,7 @@ static int sock_arg(struct conn_t *conn, int numarg, char **arg) return 0; } -static void sock_read(struct conn_t *conn) +static void sock_read(conn_t *conn) { int i, ret; char buf[SMALLBUF]; @@ -463,7 +463,7 @@ static void sock_read(struct conn_t *conn) static void sock_close(void) { - struct conn_t *conn, *cnext; + conn_t *conn, *cnext; if (sockfd != -1) { close(sockfd); @@ -487,15 +487,15 @@ static void sock_close(void) /* interface */ -void dstate_init(const char *prog, const char *port) +void dstate_init(const char *prog, const char *devname) { char sockname[SMALLBUF]; /* do this here for now */ signal(SIGPIPE, SIG_IGN); - if (port) { - snprintf(sockname, sizeof(sockname), "%s/%s-%s", dflt_statepath(), prog, port); + if (devname) { + snprintf(sockname, sizeof(sockname), "%s/%s-%s", dflt_statepath(), prog, devname); } else { snprintf(sockname, sizeof(sockname), "%s/%s", dflt_statepath(), prog); } @@ -511,7 +511,7 @@ int dstate_poll_fds(struct timeval timeout, int extrafd) int ret, maxfd, overrun = 0; fd_set rfds; struct timeval now; - struct conn_t *conn, *cnext; + conn_t *conn, *cnext; FD_ZERO(&rfds); FD_SET(sockfd, &rfds); @@ -632,7 +632,7 @@ int dstate_addenum(const char *var, const char *fmt, ...) void dstate_setflags(const char *var, int flags) { - struct st_tree_t *sttmp; + st_tree_t *sttmp; char flist[SMALLBUF]; /* find the dtree node for var */ @@ -666,7 +666,7 @@ void dstate_setflags(const char *var, int flags) void dstate_setaux(const char *var, int aux) { - struct st_tree_t *sttmp; + st_tree_t *sttmp; /* find the dtree node for var */ sttmp = state_tree_find(dtree_root, var); @@ -756,12 +756,12 @@ void dstate_free(void) sock_close(); } -const struct st_tree_t *dstate_getroot(void) +const st_tree_t *dstate_getroot(void) { return dtree_root; } -const struct cmdlist_t *dstate_getcmdlist(void) +const cmdlist_t *dstate_getcmdlist(void) { return cmdhead; } diff --git a/drivers/dstate.h b/drivers/dstate.h index d245b3f..7ffe899 100644 --- a/drivers/dstate.h +++ b/drivers/dstate.h @@ -20,6 +20,7 @@ #ifndef DSTATE_H_SEEN #define DSTATE_H_SEEN 1 +#include "state.h" #include "attribute.h" #include "parseconf.h" @@ -29,16 +30,16 @@ #define DS_MAX_READ 256 /* don't read forever from upsd */ /* track client connections */ -struct conn_t { +typedef struct conn_s { int fd; PCONF_CTX_t ctx; - struct conn_t *prev; - struct conn_t *next; -}; + struct conn_s *prev; + struct conn_s *next; +} conn_t; extern struct ups_handler upsh; -void dstate_init(const char *prog, const char *port); +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))); @@ -52,8 +53,8 @@ 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 struct st_tree_t *dstate_getroot(void); -const struct cmdlist_t *dstate_getcmdlist(void); +const st_tree_t *dstate_getroot(void); +const cmdlist_t *dstate_getcmdlist(void); void dstate_dataok(void); void dstate_datastale(void); diff --git a/drivers/dummy-ups.c b/drivers/dummy-ups.c index 2733088..468e660 100644 --- a/drivers/dummy-ups.c +++ b/drivers/dummy-ups.c @@ -1,7 +1,7 @@ -/* dummy-ups.c - NUT testing driver and repeater +/* dummy-ups.c - NUT simulation and device repeater driver Copyright (C) - 2005 - 2009 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 @@ -39,11 +39,12 @@ #include "upsclient.h" #include "dummy-ups.h" -#define DRIVER_NAME "Dummy UPS driver" -#define DRIVER_VERSION "0.10" +#define DRIVER_NAME "Device simulation and repeater driver" +#define DRIVER_VERSION "0.12" /* driver description structure */ -upsdrv_info_t upsdrv_info = { +upsdrv_info_t upsdrv_info = +{ DRIVER_NAME, DRIVER_VERSION, "Arnaud Quette ", @@ -51,12 +52,12 @@ upsdrv_info_t upsdrv_info = { { NULL } }; -#define MODE_UNKNOWN 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) */ -int mode=MODE_UNKNOWN; +int mode=MODE_NONE; /* parseconf context, for dummy mode using a file */ PCONF_CTX_t *ctx=NULL; @@ -76,7 +77,7 @@ static int upsclient_update_vars(void); /* connection information */ static char *client_upsname = NULL, *hostname = NULL; static UPSCONN_t *ups = NULL; -int port; +static int port; /* Driver functions */ @@ -84,11 +85,14 @@ void upsdrv_initinfo(void) { dummy_info_t *item; - switch (mode) { + switch (mode) + { case MODE_DUMMY: /* Initialise basic essential variables */ - for ( item = nut_data ; item->info_type != NULL ; item++ ) { - if (item->drv_flags & DU_FLAG_INIT) { + for ( item = nut_data ; item->info_type != NULL ; item++ ) + { + if (item->drv_flags & DU_FLAG_INIT) + { dstate_setinfo(item->info_type, "%s", item->default_value); dstate_setflags(item->info_type, item->info_flags); @@ -110,28 +114,33 @@ void upsdrv_initinfo(void) case MODE_META: case MODE_REPEATER: /* Obtain the target name */ - if (upscli_splitname(device_path, &client_upsname, &hostname, &port) != 0) { + if (upscli_splitname(device_path, &client_upsname, &hostname, &port) != 0) + { fatalx(EXIT_FAILURE, "Error: invalid UPS definition.\nRequired format: upsname[@hostname[:port]]"); } /* Connect to the target */ ups = xmalloc(sizeof(*ups)); - if (upscli_connect(ups, hostname, port, UPSCLI_CONN_TRYSSL) < 0) { + if (upscli_connect(ups, hostname, port, UPSCLI_CONN_TRYSSL) < 0) + { fatalx(EXIT_FAILURE, "Error: %s", upscli_strerror(ups)); } - else { + else + { upsdebugx(1, "Connected to %s@%s", client_upsname, hostname); } - if (upsclient_update_vars() < 0) { + if (upsclient_update_vars() < 0) + { /* check for an old upsd */ - if (upscli_upserror(ups) == UPSCLI_ERR_UNKCOMMAND) { + if (upscli_upserror(ups) == UPSCLI_ERR_UNKCOMMAND) + { fatalx(EXIT_FAILURE, "Error: upsd is too old to support this query"); } fatalx(EXIT_FAILURE, "Error: %s", upscli_strerror(ups)); } - /* FIXME: commands and settables! */ + /* FIXME: commands and settable variable! */ break; default: - case MODE_UNKNOWN: + case MODE_NONE: fatalx(EXIT_FAILURE, "no suitable definition found!"); break; } @@ -146,7 +155,8 @@ void upsdrv_updateinfo(void) sleep(1); - switch (mode) { + switch (mode) + { case MODE_DUMMY: /* Now get user's defined variables */ if (parse_data_file(upsfd) >= 0) @@ -155,18 +165,26 @@ void upsdrv_updateinfo(void) case MODE_META: case MODE_REPEATER: if (upsclient_update_vars() > 0) + { dstate_dataok(); - else { + } + else + { /* try to reconnect */ upscli_disconnect(ups); - if (upscli_connect(ups, hostname, port, UPSCLI_CONN_TRYSSL) < 0) { + if (upscli_connect(ups, hostname, port, UPSCLI_CONN_TRYSSL) < 0) + { upsdebugx(1, "Error reconnecting: %s", upscli_strerror(ups)); } - else { + else + { upsdebugx(1, "Reconnected"); } } break; + case MODE_NONE: + default: + break; } } @@ -198,14 +216,16 @@ void upsdrv_makevartable(void) void upsdrv_initups(void) { /* check the running mode... */ - if (strchr(device_path, '@')) { + if (strchr(device_path, '@')) + { upsdebugx(1, "Repeater mode"); mode = MODE_REPEATER; dstate_setinfo("driver.parameter.mode", "repeater"); - /* if there is at least one more => MODE_META... */ + /* FIXME: if there is at least one more => MODE_META... */ } - else { - upsdebugx(1, "Dummy mode"); + else + { + upsdebugx(1, "Dummy (simulation) mode"); mode = MODE_DUMMY; dstate_setinfo("driver.parameter.mode", "dummy"); } @@ -213,12 +233,15 @@ void upsdrv_initups(void) void upsdrv_cleanup(void) { - if ( (mode == MODE_META) || (mode == MODE_REPEATER) ) { - if (ups) { + if ( (mode == MODE_META) || (mode == MODE_REPEATER) ) + { + if (ups) + { upscli_disconnect(ups); } - if (ctx) { + if (ctx) + { pconf_finish(ctx); free(ctx); } @@ -235,7 +258,8 @@ static int setvar(const char *varname, const char *val) upsdebugx(2, "entering setvar(%s, %s)", varname, val); - if (!strncmp(varname, "ups.status", 10)) { + if (!strncmp(varname, "ups.status", 10)) + { status_init(); /* FIXME: split and check values (support multiple values), à la usbhid-ups */ status_set(val); @@ -245,29 +269,38 @@ static int setvar(const char *varname, const char *val) } /* Check variable validity */ - if (!is_valid_data(varname)) { + if (!is_valid_data(varname)) + { upsdebugx(2, "setvar: invalid variable name (%s)", varname); - return STAT_SET_UNKNOWN; } /* Check value validity */ - if (!is_valid_value(varname, val)) { + if (!is_valid_value(varname, val)) + { upsdebugx(2, "setvar: invalid value (%s) for variable (%s)", val, varname); - return STAT_SET_UNKNOWN; } - dstate_setinfo(varname, "%s", val); - - if ( (item = find_info(varname)) != NULL) { - dstate_setflags(item->info_type, item->info_flags); - - /* Set max length for strings, if needed */ - if (item->info_flags & ST_FLAG_STRING) - dstate_setaux(item->info_type, item->info_len); + /* If value is empty, remove the variable (FIXME: do we need + * a magic word?) */ + if (strlen(val) == 0) + { + dstate_delinfo(varname); } + else + { + dstate_setinfo(varname, "%s", val); + if ( (item = find_info(varname)) != NULL) + { + dstate_setflags(item->info_type, item->info_flags); + + /* Set max length for strings, if needed */ + if (item->info_flags & ST_FLAG_STRING) + dstate_setaux(item->info_type, item->info_len); + } + } return STAT_SET_HANDLED; } @@ -288,15 +321,17 @@ static int upsclient_update_vars(void) ret = upscli_list_start(ups, numq, query); - if (ret < 0) { + if (ret < 0) + { upsdebugx(1, "Error: %s (%i)", upscli_strerror(ups), upscli_upserror(ups)); return ret; } - while (upscli_list_next(ups, numq, query, &numa, &answer) == 1) { - + while (upscli_list_next(ups, numq, query, &numa, &answer) == 1) + { /* VAR */ - if (numa < 4) { + if (numa < 4) + { upsdebugx(1, "Error: insufficient data (got %d args, need at least 4)", numa); } @@ -315,7 +350,8 @@ static dummy_info_t *find_info(const char *varname) { dummy_info_t *item; - for ( item = nut_data ; item->info_type != NULL ; item++ ) { + for ( item = nut_data ; item->info_type != NULL ; item++ ) + { if (!strcasecmp(item->info_type, varname)) return item; } @@ -330,13 +366,15 @@ static int is_valid_data(const char* varname) { dummy_info_t *item; - if ( (item = find_info(varname)) != NULL) { - return 1; + if ( (item = find_info(varname)) != NULL) + { + return 1; } /* FIXME: we need to have the full data set before - * enforcing controls! */ - + * enforcing controls! We also need a way to automate + * the update / sync process (with cmdvartab?!) */ + upsdebugx(1, "Unknown data. Commiting anyway..."); return 1; /* return 0;*/ @@ -347,14 +385,16 @@ static int is_valid_value(const char* varname, const char *value) { dummy_info_t *item; - if ( (item = find_info(varname)) != NULL) { + if ( (item = find_info(varname)) != NULL) + { /* FIXME: test enum or bound against value */ return 1; } /* FIXME: we need to have the full data set before - * enforcing controls! */ - + * enforcing controls! We also need a way to automate + * the update / sync process (with cmdvartab?) */ + upsdebugx(1, "Unknown data. Commiting value anyway..."); return 1; /* return 0;*/ @@ -372,7 +412,7 @@ static void upsconf_err(const char *errmsg) static int parse_data_file(int upsfd) { char fn[SMALLBUF]; - char *ptr, *var_value; + char *ptr, *var_value = (char*) xmalloc(MAX_STRING_SIZE); int value_args = 0, counter; time_t now; @@ -380,14 +420,15 @@ static int parse_data_file(int upsfd) upsdebugx(1, "entering parse_data_file()"); - if (now < next_update) { + if (now < next_update) + { upsdebugx(1, "leaving (paused)..."); return 1; } - - /* initialise everything, to loop back at the beginning of the file */ - if (ctx == NULL) { + /* initialise everything, to loop back at the beginning of the file */ + if (ctx == NULL) + { ctx = (PCONF_CTX_t *)xmalloc(sizeof(PCONF_CTX_t)); if (device_path[0] == '/') @@ -402,14 +443,15 @@ static int parse_data_file(int upsfd) fn, ctx->errmsg); } - /* reset the next call time, so that we can loop back on the file + /* Reset the next call time, so that we can loop back on the file * if there is no blocking action (ie TIMER) until the end of the file */ next_update = -1; - - /* now start or continue parsing... */ - while (pconf_file_next(ctx)) { - if (pconf_parse_error(ctx)) { + /* Now start or continue parsing... */ + while (pconf_file_next(ctx)) + { + if (pconf_parse_error(ctx)) + { upsdebugx(2, "Parse error: %s:%d: %s", fn, ctx->linenum, ctx->errmsg); continue; @@ -419,8 +461,9 @@ static int parse_data_file(int upsfd) if (ctx->numargs < 1) continue; - /* process actions (only "TIMER" ATM) */ - if (!strncmp(ctx->arglist[0], "TIMER", 5)) { + /* Process actions (only "TIMER" ATM) */ + if (!strncmp(ctx->arglist[0], "TIMER", 5)) + { /* TIMER will wait "seconds" before * continuing the parsing */ int delay = atoi (ctx->arglist[1]); @@ -430,55 +473,63 @@ static int parse_data_file(int upsfd) break; } - /* Remove the ":" after the variable name */ + /* Remove ":" suffix, after the variable name */ if ((ptr = strchr(ctx->arglist[0], ':')) != NULL) *ptr = '\0'; - upsdebugx(3, "parse_data_file: variable \"%s\" with %d args", ctx->arglist[0], (int)ctx->numargs); + upsdebugx(3, "parse_data_file: variable \"%s\" with %d args", + ctx->arglist[0], (int)ctx->numargs); - /* skip the driver.* collection data */ - if (!strncmp(ctx->arglist[0], "driver.", 7)) { + /* Skip the driver.* collection data */ + if (!strncmp(ctx->arglist[0], "driver.", 7)) + { upsdebugx(2, "parse_data_file: skipping %s", ctx->arglist[0]); continue; } /* From there, we get varname in arg[0], and values in other arg[1...x] */ - /* FIXME: iteration on arg[2, 3, ...] - if ST_FLAG_STRING => all args are the value - if ups.status, each arg is a value to be set (ie OB LB) + check against enum - else int/float values need to be check against bound/enum - */ - var_value = (char*) xmalloc(MAX_STRING_SIZE); - for (counter = 1, value_args = ctx->numargs ; counter < value_args ; counter++) { - if (counter != 1) /* don't append the first space separator */ - strncat(var_value, " ", MAX_STRING_SIZE); - strncat(var_value, ctx->arglist[counter], MAX_STRING_SIZE); - } - /* special handler for status */ - if (!strncmp( ctx->arglist[0], "ups.status", 10)) { + if (!strncmp( ctx->arglist[0], "ups.status", 10)) + { status_init(); - setvar(ctx->arglist[0], var_value); + for (counter = 1, value_args = ctx->numargs ; + counter < value_args ; counter++) + { + status_set(ctx->arglist[counter]); + } status_commit(); } - else { - - if (setvar(ctx->arglist[0], var_value) == STAT_SET_UNKNOWN) { + else + { + memset(var_value, 0, MAX_STRING_SIZE); + for (counter = 1, value_args = ctx->numargs ; + counter < value_args ; counter++) + { + if (counter != 1) /* don't append the first space separator */ + strncat(var_value, " ", 1); + strncat(var_value, ctx->arglist[counter], MAX_STRING_SIZE); + } + + if (setvar(ctx->arglist[0], var_value) == STAT_SET_UNKNOWN) + { upsdebugx(2, "parse_data_file: can't add \"%s\" with value \"%s\"\nError: %s", ctx->arglist[0], var_value, ctx->errmsg); } - else { + else + { upsdebugx(3, "parse_data_file: added \"%s\" with value \"%s\"", ctx->arglist[0], var_value); } } } - /* cleanup parseconf if there is no pending action */ - if (next_update == -1) { + /* Cleanup parseconf if there is no pending action */ + if (next_update == -1) + { pconf_finish(ctx); free(ctx); ctx=NULL; + free(var_value); } return 1; } diff --git a/drivers/dummy-ups.h b/drivers/dummy-ups.h index 9c94b02..b086a52 100644 --- a/drivers/dummy-ups.h +++ b/drivers/dummy-ups.h @@ -1,7 +1,7 @@ /* dummy-ups.h - NUT testing driver and repeater Copyright (C) - 2005 - 2009 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 @@ -23,6 +23,7 @@ * as the "port" parameter (only the file name, not the path). * The format of this file is the same as an upsc dump: * : + * FIXME: use cmdvartab for conformance checking * ... * Once the driver is loaded: * - change the value by using upsrw @@ -36,7 +37,7 @@ /* --------------------------------------------------------------- */ typedef struct { - char *status_str; /* ups.status string */ + const char *status_str; /* ups.status string */ int status_value; /* ups.status value */ } status_lkp_t; @@ -81,11 +82,11 @@ typedef struct { /* --------------------------------------------------------------- */ typedef struct { - char *info_type; /* NUT variable name */ + const char *info_type; /* NUT variable name */ int info_flags; /* NUT flags (to set in addinfo) */ float info_len; /* if ST_FLAG_STRING: length of the string */ /* if HU_TYPE_CMD: command value ; multiplier (or max len) otherwise */ - char *default_value; /* if HU_FLAG_ABSENT: default value ; format otherwise */ + const char *default_value; /* if HU_FLAG_ABSENT: default value ; format otherwise */ int drv_flags; /* */ char **var_values; /* all possible values for this variable (allows to check data...) */ /* FIXME: "void *" so we can have bound or enum */ diff --git a/drivers/explore-hid.c b/drivers/explore-hid.c index 63a2bec..40154e1 100644 --- a/drivers/explore-hid.c +++ b/drivers/explore-hid.c @@ -42,15 +42,15 @@ static hid_info_t explore_hid2nut[] = { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } }; -static char *explore_format_model(HIDDevice_t *hd) { +static const char *explore_format_model(HIDDevice_t *hd) { return hd->Product; } -static char *explore_format_mfr(HIDDevice_t *hd) { +static const char *explore_format_mfr(HIDDevice_t *hd) { return hd->Vendor; } -static char *explore_format_serial(HIDDevice_t *hd) { +static const char *explore_format_serial(HIDDevice_t *hd) { return hd->Serial; } diff --git a/drivers/gamatronic.c b/drivers/gamatronic.c index e553934..48a37ac 100644 --- a/drivers/gamatronic.c +++ b/drivers/gamatronic.c @@ -117,7 +117,7 @@ int sec_cmd(const char mode, const char *command, char *msgbuf, int *buflen) return ret; } -void addquery(char *cmd, int field, int varnum, int pollflag) +void addquery(const char *cmd, int field, int varnum, int pollflag) { int q; @@ -297,17 +297,20 @@ void upsdrv_updateinfo(void) void upsdrv_shutdown(void) { + int msg_len; + char msgbuf[SMALLBUF]; - int msg_len; + msg_len = snprintf(msgbuf, sizeof(msgbuf), "-1"); + sec_cmd(SEC_SETCMD, SEC_SHUTDOWN, msgbuf, &msg_len); - msg_len = 2; - sec_cmd (SEC_SETCMD,SEC_SHUTDOWN,"-1",&msg_len); - msg_len = 1 ; - sec_cmd (SEC_SETCMD,SEC_AUTORESTART,"1",&msg_len); - msg_len = 1; - sec_cmd (SEC_SETCMD, SEC_SHUTTYPE,"2",&msg_len); - msg_len = 1; - sec_cmd (SEC_SETCMD,SEC_SHUTDOWN,"5",&msg_len); + msg_len = snprintf(msgbuf, sizeof(msgbuf), "1"); + sec_cmd(SEC_SETCMD, SEC_AUTORESTART, msgbuf, &msg_len); + + msg_len = snprintf(msgbuf, sizeof(msgbuf), "2"); + sec_cmd(SEC_SETCMD, SEC_SHUTTYPE,msgbuf, &msg_len); + + msg_len = snprintf(msgbuf, sizeof(msgbuf), "5"); + sec_cmd(SEC_SETCMD, SEC_SHUTDOWN, msgbuf, &msg_len); } /* diff --git a/drivers/gamatronic.h b/drivers/gamatronic.h index 4863293..85c3290 100644 --- a/drivers/gamatronic.h +++ b/drivers/gamatronic.h @@ -64,7 +64,7 @@ #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() */ -struct baud_rate_t { +struct { int rate; int name; } baud_rates[] = { @@ -80,11 +80,11 @@ struct baud_rate_t { /* macro for checking whether a variable is supported */ -struct sec_varlist_t { - char *setcmd; /* INFO_x define from shared.h */ - char *name; /* Human readable text (also in shared-tables.h) */ +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 */ - char *cmd; /* Command to send to pool/set variable */ + const char *cmd; /* Command to send to pool/set variable */ int field; /* Which returned field variable corresponsd to */ int size; /* string length/integer max/enum count */ int poll; /* poll flag */ @@ -191,8 +191,8 @@ struct sec_varlist_t { #define SEC_POLL 1 #define SEC_POLLONCE 0 -struct sec_querylist_t { - char *command; /* sec command */ +struct { + const char *command; /* sec command */ int varnum[SEC_MAXFIELDS]; /* sec variable number for each field */ int pollflag; } sec_querylist[SEC_QUERYLIST_LEN]; diff --git a/drivers/hidparser.h b/drivers/hidparser.h index b24997c..5c91d6f 100644 --- a/drivers/hidparser.h +++ b/drivers/hidparser.h @@ -27,7 +27,9 @@ #ifdef __cplusplus +/* *INDENT-OFF* */ extern "C" { +/* *INDENT-ON* */ #endif /* __cplusplus */ #include "hidtypes.h" @@ -63,7 +65,9 @@ void SetValue(const HIDData_t *pData, unsigned char *Buf, long Value); #ifdef __cplusplus +/* *INDENT-OFF* */ } /* extern "C" */ +/* *INDENT-ON* */ #endif /* __cplusplus */ #endif diff --git a/drivers/hidtypes.h b/drivers/hidtypes.h index fe7dfca..f7e2581 100644 --- a/drivers/hidtypes.h +++ b/drivers/hidtypes.h @@ -26,7 +26,9 @@ #define HIDTYPES_H #ifdef __cplusplus +/* *INDENT-OFF* */ extern "C" { +/* *INDENT-ON* */ #endif /* __cplusplus */ #include @@ -143,7 +145,9 @@ typedef struct { } HIDDesc_t; #ifdef __cplusplus +/* *INDENT-OFF* */ } /* extern "C" */ +/* *INDENT-ON* */ #endif /* __cplusplus */ #endif /* HIDTYPES_H */ diff --git a/drivers/idowell-hid.c b/drivers/idowell-hid.c new file mode 100644 index 0000000..0d77fc5 --- /dev/null +++ b/drivers/idowell-hid.c @@ -0,0 +1,169 @@ +/* idowell-hid.c - subdriver to monitor iDowell USB/HID devices with NUT + * + * Copyright (C) + * 2003 - 2009 Arnaud Quette + * 2005 - 2006 Peter Selinger + * 2008 - 2009 Arjen de Korte + * + * Note: this subdriver was initially generated as a "stub" by the + * path-to-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 "usbhid-ups.h" +#include "idowell-hid.h" +#include "main.h" /* for getval() */ +#include "usb-common.h" + +#define IDOWELL_HID_VERSION "iDowell HID 0.1" +/* FIXME: experimental flag to be put in upsdrv_info */ + +/* iDowell */ +#define IDOWELL_VENDORID 0x075d + +/* USB IDs device table */ +static usb_device_id_t idowell_usb_device_table[] = { + /* iDowell */ + { USB_DEVICE(IDOWELL_VENDORID, 0x0300), NULL }, + + /* Terminating entry */ + { -1, -1, NULL } +}; + +/* --------------------------------------------------------------- */ +/* Vendor-specific usage table */ +/* --------------------------------------------------------------- */ + +/* IDOWELL usage table */ +static usage_lkp_t idowell_usage_lkp[] = { + { NULL, 0 } +}; + +static usage_tables_t idowell_utab[] = { + idowell_usage_lkp, + hid_usage_lkp, + NULL, +}; + +/* --------------------------------------------------------------- */ +/* HID2NUT lookup table */ +/* --------------------------------------------------------------- */ + +static hid_info_t idowell_hid2nut[] = { +#ifdef DEBUG + { "unmapped.ups.flow.[4].flowid", 0, 0, "UPS.Flow.[4].FlowID", NULL, "%.0f", 0, NULL }, + { "unmapped.ups.powerconverter.output.outputid", 0, 0, "UPS.PowerConverter.Output.OutputID", NULL, "%.0f", 0, NULL }, + { "unmapped.ups.powerconverter.powerconverterid", 0, 0, "UPS.PowerConverter.PowerConverterID", NULL, "%.0f", 0, NULL }, + { "unmapped.ups.powersummary.capacitygranularity1", 0, 0, "UPS.PowerSummary.CapacityGranularity1", NULL, "%.0f", 0, NULL }, + { "unmapped.ups.powersummary.capacitymode", 0, 0, "UPS.PowerSummary.CapacityMode", NULL, "%.0f", 0, NULL }, + { "unmapped.ups.powersummary.flowid", 0, 0, "UPS.PowerSummary.FlowID", NULL, "%.0f", 0, NULL }, + { "unmapped.ups.powersummary.fullchargecapacity", 0, 0, "UPS.PowerSummary.FullChargeCapacity", NULL, "%.0f", 0, NULL }, + { "unmapped.ups.powersummary.imanufacturer", 0, 0, "UPS.PowerSummary.iManufacturer", NULL, "%.0f", 0, NULL }, + { "unmapped.ups.powersummary.iproduct", 0, 0, "UPS.PowerSummary.iProduct", NULL, "%.0f", 0, NULL }, + { "unmapped.ups.powersummary.iserialnumber", 0, 0, "UPS.PowerSummary.iSerialNumber", NULL, "%.0f", 0, NULL }, + { "unmapped.ups.powersummary.powersummaryid", 0, 0, "UPS.PowerSummary.PowerSummaryID", NULL, "%.0f", 0, NULL }, + { "unmapped.ups.powersummary.presentstatus.undefined", 0, 0, "UPS.PowerSummary.PresentStatus.Undefined", NULL, "%.0f", 0, NULL }, +#endif /* DEBUG */ + + { "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.CommunicationLost", NULL, NULL, 0, commfault_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Discharging", NULL, NULL, HU_FLAG_QUICK_POLL, discharging_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Good", NULL, NULL, 0, off_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.InternalFailure", NULL, NULL, 0, commfault_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.NeedReplacement", NULL, NULL, 0, replacebatt_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Overload", NULL, NULL, 0, overload_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ShutdownImminent", NULL, NULL, 0, shutdownimm_info }, + + /* battery page */ + { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, + { "battery.charge.low", 0, 0, "UPS.PowerSummary.RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_STATIC , NULL }, /* Read only */ + { "battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", 0, NULL }, + { "battery.type", 0, 0, "UPS.PowerSummary.iDeviceChemistry", NULL, "%s", HU_FLAG_STATIC, stringid_conversion }, + + /* UPS page */ + { "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.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 }, + + /* output page */ + { "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%.1f", 0, NULL }, + { "output.voltage.nominal", 0, 0, "UPS.Flow.[4].ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, NULL }, + { "output.frequency.nominal", 0, 0, "UPS.Flow.[4].ConfigFrequency", NULL, "%.0f", HU_FLAG_STATIC, NULL }, + + /* instant commands */ + { "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 }, + + /* end of structure. */ + { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } +}; + +static const char *idowell_format_model(HIDDevice_t *hd) { + return hd->Product; +} + +static const char *idowell_format_mfr(HIDDevice_t *hd) { + return hd->Vendor ? hd->Vendor : "iDowell"; +} + +static const char *idowell_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 idowell_claim(HIDDevice_t *hd) +{ + int status = is_usb_device_supported(idowell_usb_device_table, hd->VendorID, hd->ProductID); + + switch (status) + { + case POSSIBLY_SUPPORTED: + /* by default, reject, unless the productid option is given */ + if (getval("productid")) { + return 1; + } + possibly_supported("iDowell", hd); + return 0; + + case SUPPORTED: + return 1; + + case NOT_SUPPORTED: + default: + return 0; + } +} + +subdriver_t idowell_subdriver = { + IDOWELL_HID_VERSION, + idowell_claim, + idowell_utab, + idowell_hid2nut, + idowell_format_model, + idowell_format_mfr, + idowell_format_serial, +}; diff --git a/drivers/idowell-hid.h b/drivers/idowell-hid.h new file mode 100644 index 0000000..0be68d0 --- /dev/null +++ b/drivers/idowell-hid.h @@ -0,0 +1,30 @@ +/* idowell-hid.h - subdriver to monitor iDowell 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 IDOWELL_HID_H +#define IDOWELL_HID_H + +#include "usbhid-ups.h" + +extern subdriver_t idowell_subdriver; + +#endif /* IDOWELL_HID_H */ diff --git a/drivers/ietf-mib.c b/drivers/ietf-mib.c index 7e7d88b..ee1247d 100644 --- a/drivers/ietf-mib.c +++ b/drivers/ietf-mib.c @@ -3,6 +3,7 @@ * Copyright (C) 2002-2006 * Arnaud Quette * Niels Baggesen + * Arjen de Korte * * Sponsored by MGE UPS SYSTEMS * @@ -28,231 +29,248 @@ #define IETF_MIB_VERSION "1.3" /* SNMP OIDs set */ -#define IETF_OID_UPS_MIB "1.3.6.1.2.1.33" -#define IETF_OID_MFR_NAME "1.3.6.1.2.1.33.1.1.1.0" /* UPS-MIB::upsIdentManufacturer.0 */ -#define IETF_OID_MODEL_NAME "1.3.6.1.2.1.33.1.1.2.0" /* UPS-MIB::upsIdentModel.0 */ -#define IETF_OID_FIRMREV "1.3.6.1.2.1.33.1.1.3.0" /* UPS-MIB::upsIdentUPSSoftwareVersion.0 */ -#define IETF_OID_AGENTREV "1.3.6.1.2.1.33.1.1.4.0" /* UPS-MIB::upsIdentAgentSoftwareVersion.0 */ -#define IETF_OID_IDENT "1.3.6.1.2.1.33.1.1.5.0" /* UPS-MIB::upsIdentName.0 */ +#define IETF_OID_UPS_MIB "1.3.6.1.2.1.33.1." -#define IETF_OID_BATT_STATUS "1.3.6.1.2.1.33.1.2.1.0" /* UPS-MIB::upsBatteryStatus.0 */ -#define IETF_OID_BATT_RUNTIME "1.3.6.1.2.1.33.1.2.3.0" /* UPS-MIB::upsEstimatedMinutesRemaining.0 */ -#define IETF_OID_BATT_CHARGE "1.3.6.1.2.1.33.1.2.4.0" /* UPS-MIB::upsEstimatedChargeRemaining.0 */ -#define IETF_OID_BATT_VOLTAGE "1.3.6.1.2.1.33.1.2.5.0" /* UPS-MIB::upsBatteryVoltage.0 */ -#define IETF_OID_BATT_CURRENT "1.3.6.1.2.1.33.1.2.6.0" /* UPS-MIB::upsBatteryCurrent.0 */ -#define IETF_OID_BATT_TEMP "1.3.6.1.2.1.33.1.2.7.0" /* UPS-MIB::upsBatteryTemperature.0 */ +/* #define DEBUG */ -#define IETF_OID_IN_LINEBADS "1.3.6.1.2.1.33.1.3.1.0" /* UPS-MIB::upsInputLineBads.0 */ -#define IETF_OID_IN_LINES "1.3.6.1.2.1.33.1.3.2.0" /* UPS-MIB::upsInputNumLines.0 */ - -#define IETF_OID_IN_FREQ "1.3.6.1.2.1.33.1.3.3.1.2" /* UPS-MIB::upsInputFrequency */ -#define IETF_OID_IN_VOLTAGE "1.3.6.1.2.1.33.1.3.3.1.3" /* UPS-MIB::upsInputVoltage */ -#define IETF_OID_IN_CURRENT "1.3.6.1.2.1.33.1.3.3.1.4" /* UPS-MIB::upsInputCurrent */ -#define IETF_OID_IN_POWER "1.3.6.1.2.1.33.1.3.3.1.5" /* UPS-MIB::upsInputTruePower */ - -#define IETF_OID_POWER_STATUS "1.3.6.1.2.1.33.1.4.1.0" /* UPS-MIB::upsOutputSource.0 */ -#define IETF_OID_OUT_FREQUENCY "1.3.6.1.2.1.33.1.4.2.0" /* UPS-MIB::upsOutputFrequency.0 */ -#define IETF_OID_OUT_LINES "1.3.6.1.2.1.33.1.4.3.0" /* UPS-MIB::upsOutputNumLines.0 */ - -#define IETF_OID_OUT_VOLTAGE "1.3.6.1.2.1.33.1.4.4.1.2" /* UPS-MIB::upsOutputVoltage */ -#define IETF_OID_OUT_CURRENT "1.3.6.1.2.1.33.1.4.4.1.3" /* UPS-MIB::upsOutputCurrent */ -#define IETF_OID_OUT_POWER "1.3.6.1.2.1.33.1.4.4.1.4" /* UPS-MIB::upsOutputPower */ -#define IETF_OID_LOAD_LEVEL "1.3.6.1.2.1.33.1.4.4.1.5" /* UPS-MIB::upsOutputPercentLoad */ - -#define IETF_OID_UPS_TEST_ID "1.3.6.1.2.1.33.1.7.1" /* UPS-MIB::upsTestID */ -#define IETF_OID_UPS_TEST_RES "1.3.6.1.2.1.33.1.7.3" /* UPS-MIB::upsTestResultsSummary */ -#define IETF_OID_UPS_TEST_RESDET "1.3.6.1.2.1.33.1.7.4" /* UPS-MIB::upsTestResultsDetail */ -#define IETF_OID_UPS_TEST_NOTEST "1.3.6.1.2.1.33.1.7.7.1" /* UPS-MIB::upsTestNoTestInitiated */ -#define IETF_OID_UPS_TEST_ABORT "1.3.6.1.2.1.33.1.7.7.2" /* UPS-MIB::upsTestAbortTestInProgress */ -#define IETF_OID_UPS_TEST_GSTEST "1.3.6.1.2.1.33.1.7.7.3" /* UPS-MIB::upsTestGeneralSystemsTest */ -#define IETF_OID_UPS_TEST_QBATT "1.3.6.1.2.1.33.1.7.7.4" /* UPS-MIB::upsTestQuickBatteryTest */ -#define IETF_OID_UPS_TEST_DBATT "1.3.6.1.2.1.33.1.7.7.5" /* UPS-MIB::upsTestDeepBatteryCalibration */ - -#define IETF_OID_CONF_VOLTAGE "1.3.6.1.2.1.33.1.9.3.0" /* UPS-MIB::upsConfigOutputVoltage.0 */ -#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 */ - -/* Defines for IETF_OID_POWER_STATUS (1) */ -static info_lkp_t ietf_pwr_info[] = { - { 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" } -} ; - -/* Defines for IETF_OID_BATT_STATUS (2) */ -static info_lkp_t ietf_batt_info[] = { +static info_lkp_t ietf_battery_info[] = { { 1, "" /* unknown */ }, { 2, "" /* batteryNormal */}, { 3, "LB" /* batteryLow */ }, { 4, "LB" /* batteryDepleted */ }, - { 5, "" /* unknown */ }, - { 6, "RB" /* batteryError */}, { 0, "NULL" } -} ; +}; -/* Defines for IETF_OID_TEST_RES */ -static info_lkp_t ietf_test_res_info[] = { - { 1, "Done and passed" }, - { 2, "Done and warning" }, - { 3, "Done and error" }, - { 4, "Aborted" }, - { 5, "In progress" }, - { 6, "No test initiated" }, +static info_lkp_t ietf_power_source_info[] = { + { 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" } -} ; +}; -#define IETF_OID_SD_AFTER_DELAY "1.3.6.1.2.1.33.1.8.2" /* UPS-MIB::upsShutdownAfterDelay */ -#define IETF_OFF_DO 0 - -#define IETF_OID_ALARM_OB "1.3.6.1.2.1.33.1.6.3.2" /* UPS-MIB::upsAlarmOnBattery */ -#define IETF_OID_ALARM_LB "1.3.6.1.2.1.33.1.6.3.3" /* UPS-MIB::upsAlarmLowBattery */ - -static info_lkp_t ietf_alarm_ob[] = { - { 1, "OB" }, +static info_lkp_t ietf_overload_info[] = { + { 1, "OVER" }, /* output overload */ { 0, "NULL" } -} ; +}; -static info_lkp_t ietf_alarm_lb[] = { - { 1, "LB" }, +static info_lkp_t ietf_test_active_info[] = { + { 1, "" }, /* upsTestNoTestsInitiated */ + { 2, "" }, /* upsTestAbortTestInProgress */ + { 3, "TEST" }, /* upsTestGeneralSystemsTest */ + { 4, "TEST" }, /* upsTestQuickBatteryTest */ + { 5, "CAL" }, /* upsTestDeepBatteryCalibration */ { 0, "NULL" } -} ; +}; -/* Missing data - CAL - UPS is performing calibration - OVER - UPS is overloaded - FSD - UPS is in forced shutdown state (slaves take note) -*/ +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" } +}; -/* Snmp2NUT lookup table */ +#ifdef DEBUG +static info_lkp_t ietf_shutdown_type_info[] = { + { 1, "output" }, + { 2, "system" }, + { 0, "NULL" } +}; +#endif +static info_lkp_t ietf_yes_no_info[] = { + { 1, "yes" }, + { 2, "no" }, + { 0, "NULL" } +}; + +static info_lkp_t ietf_beeper_status_info[] = { + { 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[] = { - /* UPS page */ - /* info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar */ - { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_MFR_NAME, "Generic", - SU_FLAG_STATIC, NULL }, - { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_MODEL_NAME, "Generic SNMP UPS", - SU_FLAG_STATIC, NULL }, - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_FIRMREV, "", - SU_FLAG_STATIC, NULL }, - { "ups.firmware.aux", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_AGENTREV, "", - SU_FLAG_STATIC, NULL }, - { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_IDENT, "", - SU_FLAG_STATIC, NULL }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_POWER_STATUS, "OFF", - SU_STATUS_PWR, &ietf_pwr_info[0] }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_BATT_STATUS, "", - SU_STATUS_BATT, &ietf_alarm_ob[0] }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_BATT_STATUS, "", - SU_STATUS_BATT, &ietf_alarm_lb[0] }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_BATT_STATUS, "", - SU_STATUS_BATT, &ietf_batt_info[0] }, - { "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_TEST_RESDET, "", - 0, NULL }, - { "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_TEST_RES, "", - 0, ietf_test_res_info }, + /* 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 */ + { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "1.3.0", "", SU_FLAG_STATIC, NULL }, /* upsIdentUPSSoftwareVersion */ + { "ups.firmware.aux", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "1.4.0", "", SU_FLAG_STATIC, NULL }, /* upsIdentAgentSoftwareVersion */ +#ifdef DEBUG + { "debug.upsIdentName", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "1.5.0", "", 0, NULL }, /* upsIdentName */ + { "debug.upsIdentAttachedDevices", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "1.6.0", "", 0, NULL }, /* upsIdentAttachedDevices */ +#endif + /* Battery Group */ + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "2.1.0", "", SU_STATUS_BATT, ietf_battery_info }, /* upsBatteryStatus */ +#ifdef DEBUG + { "debug.upsSecondsOnBattery", 0, 1.0, IETF_OID_UPS_MIB "2.2.0", "", 0, NULL }, /* upsSecondsOnBattery */ +#endif + { "battery.runtime", 0, 60.0, IETF_OID_UPS_MIB "2.3.0", "", 0, NULL }, /* upsEstimatedMinutesRemaining */ + { "battery.charge", 0, 1, IETF_OID_UPS_MIB "2.4.0", "", 0, NULL }, /* upsEstimatedChargeRemaining */ + { "battery.voltage", 0, 0.1, IETF_OID_UPS_MIB "2.5.0", "", 0, NULL }, /* upsBatteryVoltage */ + { "battery.current", 0, 0.1, IETF_OID_UPS_MIB "2.6.0", "", 0, NULL }, /* upsBatteryCurrent */ + { "battery.temperature", 0, 1.0, IETF_OID_UPS_MIB "2.7.0", "", 0, NULL }, /* upsBatteryTemperature */ - /* Battery page */ - { "battery.charge", 0, 1.0, IETF_OID_BATT_CHARGE, "", - 0, NULL }, - { "battery.runtime", 0, 60.0, IETF_OID_BATT_RUNTIME, "", - 0, NULL }, - { "battery.runtime.low", ST_FLAG_RW, 1, IETF_OID_CONF_RUNTIME_LOW, "", - 0, NULL }, - { "battery.voltage", 0, 0.1, IETF_OID_BATT_VOLTAGE, "", - 0, NULL }, - { "battery.current", 0, 0.1, IETF_OID_BATT_CURRENT, "", - 0, NULL }, - { "battery.temperature", 0, 1.0, IETF_OID_BATT_TEMP, "", - 0, NULL }, + /* Input Group */ +#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", "", 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 }, + { "debug.[2].upsInputLineIndex", 0, 1.0, IETF_OID_UPS_MIB "3.3.1.1.2", "", SU_INPUT_3, NULL }, + { "debug.[3].upsInputLineIndex", 0, 1.0, IETF_OID_UPS_MIB "3.3.1.1.3", "", SU_INPUT_3, NULL }, +#endif + { "input.frequency", 0, 0.1, IETF_OID_UPS_MIB "3.3.1.2.1", "", SU_INPUT_1, NULL }, /* upsInputFrequency */ + { "input.L1.frequency", 0, 0.1, IETF_OID_UPS_MIB "3.3.1.2.1", "", SU_INPUT_3, NULL }, + { "input.L2.frequency", 0, 0.1, IETF_OID_UPS_MIB "3.3.1.2.2", "", SU_INPUT_3, NULL }, + { "input.L3.frequency", 0, 0.1, IETF_OID_UPS_MIB "3.3.1.2.3", "", SU_INPUT_3, NULL }, + { "input.voltage", 0, 1.0, IETF_OID_UPS_MIB "3.3.1.3.1", "", SU_INPUT_1, NULL }, /* upsInputVoltage */ + { "input.L1-N.voltage", 0, 1.0, IETF_OID_UPS_MIB "3.3.1.3.1", "", SU_INPUT_3, NULL }, + { "input.L2-N.voltage", 0, 1.0, IETF_OID_UPS_MIB "3.3.1.3.2", "", SU_INPUT_3, NULL }, + { "input.L3-N.voltage", 0, 1.0, IETF_OID_UPS_MIB "3.3.1.3.3", "", SU_INPUT_3, NULL }, + { "input.current", 0, 0.1, IETF_OID_UPS_MIB "3.3.1.4.1", "", SU_INPUT_1, NULL }, /* upsInputCurrent */ + { "input.L1.current", 0, 0.1, IETF_OID_UPS_MIB "3.3.1.4.1", "", SU_INPUT_3, NULL }, + { "input.L2.current", 0, 0.1, IETF_OID_UPS_MIB "3.3.1.4.2", "", SU_INPUT_3, NULL }, + { "input.L3.current", 0, 0.1, IETF_OID_UPS_MIB "3.3.1.4.3", "", SU_INPUT_3, NULL }, + { "input.realpower", 0, 1.0, IETF_OID_UPS_MIB "3.3.1.5.1", "", SU_INPUT_1, NULL }, /* upsInputTruePower */ + { "input.L1.realpower", 0, 1.0, IETF_OID_UPS_MIB "3.3.1.5.1", "", SU_INPUT_3, NULL }, + { "input.L2.realpower", 0, 1.0, IETF_OID_UPS_MIB "3.3.1.5.2", "", SU_INPUT_3, NULL }, + { "input.L3.realpower", 0, 1.0, IETF_OID_UPS_MIB "3.3.1.5.3", "", SU_INPUT_3, NULL }, - /* Output page */ - { "output.phases", 0, 1.0, IETF_OID_OUT_LINES, "", - SU_FLAG_SETINT, NULL, &output_phases }, - { "output.frequency", 0, 0.1, IETF_OID_OUT_FREQUENCY, "", - 0, NULL }, - { "output.voltage", 0, 1.0, IETF_OID_OUT_VOLTAGE ".1", "", - SU_OUTPUT_1, NULL }, - { "output.L1-N.voltage", 0, 1.0, IETF_OID_OUT_VOLTAGE ".1", "", - SU_OUTPUT_3, NULL }, - { "output.L2-N.voltage", 0, 1.0, IETF_OID_OUT_VOLTAGE ".2", "", - SU_OUTPUT_3, NULL }, - { "output.L3-N.voltage", 0, 1.0, IETF_OID_OUT_VOLTAGE ".3", "", - SU_OUTPUT_3, NULL }, - { "output.current", 0, 0.1, IETF_OID_OUT_CURRENT ".1", "", - SU_OUTPUT_1, NULL }, - { "output.L1.current", 0, 0.1, IETF_OID_OUT_CURRENT ".1", "", - SU_OUTPUT_3, NULL }, - { "output.L2.current", 0, 0.1, IETF_OID_OUT_CURRENT ".2", "", - SU_OUTPUT_3, NULL }, - { "output.L3.current", 0, 0.1, IETF_OID_OUT_CURRENT ".3", "", - SU_OUTPUT_3, NULL }, - { "output.power", 0, 1.0, IETF_OID_OUT_POWER ".1", "", - SU_OUTPUT_1, NULL }, - { "output.L1.power", 0, 1.0, IETF_OID_OUT_POWER ".1", "", - SU_OUTPUT_3, NULL }, - { "output.L2.power", 0, 1.0, IETF_OID_OUT_POWER ".2", "", - SU_OUTPUT_3, NULL }, - { "output.L3.power", 0, 1.0, IETF_OID_OUT_POWER ".3", "", - SU_OUTPUT_3, NULL }, - { "ups.load", 0, 1.0, IETF_OID_LOAD_LEVEL ".1", "", - SU_OUTPUT_1, NULL }, - { "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", "", - SU_OUTPUT_3, NULL }, - { "output.L3.power.percent", 0, 1.0, IETF_OID_LOAD_LEVEL ".3", "", - SU_OUTPUT_3, NULL }, + /* 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", "", 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 }, + { "debug.[2].upsOutputLineIndex", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.1.2", "", SU_OUTPUT_3, NULL }, + { "debug.[3].upsOutputLineIndex", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.1.3", "", SU_OUTPUT_3, NULL }, +#endif + { "output.voltage", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.2.1", "", SU_OUTPUT_1, NULL }, /* upsOutputVoltage */ + { "output.L1-N.voltage", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.2.1", "", SU_OUTPUT_3, NULL }, + { "output.L2-N.voltage", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.2.2", "", SU_OUTPUT_3, NULL }, + { "output.L3-N.voltage", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.2.3", "", SU_OUTPUT_3, NULL }, + { "output.current", 0, 0.1, IETF_OID_UPS_MIB "4.4.1.3.1", "", SU_OUTPUT_1, NULL }, /* upsOutputCurrent */ + { "output.L1.current", 0, 0.1, IETF_OID_UPS_MIB "4.4.1.3.1", "", SU_OUTPUT_3, NULL }, + { "output.L2.current", 0, 0.1, IETF_OID_UPS_MIB "4.4.1.3.2", "", SU_OUTPUT_3, NULL }, + { "output.L3.current", 0, 0.1, IETF_OID_UPS_MIB "4.4.1.3.3", "", SU_OUTPUT_3, NULL }, + { "output.realpower", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.4.1", "", SU_OUTPUT_1, NULL }, /* upsOutputPower */ + { "output.L1.realpower", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.4.1", "", SU_OUTPUT_3, NULL }, + { "output.L2.realpower", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.4.2", "", SU_OUTPUT_3, NULL }, + { "output.L3.realpower", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.4.3", "", SU_OUTPUT_3, NULL }, + { "ups.load", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.5.1", "", SU_OUTPUT_1, NULL }, /* upsOutputPercentLoad */ + { "output.L1.power.percent", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.5.1", "", SU_OUTPUT_3, NULL }, + { "output.L2.power.percent", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.5.2", "", SU_OUTPUT_3, NULL }, + { "output.L3.power.percent", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.5.3", "", SU_OUTPUT_3, NULL }, - /* Input page */ - { "input.phases", 0, 1.0, IETF_OID_IN_LINES, "", - SU_FLAG_SETINT, NULL, &input_phases }, - { "input.frequency", 0, 0.1, IETF_OID_IN_FREQ ".1", "", - SU_INPUT_1, NULL }, - { "input.voltage", 0, 1.0, IETF_OID_IN_VOLTAGE ".1", "", - SU_INPUT_1, NULL }, - { "input.L1-N.voltage", 0, 1.0, IETF_OID_IN_VOLTAGE ".1", "", - SU_INPUT_3, NULL }, - { "input.L2-N.voltage", 0, 1.0, IETF_OID_IN_VOLTAGE ".2", "", - SU_INPUT_3, NULL }, - { "input.L3-N.voltage", 0, 1.0, IETF_OID_IN_VOLTAGE ".3", "", - SU_INPUT_3, NULL }, - { "input.current", 0, 0.1, IETF_OID_IN_CURRENT ".1", "", - SU_INPUT_1, NULL }, - { "input.L1.current", 0, 0.1, IETF_OID_IN_CURRENT ".1", "", - SU_INPUT_3, NULL }, - { "input.L2.current", 0, 0.1, IETF_OID_IN_CURRENT ".2", "", - SU_INPUT_3, NULL }, - { "input.L3.current", 0, 0.1, IETF_OID_IN_CURRENT ".3", "", - SU_INPUT_3, NULL }, - { "input.realpower", 0, 0.1, IETF_OID_IN_POWER ".1", "", - SU_INPUT_1, NULL }, - { "input.L1.realpower", 0, 0.1, IETF_OID_IN_POWER ".1", "", - SU_INPUT_3, NULL }, - { "input.L2.realpower", 0, 0.1, IETF_OID_IN_POWER ".2", "", - SU_INPUT_3, NULL }, - { "input.L3.realpower", 0, 0.1, IETF_OID_IN_POWER ".3", "", - SU_INPUT_3, NULL }, - { "input.quality", 0, 1.0, IETF_OID_IN_LINEBADS, "", - 0, NULL }, + /* Bypass Group */ + { "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 */ + { "debug.[1].upsBypassLineIndex", 0, 1.0, IETF_OID_UPS_MIB "5.3.1.1.1", "", SU_BYPASS_3, NULL }, + { "debug.[2].upsBypassLineIndex", 0, 1.0, IETF_OID_UPS_MIB "5.3.1.1.2", "", SU_BYPASS_3, NULL }, + { "debug.[3].upsBypassLineIndex", 0, 1.0, IETF_OID_UPS_MIB "5.3.1.1.3", "", SU_BYPASS_3, NULL }, +#endif + { "input.bypass.voltage", 0, 1.0, IETF_OID_UPS_MIB "5.3.1.3.1", "", SU_BYPASS_1, NULL }, /* upsBypassVoltage */ + { "input.bypass.L1-N.voltage", 0, 1.0, IETF_OID_UPS_MIB "5.3.1.3.1", "", SU_BYPASS_3, NULL }, + { "input.bypass.L2-N.voltage", 0, 1.0, IETF_OID_UPS_MIB "5.3.1.3.2", "", SU_BYPASS_3, NULL }, + { "input.bypass.L3-N.voltage", 0, 1.0, IETF_OID_UPS_MIB "5.3.1.3.3", "", SU_BYPASS_3, NULL }, + { "input.bypass.current", 0, 0.1, IETF_OID_UPS_MIB "5.3.1.4.1", "", SU_BYPASS_1, NULL }, /* upsBypassCurrent */ + { "input.bypass.L1.current", 0, 0.1, IETF_OID_UPS_MIB "5.3.1.4.1", "", SU_BYPASS_3, NULL }, + { "input.bypass.L2.current", 0, 0.1, IETF_OID_UPS_MIB "5.3.1.4.2", "", SU_BYPASS_3, NULL }, + { "input.bypass.L3.current", 0, 0.1, IETF_OID_UPS_MIB "5.3.1.4.3", "", SU_BYPASS_3, NULL }, + { "input.bypass.realpower", 0, 1.0, IETF_OID_UPS_MIB "5.3.1.5.1", "", SU_BYPASS_1, NULL }, /* upsBypassPower */ + { "input.bypass.L1.realpower", 0, 1.0, IETF_OID_UPS_MIB "5.3.1.5.1", "", SU_BYPASS_3, NULL }, + { "input.bypass.L2.realpower", 0, 1.0, IETF_OID_UPS_MIB "5.3.1.5.2", "", SU_BYPASS_3, NULL }, + { "input.bypass.L3.realpower", 0, 1.0, IETF_OID_UPS_MIB "5.3.1.5.3", "", SU_BYPASS_3, NULL }, - /* instant commands. */ - { "load.off", 0, IETF_OFF_DO, IETF_OID_SD_AFTER_DELAY, "", - SU_TYPE_CMD, NULL }, - /* write the OID of the battery test into the test initiator OID */ - { "test.battery.start.quick", 0, SU_INFOSIZE, IETF_OID_UPS_TEST_ID, IETF_OID_UPS_TEST_QBATT, - SU_TYPE_CMD, NULL }, - /* write the OID of the battery test into the test initiator OID */ - { "test.battery.start.deep", 0, SU_INFOSIZE, IETF_OID_UPS_TEST_ID, IETF_OID_UPS_TEST_DBATT, - SU_TYPE_CMD, NULL }, -/* { CMD_SHUTDOWN, 0, IETF_OFF_GRACEFUL, IETF_OID_OFF, "", 0, NULL }, */ + /* Alarm Group */ +#ifdef DEBUG + { "debug.upsAlarmsPresent", 0, 1.0, IETF_OID_UPS_MIB "6.1.0", "", 0, NULL }, /* upsAlarmsPresent */ + { "debug.upsAlarmBatteryBad", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.1", "", 0, NULL }, /* upsAlarmBatteryBad */ + { "debug.upsAlarmOnBattery", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.2", "", 0, NULL }, /* upsAlarmOnBattery */ + { "debug.upsAlarmLowBattery", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.3", "", 0, NULL }, /* upsAlarmLowBattery */ + { "debug.upsAlarmDepletedBattery", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.4", "", 0, NULL }, /* upsAlarmDepletedBattery */ + { "debug.upsAlarmTempBad", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.5", "", 0, NULL }, /* upsAlarmTempBad */ + { "debug.upsAlarmInputBad", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.6", "", 0, NULL }, /* upsAlarmInputBad */ + { "debug.upsAlarmOutputBad", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.7", "", 0, NULL }, /* upsAlarmOutputBad */ +#endif + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.8", "", 0, ietf_overload_info }, /* upsAlarmOutputOverload */ +#ifdef DEBUG + { "debug.upsAlarmOnBypass", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.9", "", 0, NULL }, /* upsAlarmOnBypass */ + { "debug.upsAlarmBypassBad", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.10", "", 0, NULL }, /* upsAlarmBypassBad */ + { "debug.upsAlarmOutputOffAsRequested", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.11", "", 0, NULL }, /* upsAlarmOutputOffAsRequested */ + { "debug.upsAlarmUpsOffAsRequested", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.12", "", 0, NULL }, /* upsAlarmUpsOffAsRequested */ + { "debug.upsAlarmChargerFailed", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.13", "", 0, NULL }, /* upsAlarmChargerFailed */ + { "debug.upsAlarmUpsOutputOff", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.14", "", 0, NULL }, /* upsAlarmUpsOutputOff */ + { "debug.upsAlarmUpsSystemOff", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.15", "", 0, NULL }, /* upsAlarmUpsSystemOff */ + { "debug.upsAlarmFanFailure", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.16", "", 0, NULL }, /* upsAlarmFanFailure */ + { "debug.upsAlarmFuseFailure", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.17", "", 0, NULL }, /* upsAlarmFuseFailure */ + { "debug.upsAlarmGeneralFault", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.18", "", 0, NULL }, /* upsAlarmGeneralFault */ + { "debug.upsAlarmDiagnosticTestFailed", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.19", "", 0, NULL }, /* upsAlarmDiagnosticTestFailed */ + { "debug.upsAlarmCommunicationsLost", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.20", "", 0, NULL }, /* upsAlarmCommunicationsLost */ + { "debug.upsAlarmAwaitingPower", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.21", "", 0, NULL }, /* upsAlarmAwaitingPower */ + { "debug.upsAlarmShutdownPending", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.22", "", 0, NULL }, /* upsAlarmShutdownPending */ + { "debug.upsAlarmShutdownImminent", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.23", "", 0, NULL }, /* upsAlarmShutdownImminent */ + { "debug.upsAlarmTestInProgress", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "6.3.24", "", 0, NULL }, /* upsAlarmTestInProgress */ +#endif + + /* 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, 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 + { "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "7.3.0", "", 0, ietf_test_result_info }, /* upsTestResultsSummary */ +#ifdef DEBUG + { "debug.upsTestResultsDetail", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "7.4.0", "", 0, NULL }, /* upsTestResultsDetail */ + { "debug.upsTestStartTime", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "7.5.0", "", 0, NULL }, /* upsTestStartTime */ + { "debug.upsTestElapsedTime", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "7.6.0", "", 0, NULL }, /* upsTestElapsedTime */ +#endif + + /* Control Group */ +#ifdef DEBUG + { "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, 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, 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 */ + + /* Configuration Group */ + { "input.voltage.nominal", 0, 1.0, IETF_OID_UPS_MIB "9.1.0", "", 0, NULL }, /* upsConfigInputVoltage */ + { "input.frequency.nominal", 0, 0.1, IETF_OID_UPS_MIB "9.2.0", "", 0, NULL }, /* upsConfigInputFreq */ + { "output.voltage.nominal", 0, 1.0, IETF_OID_UPS_MIB "9.3.0", "", 0, NULL }, /* upsConfigOutputVoltage */ + { "output.frequency.nominal", 0, 0.1, IETF_OID_UPS_MIB "9.4.0", "", 0, NULL }, /* upsConfigOutputFreq */ + { "output.power.nominal", 0, 1.0, IETF_OID_UPS_MIB "9.5.0", "", 0, NULL }, /* upsConfigOutputVA */ + { "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 */ + { "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", "", 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 */ /* end of structure. */ { NULL, 0, 0, NULL, NULL, 0, NULL } }; -mib2nut_info_t ietf = { "ietf", IETF_MIB_VERSION, IETF_OID_POWER_STATUS, IETF_OID_MFR_NAME, ietf_mib }; +mib2nut_info_t ietf = { "ietf", IETF_MIB_VERSION, IETF_OID_UPS_MIB "4.1.0", IETF_OID_UPS_MIB "1.1.0", ietf_mib }; diff --git a/drivers/ivtscd.c b/drivers/ivtscd.c index 57a52a7..d8ae507 100644 --- a/drivers/ivtscd.c +++ b/drivers/ivtscd.c @@ -49,7 +49,7 @@ static struct { float temperature; } battery; -static int ivt_status() +static int ivt_status(void) { char reply[SMALLBUF]; int ret, i, j = 0; diff --git a/drivers/libhid.c b/drivers/libhid.c index 9387657..78b1236 100644 --- a/drivers/libhid.c +++ b/drivers/libhid.c @@ -155,7 +155,7 @@ static int refresh_report_buffer(reportbuf_t *rbuf, hid_dev_handle_t udev, HIDDa } /* broken report descriptors are common, so store whatever we can */ - memcpy(rbuf->data[id], buf, rbuf->len[id]); + memcpy(rbuf->data[id], buf, (r < rbuf->len[id]) ? r : rbuf->len[id]); if (rbuf->len[id] != r) { upsdebugx(2, "%s: expected %d bytes, but got %d instead", __func__, rbuf->len[id], r); @@ -221,7 +221,7 @@ static int file_report_buffer(reportbuf_t *rbuf, unsigned char *buf, int buflen) int id = buf[0]; /* broken report descriptors are common, so store whatever we can */ - memcpy(rbuf->data[id], buf, rbuf->len[id]); + memcpy(rbuf->data[id], buf, (buflen < rbuf->len[id]) ? buflen : rbuf->len[id]); if (rbuf->len[id] != buflen) { upsdebugx(2, "%s: expected %d bytes, but got %d instead", __func__, rbuf->len[id], buflen); @@ -299,7 +299,7 @@ void HIDDumpTree(hid_dev_handle_t udev, usage_tables_t *utab) /* Get data value */ if (HIDGetDataValue(udev, pData, &value, MAX_TS) == 1) { - upsdebugx(1, "Path: %s, Type: %s, ReportID: 0x%02x, Offset: %i, Size: %i, Value: %f", + upsdebugx(1, "Path: %s, Type: %s, ReportID: 0x%02x, Offset: %i, Size: %i, Value: %g", HIDGetDataItem(pData, utab), HIDDataType(pData), pData->ReportID, pData->Offset, pData->Size, value); continue; } diff --git a/drivers/libshut.c b/drivers/libshut.c index 5ff86e7..78074e6 100644 --- a/drivers/libshut.c +++ b/drivers/libshut.c @@ -192,7 +192,7 @@ int libshut_get_interrupt(int upsfd, unsigned char *buf, void libshut_close(int upsfd); /* FIXME */ -char * shut_strerror() { return ""; } +const char * shut_strerror(void) { return ""; } /*! * From SHUT specifications diff --git a/drivers/libshut.h b/drivers/libshut.h index ff11995..48f48bb 100644 --- a/drivers/libshut.h +++ b/drivers/libshut.h @@ -54,8 +54,8 @@ typedef struct SHUTDevice_s { * shut_communication_subdriver_s: structure to describe the communication routines */ typedef struct shut_communication_subdriver_s { - char *name; /* name of this subdriver */ - char *version; /* version of this subdriver */ + const char *name; /* name of this subdriver */ + 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, diff --git a/drivers/libusb.h b/drivers/libusb.h index 946ccba..66d2633 100644 --- a/drivers/libusb.h +++ b/drivers/libusb.h @@ -43,8 +43,8 @@ extern upsdrv_info_t comm_upsdrv_info; * @name: can be either "shut" for Serial HID UPS Transfer (from MGE) or "usb" */ typedef struct usb_communication_subdriver_s { - char *name; /* name of this subdriver */ - char *version; /* version of this subdriver */ + 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, diff --git a/drivers/liebertgxt2.c b/drivers/liebert-esp2.c similarity index 73% rename from drivers/liebertgxt2.c rename to drivers/liebert-esp2.c index 53105df..06d486a 100644 --- a/drivers/liebertgxt2.c +++ b/drivers/liebert-esp2.c @@ -1,4 +1,4 @@ -/* liebertgxt2.c - driver for Liebert GXT2, using the ESP2 protocol +/* liebert-esp2.c - driver for Liebert UPS, using the ESP-II protocol * * Copyright (C) * 2009 Richard Gregory @@ -21,9 +21,10 @@ #include "main.h" #include "serial.h" #include "timehead.h" +#include "nut_stdint.h" -#define DRIVER_NAME "Liebert GXT2 serial UPS driver" -#define DRIVER_VERSION "0.01" +#define DRIVER_NAME "Liebert ESP-II serial UPS driver" +#define DRIVER_VERSION "0.02" static int instcmd(const char *cmdname, const char *extra); static int setvar(const char *varname, const char *val); @@ -40,7 +41,7 @@ upsdrv_info_t upsdrv_info = { static const unsigned char /* Bit field information provided by Spiros Ioannou */ /* Ordered on MSB to LSB. Shown as DESCRIPTION (bit number), starting at 0. */ - cmd_bitfield1[] = { 1,148,2,1,1,153 }, /* INPUT_OVERVOLTAGE, BATTERY_TEST_STATE, OVERTEMP_WARNING, INRUSH_LIMIT_ON, UTILITY_STATE, ON_INVERTER, DC_DC_CONVERTER_STATE, PFC_ON */ + cmd_bitfield1[] = { 1,148,2,1,1,153 }, /* ON_BATTERY(8), INPUT_OVERVOLTAGE(7), BATTERY_TEST_STATE(6), OVERTEMP_WARNING(5), INRUSH_LIMIT_ON(4), UTILITY_STATE(3), ON_INVERTER(2), DC_DC_CONVERTER_STATE(1), PFC_ON(0) */ cmd_bitfield2[] = { 1,148,2,1,2,154 }, /* BUCK_ON (9), DIAG_LINK_SET(7), BOOST_ON(6), REPLACE_BATTERY(5), BATTERY_LIFE_ENHANCER_ON(4), BATTERY_CHARGED (1), ON_BYPASS (0) */ cmd_bitfield3[] = { 1,148,2,1,3,155 }, /* CHECK_AIR_FILTER (10), BAD_BYPASS_PWR (8), OUTPUT_OVERVOLTAGE (7), OUTPUT_UNDERVOLTAGE (6), LOW_BATTERY (5), CHARGER_FAIL (3), SHUTDOWN_PENDING (2), BAD_INPUT_FREQ (1), UPS_OVERLOAD (0) */ cmd_bitfield7[] = { 1,148,2,1,7,159 }, /* AMBIENT_OVERTEMP (2) */ @@ -94,16 +95,17 @@ void upsdrv_initinfo(void) { struct { const char *var; + const int len; } vartab[] = { - { "ups.model" }, - { "ups.serial" }, - { "ups.mfr.date" }, - { "ups.firmware" }, + { "ups.model", 15 }, + { "ups.firmware", 8 }, + { "ups.serial", 10 }, + { "ups.mfr.date", 4 }, { NULL } }; - char buf[LARGEBUF], *s; - int i; + char buf[LARGEBUF]; + int i, index; dstate_setinfo("ups.mfr", "%s", "Liebert"); @@ -115,22 +117,31 @@ void upsdrv_initinfo(void) command[5] = cksum(command, 5); ret = do_command((unsigned char *)command, reply); - if (ret < 8) { - fatalx(EXIT_FAILURE, "GTX2 capable UPS not detected"); + if (ret == 8) { + buf[i<<1] = reply[6]; + buf[(i<<1)+1] = reply[5]; + } else { + buf[i<<1] = '\0'; + buf[(i<<1)+1] = '\0'; } - - buf[i<<1] = reply[6]; - buf[(i<<1)+1] = reply[5]; } buf[i<<1] = 0; - for (s = strtok(buf, " "), i = 0; s && vartab[i].var; s = strtok(NULL, " "), i++) { - dstate_setinfo(vartab[i].var, "%s", s); + if (strlen(buf) == 0) { + fatalx(EXIT_FAILURE, "ESP-II capable UPS not detected"); + } + + for (index = 0, i = 0; vartab[i].var; index += vartab[i].len, i++) { + char val[SMALLBUF]; + + snprintf(val, sizeof(val), "%.*s", vartab[i].len, &buf[index]); + + dstate_setinfo(vartab[i].var, "%s", rtrim(val, ' ')); } upsh.instcmd = instcmd; - upsh.setvar = setvar; + upsh.setvar = setvar; } void upsdrv_updateinfo(void) @@ -144,6 +155,8 @@ void upsdrv_updateinfo(void) { { 1,149,2,1,4,157 }, "battery.charge", "%.0f", 1.0 }, { { 1,149,2,1,1,154 }, "battery.runtime", "%.0f", 60 }, { { 1,149,2,1,2,155 }, "battery.voltage", "%.1f", 0.1 }, + { { 1,149,2,1,3,156 }, "battery.current", "%.2f", 0.01 }, + { { 1,149,2,1,12,165 }, "battery.temperature", "%.1f", 0.1 }, { { 1,161,2,1,13,178 }, "battery.voltage.nominal", "%.1f", 0.1 }, { { 1,149,2,1,7,160 }, "ups.load", "%.0f", 1.0 }, { { 1,149,2,1,6,159 }, "ups.power", "%.0f", 1.0 }, @@ -160,20 +173,21 @@ void upsdrv_updateinfo(void) { { 0 }, NULL, NULL, 0 } }; + const char *val; char reply[8]; int ret, i; for (i = 0; vartab[i].var; i++) { - int val; + int16_t val; ret = do_command(vartab[i].cmd, reply); if (ret < 8) { continue; } - val = (unsigned char)reply[6]; + val = (unsigned char)reply[5]; val <<= 8; - val += (unsigned char)reply[5]; + val += (unsigned char)reply[6]; dstate_setinfo(vartab[i].var, vartab[i].fmt, val * vartab[i].mult); } @@ -187,12 +201,22 @@ void upsdrv_updateinfo(void) return; } - if (reply[6] & (1<<0)) { /* ON_BATTERY */ + if (reply[5] & (1<<0)) { /* ON_BATTERY */ status_set("OB"); } else { status_set("OL"); } + val = dstate_getinfo("battery.current"); + if (val) { + if (atof(val) > 0.05) { + status_set("CHRG"); + } + if (atof(val) < -0.05) { + status_set("DISCHRG"); + } + } + ret = do_command(cmd_bitfield2, reply); if (ret < 8) { upslogx(LOG_ERR, "Failed reading bitfield #2"); @@ -200,23 +224,19 @@ void upsdrv_updateinfo(void) return; } - if (reply[5] & (1<<0)) { /* ON_BYPASS */ + if (reply[6] & (1<<0)) { /* ON_BYPASS */ status_set("BYPASS"); } - if (reply[5] & (1<<5)) { /* REPLACE_BATTERY */ + if (reply[6] & (1<<5)) { /* REPLACE_BATTERY */ status_set("RB"); } - if (!(reply[5] & (1<<1))) { /* not BATTERY_CHARGED */ - status_set("CHRG"); - } - - if (reply[5] & (1<<6)) { /* BOOST_ON */ + if (reply[6] & (1<<6)) { /* BOOST_ON */ status_set("BOOST"); } - if (reply[6] & (1<<1)) { /* BUCK_ON */ + if (reply[5] & (1<<1)) { /* BUCK_ON */ status_set("TRIM"); } @@ -227,11 +247,11 @@ void upsdrv_updateinfo(void) return; } - if (reply[5] & (1<<0) ) { /* UPS_OVERLOAD */ + if (reply[6] & (1<<0) ) { /* UPS_OVERLOAD */ status_set("OVER"); } - if (reply[5] & (1<<5) ) { /* LOW_BATTERY */ + if (reply[6] & (1<<5) ) { /* LOW_BATTERY */ status_set("LB"); } @@ -278,12 +298,39 @@ void upsdrv_help(void) /* list flags and values that you want to receive via -x */ void upsdrv_makevartable(void) { + addvar (VAR_VALUE, "baudrate", "serial line speed"); } void upsdrv_initups(void) { + const char *val = getval("baudrate"); + speed_t baudrate = B2400; + + if (val) { + switch (atoi(val)) + { + case 1200: + baudrate = B1200; + break; + case 2400: + baudrate = B2400; + break; + case 4800: + baudrate = B4800; + break; + case 9600: + baudrate = B9600; + break; + case 19200: + baudrate = B19200; + break; + default: + fatalx(EXIT_FAILURE, "Baudrate [%s] unsupported", val); + } + } + upsfd = ser_open(device_path); - ser_set_speed(upsfd, device_path, B2400); + ser_set_speed(upsfd, device_path, baudrate); } void upsdrv_cleanup(void) diff --git a/drivers/liebert-hid.c b/drivers/liebert-hid.c index 06365f8..89ab03a 100644 --- a/drivers/liebert-hid.c +++ b/drivers/liebert-hid.c @@ -92,15 +92,15 @@ static hid_info_t liebert_hid2nut[] = { { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } }; -static char *liebert_format_model(HIDDevice_t *hd) { +static const char *liebert_format_model(HIDDevice_t *hd) { return hd->Product; } -static char *liebert_format_mfr(HIDDevice_t *hd) { +static const char *liebert_format_mfr(HIDDevice_t *hd) { return hd->Vendor ? hd->Vendor : "Liebert"; } -static char *liebert_format_serial(HIDDevice_t *hd) { +static const char *liebert_format_serial(HIDDevice_t *hd) { return hd->Serial; } diff --git a/drivers/main-hal.c b/drivers/main-hal.c index c02fdf0..8cd3275 100644 --- a/drivers/main-hal.c +++ b/drivers/main-hal.c @@ -330,7 +330,7 @@ int main(int argc, char **argv) } /* add a timer for data update */ -#ifdef HAVE_GLIB_2_14 +#ifdef HAVE_G_TIMEOUT_ADD_SECONDS g_timeout_add_seconds (poll_interval, #else g_timeout_add (1000 * poll_interval, /* seconds */ diff --git a/drivers/main-hal.h b/drivers/main-hal.h index 2342cf3..e612133 100644 --- a/drivers/main-hal.h +++ b/drivers/main-hal.h @@ -32,14 +32,14 @@ char *getval(const char *var); int testvar(const char *var); /* extended variable table - used for -x defines/flags */ -typedef struct { +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() */ - void *next; -} vartab_t; + struct vartab_s *next; +} vartab_t; /* flags to define types in the vartab */ diff --git a/drivers/main.c b/drivers/main.c index ae7c2f7..d14f990 100644 --- a/drivers/main.c +++ b/drivers/main.c @@ -92,6 +92,7 @@ static void help_msg(void) printf(" -V - print version, then exit\n"); printf(" -L - print parseable list of driver variables\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"); @@ -483,7 +484,7 @@ int main(int argc, char **argv) /* build the driver's extra (-x) variable table */ upsdrv_makevartable(); - while ((i = getopt(argc, argv, "+a:kDhx:Lr:u:Vi:")) != -1) { + while ((i = getopt(argc, argv, "+a:kDhx:Lqr:u:Vi:")) != -1) { switch (i) { case 'a': upsname = optarg; @@ -507,6 +508,9 @@ int main(int argc, char **argv) case 'L': listxarg(); exit(EXIT_SUCCESS); + case 'q': + nut_log_level++; + break; case 'r': chroot_path = xstrdup(optarg); break; diff --git a/drivers/main.h b/drivers/main.h index 67a97fe..3e3e84e 100644 --- a/drivers/main.h +++ b/drivers/main.h @@ -33,16 +33,14 @@ char *getval(const char *var); int testvar(const char *var); /* extended variable table - used for -x defines/flags */ -struct vartab_s { +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; -}; - -typedef struct vartab_s vartab_t; +} vartab_t; /* flags to define types in the vartab */ @@ -54,15 +52,13 @@ typedef struct vartab_s vartab_t; void addvar(int vartype, const char *name, const char *desc); /* subdriver description structure */ -struct upsdrv_info_s { +typedef struct upsdrv_info_s { 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 */ struct upsdrv_info_s *subdrv_info[2]; /* sub driver information */ -}; - -typedef struct upsdrv_info_s upsdrv_info_t; +} upsdrv_info_t; /* flags to define the driver development status */ #define DRV_BROKEN 0x0001 /* dito... */ diff --git a/drivers/megatec.c b/drivers/megatec.c deleted file mode 100644 index b9f0b3f..0000000 --- a/drivers/megatec.c +++ /dev/null @@ -1,1036 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: t; -*- - * - * megatec.c: support for Megatec protocol based UPSes - * - * Copyright (C) Carlos Rodrigues - * - * megatec.c created on 4/10/2003 - * - * 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 - */ - - -/* - * A document describing the protocol implemented by this driver can be - * found online at "http://www.networkupstools.org/protocols/megatec.html". - */ - - -#include "main.h" -#include "serial.h" -#include "megatec.h" - -#include -#include -#include -#include - -#define DRIVER_NAME "Megatec protocol driver" -#define DRIVER_VERSION "1.6" /* FIXME: doesn't conform to "X.YZ" */ - -/* driver description structure */ -upsdrv_info_t upsdrv_info = { - DRIVER_NAME, - DRIVER_VERSION, - "Carlos Rodrigues ", - DRV_STABLE, -#ifdef MEGATEC_SUBDRV - { &megatec_subdrv_info, NULL } -#else - { NULL } -#endif -}; - -#define ENDCHAR '\r' -#define IGNCHARS "" - -#define RECV_BUFFER_LEN 128 -#define FIELD_BUFFER_LEN 16 - -/* The expected reply lengths */ -#define F_CMD_REPLY_LEN 21 -#define Q1_CMD_REPLY_LEN 46 -#define I_CMD_REPLY_LEN 38 - -#define IDENT_MAXTRIES 3 - -#define READ_TIMEOUT 2 /* timeout on read (seconds) */ -#define READ_PACE 300000 /* interval to wait between sending a command and reading the response (usec) */ - -#define MAX_START_DELAY 9999 -#define MAX_SHUTDOWN_DELAY 99 - -/* Maximum length of a string representing these values */ -#define MAX_START_DELAY_LEN 4 -#define MAX_SHUTDOWN_DELAY_LEN 2 - -#define MAX_POLL_FAILURES 3 - -#define N_FLAGS 8 - -/* The UPS status flags */ -#define FL_ON_BATT 0 -#define FL_LOW_BATT 1 -#define FL_BOOST_TRIM 2 -#define FL_FAILED 3 -#define FL_UPS_TYPE 4 -#define FL_BATT_TEST 5 -#define FL_LOAD_OFF 6 -#define FL_BEEPER_ON 7 /* bogus on some models */ - -/* Maximum lengths for the "I" command reply fields */ -#define UPS_MFR_CHARS 15 -#define UPS_MODEL_CHARS 10 -#define UPS_VERSION_CHARS 10 - -/* Below this value we can safely consider a voltage to be zero */ -#define RESIDUAL_VOLTAGE 10.0 - - -/* The values returned by the UPS for an "I" query */ -typedef struct { - char mfr[UPS_MFR_CHARS + 1]; - char model[UPS_MODEL_CHARS + 1]; - char version[UPS_VERSION_CHARS + 1]; -} UPSInfo_t; - - -/* The values returned by the UPS for an "F" query */ -typedef struct { - float volt; - float current; - float battvolt; - float freq; -} FirmwareValues_t; - - -/* The values returned by the UPS for an "Q1" query */ -typedef struct { - float ivolt; - float fvolt; - float ovolt; - float load; - float freq; - float battvolt; - float temp; - char flags[N_FLAGS + 1]; -} QueryValues_t; - - -/* Parameters for known battery types */ -typedef struct { - float nominal; /* battery voltage (nominal) */ - float min; /* lower bound for a single battery of "nominal" voltage (see "set_battery_params" below) */ - float max; /* upper bound for a single battery of "nominal" voltage (see "set_battery_params" below) */ - float empty; /* fully discharged battery */ - float full; /* fully charged battery */ - float low; /* low battery (unused) */ -} BatteryVolts_t; - - -/* Known battery types must be in ascending order by "nominal" first, and then by "max". */ -static BatteryVolts_t batteries[] = {{ 12.0, 9.0, 16.0, 9.7, 13.7, 0.0 }, /* Mustek PowerMust 600VA Plus (LB unknown) */ - { 12.0, 18.0, 30.0, 18.8, 26.8, 22.3 }, /* PowerWalker Line-Interactive VI 1000 */ - { 23.5, 18.0, 30.0, 21.3, 27.1, 22.2 }, /* UNITEK ALPHA2600 */ - { 24.0, 18.0, 30.0, 19.4, 27.4, 22.2 }, /* Mustek PowerMust 1000VA Plus */ - { 36.0, 1.5, 3.0, 1.64, 2.31, 1.88 }, /* Mustek PowerMust 1000VA On-Line */ - { 36.0, 30.0, 42.0, 32.5, 41.0, 0.0 }, /* Mecer ME-2000 (LB unknown) */ - { 48.0, 38.0, 58.0, 40.0, 54.6, 44.0 }, /* Sven Smart RM2000 */ - { 72.0, 1.5, 3.0, 1.74, 2.37, 1.82 }, /* Effekta RM2000MH */ - { 96.0, 1.5, 3.0, 1.63, 2.29, 1.8 }, /* Ablerex MS3000RT (LB at 25% charge) */ - { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }}; /* END OF DATA */ - -/* Interval between chars on send (usec) */ -static int send_pace = 100000; - -/* Some models need this */ -static char state_dtr = 1; -static char state_rts = 0; - -/* Workaround for buggy models */ -static char ignore_off = 0; /* ignore FL_LOAD_OFF if it behaves strangely */ - -/* Defined in upsdrv_initinfo */ -static float battvolt_empty = -1; /* unknown */ -static float battvolt_full = -1; /* unknown */ - -/* Battery voltage multiplier (to match the nominal voltage on some models) */ -static float battvolt_mult = 1; - -/* Minimum and maximum voltage seen on input */ -static float ivolt_min = INT_MAX; /* unknown */ -static float ivolt_max = -1; /* unknown */ - -/* In minutes: */ -static short start_delay = 2; /* wait at least this amount of time before coming back online */ -static short shutdown_delay = 0; /* wait until going offline */ - -/* In percentage: */ -static float lowbatt = -1; /* disabled */ - -static char watchdog_enabled = 0; /* disabled by default, of course */ -static char watchdog_timeout = 1; /* in minutes */ - - -static char *copy_field(char* dest, char *src, int field_len); -static float get_battery_charge(float battvolt); -static int set_battery_params(float volt_nominal, float volt_now); -static int check_ups(QueryValues_t *status); -static int get_ups_info(UPSInfo_t *info); -static int get_firmware_values(FirmwareValues_t *values); -static int run_query(QueryValues_t *values); - -int instcmd(const char *cmdname, const char *extra); -int setvar(const char *varname, const char *val); - - -/* I know, macros should evaluate their arguments only once */ -#define CLAMP(x, min, max) (((x) < (min)) ? (min) : (((x) > (max)) ? (max) : (x))) - - -static char *copy_field(char* dest, char *src, int field_len) -{ - int i, j; - - /* First we skip the leading spaces... */ - for (i = 0; i < field_len; i++) { - if (src[i] != ' ') { - break; - } - } - - /* ... then we copy the rest of the field... */ - j = 0; - while (i < field_len) { - dest[j] = src[i]; - - i++; j++; - } - - dest[j] = '\0'; - - /* ...and finally, remove the trailing spaces. */ - rtrim(dest, ' '); - - return &src[field_len]; /* return the rest of the source buffer */ -} - - -static float get_battery_charge(float battvolt) -{ - float value; - - if (battvolt_empty < 0 || battvolt_full < 0) { - return -1; - } - - battvolt = CLAMP(battvolt, battvolt_empty, battvolt_full); - value = (battvolt - battvolt_empty) / (battvolt_full - battvolt_empty); - - return value * 100; /* percentage */ -} - - -/* - * Set the proper limits, depending on the battery voltage, - * so that the "charge" calculations return meaningful values. - * - * This has to be done by looking at the present battery voltage and - * the nominal voltage because, for example, some 24V models will - * show a nominal voltage of 24, while others will show a nominal - * voltage of 12. The present voltage helps telling them apart. - */ -static int set_battery_params(float volt_nominal, float volt_now) -{ - int i = 0; - - while (batteries[i].nominal > 0) { - if (volt_nominal == batteries[i].nominal) { /* battery voltage matches... */ - while (volt_nominal == batteries[i].nominal) { /* ...find the most adequate parameters */ - if (volt_now > batteries[i].min && volt_now < batteries[i].max) { - battvolt_empty = batteries[i].empty; - battvolt_full = batteries[i].full; - - upsdebugx(1, "%.1fV battery, interval [%.1fV, %.1fV].", volt_nominal, battvolt_empty, battvolt_full); - - return i; - } - - i++; - - } - - upsdebugx(1, "%.1fV battery, present voltage (%.1fV) outside of supported intervals.", volt_nominal, volt_now); - - return -1; - } - - i++; - } - - upsdebugx(1, "Unsupported battery voltage (%.1fV).", volt_nominal); - - return -1; -} - - -/* - * The "status" parameter is left unchanged on failure. - */ -static int check_ups(QueryValues_t *status) -{ - QueryValues_t values; - - if (run_query(&values) < 0) { - return -1; - } - - memcpy(status, &values, sizeof(values)); - - return 0; -} - - -static int get_ups_info(UPSInfo_t *info) -{ - char buffer[RECV_BUFFER_LEN]; - char *anchor; - int ret; - - upsdebugx(2, "Asking for UPS information [I]..."); - ser_flush_io(upsfd); - ser_send_pace(upsfd, send_pace, "I%c", ENDCHAR); - usleep(READ_PACE); - - /* - * Expected reply: "#UPS_MFR........ UPS_MODEL. UPS_VER..." - */ - ret = ser_get_line(upsfd, buffer, RECV_BUFFER_LEN, ENDCHAR, IGNCHARS, READ_TIMEOUT, 0); - - if (ret < 0) { - upsdebug_with_errno(2, "I => FAILED"); - - return -1; - } - - if (ret == 0) { - upsdebugx(2, "I => FAILED [timeout]"); - - return -1; - } - - if (ret < I_CMD_REPLY_LEN) { - upsdebugx(2, "I => FAILED [short read]"); - upsdebug_hex(3, "I detail", (unsigned char *)buffer, ret); - - return -1; - } - - if (buffer[0] != '#') { - upsdebugx(2, "I => FAILED [invalid start character]"); - upsdebug_hex(3, "I detail", (unsigned char *)buffer, ret); - - return -1; - } - - upsdebugx(2, "I => OK [%s]", buffer); - - memset(info, 0, sizeof(UPSInfo_t)); - - /* - * Get the manufacturer, model and version fields, skipping - * the separator character that sits between them, as well as - * the first character (the control character, always a '#'). - */ - anchor = copy_field(info->mfr, &buffer[1], UPS_MFR_CHARS); - anchor = copy_field(info->model, anchor + 1, UPS_MODEL_CHARS); - copy_field(info->version, anchor + 1, UPS_VERSION_CHARS); - - upsdebugx(2, "I VALUES => [%s %s %s]", info->mfr, info->model, info->version); - - return 0; -} - - -static int get_firmware_values(FirmwareValues_t *values) -{ - char buffer[RECV_BUFFER_LEN]; - char field[FIELD_BUFFER_LEN]; - char *anchor; - int ret; - - upsdebugx(2, "Asking for UPS power ratings [F]..."); - ser_flush_io(upsfd); - ser_send_pace(upsfd, send_pace, "F%c", ENDCHAR); - usleep(READ_PACE); - - /* - * Expected reply: "#MMM.M QQQ SS.SS RR.R" - */ - ret = ser_get_line(upsfd, buffer, RECV_BUFFER_LEN, ENDCHAR, IGNCHARS, READ_TIMEOUT, 0); - - if (ret < 0) { - upsdebug_with_errno(2, "F => FAILED"); - - return -1; - } - - if (ret == 0) { - upsdebugx(2, "F => FAILED [timeout]"); - - return -1; - } - - if (ret < F_CMD_REPLY_LEN) { - upsdebugx(2, "F => FAILED [short read]"); - upsdebug_hex(3, "F detail", (unsigned char *)buffer, ret); - - return -1; - } - - - if (buffer[0] != '#') { - upsdebugx(2, "F => FAILED [invalid start character]"); - upsdebug_hex(3, "F detail", (unsigned char *)buffer, ret); - - return -1; - } - - upsdebugx(2, "F => OK [%s]", buffer); - - anchor = copy_field(field, &buffer[1], 5); - values->volt = atof(field); - - anchor = copy_field(field, anchor + 1, 3); - values->current = atof(field); - - anchor = copy_field(field, anchor + 1, 5); - values->battvolt = atof(field); - - anchor = copy_field(field, anchor + 1, 4); - values->freq = atof(field); - - upsdebugx(2, "F VALUES => [%.1f %.1f %.1f %.1f]", values->volt, - values->current, values->battvolt, values->freq); - - return 0; -} - - -static int run_query(QueryValues_t *values) -{ - char buffer[RECV_BUFFER_LEN]; - char field[FIELD_BUFFER_LEN]; - char *anchor; - int ret; - - upsdebugx(2, "Asking for UPS status [Q1]..."); - ser_flush_io(upsfd); - ser_send_pace(upsfd, send_pace, "Q1%c", ENDCHAR); - usleep(READ_PACE); - - /* - * Expected reply: "(MMM.M NNN.N PPP.P QQQ RR.R S.SS TT.T b7b6b5b4b3b2b1b0" - */ - ret = ser_get_line(upsfd, buffer, RECV_BUFFER_LEN, ENDCHAR, IGNCHARS, READ_TIMEOUT, 0); - - if (ret < 0) { - upsdebug_with_errno(2, "Q1 => FAILED"); - - return -1; - } - - if (ret == 0) { - upsdebugx(2, "Q1 => FAILED [timeout]"); - - return -1; - } - - if (ret < Q1_CMD_REPLY_LEN) { - upsdebugx(2, "Q1 => FAILED [short read]"); - upsdebug_hex(3, "Q1 detail", (unsigned char *)buffer, ret); - - return -1; - } - - if (buffer[0] != '(') { - upsdebugx(2, "Q1 => FAILED [invalid start character]"); - upsdebug_hex(3, "Q1 detail", (unsigned char *)buffer, ret); - - return -1; - } - - upsdebugx(2, "Q1 => OK [%s]", buffer); - - anchor = copy_field(field, &buffer[1], 5); - values->ivolt = atof(field); - - anchor = copy_field(field, anchor + 1, 5); - values->fvolt = atof(field); - - anchor = copy_field(field, anchor + 1, 5); - values->ovolt = atof(field); - - anchor = copy_field(field, anchor + 1, 3); - values->load = atof(field); - - anchor = copy_field(field, anchor + 1, 4); - values->freq = atof(field); - - anchor = copy_field(field, anchor + 1, 4); - values->battvolt = atof(field); - - anchor = copy_field(field, anchor + 1, 4); - values->temp = atof(field); - - anchor = copy_field(values->flags, anchor + 1, N_FLAGS); - - if (strlen(values->flags) < N_FLAGS) { - upsdebugx(2, "Q1 => FAILED [flags error]"); - return -1; - } - - upsdebugx(2, "Q1 VALUES => [%.1f %.1f %.1f %.1f %.1f %.1f %.1f %s]", - values->ivolt, values->fvolt, values->ovolt, values->load, - values->freq, values->battvolt, values->temp, values->flags); - - return 0; -} - - -void upsdrv_initinfo(void) -{ - int i; - FirmwareValues_t values; - QueryValues_t status; - UPSInfo_t info; - - /* - * Some models apparently time-out with the default send pace, so we must - * allow the user to override it if needed be. The configuration parameter - * is specified in milliseconds for the user's benefit. - */ - if (getval("sendpace")) { - upsdebugx(2, "Default command send pace is %d usec.", send_pace); - upsdebugx(2, "Parameter [sendpace]: [%s]", getval("sendpace")); - - /* Having 1 second as the upper-bound is an arbitrary choice... */ - send_pace = CLAMP(atoi(getval("sendpace")), 1, 1000) * 1000; - - upslogx(LOG_NOTICE, "Command send pace changed to %d usec.", send_pace); - } - - /* - * UPS detection sequence. - */ - upsdebugx(1, "Starting UPS detection process..."); - - /* Some models seem to need this. We'll just discard the ouput for now... */ - get_ups_info(&info); - - /* Check for a compatible UPS... */ - for (i = 0; i < IDENT_MAXTRIES; i++) { - if (check_ups(&status) == 0) { - break; - } - } - - if (i == IDENT_MAXTRIES) { - fatalx(EXIT_FAILURE, "Megatec protocol UPS not detected."); - } - - dstate_setinfo("ups.type", status.flags[FL_UPS_TYPE] == '1' ? "standby" : "online"); - - upsdebugx(1, "Cancelling any pending shutdown or battery test."); - ser_send_pace(upsfd, send_pace, "C%c", ENDCHAR); - - /* - * Try to identify the UPS. - */ - if (get_ups_info(&info) >= 0) { - char model[UPS_MODEL_CHARS + UPS_VERSION_CHARS + 2]; - snprintf(model, sizeof(model), "%s %s", info.model, info.version); - - dstate_setinfo("ups.mfr", "%s", getval("mfr") ? getval("mfr") : info.mfr); - dstate_setinfo("ups.model", "%s", getval("model") ? getval("model") : model); - - upslogx(LOG_INFO, "Megatec protocol UPS detected [%s %s %s].", info.mfr, info.model, info.version); - } else { - dstate_setinfo("ups.mfr", "%s", getval("mfr") ? getval("mfr") : "unknown"); - dstate_setinfo("ups.model", "%s", getval("model") ? getval("model") : "unknown"); - - upslogx(LOG_INFO, "Megatec protocol UPS detected."); - } - - dstate_setinfo("ups.serial", "%s", getval("serial") ? getval("serial") : "unknown"); - - /* - * Workaround for buggy models. - */ - ignore_off = testvar("ignoreoff"); - - if (status.flags[FL_LOAD_OFF] == '1' && status.load > 0.01 && !ignore_off) { - ignore_off = 1; - upslogx(LOG_INFO, "The UPS reports OFF status but appears to be ON. Parameter \"ignoreoff\" set automatically."); - } - upsdebugx(2, "Parameter [ignoreoff]: [%s]", (ignore_off ? "true" : "false")); - - /* - * Set battery-related values. - */ - if (get_firmware_values(&values) >= 0) { - dstate_setinfo("battery.voltage.nominal", "%.1f", values.battvolt); - dstate_setinfo("input.voltage.nominal", "%.1f", values.volt); - dstate_setinfo("input.frequency.nominal", "%.1f", values.freq); - - if (set_battery_params(values.battvolt, status.battvolt) < 0) { - upslogx(LOG_NOTICE, "This UPS has an unsupported combination of battery voltage/number of batteries."); - } - } - - if (getval("battvoltmult")) { - upsdebugx(2, "Parameter [battvoltmult]: [%s]", getval("battvoltmult")); - - /* Having SHRT_MAX as the upper-bound is an arbitrary choice... */ - battvolt_mult = CLAMP(atof(getval("battvoltmult")), 1, SHRT_MAX); - - upslogx(LOG_NOTICE, "The battery voltage reported by the UPS will be multiplied by %.1f.", battvolt_mult); - } - - if (getval("battvolts")) { - upsdebugx(2, "Parameter [battvolts]: [%s]", getval("battvolts")); - - if (sscanf(getval("battvolts"), "%f:%f", &battvolt_empty, &battvolt_full) != 2) { - fatalx(EXIT_FAILURE, "Error in \"battvolts\" parameter."); - } - - upslogx(LOG_NOTICE, "Overriding battery voltage interval [%.1fV, %.1fV].", battvolt_empty, battvolt_full); - } - - if (battvolt_empty < 0 || battvolt_full < 0) { - upslogx(LOG_NOTICE, "Cannot calculate charge percentage for this UPS."); - } - - if (getval("lowbatt")) { - if (battvolt_empty < 0 || battvolt_full < 0) { - upslogx(LOG_NOTICE, "Ignoring \"lowbatt\" parameter."); - } else { - lowbatt = CLAMP(atof(getval("lowbatt")), 0, 100); - } - } - - /* - * Set the restart and shutdown delays. - */ - if (getval("ondelay")) { - start_delay = CLAMP(atoi(getval("ondelay")), 0, MAX_START_DELAY); - } - - if (getval("offdelay")) { - shutdown_delay = CLAMP(atoi(getval("offdelay")), 0, MAX_SHUTDOWN_DELAY); - } - - dstate_setinfo("ups.delay.start", "%d", start_delay); - dstate_setinfo("ups.delay.shutdown", "%d", shutdown_delay); - - /* - * Register the available instant commands. - */ - dstate_addcmd("test.battery.start.deep"); - dstate_addcmd("test.battery.start"); - dstate_addcmd("test.battery.stop"); - dstate_addcmd("shutdown.return"); - dstate_addcmd("shutdown.stayoff"); - dstate_addcmd("shutdown.stop"); - dstate_addcmd("load.on"); - dstate_addcmd("load.off"); - dstate_addcmd("reset.input.minmax"); - dstate_addcmd("reset.watchdog"); - dstate_addcmd("beeper.toggle"); - - upsh.instcmd = instcmd; - upsh.setvar = setvar; - - upsdebugx(1, "Done setting up the UPS."); -} - - -void upsdrv_updateinfo(void) -{ - QueryValues_t query; - float charge; - static int poll_fail = 0; - - if (run_query(&query) < 0) { - /* - * Query wasn't successful (we got some weird - * response), however we won't fatalx(EXIT_FAILURE, ) as this - * happens sometimes when the ups is offline. - * - * Some fault tolerance is good, we just assume - * that the UPS is just taking a nap. ;) - */ - poll_fail++; - upsdebugx(2, "Poll failure [%d].", poll_fail); - ser_comm_fail("No status from UPS."); - - if (poll_fail >= MAX_POLL_FAILURES) { - upsdebugx(2, "Too many poll failures, data is stale."); - dstate_datastale(); - } - - return; - } - - poll_fail = 0; - ser_comm_good(); - - dstate_setinfo("input.voltage", "%.1f", query.ivolt); - dstate_setinfo("input.voltage.fault", "%.1f", query.fvolt); - dstate_setinfo("output.voltage", "%.1f", query.ovolt); - dstate_setinfo("ups.load", "%.1f", query.load); - dstate_setinfo("input.frequency", "%.1f", query.freq); - - /* - * The battery voltage multiplier should only be applied to battery.voltage - * in order not to break the charge calculation (that uses the 'raw' value - * that is reported by the UPS). - */ - dstate_setinfo("battery.voltage", "%.2f", battvolt_mult * query.battvolt); - - if (query.temp > 0.01) { - dstate_setinfo("ups.temperature", "%.1f", query.temp); - } - - charge = get_battery_charge(query.battvolt); - if (charge >= 0) { - dstate_setinfo("battery.charge", "%.1f", charge); - - upsdebugx(2, "Calculated battery charge: %.1f%%", charge); - } - - dstate_setinfo("ups.beeper.status", query.flags[FL_BEEPER_ON] == '1' ? "enabled" : "disabled"); - - status_init(); - - /* - * Some models, when OFF, never change to on-battery status when - * line power is unavailable. To get around this, we also look at - * the input voltage level here. - */ - if (query.flags[FL_ON_BATT] == '1' || query.ivolt < RESIDUAL_VOLTAGE) { - status_set("OB"); - } else { - status_set("OL"); - - if (query.flags[FL_BOOST_TRIM] == '1') { - if (query.ivolt < query.ovolt) { - status_set("BOOST"); - } else if (query.ivolt > query.ovolt) { - status_set("TRIM"); - } else { - status_set("BYPASS"); - } - } - - /* Update minimum and maximum input voltage levels too */ - if (query.ivolt < ivolt_min) { - ivolt_min = query.ivolt; - } - - if (query.ivolt > ivolt_max) { - ivolt_max = query.ivolt; - } - - dstate_setinfo("input.voltage.minimum", "%.1f", ivolt_min); - dstate_setinfo("input.voltage.maximum", "%.1f", ivolt_max); - } - - /* - * If "lowbatt > 0", it becomes a "soft" low battery level - * and the hardware flag "FL_LOW_BATT" is always ignored. - */ - if ((lowbatt <= 0 && query.flags[FL_LOW_BATT] == '1') || - (lowbatt > 0 && charge < lowbatt)) { - status_set("LB"); - } - - if (query.flags[FL_BATT_TEST] == '1') { - status_set("CAL"); - } - - if (query.flags[FL_LOAD_OFF] == '1' && !ignore_off) { - status_set("OFF"); - } - - alarm_init(); - - if (query.flags[FL_FAILED] == '1') { - alarm_set("Internal UPS fault!"); - } - - alarm_commit(); - - status_commit(); - - dstate_dataok(); -} - - -void upsdrv_shutdown(void) -{ - int s_wait = getval("offdelay") ? CLAMP(atoi(getval("offdelay")), 0, MAX_SHUTDOWN_DELAY) : shutdown_delay; - int r_wait = getval("ondelay") ? CLAMP(atoi(getval("ondelay")), 0, MAX_START_DELAY) : start_delay; - - upslogx(LOG_INFO, "Shutting down UPS."); - - ser_send_pace(upsfd, send_pace, "C%c", ENDCHAR); - ser_send_pace(upsfd, send_pace, "S%02dR%04d%c", s_wait, r_wait, ENDCHAR); -} - - -int instcmd(const char *cmdname, const char *extra) -{ - char buffer[RECV_BUFFER_LEN]; - - /* - * Some commands are always supported by every UPS implementing - * the megatec protocol, but others may or may not be supported. - * Unsupported commands are echoed back without ENDCHAR. - */ - - if (strcasecmp(cmdname, "test.battery.start.deep") == 0) { - ser_flush_io(upsfd); - ser_send_pace(upsfd, send_pace, "TL%c", ENDCHAR); - usleep(READ_PACE); - - if (ser_get_line(upsfd, buffer, 2 + 1, '\0', IGNCHARS, READ_TIMEOUT, 0) > 0) { - upslogx(LOG_NOTICE, "test.battery.start.deep not supported by UPS hardware."); - } else { - upslogx(LOG_INFO, "Deep battery test started."); - } - - return STAT_INSTCMD_HANDLED; - } - - if (strcasecmp(cmdname, "test.battery.start") == 0) { - ser_flush_io(upsfd); - ser_send_pace(upsfd, send_pace, "T%c", ENDCHAR); - usleep(READ_PACE); - - if (ser_get_line(upsfd, buffer, 1 + 1, '\0', IGNCHARS, READ_TIMEOUT, 0) > 0) { - upslogx(LOG_NOTICE, "test.battery.start not supported by UPS hardware."); - } else { - upslogx(LOG_INFO, "Battery test started."); - } - - return STAT_INSTCMD_HANDLED; - } - - if (strcasecmp(cmdname, "test.battery.stop") == 0) { - ser_flush_io(upsfd); - ser_send_pace(upsfd, send_pace, "CT%c", ENDCHAR); - usleep(READ_PACE); - - if (ser_get_line(upsfd, buffer, 2 + 1, '\0', IGNCHARS, READ_TIMEOUT, 0) > 0) { - upslogx(LOG_NOTICE, "test.battery.stop not supported by UPS hardware."); - } else { - upslogx(LOG_INFO, "Battery test stopped."); - } - - return STAT_INSTCMD_HANDLED; - } - - if (strcasecmp(cmdname, "shutdown.return") == 0) { - ser_send_pace(upsfd, send_pace, "C%c", ENDCHAR); - watchdog_enabled = 0; - - ser_send_pace(upsfd, send_pace, "S%02dR%04d%c", shutdown_delay, start_delay, ENDCHAR); - - upslogx(LOG_INFO, "Shutdown (return) initiated."); - - return STAT_INSTCMD_HANDLED; - } - - if (strcasecmp(cmdname, "shutdown.stayoff") == 0) { - ser_send_pace(upsfd, send_pace, "C%c", ENDCHAR); - watchdog_enabled = 0; - - ser_flush_io(upsfd); - ser_send_pace(upsfd, send_pace, "S%02d%c", shutdown_delay, ENDCHAR); - usleep(READ_PACE); - - if (ser_get_line(upsfd, buffer, 3 + 1, '\0', IGNCHARS, READ_TIMEOUT, 0) > 0) { - ser_send_pace(upsfd, send_pace, "S%02dR9999%c", shutdown_delay, ENDCHAR); - upslogx(LOG_NOTICE, "UPS refuses to turn the load off indefinitely. Will turn off for 9999 minutes instead."); - } - - upslogx(LOG_INFO, "Shutdown (stayoff) initiated."); - - return STAT_INSTCMD_HANDLED; - } - - if (strcasecmp(cmdname, "shutdown.stop") == 0) { - ser_send_pace(upsfd, send_pace, "C%c", ENDCHAR); - watchdog_enabled = 0; - - upslogx(LOG_INFO, "Shutdown canceled."); - - return STAT_INSTCMD_HANDLED; - } - - if (strcasecmp(cmdname, "load.on") == 0) { - ser_send_pace(upsfd, send_pace, "C%c", ENDCHAR); - watchdog_enabled = 0; - - upslogx(LOG_INFO, "Turning the load on."); - - return STAT_INSTCMD_HANDLED; - } - - if (strcasecmp(cmdname, "load.off") == 0) { - ser_send_pace(upsfd, send_pace, "C%c", ENDCHAR); - watchdog_enabled = 0; - - ser_flush_io(upsfd); - ser_send_pace(upsfd, send_pace, "S00%c", ENDCHAR); - usleep(READ_PACE); - - if (ser_get_line(upsfd, buffer, 3 + 1, '\0', IGNCHARS, READ_TIMEOUT, 0) > 0) { - ser_send_pace(upsfd, send_pace, "S00R9999%c", ENDCHAR); - upslogx(LOG_NOTICE, "UPS refuses to turn the load off indefinitely. Will turn off for 9999 minutes instead."); - } - - upslogx(LOG_INFO, "Turning the load off."); - - return STAT_INSTCMD_HANDLED; - } - - if (strcasecmp(cmdname, "reset.input.minmax") == 0) { - ivolt_min = INT_MAX; - ivolt_max = -1; - - dstate_setinfo("input.voltage.minimum", "%.1f", ivolt_min); - dstate_setinfo("input.voltage.maximum", "%.1f", ivolt_max); - - upslogx(LOG_INFO, "Resetting minimum and maximum input voltage values."); - - return STAT_INSTCMD_HANDLED; - } - - if (strcasecmp(cmdname, "reset.watchdog") == 0) { - ser_send_pace(upsfd, send_pace, "C%c", ENDCHAR); - ser_send_pace(upsfd, send_pace, "S%02dR0001%c", watchdog_timeout, ENDCHAR); - - if (watchdog_enabled) { - upsdebugx(2, "Resetting the UPS watchdog."); - } else { - watchdog_enabled = 1; - upslogx(LOG_INFO, "UPS watchdog started."); - } - - return STAT_INSTCMD_HANDLED; - } - - if (strcasecmp(cmdname, "beeper.toggle") == 0) { - ser_flush_io(upsfd); - ser_send_pace(upsfd, send_pace, "Q%c", ENDCHAR); - usleep(READ_PACE); - - if (ser_get_line(upsfd, buffer, 1 + 1, '\0', IGNCHARS, READ_TIMEOUT, 0) > 0) { - upslogx(LOG_NOTICE, "beeper.toggle not supported by UPS hardware."); - } else { - upslogx(LOG_INFO, "Toggling UPS beeper."); - } - - return STAT_INSTCMD_HANDLED; - } - - upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); - - return STAT_INSTCMD_UNKNOWN; -} - - -int setvar(const char *varname, const char *val) -{ - return STAT_SET_UNKNOWN; -} - - -void upsdrv_help(void) -{ -} - - -void upsdrv_makevartable(void) -{ - addvar(VAR_VALUE, "mfr", "Manufacturer name"); - addvar(VAR_VALUE, "model", "Model name"); - addvar(VAR_VALUE, "serial", "UPS serial number"); - addvar(VAR_VALUE, "lowbatt", "Low battery level (%)"); - addvar(VAR_VALUE, "ondelay", "Min. delay before UPS startup (minutes)"); - addvar(VAR_VALUE, "offdelay", "Delay before UPS shutdown (minutes)"); - addvar(VAR_VALUE, "battvolts", "Battery voltages (empty:full)"); - addvar(VAR_VALUE, "battvoltmult", "Battery voltage multiplier"); - addvar(VAR_FLAG , "ignoreoff", "Ignore the OFF status from the UPS"); - addvar(VAR_VALUE, "sendpace", "Interval between command chars (msec)"); - addvar(VAR_VALUE, "dtr", "Serial DTR line state (0/1)"); - addvar(VAR_VALUE, "rts", "Serial RTS line state (0/1)"); - - megatec_subdrv_makevartable(); -} - - -void upsdrv_initups(void) -{ - upsfd = ser_open(device_path); - ser_set_speed(upsfd, device_path, B2400); - - if (getval("dtr")) { - upsdebugx(2, "Parameter [dtr]: [%s]", getval("dtr")); - - if (strcmp(getval("dtr"), "0") != 0 && strcmp(getval("dtr"), "1") != 0) { - fatalx(EXIT_FAILURE, "Error in \"dtr\" parameter."); - } - - state_dtr = atoi(getval("dtr")); - } - - if (getval("rts")) { - upsdebugx(2, "Parameter [rts]: [%s]", getval("rts")); - - if (strcmp(getval("rts"), "0") != 0 && strcmp(getval("rts"), "1") != 0) { - fatalx(EXIT_FAILURE, "Error in \"rts\" parameter."); - } - - state_rts = atoi(getval("rts")); - } - - upsdebugx(2, "DTR=%d, RTS=%d", state_dtr, state_rts); - - ser_set_dtr(upsfd, state_dtr); - ser_set_rts(upsfd, state_rts); -} - - -void upsdrv_cleanup(void) -{ - ser_set_dtr(upsfd, 0); - ser_close(upsfd, device_path); -} - - -/* EOF - megatec.c */ diff --git a/drivers/megatec.h b/drivers/megatec.h deleted file mode 100644 index 43224fd..0000000 --- a/drivers/megatec.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: t; -*- - * - * megatec.h: support for Megatec protocol based UPSes - * - * Copyright (C) Carlos Rodrigues - * - * megatec.c created on 4/10/2003 - * - * 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 MEGATEC_H -#define MEGATEC_H - -/* FIXME (AQ): non compliant version (should be X.YZ) - * USB and serial should also be versioned */ - - -#ifdef MEGATEC_SUBDRV - extern upsdrv_info_t megatec_subdrv_info; - void megatec_subdrv_makevartable(void); - void megatec_subdrv_banner(void); -#else -# define megatec_subdrv_makevartable(...) -# define megatec_subdrv_banner(...) -#endif - - -#endif /* MEGATEC_H */ diff --git a/drivers/megatec_usb.c b/drivers/megatec_usb.c deleted file mode 100644 index d4146c3..0000000 --- a/drivers/megatec_usb.c +++ /dev/null @@ -1,656 +0,0 @@ -/* megatec_usb.c - usb communication layer for Megatec protocol based UPSes - * - * Copyright (C) 2006 Andrey Lelikov - * Copyright (C) 2007 Alexander Gordeev - * Copyright (C) 2007 Jon Gough - * - * 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 "megatec.h" -#include "libusb.h" -#include "serial.h" -#include "usb-common.h" - -#include -#include -#include -#include - -#define SUB_DRIVER_VERSION "0.10" -#define SUB_DRIVER_NAME "Serial-over-USB transport layer" - -/* driver description structure */ -upsdrv_info_t megatec_subdrv_info = { - SUB_DRIVER_NAME, - SUB_DRIVER_VERSION, - "Andrey Lelikov \n" \ - "Alexander Gordeev \n" \ - "Jon Gough ", - DRV_STABLE, - { NULL } -}; - -/* - This is a communication driver for "USB HID" UPS-es which use proprietary -usb-to-serial converter and speak megatec protocol. Usually these are cheap -models and usb-to-serial converter is a huge oem hack - HID tables are bogus, -device has no UPS reports, etc. - This driver has a table of all known devices which has pointers to device- -specific communication functions (namely send a string to UPS and read a string -from it). Driver takes care of detection, opening a usb device, string -formatting etc. So in order to add support for another usb-to-serial device one -only needs to implement device-specific get/set functions and add an entry into -KnownDevices table. - -*/ - -static usb_communication_subdriver_t *usb = &usb_subdriver; -static usb_dev_handle *udev = NULL; -static USBDevice_t usbdevice; -static USBDeviceMatcher_t *reopen_matcher = NULL; -static USBDeviceMatcher_t *regex_matcher = NULL; - -static int (*get_data)(char *buffer, int buffer_size) = NULL; -static int (*set_data)(const char *str) = NULL; - -/* agiler-old subdriver definition */ -static int get_data_agiler_old(char *buffer, int buffer_size); -static int set_data_agiler_old(const char *str); - -static void *agiler_old_subdriver(void) -{ - get_data = &get_data_agiler_old; - set_data = &set_data_agiler_old; - return NULL; -} - -/* agiler subdriver definition */ -static int get_data_agiler(char *buffer, int buffer_size); -static int set_data_agiler(const char *str); - -static void *agiler_subdriver(void) -{ - get_data = &get_data_agiler; - set_data = &set_data_agiler; - return NULL; -} - -/* Phoenixtec Power Co subdriver definition */ -static int get_data_phoenix(char *buffer, int buffer_size); -static int set_data_phoenix(const char *str); - -static void *phoenix_subdriver(void) -{ - get_data = &get_data_phoenix; - set_data = &set_data_phoenix; - return NULL; -} - -/* krauler (ablerex) subdriver definition */ -static int get_data_krauler(char *buffer, int buffer_size); -static int set_data_krauler(const char *str); - -static void *krauler_subdriver(void) -{ - get_data = &get_data_krauler; - set_data = &set_data_krauler; - return NULL; -} - -/* list of subdrivers for manual overrides */ -static const struct { - const char *name; - void *(*handler)(void); -} subdriver[] = { - { "agiler-old", &agiler_old_subdriver }, - { "agiler", &agiler_subdriver }, - { "phoenix", &phoenix_subdriver }, - { "krauler", &krauler_subdriver }, - /* end of list */ - { NULL } -}; - -/* list of all known devices */ -static usb_device_id_t megatec_usb_id[] = { - /* Agiler UPS */ - { USB_DEVICE(0x05b8, 0x0000), &agiler_subdriver}, - /* Krauler UP-M500VA */ - { USB_DEVICE(0x0001, 0x0000), &krauler_subdriver}, - /* Ablerex 625L USB */ - { USB_DEVICE(0xffff, 0x0000), &krauler_subdriver}, - /* Belkin F6C1200-UNV */ - { USB_DEVICE(0x0665, 0x5161), &phoenix_subdriver}, - /* Mustek Powermust */ - { USB_DEVICE(0x06da, 0x0003), &phoenix_subdriver}, - /* Unitek Alpha 1200Sx */ - { USB_DEVICE(0x0f03, 0x0001), &phoenix_subdriver}, - /* end of list */ - {-1, -1, NULL} -}; - -static int subdriver_match_func(USBDevice_t *d, void *privdata) -{ - if(getval("subdriver")) - return 1; - - switch (is_usb_device_supported(megatec_usb_id, d->VendorID, d->ProductID)) - { - case SUPPORTED: - return 1; - - case POSSIBLY_SUPPORTED: - case NOT_SUPPORTED: - default: - return 0; - } -} - -static USBDeviceMatcher_t subdriver_matcher = { - &subdriver_match_func, - NULL, - NULL -}; - -static void usb_open_error(const char *port) -{ - 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 'vendorid' and 'subdriver' options\n" -"specified. Please refer to the man page for details about these options\n" -"(man 8 megatec_usb).\n" -"Please report your results to the NUT user's mailing list\n" -".\n" - ); -} - -/* FIXME: Fix "serial" variable (which conflicts with "serial" variable in megatec.c) */ -void megatec_subdrv_makevartable() -{ - 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, "subdriver", "Serial-over-USB subdriver selection"); -} - -int ser_open(const char *port) -{ - char *regex_array[6]; - int ret; - - char *subdrv = getval("subdriver"); - char *vid = getval("vendorid"); - char *pid = getval("productid"); - char *vend = getval("vendor"); - char *prod = getval("product"); - - /* pick up the subdriver name if set explicitly */ - if(subdrv) - { - int i; - - if(!vid && !pid && !vend && !prod) - { - upslogx(LOG_WARNING, "It's unsafe to select a subdriver but not specify device!\n" - "Please set some of \"vendor\", \"product\", \"vendorid\", \"productid\"" - " variables.\n"); - } - - for (i = 0; subdriver[i].name; i++) - { - if (!strcasecmp(subdrv, subdriver[i].name)) - { - (*subdriver[i].handler)(); - break; - } - } - - if(!subdriver[i].name) - fatalx(EXIT_FAILURE, "No subdrivers named \"%s\" found!", subdrv); - } - - /* FIXME: fix "serial" variable */ - /* process the UPS selection options */ - regex_array[0] = vid; - regex_array[1] = pid; - regex_array[2] = vend; - regex_array[3] = prod; - regex_array[4] = NULL; /* getval("serial"); */ - regex_array[5] = getval("bus"); - - ret = USBNewRegexMatcher(®ex_matcher, regex_array, REG_ICASE | REG_EXTENDED); - if (ret == -1) { - fatal_with_errno(EXIT_FAILURE, "USBNewRegexMatcher"); - } else if (ret) { - fatalx(EXIT_FAILURE, "invalid regular expression: %s", regex_array[ret]); - } - /* link the matchers */ - regex_matcher->next = &subdriver_matcher; - - ret = usb->open(&udev, &usbdevice, regex_matcher, NULL); - if (ret < 0) - usb_open_error(port); - - /* create a new matcher for later reopening */ - ret = USBNewExactMatcher(&reopen_matcher, &usbdevice); - if (ret) { - fatal_with_errno(EXIT_FAILURE, "USBNewExactMatcher"); - } - /* link the matchers */ - reopen_matcher->next = regex_matcher; - - /* NOTE: This is here until ser_flush_io() is used in megatec.c */ - ser_flush_io(0); - - return 0; -} - -int ser_set_speed(int fd, const char *port, speed_t speed) -{ - return 0; -} - -int ser_set_dtr(int fd, int state) -{ - return 0; -} - -int ser_set_rts(int fd, int state) -{ - return 0; -} - -int ser_flush_io(int fd) -{ - char flush_buf[256]; - int i; - - /* flush input buffers */ - for (i = 0; i < 10; i++) { - if ((*get_data)(flush_buf, sizeof(flush_buf)) < 1) - break; - } - - return 0; -} - -void ser_comm_fail(const char *fmt, ...) -{ -} - -void ser_comm_good(void) -{ -} - -int ser_close(int fd, const char *port) -{ - usb->close(udev); - USBFreeExactMatcher(reopen_matcher); - USBFreeRegexMatcher(regex_matcher); - return 0; -} - -/*!@brief Try to reconnect once. - * @return 1 if reconnection was successful. - */ -static int reconnect_ups(void) -{ - int ret; - - upsdebugx(2, "=================================================="); - upsdebugx(2, "= device has been disconnected, try to reconnect ="); - upsdebugx(2, "=================================================="); - - usb->close(udev); - - ret = usb->open(&udev, &usbdevice, reopen_matcher, NULL); - if (ret < 1) { - upslogx(LOG_INFO, "Reconnecting to UPS failed; will retry later..."); - udev = NULL; - return 0; - } else - upslogx(LOG_NOTICE, "Successfully reconnected"); - - return ret; -} - -/*!@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 - */ -void usb_comm_fail(int res, const char *msg) -{ - switch(res) { - case -EBUSY: - upslogx(LOG_WARNING, "%s: Device claimed by another process", msg); - fatalx(EXIT_FAILURE, "Terminating: EBUSY"); - - default: - upslogx(LOG_WARNING, "%s: Device detached? (error %d: %s)", msg, res, usb_strerror()); - - if(reconnect_ups()) { - /* upsdrv_initinfo(); */ - } - break; - } -} - -int ser_send_pace(int fd, unsigned long d_usec, const char *fmt, ...) -{ - char buf[128]; - size_t len; - va_list ap; - int ret; - - if ((udev == NULL) && (! reconnect_ups())) - return -1; - - va_start(ap, fmt); - - len = vsnprintf(buf, sizeof(buf), fmt, ap); - - va_end(ap); - - if ((len < 1) || (len >= (int) sizeof(buf))) { - upslogx(LOG_WARNING, "ser_send_pace: vsnprintf needed more than %d bytes", (int) sizeof(buf)); - buf[sizeof(buf) - 1] = 0; - } - - ret = (*set_data)(buf); - if(ret < 0) { - usb_comm_fail(ret, "ser_send_pace"); - } - - return ret; -} - -int ser_get_line(int fd, void *buf, size_t buflen, char endchar, const char *ignset, long d_sec, long d_usec) -{ - int len; - char *src, *dst, c; - - if ((udev == NULL) && (! reconnect_ups())) - return -1; - - len = (*get_data)((char *)buf, buflen); - if (len < 0) { - usb_comm_fail(len, "ser_get_line"); - return len; - } - - dst = (char *)buf; - - for (src = (char *)buf; src != ((char *)buf + len); src++) { - c = *src; - - if (c == endchar) - break; - - if ((c == 0) || ((ignset != NULL) && (strchr(ignset, c) != NULL))) - continue; - - *(dst++) = c; - } - - /* terminate string if we have space */ - if (dst != ((char *)buf + len)) - *dst = 0; - - return (dst - (char *)buf); -} - -/************** minidrivers go after this point **************************/ - -/* - agiler-old subdriver -*/ -/* Protocol was reverse-engineered from Windows driver - HID tables are completely bogus - Data is transferred out as one 8-byte packet with report ID 0 - Data comes in as 6 8-byte reports per line , padded with zeroes - All constants are hardcoded in windows driver -*/ - -#define AGILER_REPORT_SIZE 8 -#define AGILER_REPORT_COUNT 6 -#define AGILER_TIMEOUT 5000 - -static int set_data_agiler_old(const char *str) -{ - unsigned char report_buf[AGILER_REPORT_SIZE]; - - if (strlen(str) > AGILER_REPORT_SIZE) { - upslogx(LOG_ERR, "set_data_agiler: output string too large"); - return -1; - } - - memset(report_buf, 0, sizeof(report_buf)); - memcpy(report_buf, str, strlen(str)); - - return usb->set_report(udev, 0, report_buf, sizeof(report_buf)); -} - -static int get_data_agiler_old(char *buffer, int buffer_size) -{ - int i, len; - char buf[AGILER_REPORT_SIZE * AGILER_REPORT_COUNT + 1]; - - memset(buf, 0, sizeof(buf)); - - for (i = 0; i < AGILER_REPORT_COUNT; i++) { - len = usb->get_interrupt(udev, (unsigned char *) buf + i * AGILER_REPORT_SIZE, AGILER_REPORT_SIZE, AGILER_TIMEOUT); - if (len != AGILER_REPORT_SIZE) { - if (len < 0) - len = 0; - buf[i * AGILER_REPORT_SIZE + len] = 0; - upsdebug_hex(5, "get_data_agiler: raw dump", buf, i * AGILER_REPORT_SIZE + len); - break; - } - } - - len = strlen(buf); - - if (len > buffer_size) { - upslogx(LOG_ERR, "get_data_agiler: input buffer too small"); - len = buffer_size; - } - - memcpy(buffer, buf, len); - return len; -} - - -/* - Agiler serial-to-usb device. -*/ - -static int set_data_agiler(const char *str) -{ - return usb->set_report(udev, 0, (unsigned char *)str, strlen(str)); -} - -static int get_data_agiler(char *buffer, int buffer_size) -{ - return usb->get_interrupt(udev, (unsigned char *)buffer, buffer_size, 1000); -} - - -/* - Phoenixtec Power Co serial-to-usb device. -*/ -static char phoenix_buffer[32]; - -static int set_data_phoenix(const char *str) -{ - unsigned int count; - - memset(phoenix_buffer, '\0', sizeof(phoenix_buffer)); - - snprintf(phoenix_buffer, sizeof(phoenix_buffer), "%s", str); - - if (!strcmp(phoenix_buffer, "I\r") || !strcmp(phoenix_buffer, "C\r")) { - /* Ignore these, since they seem to lock up the connection */ - return strlen(phoenix_buffer); - } - - for (count = 0; count < strlen(phoenix_buffer); count += 8) { - - if (usb->set_report(udev, 0, (unsigned char *)(phoenix_buffer + count), 8) < 1) { - return -1; - } - } - - return strlen(phoenix_buffer); -} - -static int get_data_phoenix(char *buffer, int buffer_size) -{ - int count; - - memset(buffer, '\0', buffer_size); - - if (!strcmp(phoenix_buffer, "I\r") || !strcmp(phoenix_buffer, "C\r")) { - /* Echo back unsupported commands */ - snprintf(buffer, buffer_size, "%s", phoenix_buffer); - return strlen(buffer); - } - - for (count = 8; count <= buffer_size; count += 8) { - - /* Read data in 8-byte chunks, break on a timeout */ - if (usb->get_interrupt(udev, (unsigned char *)&buffer[count-8], 8, 1000) < 0) { - return count-8; - } - - upsdebugx(3, "get_data_phoenix: got so far [%s]", buffer); - upsdebug_hex(4, "get_data_phoenix", (unsigned char *)buffer, count); - } - - upsdebugx(3, "get_data_phoenix: buffer too small"); - return -1; -} - - -/* - Krauler serial-over-usb device. - - Protocol was reverse-engineered using Windows driver. -*/ - -#define KRAULER_MAX_ATTEMPTS_Q1 4 -#define KRAULER_MAX_ATTEMPTS_F 31 -#define KRAULER_MAX_ATTEMPTS_I 15 - -typedef struct { - char *str; /* Megatec command */ - int index; /* Krauler string index for this command */ - char prefix; /* character to replace the first byte in reply */ - int retry; /* number of retries (1 is typically for instant commands) */ -} krauler_command_t; - -static krauler_command_t krauler_command_lst[] = { - { "T\r", 0x04, '\0', 1 }, - { "TL\r", 0x05, '\0', 1 }, - { "Q\r", 0x07, '\0', 1 }, - { "C\r", 0x0b, '\0', 1 }, - { "CT\r", 0x0b, '\0', 1 }, - { "Q1\r", 0x03, '(', KRAULER_MAX_ATTEMPTS_Q1 }, - { "I\r", 0x0c, '#', KRAULER_MAX_ATTEMPTS_I }, - { "F\r", 0x0d, '#', KRAULER_MAX_ATTEMPTS_F }, - { NULL, 0, '\0', 0 } -}; - -/* -Still not implemented: - 0x6 T (don't know how to pass the parameter) - 0x68 and 0x69 both cause shutdown after an undefined interval -*/ - - -/* an intermediate buffer for 1 command's output */ -static char krauler_line_buf[255]; -static char krauler_line_buf_len = 0; - -static int set_data_krauler(const char *str) -{ - krauler_command_t *command; - int retval = strlen(str); - - for (command = krauler_command_lst; command->str != NULL; command++) { - int retry; - - if (strcmp(str, command->str)) { - continue; - } - - upsdebugx(3, "set_data_krauler: index [%02x]", command->index); - - krauler_line_buf_len = 0; - for (retry = 0; retry < command->retry; retry++) { - int res; - - res = usb->get_string(udev, command->index, krauler_line_buf, sizeof(krauler_line_buf)); - if (res < 1) { - /* TODO: handle_error(res) */ - upsdebugx(2, "set_data_krauler: connection failure"); - return res; - } - - /* "UPS No Ack" has a special meaning */ - if (!strcmp(krauler_line_buf, "UPS No Ack")) { - upsdebugx(4, "set_data_krauler: retry [%s]", krauler_line_buf); - continue; - } - - /* Replace the first byte of what we received with the correct one */ - if(command->prefix) - krauler_line_buf[0] = command->prefix; - - krauler_line_buf_len = res; - return retval; - } - - if(command->retry > 1 && retry == command->retry) - upsdebugx(2, "set_data_krauler: too many attempts, the UPS is probably switched off!"); - - return retval; - } - - upsdebugx(4, "set_data_krauler: unknown command [%s]", str); - - /* echo the unknown command back */ - strcpy(krauler_line_buf, str); - krauler_line_buf_len = retval; - - return retval; -} - -static int get_data_krauler(char *buffer, int buffer_size) -{ - int retrieved = (buffer_size < krauler_line_buf_len) ? buffer_size : krauler_line_buf_len; - int left = krauler_line_buf_len - retrieved; - - memcpy(buffer, krauler_line_buf, retrieved); - memmove(krauler_line_buf, krauler_line_buf + retrieved, left); - krauler_line_buf_len = left; - - return retrieved; -} diff --git a/drivers/metasys.c b/drivers/metasys.c index 20d8950..6a0b2d2 100644 --- a/drivers/metasys.c +++ b/drivers/metasys.c @@ -94,7 +94,7 @@ long int get_long(unsigned char *buffer) { /* return a long integer reading 4 by return result; } -void send_zeros() { /* send 100 times the value 0x00.....it seems to be used for resetting */ +void send_zeros(void) { /* send 100 times the value 0x00.....it seems to be used for resetting */ unsigned char buf[100]; /* the ups serial port */ int i; diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c index d1e80a5..7b3d59e 100644 --- a/drivers/mge-hid.c +++ b/drivers/mge-hid.c @@ -26,7 +26,7 @@ #include "usbhid-ups.h" #include "mge-hid.h" -#define MGE_HID_VERSION "MGE HID 1.18" +#define MGE_HID_VERSION "MGE HID 1.19" /* (prev. MGE Office Protection Systems, prev. MGE UPS SYSTEMS) */ /* Eaton */ @@ -77,7 +77,7 @@ static char mge_scratch_buf[20]; /* 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 char *mge_date_conversion_fun(double value) +static const char *mge_date_conversion_fun(double value) { time_t sec = value; @@ -89,7 +89,7 @@ static char *mge_date_conversion_fun(double value) return NULL; } -static char *mge_time_conversion_fun(double value) +static const char *mge_time_conversion_fun(double value) { time_t sec = value; @@ -111,8 +111,6 @@ static double mge_date_conversion_nuf(const char *value) snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s %s", value, dstate_getinfo("ups.time")); if (strptime(mge_scratch_buf, "%Y/%m/%d %H:%M:%S", &mge_tm) != NULL) { - /* Ignore DST offset */ - mge_tm.tm_isdst = 0; return mktime(&mge_tm); } @@ -129,8 +127,6 @@ static double mge_time_conversion_nuf(const char *value) snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s %s", dstate_getinfo("ups.date"), value); if (strptime(mge_scratch_buf, "%Y/%m/%d %H:%M:%S", &mge_tm) != NULL) { - /* Ignore DST offset */ - mge_tm.tm_isdst = 0; return mktime(&mge_tm); } @@ -158,7 +154,7 @@ static info_lkp_t mge_time_conversion[] = { /* The HID path 'UPS.PowerSummary.ConfigVoltage' only reports 'battery.voltage.nominal' for specific UPS series. Ignore the value for other series (default behavior). */ -static char *mge_battery_voltage_nominal_fun(double value) +static const char *mge_battery_voltage_nominal_fun(double value) { switch (mge_type & 0xFF00) /* Ignore model byte */ { @@ -186,7 +182,7 @@ static info_lkp_t mge_battery_voltage_nominal[] = { /* The HID path 'UPS.PowerSummary.Voltage' only reports 'battery.voltage' for specific UPS series. Ignore the value for other series (default behavior). */ -static char *mge_battery_voltage_fun(double value) +static const char *mge_battery_voltage_fun(double value) { switch (mge_type & 0xFF00) /* Ignore model byte */ { @@ -206,7 +202,7 @@ static info_lkp_t mge_battery_voltage[] = { { 0, NULL, mge_battery_voltage_fun } }; -static char *mge_powerfactor_conversion_fun(double value) +static const char *mge_powerfactor_conversion_fun(double value) { snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%.2f", value / 100); return mge_scratch_buf; @@ -216,7 +212,7 @@ static info_lkp_t mge_powerfactor_conversion[] = { { 0, NULL, mge_powerfactor_conversion_fun } }; -static char *mge_battery_capacity_fun(double value) +static const char *mge_battery_capacity_fun(double value) { snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%.2f", value / 3600); return mge_scratch_buf; @@ -278,7 +274,7 @@ info_lkp_t mge_onbatt_info[] = { { 0, NULL, NULL } }; /* allow limiting to ups.model ~= Protection Station */ -static char *eaton_check_pegasus_fun(double value) +static const char *eaton_check_pegasus_fun(double value) { switch (mge_type & 0xFF00) /* Ignore model byte */ { @@ -301,7 +297,7 @@ static info_lkp_t pegasus_threshold_info[] = { }; /* Limit nominal output voltage according to HV or LV models */ -static char *nominal_output_voltage_fun(double value) +static const char *nominal_output_voltage_fun(double value) { static long nominal = -1; @@ -694,7 +690,7 @@ static hid_info_t mge_hid2nut[] = { "battery.capacity", 0, 0, "UPS.BatterySystem.Battery.DesignCapacity", NULL, "%s", HU_FLAG_STATIC, mge_battery_capacity }, /* conversion needed from As to Ah */ { "battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", 0, NULL }, { "battery.runtime.elapsed", 0, 0, "UPS.StatisticSystem.Input.[1].Statistic.[1].Time", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL }, - { "battery.temperature", 0, 0, "UPS.BatterySystem.Battery.Temperature", NULL, "%.1f", 0, NULL }, + { "battery.temperature", 0, 0, "UPS.BatterySystem.Battery.Temperature", NULL, "%s", 0, kelvin_celsius_conversion }, { "battery.type", 0, 0, "UPS.PowerSummary.iDeviceChemistry", NULL, "%s", HU_FLAG_STATIC, stringid_conversion }, { "battery.voltage", 0, 0, "UPS.BatterySystem.Voltage", NULL, "%.1f", 0, NULL }, { "battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%s", 0, mge_battery_voltage }, @@ -712,10 +708,10 @@ static hid_info_t mge_hid2nut[] = { "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}, - { "ups.test.result", 0, 0, "UPS.BatterySystem.Battery.Test", NULL, "%s", HU_FLAG_SEMI_STATIC, test_read_info }, + { "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 }, { "ups.beeper.status", 0 ,0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "%s", HU_FLAG_SEMI_STATIC, beeper_info }, - { "ups.temperature", 0, 0, "UPS.PowerSummary.Temperature", NULL, "%.1f", 0, NULL }, + { "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 }, { "ups.L1.power", 0, 0, "UPS.PowerConverter.Output.Phase.[1].ApparentPower", NULL, "%.0f", 0, NULL }, { "ups.L2.power", 0, 0, "UPS.PowerConverter.Output.Phase.[2].ApparentPower", NULL, "%.0f", 0, NULL }, @@ -941,7 +937,7 @@ static char *get_model_name(const char *iProduct, const char *iModel) return strdup(model->name); } -static char *mge_format_model(HIDDevice_t *hd) { +static const char *mge_format_model(HIDDevice_t *hd) { char product[SMALLBUF]; char model[SMALLBUF]; double value; @@ -969,11 +965,11 @@ static char *mge_format_model(HIDDevice_t *hd) { return hd->Product; } -static char *mge_format_mfr(HIDDevice_t *hd) { +static const char *mge_format_mfr(HIDDevice_t *hd) { return hd->Vendor ? hd->Vendor : "Eaton"; } -static char *mge_format_serial(HIDDevice_t *hd) { +static const char *mge_format_serial(HIDDevice_t *hd) { return hd->Serial; } diff --git a/drivers/mge-shut.c b/drivers/mge-shut.c index c01349f..92deb31 100644 --- a/drivers/mge-shut.c +++ b/drivers/mge-shut.c @@ -91,7 +91,7 @@ u_char raw_buf[4096]; float expo(int a, int b); extern long FormatValue(long Value, u_char Size); -static char *hu_find_infoval(info_lkp_t *hid2info, long value); +static const char *hu_find_infoval(info_lkp_t *hid2info, long value); /* --------------------------------------------------------------- */ /* UPS Driver Functions */ @@ -184,7 +184,7 @@ void upsdrv_initinfo (void) void upsdrv_updateinfo (void) { mge_info_item_t *item; - char *nutvalue; + const char *nutvalue; upsdebugx(2, "entering upsdrv_updateinfo()"); @@ -442,7 +442,7 @@ int shut_identify_ups () { char string[MAX_STRING]; char model[MAX_STRING]; - char *finalname = NULL; + const char *finalname = NULL; int retcode, tries=MAX_TRY; if (commstatus == 0) @@ -1308,7 +1308,7 @@ float expo(int a, int b) } /* Format model names */ -char *get_model_name(char *iProduct, char *iModel) +const char *get_model_name(char *iProduct, char *iModel) { models_name_t *model = NULL; @@ -1434,7 +1434,7 @@ mge_info_item_t *shut_find_info(const char *varname) } /* find the NUT value matching that HID Item value */ -static char *hu_find_infoval(info_lkp_t *hid2info, long value) +static const char *hu_find_infoval(info_lkp_t *hid2info, long value) { info_lkp_t *info_lkp; diff --git a/drivers/mge-shut.h b/drivers/mge-shut.h index 2a490e7..850be4d 100644 --- a/drivers/mge-shut.h +++ b/drivers/mge-shut.h @@ -156,9 +156,9 @@ typedef union device_desc_data_u { /* Model Name formating entries */ /* --------------------------------------------------------------- */ typedef struct { - char *iProduct; - char *iModel; - char *finalname; + const char *iProduct; + const char *iModel; + const char *finalname; } models_name_t; models_name_t models_names [] = @@ -269,7 +269,7 @@ models_name_t models_names [] = /* for lookup between HID values and NUT values*/ typedef struct { long hid_value; /* HID value */ - char *nut_value; /* NUT value */ + const char *nut_value; /* NUT value */ } info_lkp_t; /* Actual value lookup tables => should be fine for all Mfrs (TODO: validate it!) */ @@ -344,7 +344,7 @@ typedef struct { 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[6]; /* printf format string for INFO entry */ + 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 */ @@ -506,7 +506,7 @@ int shut_wait_ack (void); void shut_ups_status(void); int hid_init_device(void); -char *get_model_name(char *iProduct, char *iModel); +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); diff --git a/drivers/mge-utalk.c b/drivers/mge-utalk.c index 97bb048..c6114c7 100644 --- a/drivers/mge-utalk.c +++ b/drivers/mge-utalk.c @@ -64,7 +64,7 @@ /* --------------------------------------------------------------- */ #define DRIVER_NAME "MGE UPS SYSTEMS/U-Talk driver" -#define DRIVER_VERSION "0.89" +#define DRIVER_VERSION "0.92" /* driver description structure */ @@ -130,7 +130,6 @@ 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 int mge_command(char *reply, int replylen, const char *fmt, ...); -static void format_model_name(char *model); /* --------------------------------------------------------------- */ /* UPS Driver Functions */ @@ -218,17 +217,18 @@ void upsdrv_initups(void) void upsdrv_initinfo(void) { char buf[BUFFLEN]; - char *model = NULL; + const char *model = NULL; char *firmware = NULL; char *p; char *v = NULL; /* for parsing Si output, get Version ID */ int table; int tries; - int status_ok; + int status_ok = 0; 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]; int chars_rcvd; @@ -247,10 +247,10 @@ void upsdrv_initinfo(void) if(bytes_rcvd > 0 && buf[0] != '?') { dstate_setinfo("ups.id", "%s", buf); /* raw id */ - - model = buf; - p = strrchr(buf, ' '); + model = buf; + + p = strrchr(buf, ' '); if ( p != NULL ) { *p = '\0'; firmware = p+1; @@ -258,6 +258,16 @@ void upsdrv_initinfo(void) if( firmware && strlen(firmware) < 1 ) firmware = NULL; /* no firmware information */ + + /* Parsing model names table */ + for ( model_info = Si1_models_names ; model_info->basename != NULL ; model_info++ ) { + if(!strcasecmp(model_info->basename, model)) + { + model = model_info->finalname; + upsdebugx(1, "initinfo: UPS model == >%s<", model); + break; + } + } } else { @@ -286,12 +296,12 @@ void upsdrv_initinfo(void) si_data2 = atoi(v); } - /* Parsing legacy model table in order to found it */ - for ( legacy_model = mge_model ; legacy_model->name != NULL ; legacy_model++ ) { - if(legacy_model->Data1 == si_data1 && legacy_model->Data2 == si_data2){ - model = (char *)legacy_model->name; - upsdebugx(1, "initinfo: UPS model == >%s<", model); - break; + /* Parsing legacy model table in order to find it */ + for ( legacy_model = mge_model ; legacy_model->name != NULL ; legacy_model++ ) { + if(legacy_model->Data1 == si_data1 && legacy_model->Data2 == si_data2){ + model = legacy_model->name; + upsdebugx(1, "initinfo: UPS model == >%s<", model); + break; } } @@ -302,8 +312,14 @@ void upsdrv_initinfo(void) } if ( model ) { - format_model_name(model); - dstate_setinfo("ups.model", "%s", model); + upsdebugx(2, "Got model name: %s", model); + + /* deal with truncated model names */ + if (!strncmp(model, "Evolutio", 8)) { + dstate_setinfo("ups.model", "Evolution %i", atoi(strchr(model, ' '))); + } else { + dstate_setinfo("ups.model", "%s", model); + } } if ( firmware && strcmp(firmware, "")) @@ -328,8 +344,8 @@ void upsdrv_initinfo(void) * information (OL, OB, LB); all else is added later by updateinfo */ status_ok = get_ups_status(); - } while ( (!status_ok) && (tries++ < MAXTRIES) && (exit_flag != 0) ); - + } while ( (!status_ok) && (tries++ < MAXTRIES) && (exit_flag != 1) ); + if ( tries == MAXTRIES && !status_ok ) fatalx(EXIT_FAILURE, "Could not get status from UPS."); @@ -398,13 +414,15 @@ void upsdrv_updateinfo(void) /* update status */ status_ok = get_ups_status(); /* only sys status is critical */ - if ( !status_ok ) { - dstate_datastale(); + if ( !status_ok ) + { upslogx(LOG_NOTICE, "updateinfo: Cannot update system status"); /* try to re enable communication */ disable_ups_comm(); enable_ups_comm(); - } else { + } + else + { dstate_dataok(); } @@ -427,8 +445,8 @@ void upsdrv_updateinfo(void) dstate_setinfo(item->type, "%s", infostr); upsdebugx(2, "updateinfo: %s == >%s<", item->type, infostr); dstate_dataok(); - } else { - dstate_datastale(); + } else + { upslogx(LOG_NOTICE, "updateinfo: Cannot update %s", item->type); /* try to re enable communication */ disable_ups_comm(); @@ -479,17 +497,6 @@ void upsdrv_help(void) /* Internal Functions */ /* --------------------------------------------------------------- */ -/* deal with truncated model names */ -void format_model_name(char *model) -{ - upsdebugx(2, "Got model name: %s", model); - - if(!strncmp(model, "Evolutio", 8)) - sprintf(model, "Evolution %i", atoi(strchr(model, ' '))); -} - -/* --------------------------------------------------------------- */ - /* handler for commands to be sent to UPS */ int instcmd(const char *cmdname, const char *extra) { diff --git a/drivers/mge-utalk.h b/drivers/mge-utalk.h index 141d117..a90f815 100644 --- a/drivers/mge-utalk.h +++ b/drivers/mge-utalk.h @@ -45,8 +45,8 @@ /* Model Name formating entries */ /* --------------------------------------------------------------- */ typedef struct { - char *basename; /* as returned by Si 1 */ - char *finalname; + const char *basename; /* as returned by Si 1 */ + const char *finalname; } models_name_t; models_name_t Si1_models_names [] = @@ -189,8 +189,8 @@ 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 cmd[32]; /* UPS command string to requets element */ - const char fmt[32]; /* printf format string for INFO entry */ + 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 */ bool_t ok; /* flag indicating if item is available */ } mge_info_item_t; diff --git a/drivers/mge-xml.c b/drivers/mge-xml.c index f732ce0..c64f3eb 100644 --- a/drivers/mge-xml.c +++ b/drivers/mge-xml.c @@ -31,7 +31,7 @@ #include "netxml-ups.h" #include "mge-xml.h" -#define MGE_XML_VERSION "MGEXML/0.21" +#define MGE_XML_VERSION "MGEXML/0.22" #define MGE_XML_INITUPS "/" #define MGE_XML_INITINFO "/mgeups/product.xml /product.xml /ws/product.xml" @@ -507,6 +507,8 @@ static const char *mge_test_result_info(const char *val) return "in progress"; case 6: return "no test initiated"; + case 7: + return "test scheduled"; } return NULL; } @@ -516,7 +518,7 @@ static const char *mge_ambient_info(const char *val) switch (mge_ambient_value) { case 1: - return (char *)val; + return val; default: return NULL; } diff --git a/drivers/microdowell.c b/drivers/microdowell.c index cae925c..319edf1 100644 --- a/drivers/microdowell.c +++ b/drivers/microdowell.c @@ -90,7 +90,7 @@ static int CheckDataChecksum(unsigned char *Buff, int Len) } -static char *ErrMessages[] = { +static const char *ErrMessages[] = { /* 0 */ "errorcode NOT DEFINED", /* default error message */ /* 1 */ "I2C bus busy (e2prom)", /* 2 */ "Command received: checksum not valid", diff --git a/drivers/netvision-mib.c b/drivers/netvision-mib.c index b931d6c..e225d64 100644 --- a/drivers/netvision-mib.c +++ b/drivers/netvision-mib.c @@ -38,7 +38,7 @@ static info_lkp_t netvision_batt_info[] = { { 2, "" }, /* battery normal */ { 3, "LB" }, /* battery low */ { 4, "LB" }, /* battery depleted */ - { 5, "" }, /* battery discharging */ + { 5, "DISCHRG" }, /* battery discharging */ { 6, "RB" }, /* battery failure */ { 0, "NULL" } }; @@ -74,15 +74,16 @@ static info_lkp_t netvision_batt_info[] = { #define NETVISION_OID_OUTPUT_SOURCE ".1.3.6.1.4.1.4555.1.1.1.1.4.1.0" static info_lkp_t netvision_output_info[] = { - { 1, "NULL" }, /* output source other */ - { 2, "NULL" }, /* output source none */ + { 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, "NULL" }, /* output source standby */ - { 9, "NULL" }, /* output source ecomode */ + { 8, "" }, /* output source standby */ + { 9, "" }, /* output source ecomode */ + { 0, "NULL" } }; /* Snmp2NUT lookup table */ @@ -97,7 +98,7 @@ static snmp_info_t netvision_mib[] = { SU_FLAG_STATIC | SU_FLAG_OK, NULL }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, NETVISION_OID_BATTERYSTATUS, "", SU_FLAG_OK | SU_STATUS_BATT, &netvision_batt_info[0] }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, NETVISION_OID_BATTERYSTATUS, "", + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, NETVISION_OID_OUTPUT_SOURCE, "", SU_FLAG_OK | SU_STATUS_PWR, &netvision_output_info[0] }, /* ups load */ diff --git a/drivers/netxml-ups.h b/drivers/netxml-ups.h index 905effc..4729b7a 100644 --- a/drivers/netxml-ups.h +++ b/drivers/netxml-ups.h @@ -23,10 +23,10 @@ #include "nut_stdint.h" -struct subdriver_s { +typedef struct { const char *version; /* name of this subdriver */ - char *initups; - char *initinfo; + const char *initups; + const char *initinfo; char *configure; /* central configuration */ char *subscribe; /* alarm subscriptions */ char *summary; /* used for quick updates */ @@ -35,9 +35,7 @@ struct subdriver_s { int (*startelm_cb)(void *userdata, int parent, const char *nspace, const char *name, const char **atts); int (*cdata_cb)(void *userdata, int state, const char *cdata, size_t len); int (*endelm_cb)(void *userdata, int state, const char *nspace, const char *name); -}; - -typedef struct subdriver_s subdriver_t; +} subdriver_t; /* ---------------------------------------------------------------------- */ /* data for processing boolean values from UPS */ diff --git a/drivers/optiups.c b/drivers/optiups.c index 2703727..26b7f47 100644 --- a/drivers/optiups.c +++ b/drivers/optiups.c @@ -130,7 +130,7 @@ static ezfill_t _initv[] = { /* 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 int optireadline() +static inline int optireadline(void) { int r; usleep(150000); diff --git a/drivers/powercom-hid.c b/drivers/powercom-hid.c index f1da141..4cfd48c 100644 --- a/drivers/powercom-hid.c +++ b/drivers/powercom-hid.c @@ -50,7 +50,7 @@ static usb_device_id_t powercom_usb_device_table[] = { static char powercom_scratch_buf[32]; -static char *powercom_startup_fun(double value) +static const char *powercom_startup_fun(double value) { uint16_t i = value; @@ -76,7 +76,7 @@ static info_lkp_t powercom_startup_info[] = { { 0, NULL, powercom_startup_fun, powercom_startup_nuf } }; -static char *powercom_shutdown_fun(double value) +static const char *powercom_shutdown_fun(double value) { uint16_t i = value; @@ -258,15 +258,15 @@ static hid_info_t powercom_hid2nut[] = { { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } }; -static char *powercom_format_model(HIDDevice_t *hd) { +static const char *powercom_format_model(HIDDevice_t *hd) { return hd->Product; } -static char *powercom_format_mfr(HIDDevice_t *hd) { +static const char *powercom_format_mfr(HIDDevice_t *hd) { return hd->Vendor ? hd->Vendor : "PowerCOM"; } -static char *powercom_format_serial(HIDDevice_t *hd) { +static const char *powercom_format_serial(HIDDevice_t *hd) { return hd->Serial; } @@ -279,6 +279,12 @@ static int powercom_claim(HIDDevice_t *hd) switch (status) { case POSSIBLY_SUPPORTED: + if (hd->ProductID == 0x0002) { + upsdebugx(0, + "This Powercom device (%04x/%04x) is not supported by usbhid-ups.\n" + "Please use the 'powercom' driver instead.\n", hd->VendorID, hd->ProductID); + return 0; + } /* by default, reject, unless the productid option is given */ if (getval("productid")) { return 1; diff --git a/drivers/powercom.h b/drivers/powercom.h index 9a879ea..8209099 100644 --- a/drivers/powercom.h +++ b/drivers/powercom.h @@ -1,7 +1,7 @@ /* * powercom.h - defines for the newpowercom.c driver * - * $Id: powercom.h 2336 2010-02-11 20:16:43Z adkorte-guest $ + * $Id: powercom.h 2627 2010-10-26 21:09:34Z adkorte-guest $ * * Copyrights: * (C) 2002 Simon Rozman @@ -41,7 +41,7 @@ struct type { unsigned char num_of_bytes_from_ups; struct method_of_flow_control { - char *name; + const char *name; void (*setup_flow_control)(void); } flowControl; diff --git a/drivers/powerman-pdu.c b/drivers/powerman-pdu.c index b70caf5..e12340a 100644 --- a/drivers/powerman-pdu.c +++ b/drivers/powerman-pdu.c @@ -52,7 +52,7 @@ static int instcmd(const char *cmdname, const char *extra) pm_err_t rv = -1; char *cmdsuffix = NULL; char *cmdindex = NULL; - char *outletname = NULL; + char outletname[SMALLBUF]; upsdebugx(1, "entering instcmd (%s)", cmdname); @@ -69,7 +69,7 @@ static int instcmd(const char *cmdname, const char *extra) char buf[32]; cmdindex++; snprintf(buf, sizeof(buf), "outlet.%i.desc", atoi(cmdindex)); - outletname = (char *)dstate_getinfo(buf); + snprintf(outletname, sizeof(outletname), "%s", dstate_getinfo(buf)); } /* Power on the outlet */ diff --git a/drivers/powerp-bin.c b/drivers/powerp-bin.c index 69ebf94..b128369 100644 --- a/drivers/powerp-bin.c +++ b/drivers/powerp-bin.c @@ -118,6 +118,24 @@ static const valtab_t yes_no_info[] = { { NULL } }; +/* Older models report the model in a numeric format 'rOnn' */ +static const struct { + const char *val; + const char *model; +} modeltab[] = { + { "rO10", "OP1000AVR" }, + { "rO27", "OP320AVR" }, + { "rO29", "OP500AVR" }, + { "rO31", "OP800AVR" }, + { "rO33", "OP850AVR" }, + { "rO37", "OP900AVR" }, + { "rO39", "OP650AVR" }, + { "rO41", "OP700AVR" }, + { "rO43", "OP1250AVR" }, + { "rO45", "OP1500AVR" }, + { NULL } +}; + static const struct { const char *var; const char *get; @@ -300,7 +318,7 @@ static int powpan_setvar(const char *varname, const char *val) return STAT_SET_UNKNOWN; } -static void powpan_initinfo() +static void powpan_initinfo(void) { int i, j; char *s; @@ -313,7 +331,18 @@ static void powpan_initinfo() * was used for autodetection of the UPS. No need to do it again. */ if ((s = strtok((char *)&powpan_answer[1], ".")) != NULL) { - dstate_setinfo("ups.model", "%s", rtrim(s, ' ')); + for (i = 0; modeltab[i].val != NULL; i++) { + if (!strncmp(s, modeltab[i].val, strlen(modeltab[i].val))) { + break; + } + } + if (modeltab[i].model) { + /* model found in table */ + dstate_setinfo("ups.model", "%s", modeltab[i].model); + } else { + /* report model value as is */ + dstate_setinfo("ups.model", "%s", rtrim(s, ' ')); + } } if ((s = strtok(NULL, ".")) != NULL) { dstate_setinfo("input.voltage.nominal", "%d", (unsigned char)s[0]); @@ -429,7 +458,7 @@ static int powpan_status(status_t *status) return 0; } -static int powpan_updateinfo() +static int powpan_updateinfo(void) { status_t status; @@ -513,7 +542,7 @@ static int powpan_updateinfo() return (status.flags[0] & 0x80) ? 1 : 0; } -static int powpan_initups() +static int powpan_initups(void) { int ret, i; @@ -581,6 +610,11 @@ static int powpan_initups() type = OP; } + /* This is for an older model series, that reports the model numerically */ + if (!strncmp((char *)&powpan_answer[1], "rO", 2)) { + type = OP; + } + if (getval("ondelay")) { fatalx(EXIT_FAILURE, "Setting 'ondelay' not supported by %s driver", powpan_binary.version); } diff --git a/drivers/powerp-txt.c b/drivers/powerp-txt.c index b080c3b..48897d0 100644 --- a/drivers/powerp-txt.c +++ b/drivers/powerp-txt.c @@ -47,10 +47,10 @@ static int offdelay = 60; /* seconds */ static char powpan_answer[SMALLBUF]; -static const struct { - char *var; - char *get; - char *set; +static struct { + const char *var; + const char *get; + const char *set; } vartab[] = { { "input.transfer.high", "P6\r", "C2:%03d\r" }, { "input.transfer.low", "P7\r", "C3:%03d\r" }, @@ -58,9 +58,9 @@ static const struct { { NULL } }; -static const struct { - char *cmd; - char *command; +static struct { + const char *cmd; + const char *command; } cmdtab[] = { { "test.battery.start.quick", "T\r" }, { "test.battery.stop", "CT\r" }, @@ -208,7 +208,7 @@ static int powpan_setvar(const char *varname, const char *val) return STAT_SET_UNKNOWN; } -static void powpan_initinfo() +static void powpan_initinfo(void) { int i; char *s; @@ -410,7 +410,7 @@ static int powpan_status(status_t *status) return 0; } -static int powpan_updateinfo() +static int powpan_updateinfo(void) { status_t status; @@ -466,7 +466,7 @@ static int powpan_updateinfo() return (status.flags[0] & 0x40) ? 1 : 0; } -static int powpan_initups() +static int powpan_initups(void) { int ret, i; diff --git a/drivers/powerpanel.h b/drivers/powerpanel.h index 2188761..8e441ba 100644 --- a/drivers/powerpanel.h +++ b/drivers/powerpanel.h @@ -33,7 +33,7 @@ #define SER_WAIT_USEC 250000 typedef struct { - char *version; + const char *version; int (*instcmd)(const char *cmdname, const char *extra); int (*setvar)(const char *varname, const char *val); int (*initups)(void); diff --git a/drivers/powerware-mib.c b/drivers/powerware-mib.c index edb6cd4..6f2fb09 100644 --- a/drivers/powerware-mib.c +++ b/drivers/powerware-mib.c @@ -201,7 +201,7 @@ static snmp_info_t pw_mib[] = { 0, NULL }, { "battery.current", 0, 0.1, PW_OID_BATT_CURRENT, "", 0, NULL }, - { "battery.runtime.low", ST_FLAG_RW, 1.0, IETF_OID_CONF_RUNTIME_LOW, "", + { "battery.runtime.low", 0, 60.0, IETF_OID_CONF_RUNTIME_LOW, "", 0, NULL }, /* Output page */ diff --git a/drivers/rhino.c b/drivers/rhino.c index 870ed81..6839fde 100644 --- a/drivers/rhino.c +++ b/drivers/rhino.c @@ -128,11 +128,11 @@ static unsigned char EventosRede, EventosSaida, EventosBateria; // Grupo de Programação /* Methods */ -static void ScanReceivePack(); +static void ScanReceivePack(void); static int AutonomyCalc( int ); static void CommReceive(const unsigned char*, int ); -static void getbaseinfo(); -static void getupdateinfo(); +static void getbaseinfo(void); +static void getupdateinfo(void); static unsigned char RecPack[37]; @@ -550,7 +550,7 @@ static void getbaseinfo(void) int tam, i, j=0; time_t *tmt; struct tm *now; - char *Model; + const char *Model; tmt = ( time_t * ) malloc( sizeof( time_t ) ); time( tmt ); diff --git a/drivers/richcomm_usb.c b/drivers/richcomm_usb.c index 7177ee6..489650a 100644 --- a/drivers/richcomm_usb.c +++ b/drivers/richcomm_usb.c @@ -157,7 +157,7 @@ static void usb_comm_fail(const char *fmt, ...) upslogx(LOG_WARNING, "Communications with UPS lost: %s", why); } -static void usb_comm_good() +static void usb_comm_good(void) { if (comm_failures == 0) { return; diff --git a/drivers/safenet.c b/drivers/safenet.c index acdf7f0..392fa45 100644 --- a/drivers/safenet.c +++ b/drivers/safenet.c @@ -122,7 +122,7 @@ static int safenet_command(const char *command) return 0; } -static void safenet_update() +static void safenet_update(void) { status_init(); diff --git a/drivers/serial.c b/drivers/serial.c index 9c83a58..d709e5d 100644 --- a/drivers/serial.c +++ b/drivers/serial.c @@ -289,10 +289,11 @@ int ser_send_buf_pace(int fd, unsigned long d_usec, const void *buf, { int ret; size_t sent; + const char *data = buf; for (sent = 0; sent < buflen; sent += ret) { - ret = write(fd, &((char *)buf)[sent], (d_usec == 0) ? (buflen - sent) : 1); + ret = write(fd, &data[sent], (d_usec == 0) ? (buflen - sent) : 1); if (ret < 1) { return ret; @@ -321,12 +322,13 @@ int ser_get_buf_len(int fd, void *buf, size_t buflen, long d_sec, long d_usec) { int ret; size_t recv; + char *data = buf; memset(buf, '\0', buflen); for (recv = 0; recv < buflen; recv += ret) { - ret = select_read(fd, &((char *)buf)[recv], buflen - recv, d_sec, d_usec); + ret = select_read(fd, &data[recv], buflen - recv, d_sec, d_usec); if (ret < 1) { return ret; @@ -344,6 +346,7 @@ int ser_get_line_alert(int fd, void *buf, size_t buflen, char endchar, { int i, ret; char tmp[64]; + char *data = buf; size_t count = 0, maxcount; memset(buf, '\0', buflen); @@ -373,7 +376,7 @@ int ser_get_line_alert(int fd, void *buf, size_t buflen, char endchar, continue; } - ((char *)buf)[count++] = tmp[i]; + data[count++] = tmp[i]; } } diff --git a/drivers/skel.c b/drivers/skel.c index 2aa5cb7..4957bcd 100644 --- a/drivers/skel.c +++ b/drivers/skel.c @@ -10,7 +10,6 @@ and possibly also to: * docs/hid-subdrivers.txt for USB/HID devices * or docs/snmp-subdrivers.txt for SNMP devices - * or docs/megatec.txt for Megatec / Q1 devices */ #include "main.h" diff --git a/drivers/snmp-ups.c b/drivers/snmp-ups.c index cffbefb..d852dc5 100644 --- a/drivers/snmp-ups.c +++ b/drivers/snmp-ups.c @@ -3,7 +3,7 @@ * Based on NetSNMP API (Simple Network Management Protocol V1-2) * * Copyright (C) - * 2002 - 2008 Arnaud Quette + * 2002 - 2010 Arnaud Quette * 2002 - 2006 Dmitry Frolov * J.W. Hoogervorst * Niels Baggesen @@ -43,6 +43,7 @@ #include "raritan-pdu-mib.h" #include "baytech-mib.h" #include "compaq-mib.h" +#include "bestpower-mib.h" #include "ietf-mib.h" static mib2nut_info_t *mib2nut[] = { @@ -55,6 +56,7 @@ static mib2nut_info_t *mib2nut[] = { &raritan, &baytech, &compaq, + &bestpower, /* * Prepend vendor specific MIB mappings before IETF, so that * if a device supports both IETF and vendor specific MIB, @@ -65,6 +67,8 @@ static mib2nut_info_t *mib2nut[] = { NULL }; +int input_phases, output_phases, bypass_phases; + /* pointer to the Snmp2Nut lookup table */ mib2nut_info_t *mib2nut_info; /* FIXME: to be trashed */ @@ -75,7 +79,7 @@ const char *mibvers; static void disable_transfer_oids(void); #define DRIVER_NAME "Generic SNMP UPS driver" -#define DRIVER_VERSION "0.47" +#define DRIVER_VERSION "0.50" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -181,15 +185,27 @@ void upsdrv_makevartable(void) upsdebugx(1, "entering upsdrv_makevartable()"); addvar(VAR_VALUE, SU_VAR_MIBS, - "Set MIB compliance (default=ietf, allowed mge,apcc,netvision,pw,cpqpower)"); + "Set MIB compliance (default=ietf, allowed: mge,apcc,netvision,pw,cpqpower,...)"); addvar(VAR_VALUE | VAR_SENSITIVE, SU_VAR_COMMUNITY, - "Set community name (default=public)"); + "Set community name (default=public)"); addvar(VAR_VALUE, SU_VAR_VERSION, - "Set SNMP version (default=v1, allowed v2c)"); + "Set SNMP version (default=v1, allowed v2c)"); addvar(VAR_VALUE, SU_VAR_POLLFREQ, - "Set polling frequency in seconds, to reduce network flow (default=30)"); + "Set polling frequency in seconds, to reduce network flow (default=30)"); addvar(VAR_FLAG, "notransferoids", - "Disable transfer OIDs (use on APCC Symmetras)"); + "Disable transfer OIDs (use on APCC 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, + "Set the securityName used for authenticated SNMPv3 messages (no default)"); + 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)"); + 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) @@ -197,16 +213,15 @@ void upsdrv_initups(void) snmp_info_t *su_info_p; char model[SU_INFOSIZE]; bool_t status; - const char *community, *version, *mibs; + const char *mibs; upsdebugx(1, "SNMP UPS driver : entering upsdrv_initups()"); - community = testvar(SU_VAR_COMMUNITY) ? getval(SU_VAR_COMMUNITY) : "public"; - version = testvar(SU_VAR_VERSION) ? getval(SU_VAR_VERSION) : "v1"; + /* Retrieve user's parameters */ mibs = testvar(SU_VAR_MIBS) ? getval(SU_VAR_MIBS) : "auto"; /* init SNMP library, etc... */ - nut_snmp_init(progname, device_path, version, community); + nut_snmp_init(progname, device_path); /* FIXME: first test if the device is reachable to avoid timeouts! */ @@ -219,7 +234,7 @@ void upsdrv_initups(void) else pollfreq = DEFAULT_POLLFREQ; - /* Get UPS Model node to see if there's a MIB */ + /* Get UPS Model node to see if there's a MIB */ su_info_p = su_find_info("ups.model"); status = nut_snmp_get_str(su_info_p->OID, model, sizeof(model), NULL); @@ -228,7 +243,7 @@ void upsdrv_initups(void) model, device_path, mibname, mibvers); else fatalx(EXIT_FAILURE, "%s MIB wasn't found on %s", mibs, g_snmp_sess.peername); - /* No supported device detected */ + /* FIXME: "No supported device detected" */ } void upsdrv_cleanup(void) @@ -240,11 +255,13 @@ void upsdrv_cleanup(void) * SNMP functions. * ----------------------------------------------------------- */ -void nut_snmp_init(const char *type, const char *hostname, const char *version, - const char *community) +void nut_snmp_init(const char *type, const char *hostname) { - upsdebugx(2, "SNMP UPS driver : entering nut_snmp_init(%s, %s, %s, %s)", - type, hostname, version, community); + const char *community, *version; + const char *secLevel = NULL, *authPassword, *privPassword; + const char *authProtocol, *privProtocol; + + upsdebugx(2, "SNMP UPS driver : entering nut_snmp_init(%s)", type); /* Initialize the SNMP library */ init_snmp(type); @@ -253,17 +270,104 @@ void nut_snmp_init(const char *type, const char *hostname, const char *version, snmp_sess_init(&g_snmp_sess); g_snmp_sess.peername = xstrdup(hostname); - g_snmp_sess.community = (unsigned char *)xstrdup(community); - g_snmp_sess.community_len = strlen(community); - if (strcmp(version, "v1") == 0) - g_snmp_sess.version = SNMP_VERSION_1; - else if (strcmp(version, "v2c") == 0) - g_snmp_sess.version = SNMP_VERSION_2c; + + /* Retrieve user parameters */ + version = testvar(SU_VAR_VERSION) ? getval(SU_VAR_VERSION) : "v1"; + + 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"; + g_snmp_sess.community = (unsigned char *)xstrdup(community); + g_snmp_sess.community_len = strlen(community); + } + else if (strcmp(version, "v3") == 0) { + /* SNMP v3 related init */ + g_snmp_sess.version = SNMP_VERSION_3; + + /* Security level */ + if (testvar(SU_VAR_SECLEVEL)) { + secLevel = getval(SU_VAR_SECLEVEL); + + if (strcmp(secLevel, "noAuthNoPriv") == 0) + g_snmp_sess.securityLevel = SNMP_SEC_LEVEL_NOAUTH; + else if (strcmp(secLevel, "authNoPriv") == 0) + g_snmp_sess.securityLevel = SNMP_SEC_LEVEL_AUTHNOPRIV; + else if (strcmp(secLevel, "authPriv") == 0) + g_snmp_sess.securityLevel = SNMP_SEC_LEVEL_AUTHPRIV; + else + fatalx(EXIT_FAILURE, "Bad SNMPv3 securityLevel: %s", secLevel); + } + else + g_snmp_sess.securityLevel = SNMP_SEC_LEVEL_NOAUTH; + + /* Security name */ + if (testvar(SU_VAR_SECNAME)) { + g_snmp_sess.securityName = xstrdup(getval(SU_VAR_SECNAME)); + g_snmp_sess.securityNameLen = strlen(g_snmp_sess.securityName); + } + else + fatalx(EXIT_FAILURE, "securityName is required for SNMPv3"); + + /* Process mandatory fields, based on the security level */ + authPassword = testvar(SU_VAR_AUTHPASSWD) ? getval(SU_VAR_AUTHPASSWD) : NULL; + privPassword = testvar(SU_VAR_PRIVPASSWD) ? getval(SU_VAR_PRIVPASSWD) : NULL; + + switch (g_snmp_sess.securityLevel) { + case SNMP_SEC_LEVEL_AUTHNOPRIV: + if (authPassword == NULL) + fatalx(EXIT_FAILURE, "authPassword is required for SNMPv3 in %s mode", secLevel); + case SNMP_SEC_LEVEL_AUTHPRIV: + if ((authPassword == NULL) || (privPassword == NULL)) + fatalx(EXIT_FAILURE, "authPassword and privPassword are required for SNMPv3 in %s mode", secLevel); + default: + case SNMP_SEC_LEVEL_NOAUTH: + /* nothing else needed */ + break; + } + + /* Process authentication protocol and key */ + g_snmp_sess.securityAuthKeyLen = USM_AUTH_KU_LEN; + authProtocol = testvar(SU_VAR_AUTHPROT) ? getval(SU_VAR_AUTHPROT) : "MD5"; + + if (strcmp(authProtocol, "MD5") == 0) { + g_snmp_sess.securityAuthProto = usmHMACMD5AuthProtocol; + g_snmp_sess.securityAuthProtoLen = sizeof(usmHMACMD5AuthProtocol)/sizeof(oid); + } + else if (strcmp(authProtocol, "SHA") == 0) { + g_snmp_sess.securityAuthProto = usmHMACSHA1AuthProtocol; + g_snmp_sess.securityAuthProtoLen = sizeof(usmHMACSHA1AuthProtocol)/sizeof(oid); + } + else + 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 (generate_Ku(g_snmp_sess.securityAuthProto, + g_snmp_sess.securityAuthProtoLen, + (u_char *) privPassword, strlen(privPassword), + g_snmp_sess.securityAuthKey, + &g_snmp_sess.securityAuthKeyLen) != SNMPERR_SUCCESS) { + fatalx(EXIT_FAILURE, "Error generating Ku from authentication pass phrase"); + } + + privProtocol = testvar(SU_VAR_PRIVPROT) ? getval(SU_VAR_PRIVPROT) : "DES"; + + if (strcmp(privProtocol, "DES") == 0) { + g_snmp_sess.securityPrivProto = usmDESPrivProtocol; + g_snmp_sess.securityPrivProtoLen = sizeof(usmDESPrivProtocol)/sizeof(oid); + } + else if (strcmp(privProtocol, "AES") == 0) { + g_snmp_sess.securityPrivProto = usmAESPrivProtocol; + g_snmp_sess.securityPrivProtoLen = sizeof(usmAESPrivProtocol)/sizeof(oid); + } + else + fatalx(EXIT_FAILURE, "Bad SNMPv3 authProtocol: %s", authProtocol); + } else fatalx(EXIT_FAILURE, "Bad SNMP version: %s", version); /* Open the session */ - SOCK_STARTUP; /* wrapper not needed on Unix! */ + SOCK_STARTUP; /* MS Windows wrapper, not really needed on Unix! */ g_snmp_sess_p = snmp_open(&g_snmp_sess); /* establish the session */ if (g_snmp_sess_p == NULL) { nut_snmp_perror(&g_snmp_sess, 0, NULL, "nut_snmp_init: snmp_open"); @@ -767,7 +871,7 @@ int base_snmp_outlet_index(const char *OID_template) /* 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() +int base_nut_outlet_offset(void) { return (outlet_index_base==0)?1:0; } @@ -860,50 +964,86 @@ bool_t snmp_ups_walk(int mode) continue; if (su_info_p->flags & SU_INPHASES) { - upsdebugx(1, "Check inphases"); - if (input_phases == 0) continue; - upsdebugx(1, "inphases is set"); - if (su_info_p->flags & SU_INPUT_1) { - if (input_phases == 1) - su_info_p->flags &= ~SU_INPHASES; - else { - upsdebugx(1, "inphases is not 1"); - su_info_p->flags &= ~SU_FLAG_OK; - continue; - } + upsdebugx(1, "Check input_phases"); + if (input_phases == 0) { + continue; } - else if (su_info_p->flags & SU_INPUT_3) { - if (input_phases == 3) + 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, "inphases is not 3"); - su_info_p->flags &= ~SU_FLAG_OK; + } 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); } } if (su_info_p->flags & SU_OUTPHASES) { - upsdebugx(1, "Check outphases"); - if (output_phases == 0) continue; - upsdebugx(1, "outphases is set"); + upsdebugx(1, "Check output_phases"); + if (output_phases == 0) { + continue; + } if (su_info_p->flags & SU_OUTPUT_1) { - if (output_phases == 1) + if (output_phases == 1) { + upsdebugx(1, "output_phases is 1"); su_info_p->flags &= ~SU_OUTPHASES; - else { - upsdebugx(1, "outphases is not 1"); + } 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) + } 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, "outphases is not 3"); - su_info_p->flags &= ~SU_FLAG_OK; + } 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); + } + } + + 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); } } diff --git a/drivers/snmp-ups.h b/drivers/snmp-ups.h index ee3c0db..a42c15e 100644 --- a/drivers/snmp-ups.h +++ b/drivers/snmp-ups.h @@ -3,7 +3,7 @@ * Based on NET-SNMP API (Simple Network Management Protocol V1-2) * * Copyright (C) - * 2002-2008 Arnaud Quette + * 2002-2010 Arnaud Quette * 2002-2006 Dmitry Frolov * J.W. Hoogervorst * Niels Baggesen @@ -35,19 +35,19 @@ 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()... -- ... and use Net-SNMP lookup mecanism for OIDs (use string path, not numeric) - adjust information logging. -- move to numeric OIDs +- move numeric OIDs into th mib2nut tables and remove defines - move mib2nut into c files (à la usbhid-ups)? -- add a claim function and move to usbhid-ups style +- add a claim function and move to usbhid-ups style for specific processing - rework the flagging system */ #ifndef SNMP_UPS_H #define SNMP_UPS_H -/* workaround for buggy Net-SNMP config */ +/* FIXME: still needed? + * workaround for buggy Net-SNMP config */ #ifdef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif @@ -143,28 +143,39 @@ typedef struct { #define SU_STATUS_INDEX(t) (((t) >> 8) & 7) /* Phase specific data */ -#define SU_PHASES (0xF << 12) +#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 << 16) /* cast to int when setting value */ -#define SU_TYPE_STRING (1 << 16) /* cast to string. FIXME: redundant with ST_FLAG_STRING */ -#define SU_TYPE_TIME (2 << 16) /* cast to int */ -#define SU_TYPE_CMD (3 << 16) /* instant command */ -#define SU_TYPE(t) ((t)->flags & (7 << 16)) +#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)) #define SU_VAR_COMMUNITY "community" #define SU_VAR_VERSION "snmp_version" #define SU_VAR_MIBS "mibs" -#define SU_VAR_SDTYPE "sdtype" #define SU_VAR_POLLFREQ "pollfreq" +#define SU_VAR_SDTYPE "sdtype" +/* SNMP v3 related parameters */ +#define SU_VAR_SECLEVEL "secLevel" +#define SU_VAR_SECNAME "secName" +#define SU_VAR_AUTHPASSWD "authPassword" +#define SU_VAR_PRIVPASSWD "privPassword" +#define SU_VAR_AUTHPROT "authProtocol" +#define SU_VAR_PRIVPROT "privProtocol" + #define SU_INFOSIZE 128 #define SU_BUFSIZE 32 @@ -191,8 +202,7 @@ typedef struct { } mib2nut_info_t; /* Common SNMP functions */ -void nut_snmp_init(const char *type, const char *host, const char *version, - const char *community); +void nut_snmp_init(const char *type, const char *hostname); 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, @@ -230,7 +240,7 @@ struct snmp_session g_snmp_sess, *g_snmp_sess_p; const char *OID_pwr_status; int g_pwr_battery; int pollfreq; /* polling frequency */ -int input_phases, output_phases; +extern int input_phases, output_phases, bypass_phases; #endif /* SNMP_UPS_H */ diff --git a/drivers/solis.h b/drivers/solis.h index a9ed719..521d080 100644 --- a/drivers/solis.h +++ b/drivers/solis.h @@ -341,13 +341,13 @@ double Bat_LimInfRede, Bat_LimSupRede, Bat_LimInfInv, Bat_LimSupInv, Bat_VoltNom double AppPower, UtilPower, upscharge; int ChargePowerFactor, NominalPower, UpsPowerFactor; -static void prnInfo(); +static void prnInfo(void); static int IsToday( unsigned char, int ); static void AutonomyCalc( int ); -static void ScanReceivePack(); +static void ScanReceivePack(void); static void CommReceive(const char*, int ); -static void getbaseinfo(); -static void getupdateinfo(); +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 3c81a72..5fc88cd 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.4" +#define TRIPPLITE_HID_VERSION "TrippLite HID 0.6" /* FIXME: experimental flag to be put in upsdrv_info */ @@ -41,13 +41,13 @@ static double battery_scale = 1.0; /* Specific handlers for USB device matching */ -static void *battery_scale_1dot0() +static void *battery_scale_1dot0(void) { /* FIXME: we could remove this one since it's the default! */ battery_scale = 1.0; return NULL; } -static void *battery_scale_0dot1() +static void *battery_scale_0dot1(void) { battery_scale = 0.1; return NULL; @@ -67,25 +67,60 @@ static usb_device_id_t tripplite_usb_device_table[] = { { USB_DEVICE(TRIPPLITE_VENDORID, 0x1007), battery_scale_0dot1 }, /* e.g. TrippLite ECO550UPS */ { 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 OMNI1000LCD */ { USB_DEVICE(TRIPPLITE_VENDORID, 0x2005), battery_scale_0dot1 }, /* e.g. TrippLite OMNI900LCD */ { USB_DEVICE(TRIPPLITE_VENDORID, 0x2007), battery_scale_0dot1 }, + /* e.g. ? */ + { USB_DEVICE(TRIPPLITE_VENDORID, 0x2008), battery_scale_0dot1 }, + /* e.g. TrippLite Smart1000LCD */ + { USB_DEVICE(TRIPPLITE_VENDORID, 0x2009), battery_scale_0dot1 }, + /* e.g. ? */ + { USB_DEVICE(TRIPPLITE_VENDORID, 0x2010), battery_scale_0dot1 }, + { USB_DEVICE(TRIPPLITE_VENDORID, 0x2011), battery_scale_0dot1 }, + { USB_DEVICE(TRIPPLITE_VENDORID, 0x2012), battery_scale_0dot1 }, + { USB_DEVICE(TRIPPLITE_VENDORID, 0x2013), battery_scale_0dot1 }, + { USB_DEVICE(TRIPPLITE_VENDORID, 0x2014), battery_scale_0dot1 }, + { USB_DEVICE(TRIPPLITE_VENDORID, 0x3008), battery_scale_1dot0 }, + { USB_DEVICE(TRIPPLITE_VENDORID, 0x3009), battery_scale_1dot0 }, + { USB_DEVICE(TRIPPLITE_VENDORID, 0x3010), battery_scale_1dot0 }, + { USB_DEVICE(TRIPPLITE_VENDORID, 0x3011), battery_scale_1dot0 }, /* e.g. TrippLite smart2200RMXL2U */ { USB_DEVICE(TRIPPLITE_VENDORID, 0x3012), battery_scale_1dot0 }, /* e.g. ? */ + { USB_DEVICE(TRIPPLITE_VENDORID, 0x3013), battery_scale_1dot0 }, + /* e.g. ? */ { USB_DEVICE(TRIPPLITE_VENDORID, 0x3014), battery_scale_1dot0 }, + /* e.g. ? */ + { USB_DEVICE(TRIPPLITE_VENDORID, 0x3015), battery_scale_1dot0 }, /* e.g. TrippLite SmartOnline SU1500RTXL2UA (older unit?) */ { USB_DEVICE(TRIPPLITE_VENDORID, 0x4001), battery_scale_1dot0 }, /* e.g. TrippLite SmartOnline SU6000RT4U? */ { USB_DEVICE(TRIPPLITE_VENDORID, 0x4002), battery_scale_1dot0 }, /* e.g. TrippLite SmartOnline SU1500RTXL2ua */ { USB_DEVICE(TRIPPLITE_VENDORID, 0x4003), battery_scale_1dot0 }, + /* e.g. TrippLite SmartOnline SU1000XLA */ + { USB_DEVICE(TRIPPLITE_VENDORID, 0x4004), battery_scale_1dot0 }, + /* e.g. ? */ + { USB_DEVICE(TRIPPLITE_VENDORID, 0x4005), battery_scale_1dot0 }, + { USB_DEVICE(TRIPPLITE_VENDORID, 0x4006), battery_scale_1dot0 }, + { USB_DEVICE(TRIPPLITE_VENDORID, 0x4007), battery_scale_1dot0 }, + { USB_DEVICE(TRIPPLITE_VENDORID, 0x4008), battery_scale_1dot0 }, - /* HP R/T 2200 INTL (like SMART2200RMXL2U) */ - { USB_DEVICE(HP_VENDORID, 0x1f0a), battery_scale_1dot0 }, /* HP T750 INTL */ { USB_DEVICE(HP_VENDORID, 0x1f06), battery_scale_1dot0 }, + /* HP T1000 INTL */ + { USB_DEVICE(HP_VENDORID, 0x1f08), battery_scale_1dot0 }, + /* HP T1500 INTL */ + { USB_DEVICE(HP_VENDORID, 0x1f09), battery_scale_1dot0 }, + /* HP R/T 2200 INTL (like SMART2200RMXL2U) */ + { USB_DEVICE(HP_VENDORID, 0x1f0a), battery_scale_1dot0 }, + /* HP R1500 G2 INTL */ + { USB_DEVICE(HP_VENDORID, 0x1fe0), battery_scale_1dot0 }, + /* HP T750 G2 */ + { USB_DEVICE(HP_VENDORID, 0x1fe1), battery_scale_1dot0 }, /* Terminating entry */ { -1, -1, NULL } @@ -93,7 +128,7 @@ static usb_device_id_t tripplite_usb_device_table[] = { /* returns statically allocated string - must not use it again before done with result! */ -static char *tripplite_chemistry_fun(double value) +static const char *tripplite_chemistry_fun(double value) { static char buf[20]; const char *model; @@ -119,7 +154,7 @@ static info_lkp_t tripplite_chemistry[] = { /* returns statically allocated string - must not use it again before done with result! */ -static char *tripplite_battvolt_fun(double value) +static const char *tripplite_battvolt_fun(double value) { static char buf[8]; @@ -261,7 +296,8 @@ static hid_info_t tripplite_hid2nut[] = { { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.Buck", NULL, NULL, 0, trim_info }, { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.Boost", NULL, NULL, 0, boost_info }, { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.Overload", NULL, NULL, 0, overload_info }, - { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.Used", NULL, NULL, 0, nobattery_info }, + /* This is probably not the correct mapping for all models */ + /* { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.Used", NULL, NULL, 0, nobattery_info }, */ { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.OverTemperature", NULL, NULL, 0, overheat_info }, { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.InternalFailure", NULL, NULL, 0, commfault_info }, { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.AwaitingPower", NULL, NULL, 0, awaitingpower_info }, @@ -322,15 +358,15 @@ static hid_info_t tripplite_hid2nut[] = { { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } }; -static char *tripplite_format_model(HIDDevice_t *hd) { +static const char *tripplite_format_model(HIDDevice_t *hd) { return hd->Product; } -static char *tripplite_format_mfr(HIDDevice_t *hd) { +static const char *tripplite_format_mfr(HIDDevice_t *hd) { return hd->Vendor; } -static char *tripplite_format_serial(HIDDevice_t *hd) { +static const char *tripplite_format_serial(HIDDevice_t *hd) { return hd->Serial; } @@ -347,11 +383,16 @@ static int tripplite_claim(HIDDevice_t *hd) { switch (hd->VendorID) { - /* - * this vendor makes lots of USB devices that are - * not a UPS, so don't use possibly_supported here - */ case HP_VENDORID: + /* by default, reject, unless the productid option is given */ + if (getval("productid")) { + return 1; + } + + /* + * this vendor makes lots of USB devices that are + * not a UPS, so don't use possibly_supported here + */ return 0; case TRIPPLITE_VENDORID: diff --git a/drivers/tripplite.c b/drivers/tripplite.c index 517796e..78ef253 100644 --- a/drivers/tripplite.c +++ b/drivers/tripplite.c @@ -178,7 +178,7 @@ static int send_cmd(const char *str, char *buf, size_t len) return i; } -static void get_letter_cmd(char *str, char *buf, size_t len) +static void get_letter_cmd(const char *str, char *buf, size_t len) { int tries, ret; diff --git a/drivers/tripplite_usb.c b/drivers/tripplite_usb.c index 25ba65f..56061a7 100644 --- a/drivers/tripplite_usb.c +++ b/drivers/tripplite_usb.c @@ -130,7 +130,7 @@ POD ("Plain Old Documentation") - run through pod2html or perldoc. See perlpod(1) for more information. -pod2man --name='TRIPPLITE_USB' --section=8 --release='$Rev: 2336 $' --center='Network UPS Tools (NUT)' tripplite_usb.c +pod2man --name='TRIPPLITE_USB' --section=8 --release='$Rev: 2598 $' --center='Network UPS Tools (NUT)' tripplite_usb.c =head1 NAME @@ -489,7 +489,7 @@ static int hex2d(const unsigned char *start, unsigned int len) unsigned char buf[32]; buf[31] = '\0'; - strncpy((char *)buf, (char *)start, (len < (sizeof buf) ? len : (sizeof buf - 1))); + strncpy((char *)buf, (const char *)start, (len < (sizeof buf) ? len : (sizeof buf - 1))); if(len < sizeof(buf)) buf[len] = '\0'; return strtol((char *)buf, NULL, 16); } @@ -722,7 +722,7 @@ void debug_message(const char *msg, int len) snprintf(var_name, sizeof(var_name), "ups.debug.%c", *msg); - ret = send_cmd((unsigned char *)msg, len, tmp_value, sizeof(tmp_value)); + ret = send_cmd((const unsigned char *)msg, len, tmp_value, sizeof(tmp_value)); if(ret <= 0) { sprintf(err_msg, "Error reading '%c' value", *msg); usb_comm_fail(ret, err_msg); @@ -847,12 +847,12 @@ static int instcmd(const char *cmdname, const char *extra) if(tl_model == TRIPP_LITE_SMARTPRO || tl_model == TRIPP_LITE_SMART_0004) { if (!strcasecmp(cmdname, "test.battery.start")) { - send_cmd((unsigned char *)"A", 2, buf, sizeof buf); + send_cmd((const unsigned char *)"A", 2, buf, sizeof buf); return STAT_INSTCMD_HANDLED; } if(!strcasecmp(cmdname, "reset.input.minmax")) { - return (send_cmd((unsigned char *)"Z", 2, buf, sizeof buf) == 2) ? STAT_INSTCMD_HANDLED : STAT_INSTCMD_UNKNOWN; + return (send_cmd((const unsigned char *)"Z", 2, buf, sizeof buf) == 2) ? STAT_INSTCMD_HANDLED : STAT_INSTCMD_UNKNOWN; } } diff --git a/drivers/upscode2.c b/drivers/upscode2.c index b5e4e83..5f2e0b4 100644 --- a/drivers/upscode2.c +++ b/drivers/upscode2.c @@ -20,7 +20,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - $Id: upscode2.c 2350 2010-02-16 08:28:21Z adkorte-guest $ + $Id: upscode2.c 2391 2010-03-04 15:35:09Z adkorte-guest $ */ /* @@ -539,8 +539,7 @@ void upsdrv_initinfo(void) upslogx(LOG_ERR, "No contact with UPS, delaying init."); status = UPSC_STAT_NOTINIT; return; - } - else { + } else { status = 0; } @@ -549,10 +548,16 @@ void upsdrv_initinfo(void) upsc_flush_input(); upscsend("UPDA"); } - if (can_upid) + if (can_upid) { upsc_getvalue("UPID", NULL, "ACID", "ups.id", NULL); - if (can_uppm) + } + if (can_uppm) { check_uppm(); + } + + /* make sure we have some sensible defaults */ + setvar("ups.delay.shutdown", "10"); + setvar("ups.delay.reboot", "60"); upsh.instcmd = instcmd; upsh.setvar = setvar; @@ -870,27 +875,19 @@ void upsdrv_updateinfo(void) void upsdrv_shutdown(void) { - if (upsc_commandlist()) { - if (!can_upsd || !can_uppc) { - fatalx(LOG_EMERG, "Shutdown called, but UPS does not support it"); - } - } else { - upslogx(LOG_EMERG, "Can't determine if shutdown is supported, attempting anyway"); - } - - upslogx(LOG_EMERG, "Emergency shutdown"); - upscsend("UPSD"); /* Set shutdown delay */ - upscsend("1"); /* 1 second (lowest possible. 0 returns current.*/ - upslogx(LOG_EMERG, "Shutting down..."); - upscsend("UPPC"); /* Powercycle UPS */ - upscsend("IJHLDMGCIU"); /* security code */ + + /* send shutdown command twice, just to be sure */ + instcmd("shutdown.reboot", NULL); + sleep(1); + instcmd("shutdown.reboot", NULL); + sleep(1); } static int instcmd (const char *auxcmd, const char *data) { - cmd_t *cp = commands; + cmd_t *cp; if (!strcasecmp(auxcmd, "beeper.off")) { /* compatibility mode for old command */ @@ -907,17 +904,20 @@ static int instcmd (const char *auxcmd, const char *data) } upsdebugx(1, "Instcmd: %s %s", auxcmd, data ? data : "\"\""); - while (cp->cmd) { - if (strcmp(cp->cmd, auxcmd) == 0) { - upscsend(cp->upsc); - if (cp->upsp) - upscsend(cp->upsp); - else if (data) - upscsend(data); - return STAT_INSTCMD_HANDLED; + + for (cp = commands; cp->cmd; cp++) { + if (strcasecmp(cp->cmd, auxcmd)) { + continue; } - cp++; + upscsend(cp->upsc); + if (cp->upsp) { + upscsend(cp->upsp); + } else if (data) { + upscsend(data); + } + return STAT_INSTCMD_HANDLED; } + upslogx(LOG_INFO, "instcmd: unknown command %s", auxcmd); return STAT_INSTCMD_UNKNOWN; } @@ -925,16 +925,18 @@ static int instcmd (const char *auxcmd, const char *data) static int setvar (const char *var, const char *data) { - cmd_t *cp = variables; + cmd_t *cp; upsdebugx(1, "Setvar: %s %s", var, data); - while (cp->cmd) { - if (strcmp(cp->cmd, var) == 0) { - upsc_getvalue(cp->upsc, data, cp->upsp, cp->cmd, NULL); - return STAT_SET_HANDLED; + + for (cp = variables; cp->cmd; cp++) { + if (strcasecmp(cp->cmd, var)) { + continue; } - cp++; + upsc_getvalue(cp->upsc, data, cp->upsp, cp->cmd, NULL); + return STAT_SET_HANDLED; } + upslogx(LOG_INFO, "Setvar: unsettable variable %s", var); return STAT_SET_UNKNOWN; } @@ -1100,38 +1102,34 @@ static int upsc_commandlist(void) can_upsd = 1; else if (strcmp(buf, "UPPC") == 0) can_uppc = 1; - cp = commands; - while (cp->cmd) { + + for (cp = commands; cp->cmd; cp++) { if (cp->upsc && strcmp(cp->upsc, buf) == 0) { upsdebugx(1, "instcmd: %s %s", cp->cmd, cp->upsc); dstate_addcmd(cp->cmd); cp->enabled = 1; - break; + break; } - cp++; } - cp = variables; - while (cp->cmd) { + + for (cp = variables; cp->cmd; cp++) { if (cp->upsc && strcmp(cp->upsc, buf) == 0) { upsdebugx(1, "setvar: %s %s", cp->cmd, cp->upsc); cp->enabled = 1; break; } - cp++; } if (strcmp(buf, "UPCL") == 0) break; } - cp = variables; - while (cp->cmd) { + for (cp = variables; cp->cmd; cp++) { if (cp->enabled) { - upsc_getvalue(cp->upsc, "0", cp->upsp, cp->cmd, NULL); + upsc_getvalue(cp->upsc, "0000", cp->upsp, cp->cmd, NULL); dstate_setflags(cp->cmd, ST_FLAG_RW | ST_FLAG_STRING); dstate_setaux(cp->cmd, 7); } - cp++; } return 1; diff --git a/drivers/upsdrvctl.c b/drivers/upsdrvctl.c index f1a1646..623f753 100644 --- a/drivers/upsdrvctl.c +++ b/drivers/upsdrvctl.c @@ -38,18 +38,18 @@ typedef struct { void *next; } ups_t; -static ups_t *upstable = NULL; +static ups_t *upstable = NULL; -static int maxsdorder = 0, testmode = 0, exec_error = 0; +static int maxsdorder = 0, testmode = 0, exec_error = 0; /* timer - keeps us from getting stuck if a driver hangs */ -static int maxstartdelay = 45; +static int maxstartdelay = 45; /* Directory where driver executables live */ -static char *driverpath = NULL; +static char *driverpath = NULL; /* passthrough to the drivers: chroot path and new user name */ -static char *pt_root = NULL, *pt_user = NULL; +static char *pt_root = NULL, *pt_user = NULL; void do_upsconf_args(char *upsname, char *var, char *val) { @@ -123,7 +123,7 @@ static void stop_driver(const ups_t *ups) { char pidfn[SMALLBUF]; int ret; - struct stat fs; + struct stat fs; upsdebugx(1, "Stopping UPS: %s", ups->upsname); @@ -131,7 +131,7 @@ static void stop_driver(const ups_t *ups) ups->driver, ups->upsname); ret = stat(pidfn, &fs); - if (ret != 0) { + if ((ret != 0) && (ups->port != NULL)) { snprintf(pidfn, sizeof(pidfn), "%s/%s-%s.pid", altpidpath(), ups->driver, xbasename(ups->port)); ret = stat(pidfn, &fs); @@ -164,22 +164,20 @@ static void waitpid_timeout(const int sig) } /* print out a command line at the given debug level. */ -static void debugcmdline(int level, char *msg, char *cmd, char **argv) { - char cmdline[200]; +static void debugcmdline(int level, const char *msg, char *const argv[]) +{ + char cmdline[LARGEBUF]; + + snprintf(cmdline, sizeof(cmdline), "%s", msg); - cmdline[0] = 0; - strncat(cmdline, msg, 200-strlen(cmdline)); - strncat(cmdline, cmd, 200-strlen(cmdline)); - argv++; /* don't repeat command name */ while (*argv) { - strncat(cmdline, " ", 200-strlen(cmdline)); - strncat(cmdline, *argv, 200-strlen(cmdline)); - argv++; + snprintfcat(cmdline, sizeof(cmdline), " %s", *argv++); } + upsdebugx(level, "%s", cmdline); } -static void forkexec(const char *prog, char **argv, const ups_t *ups) +static void forkexec(char *const argv[], const ups_t *ups) { int ret; pid_t pid; @@ -239,7 +237,7 @@ static void forkexec(const char *prog, char **argv, const ups_t *ups) /* child */ - ret = execv(prog, argv); + ret = execv(argv[0], argv); /* shouldn't get here */ fatal_with_errno(EXIT_FAILURE, "execv"); @@ -247,9 +245,10 @@ static void forkexec(const char *prog, char **argv, const ups_t *ups) static void start_driver(const ups_t *ups) { - char dfn[SMALLBUF], *argv[8]; + char *argv[8]; + char dfn[SMALLBUF]; int ret, arg = 0; - struct stat fs; + struct stat fs; upsdebugx(1, "Starting UPS: %s", ups->upsname); @@ -260,29 +259,28 @@ static void start_driver(const ups_t *ups) fatal_with_errno(EXIT_FAILURE, "Can't start %s", dfn); argv[arg++] = dfn; - argv[arg++] = "-a"; + argv[arg++] = (char *)"-a"; /* FIXME: cast away const */ argv[arg++] = ups->upsname; /* stick on the chroot / user args if given to us */ if (pt_root) { - argv[arg++] = "-r"; + argv[arg++] = (char *)"-r"; /* FIXME: cast away const */ argv[arg++] = pt_root; } if (pt_user) { - argv[arg++] = "-u"; + argv[arg++] = (char *)"-u"; /* FIXME: cast away const */ argv[arg++] = pt_user; } /* tie it off */ argv[arg++] = NULL; - debugcmdline(2, "exec: ", dfn, argv); + debugcmdline(2, "exec: ", argv); - if (testmode) - return; - - forkexec(dfn, argv, ups); + if (!testmode) { + forkexec(argv, ups); + } } static void help(const char *progname) @@ -307,7 +305,8 @@ static void help(const char *progname) static void shutdown_driver(const ups_t *ups) { - char *argv[7], dfn[SMALLBUF]; + char *argv[9]; + char dfn[SMALLBUF]; int arg = 0; upsdebugx(1, "Shutdown UPS: %s", ups->upsname); @@ -315,29 +314,28 @@ static void shutdown_driver(const ups_t *ups) snprintf(dfn, sizeof(dfn), "%s/%s", driverpath, ups->driver); argv[arg++] = dfn; - argv[arg++] = "-a"; + argv[arg++] = (char *)"-a"; /* FIXME: cast away const */ argv[arg++] = ups->upsname; - argv[arg++] = "-k"; + argv[arg++] = (char *)"-k"; /* FIXME: cast away const */ /* stick on the chroot / user args if given to us */ if (pt_root) { - argv[arg++] = "-r"; + argv[arg++] = (char *)"-r"; /* FIXME: cast away const */ argv[arg++] = pt_root; } if (pt_user) { - argv[arg++] = "-u"; + argv[arg++] = (char *)"-u"; /* FIXME: cast away const */ argv[arg++] = pt_user; } argv[arg++] = NULL; - debugcmdline(2, "exec: ", dfn, argv); + debugcmdline(2, "exec: ", argv); - if (testmode) - return; - - forkexec(dfn, argv, ups); + if (!testmode) { + forkexec(argv, ups); + } } static void send_one_driver(void (*command)(const ups_t *), const char *upsname) diff --git a/drivers/usb-common.c b/drivers/usb-common.c index 10944a3..e51f3cf 100644 --- a/drivers/usb-common.c +++ b/drivers/usb-common.c @@ -210,7 +210,7 @@ static int compile_regex(regex_t **compiled, char *regex, int cflags) static int match_regex(regex_t *preg, char *str) { int r; - size_t len; + size_t len = 0; char *string; regmatch_t match; @@ -219,31 +219,28 @@ static int match_regex(regex_t *preg, char *str) } if (!str) { - str = ""; - } + string = xstrdup(""); + } else { + /* skip leading whitespace */ + for (len = 0; len < strlen(str); len++) { - /* skip leading whitespace */ - for (len = 0; len < strlen(str); len++) { - - if (!strchr(" \t\n", str[len])) { - break; + if (!strchr(" \t\n", str[len])) { + break; + } } - } - string = strdup(str+len); - if (!string) { - return -1; - } + string = xstrdup(str+len); - /* skip trailing whitespace */ - for (len = strlen(string); len > 0; len--) { + /* skip trailing whitespace */ + for (len = strlen(string); len > 0; len--) { - if (!strchr(" \t\n", string[len-1])) { - break; + if (!strchr(" \t\n", string[len-1])) { + break; + } } - } - string[len] = '\0'; + string[len] = '\0'; + } /* test the regular expression */ r = regexec(preg, string, 1, &match, 0); diff --git a/drivers/usbhid-ups.c b/drivers/usbhid-ups.c index 0cefb06..c925a81 100644 --- a/drivers/usbhid-ups.c +++ b/drivers/usbhid-ups.c @@ -27,7 +27,7 @@ */ #define DRIVER_NAME "Generic HID driver" -#define DRIVER_VERSION "0.34" +#define DRIVER_VERSION "0.35" #include "main.h" #include "libhid.h" @@ -45,6 +45,7 @@ #include "liebert-hid.h" #include "powercom-hid.h" #include "tripplite-hid.h" + #include "idowell-hid.h" #endif /* master list of avaiable subdrivers */ @@ -60,6 +61,7 @@ static subdriver_t *subdriver_list[] = { &liebert_subdriver, &powercom_subdriver, &tripplite_subdriver, + &idowell_subdriver, #endif NULL }; @@ -112,9 +114,9 @@ hid_dev_handle_t udev; /* support functions */ static hid_info_t *find_nut_info(const char *varname); static hid_info_t *find_hid_info(const HIDData_t *hiddata); -static char *hu_find_infoval(info_lkp_t *hid2info, const double value); +static const char *hu_find_infoval(info_lkp_t *hid2info, const double value); static long hu_find_valinfo(info_lkp_t *hid2info, const char* value); -static void process_boolean_info(char *nutvalue); +static void process_boolean_info(const char *nutvalue); static void ups_alarm_set(void); static void ups_status_set(void); static bool_t hid_ups_walk(walkmode_t mode); @@ -172,8 +174,8 @@ typedef enum { collected from the hardware; not yet converted to official NUT status or alarms */ typedef struct { - char *status_str; /* ups status string */ - 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[] = { @@ -382,6 +384,7 @@ info_lkp_t test_read_info[] = { { 4, "Aborted", NULL }, { 5, "In progress", NULL }, { 6, "No test initiated", NULL }, + { 7, "Test scheduled", NULL }, { 0, NULL, NULL } }; @@ -406,7 +409,7 @@ info_lkp_t on_off_info[] = { /* returns statically allocated string - must not use it again before done with result! */ -static char *date_conversion_fun(double value) +static const char *date_conversion_fun(double value) { static char buf[20]; int year, month, day; @@ -430,7 +433,7 @@ info_lkp_t date_conversion[] = { /* returns statically allocated string - must not use it again before done with result! */ -static char *hex_conversion_fun(double value) +static const char *hex_conversion_fun(double value) { static char buf[20]; @@ -445,7 +448,7 @@ info_lkp_t hex_conversion[] = { /* returns statically allocated string - must not use it again before done with result! */ -static char *stringid_conversion_fun(double value) +static const char *stringid_conversion_fun(double value) { static char buf[20]; @@ -458,7 +461,7 @@ info_lkp_t stringid_conversion[] = { /* returns statically allocated string - must not use it again before done with result! */ -static char *divide_by_10_conversion_fun(double value) +static const char *divide_by_10_conversion_fun(double value) { static char buf[20]; @@ -473,7 +476,7 @@ info_lkp_t divide_by_10_conversion[] = { /* returns statically allocated string - must not use it again before done with result! */ -static char *kelvin_celsius_conversion_fun(double value) +static const char *kelvin_celsius_conversion_fun(double value) { static char buf[20]; @@ -773,7 +776,7 @@ void upsdrv_updateinfo(void) continue; if (nut_debug_level >= 2) { - upsdebugx(2, "Path: %s, Type: %s, ReportID: 0x%02x, Offset: %i, Size: %i, Value: %f", + 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); @@ -984,7 +987,7 @@ void possibly_supported(const char *mfr, HIDDevice_t *hd) /* Update ups_status to remember this status item. Interpretation is done in ups_status_set(). */ -static void process_boolean_info(char *nutvalue) +static void process_boolean_info(const char *nutvalue) { status_lkp_t *status_item; int clear = 0; @@ -1016,7 +1019,7 @@ static void process_boolean_info(char *nutvalue) static int callback(hid_dev_handle_t udev, HIDDevice_t *hd, unsigned char *rdbuf, int rdlen) { int i; - char *mfr = NULL, *model = NULL, *serial = NULL; + const char *mfr = NULL, *model = NULL, *serial = NULL; #ifndef SHUT_MODE int ret; #endif @@ -1232,7 +1235,7 @@ static bool_t hid_ups_walk(walkmode_t mode) continue; } - upsdebugx(2, "Path: %s, Type: %s, ReportID: 0x%02x, Offset: %i, Size: %i, Value: %f", + 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); @@ -1451,7 +1454,7 @@ static long hu_find_valinfo(info_lkp_t *hid2info, const char* value) } /* find the NUT value matching that HID Item value */ -static char *hu_find_infoval(info_lkp_t *hid2info, const double value) +static const char *hu_find_infoval(info_lkp_t *hid2info, const double value) { info_lkp_t *info_lkp; @@ -1475,7 +1478,7 @@ static char *hu_find_infoval(info_lkp_t *hid2info, const double value) /* return -1 on failure, 0 for a status update and 1 in all other cases */ static int ups_infoval_set(hid_info_t *item, double value) { - char *nutvalue; + const char *nutvalue; /* need lookup'ed translation? */ if (item->hid2info != NULL){ diff --git a/drivers/usbhid-ups.h b/drivers/usbhid-ups.h index a2c94d5..96bce48 100644 --- a/drivers/usbhid-ups.h +++ b/drivers/usbhid-ups.h @@ -59,9 +59,9 @@ extern bool_t use_interrupt_pipe; /* Set to FALSE if interrupt reports should /* --------------------------------------------------------------- */ typedef struct { - long hid_value; /* HID value */ - char *nut_value; /* NUT value */ - char *(*fun)(double hid_value); /* optional HID to NUT mapping */ + const long hid_value; /* HID value */ + const char *nut_value; /* NUT value */ + const char *(*fun)(double hid_value); /* optional HID to NUT mapping */ double (*nuf)(const char *nut_value); /* optional NUT to HID mapping */ } info_lkp_t; @@ -115,13 +115,13 @@ extern info_lkp_t kelvin_celsius_conversion[]; /* --------------------------------------------------------------- */ typedef struct { - char *info_type; /* NUT variable name */ + const char *info_type; /* NUT variable name */ int info_flags; /* NUT flags (to set in addinfo) */ int info_len; /* if ST_FLAG_STRING: length of the string */ /* if HU_TYPE_CMD: command value */ - char *hidpath; /* Full HID Object path (or NULL for server side vars) */ + const char *hidpath; /* Full HID Object path (or NULL for server side vars) */ HIDData_t *hiddata; /* Full HID Object data (for caching purpose, filled at runtime) */ - char *dfl; /* if HU_FLAG_ABSENT: default value ; format otherwise */ + const char *dfl; /* if HU_FLAG_ABSENT: default value ; format otherwise */ unsigned long hidflags; /* driver's own flags */ info_lkp_t *hid2info; /* lookup table between HID and NUT values */ /* if HU_FLAG_ENUM is set, hid2info is also used @@ -158,17 +158,16 @@ typedef struct { * particular manufacturer (e.g. MGE, APC, Belkin), or a particular * range of models. */ -struct subdriver_s { - char *name; /* name of this subdriver */ +typedef struct { + const char *name; /* name of this subdriver */ int (*claim)(HIDDevice_t *hd); /* return 1 if device covered by * this subdriver */ usage_tables_t *utab; /* points to array of usage tables */ hid_info_t *hid2nut; /* main table of vars and instcmds */ - char *(*format_model)(HIDDevice_t *hd); /* driver-specific methods */ - char *(*format_mfr)(HIDDevice_t *hd); /* for preparing human- */ - char *(*format_serial)(HIDDevice_t *hd); /* readable information */ -}; -typedef struct subdriver_s subdriver_t; + const char *(*format_model)(HIDDevice_t *hd); /* driver-specific methods */ + const char *(*format_mfr)(HIDDevice_t *hd); /* for preparing human- */ + const char *(*format_serial)(HIDDevice_t *hd); /* readable information */ +} subdriver_t; /* the following functions are exported for the benefit of subdrivers */ int instcmd(const char *cmdname, const char *extradata); diff --git a/include/Makefile.in b/include/Makefile.in index 18004c8..81a05c6 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -38,12 +38,13 @@ subdir = include DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/config.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -53,6 +54,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -65,9 +67,11 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -80,8 +84,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -98,7 +104,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -109,22 +114,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ diff --git a/include/common.h b/include/common.h index c253a3d..431751c 100644 --- a/include/common.h +++ b/include/common.h @@ -104,6 +104,7 @@ void fatalx(int status, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))) __attribute__((noreturn)); extern int nut_debug_level; +extern int nut_log_level; void *xmalloc(size_t size); void *xcalloc(size_t number, size_t size); diff --git a/include/config.h.in b/include/config.h.in index d6bf20c..e2df661 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -30,10 +30,7 @@ MSVC and with C++ compilers. */ #undef FLEXIBLE_ARRAY_MEMBER -/* HAL device match key */ -#undef HAL_DEVICE_MATCH_KEY - -/* HAL user */ +/* addons run as user */ #undef HAL_USER /* Define to 1 if you have the `atexit' function. */ @@ -45,6 +42,13 @@ /* Define to 1 if C supports variable-length arrays. */ #undef HAVE_C_VARARRAYS +/* 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. */ +#undef HAVE_DECL_LOG_UPTO + /* Define to 1 if you have the declaration of `optind', and to 0 if you don't. */ #undef HAVE_DECL_OPTIND @@ -73,29 +77,23 @@ /* Define to 1 if you have the `flock' function. */ #undef HAVE_FLOCK -/* Define to 1 if you have the `freeaddrinfo' function. */ -#undef HAVE_FREEADDRINFO - /* Define to 1 if you have the header file. */ #undef HAVE_GDFONTMB_H /* Define to 1 if you have the header file. */ #undef HAVE_GD_H -/* Define to 1 if you have the `getaddrinfo' function. */ -#undef HAVE_GETADDRINFO - /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have the `getpassphrase' function. */ #undef HAVE_GETPASSPHRASE -/* Define to 1 if GLib is version 2.14 or newer */ -#undef HAVE_GLIB_2_14 +/* Define to 1 if you have the header file. */ +#undef HAVE_GLIB_H -/* Define to 1 if you have the `inet_aton' function. */ -#undef HAVE_INET_ATON +/* 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 @@ -103,9 +101,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H -/* Define to enable IPv6 support */ -#undef HAVE_IPV6 - /* Define if you have Boutell's libgd installed */ #undef HAVE_LIBGD @@ -160,6 +155,9 @@ /* Define to 1 if you have the `seteuid' function. */ #undef HAVE_SETEUID +/* Define to 1 if you have the `setlogmask' function. */ +#undef HAVE_SETLOGMASK + /* Define to 1 if you have the `setsid' function. */ #undef HAVE_SETSID @@ -193,18 +191,6 @@ /* Define to 1 if you have the `strptime' function. */ #undef HAVE_STRPTIME -/* Define to 1 if the system has the type `struct addrinfo'. */ -#undef HAVE_STRUCT_ADDRINFO - -/* Define to 1 if the system has the type `struct in6_addr'. */ -#undef HAVE_STRUCT_IN6_ADDR - -/* Define to 1 if the system has the type `struct sockaddr_in6'. */ -#undef HAVE_STRUCT_SOCKADDR_IN6 - -/* Define to 1 if the system has the type `struct sockaddr_storage'. */ -#undef HAVE_STRUCT_SOCKADDR_STORAGE - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MODEM_H diff --git a/include/extstate.h b/include/extstate.h index 930696e..cb178c3 100644 --- a/include/extstate.h +++ b/include/extstate.h @@ -12,15 +12,15 @@ #define ST_FLAG_IMMUTABLE 0x0004 /* list of possible ENUM values */ -struct enum_t { +typedef struct enum_s { char *val; - struct enum_t *next; -}; + struct enum_s *next; +} enum_t; /* list of instant commands */ -struct cmdlist_t { +typedef struct cmdlist_s { char *name; - struct cmdlist_t *next; -}; + struct cmdlist_s *next; +} cmdlist_t; #endif /* EXTSTATE_H_SEEN */ diff --git a/include/nut_version.h b/include/nut_version.h index 3eb406e..b830a50 100644 --- a/include/nut_version.h +++ b/include/nut_version.h @@ -1,3 +1,3 @@ /* Autogenerated file. Do not change. */ /* This file was generated by "make". */ -#define NUT_VERSION_MACRO "2.4.3-2365:2366" +#define NUT_VERSION_MACRO "2.6.0-2831:2832" diff --git a/include/parseconf.h b/include/parseconf.h index 844134d..00d4d8d 100644 --- a/include/parseconf.h +++ b/include/parseconf.h @@ -21,7 +21,9 @@ #define PARSECONF_H_SEEN 1 #ifdef __cplusplus +/* *INDENT-OFF* */ extern "C" { +/* *INDENT-ON* */ #endif #define PCONF_CTX_t_MAGIC 0x00726630 @@ -69,7 +71,9 @@ char *pconf_encode(const char *src, char *dest, size_t destsize); int pconf_char(PCONF_CTX_t *ctx, char ch); #ifdef __cplusplus +/* *INDENT-OFF* */ } +/* *INDENT-ON* */ #endif #endif /* PARSECONF_H_SEEN */ diff --git a/include/state.h b/include/state.h index f86a957..cb1814e 100644 --- a/include/state.h +++ b/include/state.h @@ -17,11 +17,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef STATE_H_SEEN +#define STATE_H_SEEN + #include "extstate.h" #define ST_SOCK_BUF_LEN 512 -struct st_tree_t { +typedef struct st_tree_s { char *var; char *val; /* points to raw or safe */ @@ -34,24 +37,26 @@ struct st_tree_t { int flags; int aux; - struct enum_t *enum_list; + struct enum_s *enum_list; - struct st_tree_t *left; - struct st_tree_t *right; -}; + struct st_tree_s *left; + struct st_tree_s *right; +} st_tree_t; -int state_setinfo(struct st_tree_t **nptr, const char *var, const char *val); -int state_addenum(struct st_tree_t *root, const char *var, const char *val); -int state_setaux(struct st_tree_t *root, const char *var, const char *auxs); -const char *state_getinfo(struct st_tree_t *root, const char *var); -int state_getflags(struct st_tree_t *root, const char *var); -int state_getaux(struct st_tree_t *root, const char *var); -const struct enum_t *state_getenumlist(struct st_tree_t *root, const char *var); -void state_setflags(struct st_tree_t *root, const char *var, int numflags, char **flags); -int state_addcmd(struct cmdlist_t **list, const char *cmd); -void state_infofree(struct st_tree_t *node); -void state_cmdfree(struct cmdlist_t *list); -int state_delcmd(struct cmdlist_t **list, const char *cmd); -int state_delinfo(struct st_tree_t **root, const char *var); -int state_delenum(struct st_tree_t *root, const char *var, const char *val); -struct st_tree_t *state_tree_find(struct st_tree_t *node, const char *var); +int state_setinfo(st_tree_t **nptr, const char *var, const char *val); +int state_addenum(st_tree_t *root, const char *var, const char *val); +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); +int state_getaux(st_tree_t *root, const char *var); +const enum_t *state_getenumlist(st_tree_t *root, const char *var); +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); +int state_delcmd(cmdlist_t **list, const char *cmd); +int state_delinfo(st_tree_t **root, const char *var); +int state_delenum(st_tree_t *root, const char *var, const char *val); +st_tree_t *state_tree_find(st_tree_t *node, const char *var); + +#endif /* STATE_H_SEEN */ diff --git a/install-sh b/install-sh index a5897de..6781b98 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2006-12-25.00 +scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -515,5 +515,6 @@ done # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff --git a/lib/Makefile.in b/lib/Makefile.in index 233ad28..e3e5b8a 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -42,12 +42,13 @@ subdir = lib DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/libupsclient-config.in $(srcdir)/libupsclient.pc.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -57,6 +58,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -93,9 +95,11 @@ SOURCES = DIST_SOURCES = DATA = $(pkgconfig_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -108,8 +112,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -126,7 +132,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -137,22 +142,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ diff --git a/ltmain.sh b/ltmain.sh index 3506ead..7ed280b 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,6 +1,6 @@ # Generated from ltmain.m4sh. -# ltmain.sh (GNU libtool) 2.2.6 +# ltmain.sh (GNU libtool) 2.2.6b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. @@ -65,7 +65,7 @@ # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.2.6 Debian-2.2.6a-4 +# $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # @@ -73,9 +73,9 @@ PROGRAM=ltmain.sh PACKAGE=libtool -VERSION="2.2.6 Debian-2.2.6a-4" +VERSION="2.2.6b Debian-2.2.6b-2ubuntu1" TIMESTAMP="" -package_revision=1.3012 +package_revision=1.3017 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then diff --git a/m4/ax_compare_version.m4 b/m4/ax_compare_version.m4 new file mode 100755 index 0000000..74dc0fd --- /dev/null +++ b/m4/ax_compare_version.m4 @@ -0,0 +1,177 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_compare_version.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# +# DESCRIPTION +# +# This macro compares two version strings. Due to the various number of +# minor-version numbers that can exist, and the fact that string +# comparisons are not compatible with numeric comparisons, this is not +# necessarily trivial to do in a autoconf script. This macro makes doing +# these comparisons easy. +# +# The six basic comparisons are available, as well as checking equality +# limited to a certain number of minor-version levels. +# +# The operator OP determines what type of comparison to do, and can be one +# of: +# +# eq - equal (test A == B) +# ne - not equal (test A != B) +# le - less than or equal (test A <= B) +# ge - greater than or equal (test A >= B) +# lt - less than (test A < B) +# gt - greater than (test A > B) +# +# Additionally, the eq and ne operator can have a number after it to limit +# the test to that number of minor versions. +# +# eq0 - equal up to the length of the shorter version +# ne0 - not equal up to the length of the shorter version +# eqN - equal up to N sub-version levels +# neN - not equal up to N sub-version levels +# +# When the condition is true, shell commands ACTION-IF-TRUE are run, +# otherwise shell commands ACTION-IF-FALSE are run. The environment +# variable 'ax_compare_version' is always set to either 'true' or 'false' +# as well. +# +# Examples: +# +# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8]) +# AX_COMPARE_VERSION([3.15],[lt],[3.15.8]) +# +# would both be true. +# +# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8]) +# AX_COMPARE_VERSION([3.15],[gt],[3.15.8]) +# +# would both be false. +# +# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8]) +# +# would be true because it is only comparing two minor versions. +# +# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15]) +# +# would be true because it is only comparing the lesser number of minor +# versions of the two values. +# +# Note: The characters that separate the version numbers do not matter. An +# empty string is the same as version 0. OP is evaluated by autoconf, not +# configure, so must be a string, not a variable. +# +# The author would like to acknowledge Guido Draheim whose advice about +# the m4_case and m4_ifvaln functions make this macro only include the +# portions necessary to perform the specific comparison specified by the +# OP argument in the final configure script. +# +# LICENSE +# +# Copyright (c) 2008 Tim Toolan +# +# 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 11 + +dnl ######################################################################### +AC_DEFUN([AX_COMPARE_VERSION], [ + AC_REQUIRE([AC_PROG_AWK]) + + # 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. + AS_VAR_PUSHDEF([A],[ax_compare_version_A]) + A=`echo "$1" | 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'` + + AS_VAR_PUSHDEF([B],[ax_compare_version_B]) + B=`echo "$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'` + + dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary + dnl # then the first line is used to determine if the condition is true. + dnl # The sed right after the echo is to remove any indented white space. + m4_case(m4_tolower($2), + [lt],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"` + ], + [gt],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"` + ], + [le],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"` + ], + [ge],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"` + ],[ + dnl Split the operator from the subversion count if present. + m4_bmatch(m4_substr($2,2), + [0],[ + # A count of zero means use the length of the shorter version. + # Determine the number of characters in A and B. + ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'` + ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'` + + # Set A to no more than B's length and B to no more than A's length. + A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"` + B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"` + ], + [[0-9]+],[ + # A count greater than zero means use only that many subversions + A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` + B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` + ], + [.+],[ + AC_WARNING( + [illegal OP numeric parameter: $2]) + ],[]) + + # Pad zeros at end of numbers to make same length. + ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`" + B="$B`echo $A | sed 's/./0/g'`" + A="$ax_compare_version_tmp_A" + + # Check for equality or inequality as necessary. + m4_case(m4_tolower(m4_substr($2,0,2)), + [eq],[ + test "x$A" = "x$B" && ax_compare_version=true + ], + [ne],[ + test "x$A" != "x$B" && ax_compare_version=true + ],[ + AC_WARNING([illegal OP parameter: $2]) + ]) + ]) + + AS_VAR_POPDEF([A])dnl + AS_VAR_POPDEF([B])dnl + + dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE. + if test "$ax_compare_version" = "true" ; then + m4_ifvaln([$4],[$4],[:])dnl + m4_ifvaln([$5],[else $5])dnl + fi +]) dnl AX_COMPARE_VERSION diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 1e7ea47..a3fee53 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -2445,7 +2445,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be Linux ELF. -linux* | k*bsd*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -3084,7 +3084,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be Linux ELF. -linux* | k*bsd*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -3705,7 +3705,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler @@ -3989,7 +3989,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -4285,6 +4285,7 @@ dnl Note also adjust exclude_expsyms for C++ above. fi supports_anon_versioning=no 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 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... @@ -4376,7 +4377,7 @@ _LT_EOF _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) + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in @@ -5860,7 +5861,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler diff --git a/m4/ltversion.m4 b/m4/ltversion.m4 index b8e154f..f3c5309 100644 --- a/m4/ltversion.m4 +++ b/m4/ltversion.m4 @@ -9,15 +9,15 @@ # Generated from ltversion.in. -# serial 3012 ltversion.m4 +# serial 3017 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.2.6]) -m4_define([LT_PACKAGE_REVISION], [1.3012]) +m4_define([LT_PACKAGE_VERSION], [2.2.6b]) +m4_define([LT_PACKAGE_REVISION], [1.3017]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.2.6' -macro_revision='1.3012' +[macro_version='2.2.6b' +macro_revision='1.3017' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) diff --git a/m4/nut_check_asciidoc.m4 b/m4/nut_check_asciidoc.m4 new file mode 100644 index 0000000..944870e --- /dev/null +++ b/m4/nut_check_asciidoc.m4 @@ -0,0 +1,40 @@ +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], +[ +if test -z "${nut_have_asciidoc_seen}"; then + nut_have_asciidoc_seen=yes + + AC_PATH_PROGS([ASCIIDOC], [asciidoc]) + if test -n "${ASCIIDOC}"; then + AC_MSG_CHECKING([for asciiDoc version]) + ASCIIDOC_VERSION="`${ASCIIDOC} --version 2>/dev/null`" + dnl strip 'asciidoc ' from version string + ASCIIDOC_VERSION="${ASCIIDOC_VERSION##* }" + AC_MSG_RESULT(${ASCIIDOC_VERSION} found) + fi + + AC_PATH_PROGS([A2X], [a2x]) + if test -n "${A2X}"; then + AC_MSG_CHECKING([for a2x version]) + A2X_VERSION="`${A2X} --version 2>/dev/null`" + dnl strip 'a2x ' from version string + A2X_VERSION="${A2X_VERSION##* }" + AC_MSG_RESULT(${A2X_VERSION} found) + fi + + AC_PATH_PROGS([DBLATEX], [dblatex]) + if test -n "${DBLATEX}"; then + AC_MSG_CHECKING([for dblatex version]) + DBLATEX_VERSION="`${DBLATEX} --version 2>/dev/null`" + dnl strip 'dblatex version ' from version string + DBLATEX_VERSION="${DBLATEX_VERSION##* }" + AC_MSG_RESULT(${DBLATEX_VERSION} found) + fi + + dnl FIXME check for xsltproc, xmlllint, etc for chunked HTML and man pages +fi +]) diff --git a/m4/nut_check_ipv6.m4 b/m4/nut_check_ipv6.m4 deleted file mode 100644 index 827a539..0000000 --- a/m4/nut_check_ipv6.m4 +++ /dev/null @@ -1,27 +0,0 @@ -dnl Check for various features required for IPv6 support. Define a -dnl preprocessor symbol for each individual feature (HAVE_GETADDRINFO, -dnl HAVE_FREEADDRINFO, HAVE_STRUCT_ADDRINFO, HAVE_SOCKADDR_STORAGE, -dnl HAVE_SOCKADDR_IN6, HAVE_IN6_ADDR). Also set the shell variable nut_have_ipv6=yes -dnl if all the required features are present. Set nut_have_ipv6=no otherwise. - -AC_DEFUN([NUT_CHECK_IPV6], -[ -if test -z "${nut_check_ipv6_seen}"; then - nut_check_ipv6_seen=yes - - AC_CHECK_FUNCS([getaddrinfo freeaddrinfo], [nut_have_ipv6=yes], [nut_have_ipv6=no]) - - AC_CHECK_TYPES([struct addrinfo], - [], [nut_have_ipv6=no], [#include ]) - - AC_CHECK_TYPES([struct sockaddr_storage], - [], [nut_have_ipv6=no], [#include ]) - - AC_CHECK_TYPES([struct sockaddr_in6, struct in6_addr], - [], [nut_have_ipv6=no], [#include ]) - - if test "${nut_have_ipv6}" = "yes"; then - AC_DEFINE(HAVE_IPV6, 1, [Define to enable IPv6 support]) - fi -fi -]) diff --git a/m4/nut_check_libgd.m4 b/m4/nut_check_libgd.m4 index 737520e..01cc882 100644 --- a/m4/nut_check_libgd.m4 +++ b/m4/nut_check_libgd.m4 @@ -21,38 +21,55 @@ if test -z "${nut_have_libgd_seen}"; then AC_MSG_CHECKING(for gd version via gdlib-config) GD_VERSION=`gdlib-config --version 2>/dev/null` - if test "$?" = "0"; then - AC_MSG_RESULT(${GD_VERSION}) - else - AC_MSG_RESULT(not found) - GD_VERSION="unknown" + if test "$?" != "0" -o -z "${GD_VERSION}"; then + GD_VERSION="none" fi + AC_MSG_RESULT(${GD_VERSION} found) case "${GD_VERSION}" in - unknown) + 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`" - LDFLAGS="`gdlib-config --ldflags`" - LIBS="`gdlib-config --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) - AC_ARG_WITH(gd-includes, [ - AC_HELP_STRING([--with-gd-includes=CFLAGS], [include flags for the gd library]) - ], [CFLAGS="${withval}"], []) + AC_ARG_WITH(gd-includes, + AS_HELP_STRING([@<:@--with-gd-includes=CFLAGS@:>@], [include flags for the gd library]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-gd-includes - see docs/configure.txt) + ;; + *) + CFLAGS="${withval}" + ;; + esac + ], []) AC_MSG_RESULT([${CFLAGS}]) AC_MSG_CHECKING(for gd library flags) - AC_ARG_WITH(gd-libs, [ - AC_HELP_STRING([--with-gd-libs=LDFLAGS], [linker flags for the gd library]) - ], [LDFLAGS="${withval}" LIBS=""], []) + AC_ARG_WITH(gd-libs, + AS_HELP_STRING([@<:@--with-gd-libs=LDFLAGS@:>@], [linker flags for the gd library]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-gd-libs - see docs/configure.txt) + ;; + *) + LDFLAGS="${withval}" + LIBS="" + ;; + esac + ], []) AC_MSG_RESULT([${LDFLAGS} ${LIBS}]) dnl check if gd is usable diff --git a/m4/nut_check_libhal.m4 b/m4/nut_check_libhal.m4 index a730591..ec54068 100644 --- a/m4/nut_check_libhal.m4 +++ b/m4/nut_check_libhal.m4 @@ -1,5 +1,5 @@ dnl Check for LIBHAL compiler flags. On success, set nut_have_libhal="yes" -dnl and set LIBHAL_CFLAGS and LIBHAL_LDFLAGS. On failure, set +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 @@ -10,129 +10,72 @@ if test -z "${nut_have_libhal_seen}"; then nut_have_libhal_seen=yes CFLAGS_ORIG="${CFLAGS}" - LDFLAGS_ORIG="${LDFLAGS}" + 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` - if test "$?" = "0"; then - if pkg-config --atleast-version=0.5.8 hal; then - AC_MSG_RESULT(${HAL_VERSION} found) - nut_have_libhal=yes - - dnl also get cflags from glib-2.0 to workaround a bug in dbus-glib - AC_MSG_CHECKING(for libhal cflags via pkg-config) - CFLAGS=`pkg-config --silence-errors --cflags hal dbus-glib-1` - if test "$?" = "0"; then - AC_MSG_RESULT(${CFLAGS}) - else - AC_MSG_RESULT(not found) - nut_have_libhal=no - fi - - dnl also get libs from glib-2.0 to workaround a bug in dbus-glib - AC_MSG_CHECKING(for libhal ldflags via pkg-config) - LDFLAGS=`pkg-config --silence-errors --libs hal dbus-glib-1` - if test "$?" = "0"; then - AC_MSG_RESULT(${LDFLAGS}) - else - AC_MSG_RESULT(not found) - nut_have_libhal=no - fi - else - AC_MSG_RESULT(${HAL_VERSION} is too old) - nut_have_libhal=no - fi + 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_RESULT(not found) - nut_have_libhal=check + AC_MSG_WARN(${HAL_VERSION} is too old) fi - dnl try again using defaults if pkg-config is not available - if test "${nut_have_libhal}" = "check"; then - CFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/hal -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include" - LDFLAGS="-lhal -ldbus-1 -lpthread" + 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_CHECK_HEADERS(libhal.h, [nut_have_libhal=yes], [nut_have_libhal=no], [AC_INCLUDES_DEFAULT]) - AC_CHECK_FUNCS(libhal_device_new_changeset, [], [nut_have_libhal=no]) - fi + 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_LDFLAGS="${LDFLAGS}" - - dnl this will only work as of HAL 0.5.9 - AC_MSG_CHECKING(for libhal user via pkg-config) - HAL_USER=`pkg-config --silence-errors --variable=haluser hal` - if test -n "$HAL_USER"; then - AC_MSG_RESULT(${HAL_USER}) - else - HAL_USER="haldaemon" - AC_MSG_RESULT(using default (${HAL_USER})) - fi - AC_DEFINE_UNQUOTED(HAL_USER, "${HAL_USER}", [HAL user]) - - dnl the device match key changed with HAL 0.5.11 - AC_MSG_CHECKING(for hal-${HAL_VERSION} device match key) - HAL_DEVICE_MATCH_KEY=`pkg-config --silence-errors --atleast-version=0.5.11 hal` - if test "$?" != "0"; then - HAL_DEVICE_MATCH_KEY="info.bus" - else - HAL_DEVICE_MATCH_KEY="info.subsystem" - fi - AC_MSG_RESULT(${HAL_DEVICE_MATCH_KEY}) - AC_DEFINE_UNQUOTED(HAL_DEVICE_MATCH_KEY, "${HAL_DEVICE_MATCH_KEY}", [HAL device match key]) - - dnl Determine installation paths for callout and .fdi - dnl As per HAL spec, §5 Callouts and §2 Device Information Files - dnl - addon install path: $libdir/hal - AC_MSG_CHECKING(for libhal Callouts path) - HAL_CALLOUTS_PATH=`pkg-config --silence-errors --variable=libexecdir hal` - if test -n "$HAL_CALLOUTS_PATH"; then - AC_MSG_RESULT(${HAL_CALLOUTS_PATH}) - else - # fallback to detecting the right path - if (test -d "${libdir}/hal"); then - # For Debian - HAL_CALLOUTS_PATH="${libdir}/hal" - AC_MSG_RESULT(${HAL_CALLOUTS_PATH}) - elif (test -d "/usr/libexec"); then - # For RedHat - HAL_CALLOUTS_PATH="${libexecdir}" - AC_MSG_RESULT(${HAL_CALLOUTS_PATH}) - elif (test -d "/usr/lib/hal"); then - # For OpenSUSE - HAL_CALLOUTS_PATH="${libdir}/hal" - AC_MSG_RESULT(${HAL_CALLOUTS_PATH}) - else - # FIXME - HAL_CALLOUTS_PATH="${libdir}/hal" - AC_MSG_RESULT(using default (${HAL_CALLOUTS_PATH})) - fi - fi - - dnl - fdi install path: $datarootdir/hal/fdi/information/20thirdparty - AC_MSG_CHECKING(for libhal Device Information path) - HAL_FDI_PATH=`pkg-config --silence-errors --variable=hal_fdidir hal` - if test -n "$HAL_FDI_PATH"; then - HAL_FDI_PATH="${HAL_FDI_PATH}/information/20thirdparty" - AC_MSG_RESULT(${HAL_FDI_PATH}) - else - # seems supported everywhere - HAL_FDI_PATH="${datarootdir}/hal/fdi/information/20thirdparty" - AC_MSG_RESULT(${HAL_FDI_PATH}) - fi + LIBHAL_LIBS="${LIBS}" fi CFLAGS="${CFLAGS_ORIG}" - LDFLAGS="${LDFLAGS_ORIG}" - - dnl - test for g_timeout_add_seconds availability - AC_MSG_CHECKING([if GLib is version 2.14.0 or newer]) - if pkg-config --silence-errors --atleast-version=2.14.0 glib-2.0; then - AC_DEFINE(HAVE_GLIB_2_14, 1, [Define to 1 if GLib is version 2.14 or newer]) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi + LIBS="${LIBS_ORIG}" fi ]) diff --git a/m4/nut_check_libneon.m4 b/m4/nut_check_libneon.m4 index 2cb9ce7..4fd290b 100644 --- a/m4/nut_check_libneon.m4 +++ b/m4/nut_check_libneon.m4 @@ -1,5 +1,5 @@ dnl Check for LIBNEON compiler flags. On success, set nut_have_neon="yes" -dnl and set LIBNEON_CFLAGS and LIBNEON_LDFLAGS. On failure, set +dnl and set LIBNEON_CFLAGS and LIBNEON_LIBS. On failure, set dnl nut_have_neon="no". This macro can be run multiple times, but will dnl do the checking only once. @@ -8,30 +8,47 @@ AC_DEFUN([NUT_CHECK_LIBNEON], if test -z "${nut_have_neon_seen}"; then nut_have_neon_seen=yes - dnl save CFLAGS and LDFLAGS + dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" - LDFLAGS_ORIG="${LDFLAGS}" + LIBS_ORIG="${LIBS}" 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` - if test "$?" = "0"; then - AC_MSG_RESULT(${NEON_VERSION} found) - else - AC_MSG_RESULT(not found) + 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, [ - AC_HELP_STRING([--with-neon-includes=CFLAGS], [include flags for the neon library]) - ], [CFLAGS="${withval}"], [CFLAGS="`pkg-config --silence-errors --cflags neon`"]) + AC_ARG_WITH(neon-includes, + AS_HELP_STRING([@<:@--with-neon-includes=CFLAGS@:>@], [include flags for the neon library]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-neon-includes - see docs/configure.txt) + ;; + *) + CFLAGS="${withval}" + ;; + esac + ], [CFLAGS="`pkg-config --silence-errors --cflags neon 2>/dev/null`"]) AC_MSG_RESULT([${CFLAGS}]) AC_MSG_CHECKING(for libneon ldflags) - AC_ARG_WITH(neon-libs, [ - AC_HELP_STRING([--with-neon-libs=LDFLAGS], [linker flags for the neon library]) - ], [LDFLAGS="${withval}"], [LDFLAGS="`pkg-config --silence-errors --libs neon`"]) - AC_MSG_RESULT([${LDFLAGS}]) + AC_ARG_WITH(neon-libs, + AS_HELP_STRING([@<:@--with-neon-libs=LIBS@:>@], [linker flags for the neon library]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-neon-libs - see docs/configure.txt) + ;; + *) + LIBS="${withval}" + ;; + esac + ], [LIBS="`pkg-config --silence-errors --libs neon 2>/dev/null`"]) + AC_MSG_RESULT([${LIBS}]) dnl check if neon is usable AC_CHECK_HEADERS(ne_xmlreq.h, [nut_have_neon=yes], [nut_have_neon=no], [AC_INCLUDES_DEFAULT]) @@ -41,11 +58,11 @@ if test -z "${nut_have_neon_seen}"; then dnl Check for connect timeout support in library (optional) AC_CHECK_FUNCS(ne_set_connect_timeout ne_sock_connect_timeout) LIBNEON_CFLAGS="${CFLAGS}" - LIBNEON_LDFLAGS="${LDFLAGS}" + LIBNEON_LIBS="${LIBS}" fi - dnl restore original CFLAGS and LDFLAGS + dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" - LDFLAGS="${LDFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" fi ]) diff --git a/m4/nut_check_libnetsnmp.m4 b/m4/nut_check_libnetsnmp.m4 index a414089..e1c1426 100644 --- a/m4/nut_check_libnetsnmp.m4 +++ b/m4/nut_check_libnetsnmp.m4 @@ -1,6 +1,6 @@ dnl Check for LIBNETSNMP compiler flags. On success, set dnl nut_have_libnetsnmp="yes" and set LIBNETSNMP_CFLAGS and -dnl LIBNETSNMP_LDFLAGS. On failure, set nut_have_libnetsnmp="no". +dnl LIBNETSNMP_LIBS. On failure, set nut_have_libnetsnmp="no". dnl This macro can be run multiple times, but will do the checking only dnl once. @@ -9,30 +9,47 @@ AC_DEFUN([NUT_CHECK_LIBNETSNMP], if test -z "${nut_have_libnetsnmp_seen}"; then nut_have_libnetsnmp_seen=yes - dnl save CFLAGS and LDFLAGS + dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" - LDFLAGS_ORIG="${LDFLAGS}" + LIBS_ORIG="${LIBS}" 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"; then - AC_MSG_RESULT(${SNMP_VERSION} found) - else - AC_MSG_RESULT(not found) + 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, [ - AC_HELP_STRING([--with-snmp-includes=CFLAGS], [include flags for the Net-SNMP library]) - ], [CFLAGS="${withval}"], [CFLAGS="`net-snmp-config --cflags 2>/dev/null`"]) + AC_ARG_WITH(snmp-includes, + AS_HELP_STRING([@<:@--with-snmp-includes=CFLAGS@:>@], [include flags for the Net-SNMP library]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-snmp-includes - see docs/configure.txt) + ;; + *) + CFLAGS="${withval}" + ;; + esac + ], [CFLAGS="`net-snmp-config --base-cflags 2>/dev/null`"]) AC_MSG_RESULT([${CFLAGS}]) AC_MSG_CHECKING(for Net-SNMP libs) - AC_ARG_WITH(snmp-libs, [ - AC_HELP_STRING([--with-snmp-libs=LDFLAGS], [linker flags for the Net-SNMP library]) - ], [LDFLAGS="${withval}"], [LDFLAGS="`net-snmp-config --libs 2>/dev/null`"]) - AC_MSG_RESULT([${LDFLAGS}]) + AC_ARG_WITH(snmp-libs, + AS_HELP_STRING([@<:@--with-snmp-libs=LIBS@:>@], [linker flags for the Net-SNMP library]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-snmp-libs - see docs/configure.txt) + ;; + *) + LIBS="${withval}" + ;; + esac + ], [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]) @@ -40,11 +57,11 @@ if test -z "${nut_have_libnetsnmp_seen}"; then if test "${nut_have_libnetsnmp}" = "yes"; then LIBNETSNMP_CFLAGS="${CFLAGS}" - LIBNETSNMP_LDFLAGS="${LDFLAGS}" + LIBNETSNMP_LIBS="${LIBS}" fi - dnl restore original CFLAGS and LDFLAGS + dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" - LDFLAGS="${LDFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" fi ]) diff --git a/m4/nut_check_libpowerman.m4 b/m4/nut_check_libpowerman.m4 index 48b7857..a29afed 100644 --- a/m4/nut_check_libpowerman.m4 +++ b/m4/nut_check_libpowerman.m4 @@ -1,5 +1,5 @@ dnl Check for LIBPOWERMAN compiler flags. On success, set nut_have_libpowerman="yes" -dnl and set LIBPOWERMAN_CFLAGS and LIBPOWERMAN_LDFLAGS. On failure, set +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. @@ -8,21 +8,39 @@ AC_DEFUN([NUT_CHECK_LIBPOWERMAN], if test -z "${nut_have_libpowerman_seen}"; then nut_have_libpowerman_seen=yes - dnl save CFLAGS and LDFLAGS + dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" - LDFLAGS_ORIG="${LDFLAGS}" + LIBS_ORIG="${LIBS}" AC_MSG_CHECKING(for libpowerman cflags) - AC_ARG_WITH(powerman-includes, [ - AC_HELP_STRING([--with-powerman-includes=CFLAGS], [include flags for the libpowerman library]) - ], [CFLAGS="${withval}"], [CFLAGS="`pkg-config --silence-errors --cflags libpowerman`"]) + 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) + ;; + *) + CFLAGS="${withval}" + ;; + esac + ], [CFLAGS="`pkg-config --silence-errors --cflags libpowerman 2>/dev/null`"]) AC_MSG_RESULT([${CFLAGS}]) AC_MSG_CHECKING(for libpowerman libs) - AC_ARG_WITH(powerman-libs, [ - AC_HELP_STRING([--with-powerman-libs=LDFLAGS], [linker flags for the libpowerman library]) - ], [LDFLAGS="${withval}"], [LDFLAGS="`pkg-config --silence-errors --libs libpowerman`"]) - AC_MSG_RESULT([${LDFLAGS}]) + AC_ARG_WITH(powerman-libs, + AS_HELP_STRING([@<:@--with-powerman-libs=LIBS@:>@], [linker flags for the libpowerman library]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-powerman-libs - see docs/configure.txt) + ;; + *) + 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]) @@ -30,12 +48,12 @@ if test -z "${nut_have_libpowerman_seen}"; then if test "${nut_have_libpowerman}" = "yes"; then LIBPOWERMAN_CFLAGS="${CFLAGS}" - LIBPOWERMAN_LDFLAGS="${LDFLAGS}" + LIBPOWERMAN_LIBS="${LIBS}" fi - dnl restore original CFLAGS and LDFLAGS + dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" - LDFLAGS="${LDFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" fi ]) diff --git a/m4/nut_check_libssl.m4 b/m4/nut_check_libssl.m4 index adaf841..5984bfd 100644 --- a/m4/nut_check_libssl.m4 +++ b/m4/nut_check_libssl.m4 @@ -1,5 +1,5 @@ dnl Check for LIBSSL compiler flags. On success, set nut_have_libssl="yes" -dnl and set LIBSSL_CFLAGS and LIBSSL_LDFLAGS. On failure, set +dnl and set LIBSSL_CFLAGS and LIBSSL_LIBS. On failure, set dnl nut_have_libssl="no". This macro can be run multiple times, but will dnl do the checking only once. @@ -8,34 +8,52 @@ AC_DEFUN([NUT_CHECK_LIBSSL], if test -z "${nut_have_libssl_seen}"; then nut_have_libssl_seen=yes - dnl save CFLAGS and LDFLAGS + dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" - LDFLAGS_ORIG="${LDFLAGS}" + LIBS_ORIG="${LIBS}" AC_MSG_CHECKING(for openssl version via pkg-config) - OPENSSL_VERSION=`pkg-config --silence-errors --modversion openssl` - if test "$?" = "0"; then - AC_MSG_RESULT(${OPENSSL_VERSION} found) - CFLAGS="`pkg-config --silence-errors --cflags openssl`" - LDFLAGS="`pkg-config --silence-errors --libs openssl`" + 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 - AC_MSG_RESULT(not found) + OPENSSL_VERSION="none" CFLAGS="" - LDFLAGS="-lssl -lcrypto" + 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) - AC_ARG_WITH(ssl-includes, [ - AC_HELP_STRING([--with-ssl-includes=CFLAGS], [include flags for the OpenSSL library]) - ], [CFLAGS="${withval}"], []) + AC_ARG_WITH(ssl-includes, + AS_HELP_STRING([@<:@--with-ssl-includes=CFLAGS@:>@], [include flags for the OpenSSL library]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-ssl-includes - see docs/configure.txt) + ;; + *) + CFLAGS="${withval}" + ;; + esac + ], []) AC_MSG_RESULT([${CFLAGS}]) AC_MSG_CHECKING(for openssl ldflags) - AC_ARG_WITH(ssl-libs, [ - AC_HELP_STRING([--with-ssl-libs=LDFLAGS], [linker flags for the OpenSSL library]) - ], [LDFLAGS="${withval}"], []) - AC_MSG_RESULT([${LDFLAGS}]) + AC_ARG_WITH(ssl-libs, + AS_HELP_STRING([@<:@--with-ssl-libs=LIBS@:>@], [linker flags for the OpenSSL library]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-ssl-libs - see docs/configure.txt) + ;; + *) + LIBS="${withval}" + ;; + esac + ], []) + AC_MSG_RESULT([${LIBS}]) dnl check if openssl is usable AC_CHECK_HEADERS(openssl/ssl.h, [nut_have_libssl=yes], [nut_have_libssl=no], [AC_INCLUDES_DEFAULT]) @@ -44,11 +62,11 @@ if test -z "${nut_have_libssl_seen}"; then if test "${nut_have_libssl}" = "yes"; then AC_DEFINE(HAVE_SSL, 1, [Define to enable SSL development code]) LIBSSL_CFLAGS="${CFLAGS}" - LIBSSL_LDFLAGS="${LDFLAGS}" + LIBSSL_LIBS="${LIBS}" fi - dnl restore original CFLAGS and LDFLAGS + dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" - LDFLAGS="${LDFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" fi ]) diff --git a/m4/nut_check_libusb.m4 b/m4/nut_check_libusb.m4 index 037cf26..b2bb0ab 100644 --- a/m4/nut_check_libusb.m4 +++ b/m4/nut_check_libusb.m4 @@ -1,5 +1,5 @@ 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 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. @@ -8,41 +8,58 @@ AC_DEFUN([NUT_CHECK_LIBUSB], if test -z "${nut_have_libusb_seen}"; then nut_have_libusb_seen=yes - dnl save CFLAGS and LDFLAGS + dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" - LDFLAGS_ORIG="${LDFLAGS}" + LIBS_ORIG="${LIBS}" AC_MSG_CHECKING(for libusb version via pkg-config) - LIBUSB_VERSION=`pkg-config --silence-errors --modversion libusb` - if test "$?" = "0"; then - AC_MSG_RESULT(${LIBUSB_VERSION} found) - CFLAGS="`pkg-config --silence-errors --cflags libusb`" - LDFLAGS="`pkg-config --silence-errors --libs libusb`" + 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"; then - AC_MSG_RESULT(${LIBUSB_VERSION} found) + LIBUSB_VERSION="`libusb-config --version 2>/dev/null`" + if test "$?" = "0" -a -n "${LIBUSB_VERSION}"; then CFLAGS="`libusb-config --cflags 2>/dev/null`" - LDFLAGS="`libusb-config --libs 2>/dev/null`" + LIBS="`libusb-config --libs 2>/dev/null`" else - AC_MSG_RESULT(not found) + LIBUSB_VERSION="none" CFLAGS="" - LDFLAGS="-lusb" + LIBS="-lusb" fi fi + AC_MSG_RESULT(${LIBUSB_VERSION} found) AC_MSG_CHECKING(for libusb cflags) - AC_ARG_WITH(usb-includes, [ - AC_HELP_STRING([--with-usb-includes=CFLAGS], [include flags for the libusb library]) - ], [CFLAGS="${withval}"], []) + AC_ARG_WITH(usb-includes, + AS_HELP_STRING([@<:@--with-usb-includes=CFLAGS@:>@], [include flags for the libusb library]), + [ + 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}]) AC_MSG_CHECKING(for libusb ldflags) - AC_ARG_WITH(usb-libs, [ - AC_HELP_STRING([--with-usb-libs=LDFLAGS], [linker flags for the libusb library]) - ], [LDFLAGS="${withval}"], []) - AC_MSG_RESULT([${LDFLAGS}]) + AC_ARG_WITH(usb-libs, + AS_HELP_STRING([@<:@--with-usb-libs=LIBS@:>@], [linker flags for the libusb library]), + [ + 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 check if libusb is usable AC_CHECK_HEADERS(usb.h, [nut_have_libusb=yes], [nut_have_libusb=no], [AC_INCLUDES_DEFAULT]) @@ -52,11 +69,11 @@ if test -z "${nut_have_libusb_seen}"; then dnl Check for libusb "force driver unbind" availability AC_CHECK_FUNCS(usb_detach_kernel_driver_np) LIBUSB_CFLAGS="${CFLAGS}" - LIBUSB_LDFLAGS="${LDFLAGS}" + LIBUSB_LIBS="${LIBS}" fi - dnl restore original CFLAGS and LDFLAGS + dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" - LDFLAGS="${LDFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" fi ]) diff --git a/m4/nut_check_libwrap.m4 b/m4/nut_check_libwrap.m4 index 3be46e4..6704b94 100644 --- a/m4/nut_check_libwrap.m4 +++ b/m4/nut_check_libwrap.m4 @@ -1,5 +1,5 @@ dnl Check for LIBWRAP compiler flags. On success, set nut_have_libwrap="yes" -dnl and set LIBWRAP_CFLAGS and LIBWRAP_LDFLAGS. On failure, set +dnl and set LIBWRAP_CFLAGS and LIBWRAP_LIBS. On failure, set dnl nut_have_libwrap="no". This macro can be run multiple times, but will dnl do the checking only once. @@ -39,7 +39,7 @@ int allow_severity = 0, deny_severity = 0; if test "${nut_have_libwrap}" = "yes"; then AC_DEFINE(HAVE_WRAP, 1, [Define to enable libwrap support]) LIBWRAP_CFLAGS="" - LIBWRAP_LDFLAGS="${LIBS}" + LIBWRAP_LIBS="${LIBS}" fi dnl restore original LIBS diff --git a/m4/nut_check_os.m4 b/m4/nut_check_os.m4 old mode 100755 new mode 100644 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_report_feature.m4 b/m4/nut_report_feature.m4 index 86e72cd..e8d73b6 100644 --- a/m4/nut_report_feature.m4 +++ b/m4/nut_report_feature.m4 @@ -5,7 +5,7 @@ AC_DEFUN([NUT_REPORT], 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 -e "Configuration summary:\n======================" >> conf_nut_report_feature fi echo "$1: $2" >> conf_nut_report_feature ]) diff --git a/man/Makefile.am b/man/Makefile.am deleted file mode 100644 index cb88f60..0000000 --- a/man/Makefile.am +++ /dev/null @@ -1,99 +0,0 @@ -# Network UPS Tools: man - -LIB_PAGES = upsclient.3 upscli_connect.3 upscli_disconnect.3 \ - upscli_readline.3 upscli_sendline.3 upscli_splitaddr.3 \ - upscli_splitname.3 upscli_strerror.3 upscli_fd.3 upscli_get.3 \ - upscli_list_next.3 upscli_list_start.3 upscli_ssl.3 \ - upscli_upserror.3 -if WITH_DEV -if !WITH_PKG_CONFIG - LIB_PAGES += libupsclient-config.1 -endif -endif - -CONF_PAGES = nut.conf.5 ups.conf.5 upssched.conf.5 upsd.conf.5 \ - upsmon.conf.5 upsd.users.5 -CLIENT_PAGES = upsc.8 upsrw.8 upscmd.8 upslog.8 upssched.8 \ - upsmon.8 upsd.8 nutupsdrv.8 upsdrvctl.8 - -CGI_PAGES = hosts.conf.5 upsset.conf.5 upsstats.html.5 \ - upsset.cgi.8 upsstats.cgi.8 upsimage.cgi.8 - -SERIAL_PAGES = \ - apcsmart.8 \ - bcmxcp.8 \ - belkin.8 \ - belkinunv.8 \ - bestfortress.8 \ - bestuferrups.8 \ - bestups.8 \ - bestfcom.8 \ - blazer.8 \ - dummy-ups.8 \ - etapro.8 \ - everups.8 \ - gamatronic.8 \ - genericups.8 \ - isbmex.8 \ - ivtscd.8 \ - liebert.8 \ - liebertgxt2.8 \ - masterguard.8 \ - metasys.8 \ - mge-shut.8 \ - mge-utalk.8 \ - oneac.8 \ - microdowell.8 \ - optiups.8 \ - powercom.8 \ - powerpanel.8 \ - megatec.8 \ - rhino.8 \ - safenet.8 \ - solis.8 \ - tripplite.8 \ - tripplitesu.8 \ - upscode2.8 \ - victronups.8 \ - clone.8 - -SNMP_PAGES = snmp-ups.8 - -USB_LIBUSB_PAGES = usbhid-ups.8 bcmxcp_usb.8 tripplite_usb.8 megatec_usb.8 richcomm_usb.8 -NETXML_PAGES = netxml-ups.8 -POWERMAN_PAGES = powerman-pdu.8 - -# decide which pages to install -man_MANS = $(CONF_PAGES) $(CLIENT_PAGES) - -if WITH_CGI - man_MANS += $(CGI_PAGES) -endif -if WITH_DEV - man_MANS += $(LIB_PAGES) -endif - -if SOME_DRIVERS - man_MANS += $(DRIVER_MAN_LIST) -else -if WITH_SERIAL - man_MANS += $(SERIAL_PAGES) -endif -if WITH_SNMP - man_MANS += $(SNMP_PAGES) -endif -if WITH_USB - man_MANS += $(USB_LIBUSB_PAGES) -endif -if WITH_NEONXML - man_MANS += $(NETXML_PAGES) -endif -if WITH_LIBPOWERMAN - man_MANS += $(POWERMAN_PAGES) -endif -endif - -# distribute everything, even that which is not installed by default -EXTRA_DIST = $(LIB_PAGES) $(CONF_PAGES) $(CLIENT_PAGES) \ - $(CGI_PAGES) $(SERIAL_PAGES) $(SNMP_PAGES) $(USB_LIBUSB_PAGES) \ - $(NETXML_PAGES) $(POWERMAN_PAGES) libupsclient-config.1 skel.8 diff --git a/man/bcmxcp.8 b/man/bcmxcp.8 deleted file mode 100644 index 3c5ac53..0000000 --- a/man/bcmxcp.8 +++ /dev/null @@ -1,69 +0,0 @@ -.TH "BCMXCP" "8" "Wed Dec 31 2008" "" "Network UPS Tools (NUT)" -.SH "NAME" -bcmxcp \- Driver for UPS'es supporting the serial BCM/XCP protocol -.SH "NOTE" -This man page only documents the hardware\(hyspecific features of the -bcmxcp driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH "SUPPORTED HARDWARE" -This driver should recognize all serial BCM/XCP\-compatible UPS'es. It has -been developed and tested on Powerware PW5115 and PW9120 hardware. If your UPS -has a USB connection, you may also consult the \fBbcmxcp_usb\fR(8) driver -documentation. - -.SH "EXTRA ARGUMENTS" -This driver supports the following optional settings in the -\fBups.conf\fR(5). - -.IP "shutdown_delay=\fIdelay\fR" -The number of seconds that the UPS should wait between receiving the -shutdown command (upsdrvctl shutdown) and actually shutting off. - -.IP "baud_rate=\fIrate\fR" -Communication speed for the UPS. If this is set to 9600, it try to connect -to the UPS on 9600bps. If it fails to communicate, it go into baudhunting. -It start at 1200 and up to 19200. If it succeed it tell you the speed it -connect with. If not included in the config it default's to baudhunting. - -.SH "DEFAULT VALUES FOR THE EXTRA ARGUMENTS" -.IP "shutdown_delay = \fI120\fR" -.IP "baud_rate = \fInone\fR" -.SH "INSTANT COMMANDS" -This driver supports the following Instant Commands: - -.IP "shutdown.return" -Turn off the load and return when power is back. - -.IP "shutdown.stayoff" -Turn off the load and remain off. - -.IP "test.battery.start" -Start a battery test. - -.IP "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 ) - -.SH "TODO LIST" -.IP "Report UPS statistics informations" -BCM/XCP supports reporting of UPS statistics data. - -.IP "Change settings" -Access the config register to change settings. - -.SH "BUGS" -None known. - -.SH "AUTHOR" -Tore \[/O]rpetveit - -.SH "SEE ALSO" -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS The USB BCM/XCP driver: -\fBbcmxcp_usb\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/belkinunv.8 b/man/belkinunv.8 deleted file mode 100644 index 5c68e5d..0000000 --- a/man/belkinunv.8 +++ /dev/null @@ -1,327 +0,0 @@ -.TH BELKINUNV 8 "Sun Dec 7 2003" "" "Network UPS Tools (NUT)" -.SH NAME -belkinunv \- Driver for Belkin "Universal UPS" and compatible -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -belkin driver. For information about the core driver, see -\fBnutupsdrv\fP(8). - -.SH SUPPORTED HARDWARE -The belkinunv driver is known to work with the Belkin Universal UPS -models F6C800\(hyUNV and F6C120\(hyUNV, and is expected to work with other -Belkin Universal UPS models. The driver only supports serial -communication, not USB. - -The Trust UPS and older Belkin units are not supported by this driver, -and neither are the Belkin Home Office models (F6H500\(hySER and so -forth). However, some Belkin models, such as the Regulator Pro, are -supported by the \fBbelkin\fP(8) driver, and the Home Office models -are supported using the \fBgenericups\fP(8) driver with -\fIupstype=7\fP. - -.SH 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 -UPS after operating system shutdown; it will not come back on when the -power comes back on. Therefore, the belkinunv driver should never be -used with the \fB\-k\fP option. Instead, the \fB\-x wait\fP option is -provided as a workaround. - -When called with the \fB\-x wait\fP option, \fBbelkinunv\fP behaves as -a standalone program (i.e., it does not fork into the background). It -performs one simple task: it connects to the UPS, waits for AC power -to return, and then exits with status 0. - -This is meant to be used in a shutdown script as follows: during a -shutdown, after all filesystems have been remounted read\(hyonly, and -just before the system would normally be halted: check /etc/killpower -(or similar) to see if this shutdown was caused by \fBupsmon\fP(8), -and if yes, call \fBbelkinunv \-x wait\fP. If AC power comes back on, -\fBbelkinunv\fP exits, and things should be arranged so that the -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. - -In addition, if an optional integer argument is given to the \fB\-x -wait\fP option, this causes \fBbelkinunv\fP to wait not only for AC -power to be present, but also for the battery charge to reach the -given level. I use this as part of my startup scripts, to ensure that -the batteries are sufficiently charged before the computer continues -booting. This should be put very early in the startup script, before -any filesystems are mounted read/write, and before any filesystem -checks are performed. - -Several other \fB\-x\fP options are provided to fine\(hytune this -behavior. See OPTIONS below for detailed descriptions. See EXAMPLES -below for examples of how to use \fBbelkinunv\fP in shutdown and -startup scripts. - -.SH OPTIONS -See also \fBnutupsdrv\fP(8) for generic options. Never use the -\fB\-k\fP option with this driver; it does not work properly. -.TP 12 -.B \-x wait[=\fIlevel\fP] -When this option is used, \fBbelkinunv\fP does not fork into the -background, but behaves as a standalone program. It connects to the UPS and -waits until AC power is present. If \fIlevel\fP is specified, it also -waits until the battery charge reaches at least the given level in -percent. Then, and only then, \fBbelkinunv\fP exits. In addition, -while \fBbelkinunv\fP runs in this mode, it displays a status line -with information on the UPS status and battery level. This is intended -for use in the computer's shutdown and startup scripts, as described -under SOFT SHUTDOWN WORKAROUND above. -.TP -.B \-x nohang -This option only has an effect when used in conjunction with the \fB\-x -wait\fP option. It causes \fBbelkinunv\fP to exit if a connection with -the UPS cannot be established or is lost, instead of retrying forever, -which is the default behavior. The \fB\-x nohang\fP option should be -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). -.TP -.B \-x flash -This option only has an effect when used in conjunction with the \fB\-x -wait\fP option. It causes the UPS load to be shut off for a short time -("flashed") just after the AC power has returned and the requested -battery level (if any) has been attained. This is useful if slaves are -attached to this UPS; the flash will cause all of them to reboot. Note -that, due to the design of the Belkin UPS hardware, the load shutdown lasts -ca. 1\(hy2 minutes; a shorter flash cannot be performed reliably. Also, -the computers will reboot at the scheduled time, on battery power if -necessary, even if AC power fails again in the meantime. This should -not be a problem, as your startup scripts can catch this situation. -.TP -.B \-x silent -This option only has an effect when used in conjunction with the \fB\-x -wait\fP option. It suppresses the status line which \fBbelkinunv\fP -would normally print. -.TP -.B \-x dumbterm -This option only has an effect when used in conjunction with the \fB\-x -wait\fP option. It changes the way in which \fBbelkinunv\fP prints its -status line. Normally, terminal control sequences are used to -overwrite the same line with new status information, each time the -status is updated. This may not work on all terminals. If the \fB\-x -dumbterm\fP option is given, each status update is written on a new -line. -.PD - -.SH VARIABLES: -.TP 12 -.B battery.charge -.TP -.B battery.runtime -not supported by all hardware. -.TP -.B battery.voltage -.TP -.B battery.voltage.nominal -.TP -.B driver.version.internal -.TP -.B input.frequency -.TP -.B input.frequency.nominal -e.g. 60 for 60Hz -.TP -.B input.sensitivity -writable: normal/medium/low -.TP -.B input.transfer.high -writable: high transfer voltage point in V -.TP -.B input.transfer.low -writable: low transfer voltage point in V -.TP -.B input.voltage -.TP -.B input.voltage.maximum -.TP -.B input.voltage.minimum -.TP -.B input.voltage.nominal -.TP -.B output.frequency -.TP -.B output.voltage -.TP -.B ups.beeper.status -writable. Values: enabled/disabled/muted. This variable controls the -state of the panel beeper. Enabled means sound when the alarm is -present, disabled means never sound, and muted means the sound is -temporarily disabled until the alarm would normally stop sounding. In -the muted state, the beeper is automatically turned back on at the -next event (AC failure, battery test, etc). Also, the beeper can't be -turned off during a critical event (low battery). Note that not all -UPS models support the "disabled" state. -.TP -.B ups.firmware -.TP -.B ups.load -.TP -.B ups.model -.TP -.B ups.power.nominal -e.g. 800 for an 800VA system -.TP -.B ups.status -a list of flags; see STATUS FLAGS below. -.TP -.B ups.temperature -not supported by all hardware. -.TP -.B ups.test.result -.TP -.B ups.delay.restart -time to restart (read only) -.TP -.B ups.delay.shutdown -time to shutdown (read only). This is always a multiple of 60 seconds. -.TP -.B ups.type -ONLINE/OFFLINE/LINEINT. This describes the basic layout of this UPS -(for GUI clients which want to draw an animated picture of power -flow). An offline UPS has a direct connection from AC input to AC -output, and also a connection from AC input to the battery, and from -the battery to AC output. An online UPS lacks the direct connection -from AC input to AC output, whereas a line interactive UPS lacks the -connection from AC input to the battery. -.PD - -.SH COMMANDS: -.TP 12 -.B beeper.enable, beeper.disable, beeper.mute -enable, disable or mute the panel beeper. Note that if the beeper is -muted, it is automatically turned back on at the next event (AC failure, -battery test, etc). Also, the beeper can't be turned muted during a -critical event (low battery). -.TP -.B reset.input.minmax -reset the variables \fBinput.voltage.minimum\fP and -\fBinput.voltage.maximum\fP. -.TP -.B shutdown.reboot -shut down load immediately for ca. 1\(hy2 minutes -.TP -.B shutdown.reboot.graceful -after 40 second delay, shut down load for ca. 1\(hy2 minutes -.TP -.B shutdown.stayoff -shut down load immediately and stay off. The only way it can be turned -back on is by manually pressing the front panel button. -.TP -.B test.battery.start, test.battery.stop -start/stop 10 second battery test -.TP -.B test.failure.start, test.failure.stop -start/stop "deep" battery test -.PD - -.SH STATUS FLAGS: -.TP 12 -.B OB -load is on battery, including during tests -.TP -.B OFF -load is off -.TP -.B OL -load is online -.TP -.B 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. -.TP -.B OVER -overload -.TP -.B OVERHEAT -overheat -.TP -.B COMMFAULT -UPS fault -.TP -.B LB -low battery -.TP -.B CHRG -charging -.TP -.B DEPLETED -the battery is depleted. When the UPS raises this flag, it -simultaneously switches off the load. -.TP -.B RB -replace battery -.PD -.SH EXAMPLES - -Here is an example for how \fBbelkinunv\fP should be used in a -computer's shutdown script. These commands should go in the very last -part of the shutdown script, after all file systems have been mounted -read\(hyonly, and just before the computer halts. Note that -\fBbelkinunv\fP must be installed in a directory which is still -readable at that point. - -.nf -# NEAR END OF SHUTDOWN SCRIPT: -# if shutdown was caused by UPS, perform Belkin UPS workaround. -if [ \-f /etc/killpower ] ; then - echo "Waiting for AC power, or for UPS batteries to run out..." - /usr/bin/belkinunv \-x wait /dev/ttyS1 - - # we get here if the power came back on. Reboot. - echo "Power is back. Rebooting..." - reboot -fi -.fi - -And here is an example of how to use \fBbelkinunv\fP in the startup -script. These commands should go near the beginning of the startup -script, before any file systems are mounted read/write, and before any -file system integrity checks are done. - -.nf -# NEAR BEGINNING OF STARTUP SCRIPT: -# if we are recovering from a power failure, wait for the UPS to -# charge to a comfortable level before writing anything to disk -if [ \-f /etc/killpower ] ; then - echo "Waiting for UPS battery charge to reach 60%..." - /usr/bin/belkinunv \-x wait=60 \-x nohang /dev/ttyS1 -fi -.fi -.SH EXIT STATUS - -When used normally, \fBbelkinunv\fP forks into the background and its -diagnostics are the same as for all NUT drivers, see -\fBnutupsdrv\fP(8). - -When used with the \fB\-x wait\fP option, the exit status is normally -0. If the \fB\-x nohang\fP option has also been specified, an exit -status of 1 indicates that communication with the UPS was lost. If the -\fB\-x flash\fP option has been specified, an exit status of 2 -indicates that the timed shutdown has failed. -.SH EXTRA ARGUMENTS - -This driver does not support any extra settings in \fBups.conf\fP(5). -.SH SEE ALSO - -.SS The documentation for the protocol used by this UPS: -belkin\(hyuniversal\(hyups.html - -.SS The core driver: -\fBnutupsdrv\fP(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ - -.SH AUTHOR - -Peter Selinger diff --git a/man/bestfortress.8 b/man/bestfortress.8 deleted file mode 100644 index c6c283d..0000000 --- a/man/bestfortress.8 +++ /dev/null @@ -1,35 +0,0 @@ -.TH BESTFORTRESS 8 "Sun Aug 16 2009" "" "Network UPS Tools (NUT)" -.SH NAME -bestfortress \- Driver for old Best Fortress UPS equipment -.SH NOTE -This man page only documents the hardware-specific features of the -bestfortress driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -This driver supports old Best Fortress UPS equipment. - -.SH EXTRA ARGUMENTS -This driver supports the following optional settings in the -\fBups.conf\fR(5): - -.IP "baudrate=\fInum\fR" -Set the speed of the serial connection - 1200, 2400, 4800 or 9600. - -.IP "max_load=\fIVA\fR" -Set the value of the \fIups.load\fR variable. - -.SH AUTHOR -Holger Dietze , -Stuart D. Gathman - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS The newer Best Power drivers: -\fBbestups\fR(8), \fBbestuferrups\fR(8), \fBbestfcom\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/bestuferrups.8 b/man/bestuferrups.8 deleted file mode 100644 index 41154dc..0000000 --- a/man/bestuferrups.8 +++ /dev/null @@ -1,30 +0,0 @@ -.TH bestuferrups 8 "Sun Jul 28 2002" "" "Network UPS Tools (NUT)" -.SH NAME -bestuferrups \- Driver for Best Power Micro\(hyFerrups -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -bestuferrups driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -Best Power Micro\(hyFerrups ME3100, probably other similar models too. - -.SH EXTRA ARGUMENTS - -This driver does not support any extra settings in the -\fBups.conf\fR(5). - -.SH AUTHORS -Andreas Wrede, John Stone (bestuferrups) - -Grant Taylor (bestfort) - -Russell Kroll (bestups) - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/etapro.8 b/man/etapro.8 deleted file mode 100644 index a8a8d48..0000000 --- a/man/etapro.8 +++ /dev/null @@ -1,26 +0,0 @@ -.TH ETAPRO 8 "Tue Oct 22 2002" "" "Network UPS Tools (NUT)" -.SH NAME -etapro \- Driver for ETA UPS equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -etapro driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -This driver supports ETA UPS equipment with the "PRO" option for smart mode. - -.SH EXTRA ARGUMENTS - -This driver does not support any extra settings in the -\fBups.conf\fR(5). - -.SH AUTHOR -Marek Michalkiewicz - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/everups.8 b/man/everups.8 deleted file mode 100644 index 0ba703d..0000000 --- a/man/everups.8 +++ /dev/null @@ -1,32 +0,0 @@ -.TH EVERUPS 8 "Wed Oct 16 2002" "" "Network UPS Tools (NUT)" -.SH NAME -everups \- Driver for Ever UPS models -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -everups driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -This driver should recognize the NET *\(hyDPC and AP *\(hyPRO models. - -.SH EXTRA ARGUMENTS - -This driver does not support any extra settings in the -\fBups.conf\fR(5). - -.SH BUGS - -This UPS can only switch off the load if it's running on battery. This -means you may be vulnerable to power races if your shutdown scripts -don't sleep and force a reboot. - -.SH AUTHOR -Bartek Szady - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/isbmex.8 b/man/isbmex.8 deleted file mode 100644 index d6192ed..0000000 --- a/man/isbmex.8 +++ /dev/null @@ -1,26 +0,0 @@ -.TH ISBMEX 8 "Tue Oct 22 2002" "" "Network UPS Tools (NUT)" -.SH NAME -isbmex \- Driver for ISBMEX UPS equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -isbmex driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -This driver supports SOLA/BASIC Mexico ISBMEX protocol UPS equipment. - -.SH EXTRA ARGUMENTS - -This driver does not support any extra settings in the -\fBups.conf\fR(5). - -.SH AUTHOR -Edscott Wilson Garcia - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/ivtscd.8 b/man/ivtscd.8 deleted file mode 100644 index f1411da..0000000 --- a/man/ivtscd.8 +++ /dev/null @@ -1,27 +0,0 @@ -.TH IVTSCD 8 "Tue Sep 8 2009" "" "Network UPS Tools (NUT)" -.SH NAME -ivtscd \- driver for the IVT Solar Controller Device - -.SH NOTE -This man page only documents the specific features of the -ivtscd driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH DESCRIPTION -This driver allows to access the IVT SCD-series devices. - -.SH EXTRA ARGUMENTS -This driver does not support any extra argument. - -.SH AUTHOR -Arjen de Korte - -.SH SEE ALSO - -\fBupscmd\fR(1), -\fBupsrw\fR(1), -\fBups.conf\fR(5), -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/libupsclient-config.1 b/man/libupsclient-config.1 deleted file mode 100644 index 3857507..0000000 --- a/man/libupsclient-config.1 +++ /dev/null @@ -1,35 +0,0 @@ -.TH LIBUPSCLIENT-CONFIG 1 "December 27, 2008" -.SH NAME -libupsclient-config \- script to get information about the installed version of libupsclient -.SH SYNOPSIS -.B libupsclient-config [\-\-version] [\-\-libs] [\-\-cflags] -.SH DESCRIPTION -.PP -\fIlibupsclient-config\fP is a tool that is used to configure to determine -the compiler and linker flags that should be used to compile -and link programs that use \fIlibupsclient\fP from the Network UPS Tools project. -. -.SH OPTIONS -.l -\fIlibupsclient-config\fP accepts the following options: -.TP 8 -.B LIBRARIES -This argument is currently ignored as libupsclient has only one library. -.TP 8 -.B \-\-version -Print the currently installed version of \fIlibupsclient\fP on the standard output. -.TP 8 -.B \-\-libs -Print the linker flags that are necessary to link a \fIlibupsclient\fP program. -.TP 8 -.B \-\-cflags -Print the compiler flags that are necessary to compile a \fIlibupsclient\fP program. - -.SH AUTHORS -This manual page was written by Arnaud Quette . - -.SH SEE ALSO - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ - diff --git a/man/liebert.8 b/man/liebert.8 deleted file mode 100644 index 6b3dcca..0000000 --- a/man/liebert.8 +++ /dev/null @@ -1,42 +0,0 @@ -.TH LIEBERT 8 "Wed Jul 28 2009" "" "Network UPS Tools (NUT)" -.SH NAME -liebert \- Driver for Liebert contact\(hyclosure UPS equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -liebert driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -This driver supports some Liebert UPS equipment with a contact\(hyclosure -interface. This includes the UPStation GXT2 with their contact\(hyclosure -cable. The smart mode ("Multilink") cable is not supported by this -driver. - -.SH EXTRA ARGUMENTS - -This driver does not support any extra settings in the -\fBups.conf\fR(5). - -.SH BUGS - -This driver does not yet support shutdowns by raising DTR. Be aware -that shutdowns are not possible with the stock contact\(hyclosure cable. -You may have to build another cable with DTR connected through to the -UPS for it to work. - -There is no way for this driver to detect the hardware or cable. It -will start up successfully even if no UPS is present. This is a -fundamental limitation of any contact\(hyclosure driver. - -Since the TX and RX signals are only used to detect loopback (when the -contacts close), the baud rate should not matter. However, it is hardcoded to -9600 baud to prevent problems with noise if the port defaults to a higher baud -rate. - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/liebertgxt2.8 b/man/liebertgxt2.8 deleted file mode 100644 index 7bea835..0000000 --- a/man/liebertgxt2.8 +++ /dev/null @@ -1,40 +0,0 @@ -.TH liebertgxt2 8 "Tue Nov 03 2009" "" "Network UPS Tools (NUT)" -.SH NAME -liebertgxt2 \- Driver for Liebert GXT2 UPS, using the ESP2 serial protocol -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -liebertgxt2 driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -liebertgxt2 is experimental and will recognize only those models known to work. The driver will report the model it finds and abort if it is unknown. modelname= in ups.conf can be used to force the driver to accept the model as supported. - -The driver is incomplete but supports the numerious information fields and fields necessary to make the driver useful. Potentially useful features that aren't supported are shutdown and battery test - or any command that instructs the UPS to take some action. - -.SH CABLING - -This driver expects to see 2400 baud serial data at the TX/RX pins. This driver was tested with an original cable. - -.SH EXTRA ARGUMENTS -This driver supports the following optional settings in the -\fBups.conf\fR(5): - -.IP "modelname=\fImodel\fR" -Force the model name of \fImodel\fR to be a supported model, giving you the chance to try this driver with your Liebert UPS. - -.SH BUGS -Action commands are not supported, that includes battery test and shutdown. - -.SH AUTHOR -Richard Gregory . With additional information from -Spiros Ioannou. - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ - -Partial description of the ESP2 protocol: http://www.csc.liv.ac.uk/~greg/projects/liebertserial/ diff --git a/man/masterguard.8 b/man/masterguard.8 deleted file mode 100644 index b620b85..0000000 --- a/man/masterguard.8 +++ /dev/null @@ -1,26 +0,0 @@ -.TH MASTERGUARD 8 "Tue Apr 2 2002" "" "Network UPS Tools (NUT)" -.SH NAME -masterguard \- Driver for Masterguard UPS equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -masterguard driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -This driver supports Masterguard UPS equipment. - -.SH EXTRA ARGUMENTS - -.IP "CS" -Cancel the shutdown procedure. - -.SH AUTHOR -Michael Spanier - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/megatec.8 b/man/megatec.8 deleted file mode 100644 index 52ac2a5..0000000 --- a/man/megatec.8 +++ /dev/null @@ -1,169 +0,0 @@ -.TH MEGATEC 8 "Sat Jan 14 2006" "" "Network UPS Tools (NUT)" -.SH NAME -megatec \- Driver for Megatec protocol based UPS equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -megatec driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE - -The megatec driver is known to work with various UPSes from Blazer, Energy -Sistem, Fenton Technologies, 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't been tested. - -On models with both a serial port (RS-232) and an USB port, only the serial -port is supported. Connecting a computer which does not have a serial -interface to the UPS serial port using a USB-to-serial converter should -work, provided the converter is supported by your operating system. - -.SH EXTRA ARGUMENTS - -This driver supports some extra parameters (see \fBups.conf\fR(5)): - -.IP "mfr=\fIstring\fR" - -Optional. Specify the UPS manufacturer name. - -.IP "model=\fIstring\fR" - -Optional. Specify the UPS model name. - -.IP "serial=\fIstring\fR" - -Optional. Specify the UPS serial number. - -.IP "offdelay=\fIint\fR" - -Optional. After receiving a shutdown command, the UPS will wait this many -minutes before turning off the load. Specify this if the UPS must remain online -for a short period of time after the computer has powered down. The default is 0 -(turn off immediately). - -.IP "ondelay=\fIint\fR" - -Optional. After turning off the load (see \fBoffdelay\fR), the UPS will wait at -least this many minutes before coming back online. If line power gets restored -before this delay expires, the UPS will wait until it does. If line power gets -restored after this delay expires, the UPS will power on the load immediately. -The default is 2 minutes. - -.IP "lowbatt=\fIfloat\fR" - -Optional. Low battery level (%). Overrides the hardware default level. Cannot be -used if the driver is unable to calculate the charge percentage for your UPS -automatically (see \fBKNOWN PROBLEMS\fR) and the \fBbattvolts\fR parameter -isn't specified. - -.IP "battvolts=\fIfloat\fR:\fIfloat\fR" - -Optional. The battery voltage interval (see \fBKNOWN PROBLEMS\fR). - -.IP "battvoltmult=\fInum\fR" - -Optional. Multiply the reported battery voltage by this number. Some devices -report only a fraction of the total battery voltage. The default is 1. - -.IP "dtr=\fIint\fR" - -Optional. Some UPS models need the DTR serial line set to a specific -state, either \fI0\fR or \fI1\fR. See also \fBrts\fR. - -.IP "rts=\fIint\fR" - -Optional. Some UPS models need the RTS serial line set to a specific -state, either \fI0\fR or \fI1\fR. See also \fBdtr\fR. - -.IP "ignoreoff" - -Optional. This option should be used if \fBupsc\fR(8) shows the UPS status -as OFF when it's clearly on. This will force the driver to ignore the OFF -status altogether. - -.IP "sendpace=\fIint\fR" - -Optional. This option can be used to change the wait interval between each -character that is sent to the UPS, between 1 and 1000 milliseconds. Some models -may need this if the default interval (100 milliseconds) proves to be too long, -or too short. - -.SH UPS COMMANDS - -This driver supports some instant commands (see \fBupscmd\fR(8)): - -.IP beeper.toggle -Toggle the UPS beeper. (Not available on some hardware.) - -.IP load.on -Turn on the load immediately. - -.IP load.off -Turn off the load immediately (see \fBKNOWN PROBLEMS\fR). - -.IP reset.input.minmax -Reset minimum and maximum input voltage status. - -.IP reset.watchdog -Restarts the UPS watchdog timeout. The watchdog is started if it isn't running, -which means the UPS shuts down one minute after this command is executed for -the last time, restarting one minute afterwards. To cancel the watchdog, run -the "shutdown.stop" command. - -.IP shutdown.return -Turn off the load and return when power is back. Uses the timers defined by -\fBondelay\fR and \fBoffdelay\fR. - -.IP shutdown.stayoff -Turn off the load and remain off (see \fBKNOWN PROBLEMS\fR). Uses the timer defined by \fBoffdelay\fR. - -.IP shutdown.stop -Stop a shutdown in progress. - -.IP test.battery.start.deep -Perform a long battery test (Not available on some hardware.) - -.IP test.battery.start -Perform a (10 second) battery test. - -.IP test.battery.stop -Stop a running battery test. (Not available on some hardware.) - -.SH KNOWN PROBLEMS - -The battery charge (%) value is only a best-effort calculation and may be -incorrect, or non-existant, for some UPS models. In any case, you can always -resort to finding the voltages at which the battery becomes fully discharged -and fully charged, and specify them manually using the "battvolts" option. -If you do this, please notify the author of this driver so that information -can be added to the NUT hardware compatibility list. Note that if you also -specified the "battvoltmult" option, you need to divide the found voltages -for fully discharged and fully charged by this number. - -Some UPS commands aren't supported by all models. In most cases, the driver -will send a message to the system log when the user tries to execute an -unsupported command. Unfortunately, some models don't even provide a way for -the driver to check for this, so the unsupported commands will silently -fail. - -Both the "load.off" and "shutdown.stayoff" instant commands are meant to -turn the load off indefinitely. However, some UPS models don't allow this. -When this is the case, the driver will tell the UPS to turn off the load for -9999 minutes (about 7 days) and a message will be sent to the system log. - -Some models report a bogus value for the beeper status (will always be -"enabled" or "disabled"). So, the "beeper.toggle" command may appear to have -no effect in the status reported by the driver when, in fact, it is working -fine. - -The temperature value is also known to be bogus in some models. - -.SH AUTHOR -Carlos Rodrigues - -.SH SEE ALSO - -\fBnutupsdrv\fR(8), \fBupsc\fR(8), \fBupscmd\fR(8), \fBupsrw\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/megatec_usb.8 b/man/megatec_usb.8 deleted file mode 100644 index bb028b5..0000000 --- a/man/megatec_usb.8 +++ /dev/null @@ -1,187 +0,0 @@ -.TH MEGATEC_USB 8 "Sun Mar 4 2007" "" "Network UPS Tools (NUT)" -.SH NAME -megatec_usb \- Driver for Megatec protocol based USB UPS equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -megatec_usb driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -\fBNote.\fR This driver is experimental at the moment. It is currently being -worked on and may change over time. However, it is stable in execution and -does what is needed. - -.SH SUPPORTED HARDWARE - -The megatec_usb driver is known to work with various UPSes from Krauler, Agiler, -and Upsonic (Ablerex interface). Others that use the Megatec protocol -may work, but haven't been tested. - -This driver supports the USB versions of UPSs, if you have only serial interface then use the -straight \fBmegatec\fR(8) driver. - -If you find that this driver does not work, and you are sure that your hardware speaks megatec protocol, -then you can easily extend this driver. However, you will need to do some analysis of the -commands that are sent to the UPS. Please see the forums for discussions on this and how -to extend this driver. - -.SH EXTENSIONS TO MEGATEC - -This driver extends the standard \fBmegatec\fR(8) driver to work with certain UPSes that have -a USB interface. These devices do not obey the normal rules for HID USB devices and therefore the -\fBnewhidups\fR(8) driver will not work for them. - -This driver takes the standard serial interface and passes this over USB to the UPS. -This means that most, but not all, commands available for the serial driver will -work. For Krauler, Agiler, and Upsonic (with Ablerex interface) UPSes -it appears to give very similar results to the serial interface. The -driver supports monitoring most of the usual UPS variables, and also -supports automatic shutdown. - -.SH EXTRA ARGUMENTS - -.IP "mfr=\fIstring\fR" - -Optional. Specify the UPS manufacturer name. - -.IP "model=\fIstring\fR" - -Optional. Specify the UPS model name. - -.IP "serial=\fIstring\fR" - -Optional. Specify the UPS serial number. - -.IP "lowbatt=\fIfloat\fR" - -Optional. Low battery level (%). Overrides the hardware default level. - -.IP "ondelay=\fIint\fR" - -Optional. Delay before the UPS is turned back on (minutes). - -.IP "offdelay=\fIint\fR" - -Optional. Delay before the UPS is turned off (minutes). - -.IP "battvolts=\fIfloat\fR:\fIfloat\fR" - -Optional. The battery voltage interval (volts). - -.IP "vendor=\fIregex\fR" -.IP "product=\fIregex\fR" -.IP "vendorid=\fIregex\fR" -.IP "productid=\fIregex\fR" - -Select a specific UPS, in case there is more than one connected via -USB. Each option specifies an extended regular expression (see -\fBregex(7)\fR) 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 \fB-DD\fR for -finding out the strings to match. - -Examples: - - \fB-x vendor="Foo.Corporation.*"\fR - - \fB-x vendorid=05b8\fR (Agiler) - - \fB-x product=".*(Smart|Back)-?UPS.*"\fR - -.IP "bus=\fIregex\fR" - -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]"). - -.IP "subdriver=\fIstring\fR" - -Select a serial-over-USB subdriver to use. You have a choice between "agiler" and "krauler" subdrivers currently. - -.SH UPS COMMANDS - -This driver supports some extra commands (see \fBupscmd\fR(8)): - -.IP beeper.toggle -Toggle the UPS beeper. (Not available on some hardware.) - -.IP load.on -Turn on the load immediately. - -.IP load.off -Turn off the load immediately. (Not yet supported) - -.IP reset.input.minmax -Reset minimum and maximum input voltage status. (Not yet supported) - -.IP reset.watchdog -Restarts the UPS watchdog timeout. The watchdog is started if it isn't running, -which means the UPS shuts down one minute after this command is executed for -the last time, restarting one minute afterwards. To cancel the watchdog, run -the "shutdown.stop" command. - -.IP shutdown.return -Turn off the load and return when power is back. (Not yet supported) - -.IP shutdown.stayoff -Turn off the load and remain off. (Not yet supported) - -.IP shutdown.stop -Stop a shutdown in progress. - -.IP test.battery.start.deep -Perform a long battery test (Not available on some hardware.) - -.IP test.battery.start -Perform a (10 second) battery test. - -.IP test.battery.stop -Stop a running battery test. (Not available on some hardware.) - -.SH USER VARIABLES - -The behavior of the driver can be controlled by some user definable -variables (see \fBupsrw\fR(8)): - -.IP ups.delay.shutdown -Interval to wait after shutdown with delay command (seconds) - -.IP ups.delay.start -Interval to wait before (re)starting the load (seconds) - -.SH KNOWN PROBLEMS - -The battery charge (%) value is only a best-effort calculation and may be -incorrect, or non-existant, for some UPS models. In any case, you can always -resort to finding the voltages at which the battery becomes fully discharged -and fully charged, and specify them manually using the "battvolts" option. -If you do this, please notify the author of this driver. - -Some UPS commands aren't supported by all models. In most cases, the driver -will send a message to the system log when the user tries to execute an -unsupported command. Unfortunately, some models don't even provide a way for -the driver to check for this, so the unsupported commands will silently -fail. - -Some models report a bogus value for the beeper status (will always be -"enabled" or "disabled"). So, the "beeper.toggle" command may appear to have -no effect in the status reported by the driver when, in fact, it is working -fine. - -The temperature value is also known to be bogus in some models. - - -.SH AUTHORS -Carlos Rodrigues -.br -Andrey Lelikov -.br -Alexander Gordeev -.br -Jon Gough - -.SH SEE ALSO - -\fBmegatec\fR(8), \fBnutupsdrv\fR(8), \fBupsc\fR(8), \fBupscmd\fR(8), \fBupsrw\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/mge-shut.8 b/man/mge-shut.8 deleted file mode 100644 index 5506fa6..0000000 --- a/man/mge-shut.8 +++ /dev/null @@ -1,70 +0,0 @@ -.TH mge\-shut 8 "Thu Nov 19 2009" "" "Network UPS Tools (NUT)" -.SH NAME -mge\(hyshut, newmge\(hyshut \- Driver for SHUT Protocol UPS equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -mge\(hyshut driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -mge\(hyshut support all recent Eaton, MGE and Dell UPS models which use the SHUT -(Serial HID UPS Transfer) protocol. - -Older MGE models, such as Pulsar ESV+, Pulsar EX and Pulsar ES+, use the U\(hyTalk -protocol and should use the mge\(hyutalk driver. - -.SH EXTRA ARGUMENTS -This driver supports the following optional settings in the -\fBups.conf\fR(5): - -.IP "lowbatt=\fInum\fR" -Set the low battery warning threshold at which shutdown is initiated by -\fBupsmon\fR(8). -The factory default value is 30 (in percentage), and only be settable -depending on the exact model. - -.IP "offdelay=\fInum\fR" -Set the timer before the UPS is turned off after the kill power command is -sent (via the \fI\-k\fR switch). -The default value is 20 (in seconds), and MUST BE LOWER than ondelay. - -.IP "ondelay=\fInum\fR" -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. -The default value is 3 (in 10 seconds units, which means 30 seconds), -and MUST BE GREATER than offdelay. - -.IP "notification=\fInum\fR" -Set notification type to 1 (no), 2 (light) or 3 (yes). -The default value is 3 (yes) because of some early Ellipse models which -need it. - -.SH KNOWN ISSUES -.SS "Pulsar Ellipse S: Repetitive stale status \(hy Loss of communication" - -Several users have reported "data stale" errors with Pulsar Ellipse -equipment. This lasts around 10 seconds and happens once every few hours. -This is due to the fact that the SHUT protocol is verbose, and the driver -sometimes does not handle all of it during the usual polling interval in -upsd. To solve this problem, change the value of MAXAGE to 25 in -upsd.conf. Also add "notification=3" in ups.conf (thanks to Julien -Lesaint and Fabien). - - -.SH AUTHOR -Arnaud Quette or - -Philippe Marzouk - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ - -MGE UPS SYSTEMS SHUT protocol information: -http://random.networkupstools.org/protocols/mge/ diff --git a/man/mge-utalk.8 b/man/mge-utalk.8 deleted file mode 100644 index 1b0526b..0000000 --- a/man/mge-utalk.8 +++ /dev/null @@ -1,103 +0,0 @@ -.TH mge\-utalk 8 "Mon Jan 16 2006" "" "Network UPS Tools (NUT)" -.SH NAME -mge\(hyutalk \- Driver for MGE UPS SYSTEMS UTalk protocol hardware -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -mge\(hyutalk driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -mge\(hyutalk 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). - -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 - -This driver supports the following optional settings in the -\fBups.conf\fR(5): - -.IP "lowbatt=\fIvalue\fR" -Low battery level below which LB is raised, in % (default 30%) - -.IP "ondelay=\fIvalue\fR" -Set delay before startup, in minutes (default 1 minute) - -.IP "offdelay=\fIvalue\fR" -Delay before shutdown, in seconds (default 120 seconds) - -.IP "oldmac" -Set this flag if you are running Linux on an Oldworld Macintosh box -(all beige Apple Macintosh). This might also be needed for other -OSs (like *BSD) running on PowerMac. - -.SH IMPLEMENTATION DETAILS - -Not all MGE UPS models provide all possible information, settings and commands. -mge\(hyutalk checks on startup which variables and commands are available from -the UPS, and re\(hyreads these regularly. Thus, startup is a bit slow, -but this should not matter much. - -mge\(hyutalk.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). - -enable_ups_comm() is called before each attempt to read/write data -from/to the UPS to re synchronise the communication. - -.SH KNOWN ISSUES -.SS "Repetitive stale status \(hy Loss of communication" - -Older models, such as ES/ESV ones, might report repetitive "data stale" -errors. This is due to the fact that these models doesn'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. - -.SH TODO LIST - -.IP "Sort out OFF/OL issues" -OFF is set according to Ls.2.7, but maybe this interpretation is in -conflict with the NUT interpretation of the OFF flag? - -.IP "Add PowerShare / PowerSave support (selectable plug number for commands)" -ON/OFF/REBOOT commands can act either on outlet 1, 2 or main (1 + 2). This -features depends on the UPS model. This would also allow to support -UM\(hySwitch (smart outlet). - -.IP "Enhance the model name exposure" -A table, named Si1_models_names, has been created to format finelly the -UPSs model names, but it is not yet being used. - -.SH AUTHORS -Arnaud Quette, Hans Ekkehard Plesser, Martin Loyer, Patrick Agrain, -Nicholas Reilly, Dave Abbott, Marek Kralewski - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/microdowell.8 b/man/microdowell.8 deleted file mode 100644 index a2e9b20..0000000 --- a/man/microdowell.8 +++ /dev/null @@ -1,26 +0,0 @@ -.TH MICRODOWELL 8 "Fri Sep 14 2007" "" "Network UPS Tools (NUT)" -.SH NAME -microdowell \- Driver for Microdowell Enterprise UPS series -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -Microdowell driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -This driver was developed for the Enterprise Nxx and Bxx models. Other Microdowell models may work too. - -.SH EXTRA ARGUMENTS - -This driver does not support any extra settings in the -\fBups.conf\fR(5). - -.SH AUTHOR -Elio Corbolante - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/netxml-ups.8 b/man/netxml-ups.8 deleted file mode 100644 index 65ad7a7..0000000 --- a/man/netxml-ups.8 +++ /dev/null @@ -1,81 +0,0 @@ -.TH netxml\-ups 8 "Mon Aug 10 2009" "" "Network UPS Tools (NUT)" -.SH NAME -netxml\(hyups \- Driver for Eaton /MGE Network Management Card / Proxy -(XML/HTTP Protocol) equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -netxml\(hyups driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -netxml\(hyups 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: - - NMC Minislot (Ref 66102, firmware EA or newer), - SNMP/Web Minislot card (Ref 66244) - NMC Transverse (Ref 66074), - NMC & Modbus/JBus (Ref 66103), - Network Management Proxy, - ePDU Monitored (newer version). - -Older models, such as SNMP card (Ref 66062 and Ref 66045), use the SNMP -protocol and should use the snmp\(hyups driver with the "mibs=mge" parameter. - -.SH EXTRA ARGUMENTS -This driver supports the following optional settings in the -\fBups.conf\fR(5): - -.IP "timeout=\fIvalue\fR" -The timeout for connecting to and reading from the UPS. Defaults to 5 seconds. -Don't change this value unless you know exactly what you're doing. - -This value \fBmust never\fR be higher than half the MAXAGE value specified in -\fBupsd.conf\fR(5), otherwise you risk that \fBupsd\fR(8) declares the driver -stale while it is waiting for a connection to timeout. - -.IP "login=\fIvalue\fR" -Set the login value for authenticated mode. This feature also needs the -password argument, and allows value settings in the card. -This feature is not used yet. - -.IP "password=\fIvalue\fR" -Set the password value, needed with the login for authenticated mode. -This feature is not used yet. - -.SH IMPLEMENTATION -The hostname of the UPS is specified with the "port" value in -\fBups.conf\fR, i.e.: - -.nf - [mgexml] - driver = netxml\-ups - port = http://netxml\-ups.example.com:80 -.fi - -Specifying the method how to connect to the UPS (http, https) is mandatory. -If the port is equal to the default for the method specified (80 for http, -443 for https) it may be omitted. - -In order not to overload older NMCs by polling them too frequently, it is -recommended to increase the "pollinterval" (see \fBnutupsdrv\fR(8)) and -\fBups.conf\fR(5)) to at least 5 seconds. - -.SH 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, -but also it adds an additional failure mode. If the proxy goes down (for -whatever reason), the driver will no longer be able to reach the UPS. - -.SH AUTHORS -Arjen de Korte - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/nutupsdrv.8 b/man/nutupsdrv.8 deleted file mode 100644 index e57dc93..0000000 --- a/man/nutupsdrv.8 +++ /dev/null @@ -1,181 +0,0 @@ -.TH NUTUPSDRV 8 "Wed Dec 31 2008" "" "Network UPS Tools (NUT)" -.SH NAME -nutupsdrv \- generic manual for unified NUT drivers -.SH SYNOPSIS -.B nutupsdrv \-h -.br -.B nutupsdrv [OPTIONS] - -.SH DESCRIPTION -.B nutupsdrv -is not actually a driver. This is a combined man page for the shared code -that is the core of many drivers within the Network UPS Tools package. - -For information on the specific drivers, see their individual man pages. - -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. - -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. - -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. - -.SH NOTE -You probably don't want to use any of these options directly. You -should use \fBupsdrvctl\fR(8) to control your drivers, and -\fBups.conf\fR(5) to configure them. The rest of this manual describes -options and parameters that generally are not needed by normal users. - -.SH OPTIONS -.IP \-h -display an help message without doing anything else. This will also list -possible values for \fB\-x\fR in that driver, and other help text that the -driver's author may have provided. - -.IP "\-a \fIid" -autoconfigure this driver using the \fIid\fR section of \fBups.conf\fR(5). -.B This argument is mandatory when calling the driver directly. - -.IP \-D -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. - -The level of debugging needed depends both on the driver and the -problem you're 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. - -.IP "\-i \fIinterval\fR" -Set the poll interval for the device - -.IP \-V -print only version information, then exit - -.IP \-L -print parseable list of driver variables. Mostly useful for configuration -wizard programs. - -.IP \-k -("kill" power) Force shutdown mode. The UPS will power off the -attached load, if possible. - -You should use \fBupsdrvctl shutdown\fR whenever possible instead of -calling this directly. - -.IP "\-r \fIdirectory\fR" -The driver will \fBchroot\fR(2) to \fIdirectory\fR during initialization. -This can be useful when securing systems. - -In addition to the state path, many systems will require /dev/null to -exist within \fIdirectory\fR for this to work. The serial ports are -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. - -.IP "\-u \fIusername\fR" -If started as root, the driver will \fBsetuid\fR(2) to the user id -associated with \fIusername\fR. - -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. - -.IP "\-x \fIvar\fR=\fIval\fR" -define a variable called \fIvar\fR with the value of \fIvar\fR in the -driver. This varies from driver to driver \(hy see the specific man pages -for more information. - -This is like setting \fIvar\fR=\fIval\fR in the \fBups.conf\fR(5), but -\-x overrides any settings from that file. - -.SH DIAGNOSTICS -Information about the startup process is printed to stdout. Additional -messages after that point are available in the syslog. The ups clients -such as \fBupsc\fR(8) can be used to query the status of a UPS. - -.SH PROGRAM CONTROL -You should always use \fBupsdrvctl\fR(8) to control the drivers. While -drivers can be started by hand for testing purposes, it is not -recommended for production use. - -.SH FILES -.IP \fBups.conf\fR(5) -Required configuration file. This contains all details on which drivers -to start and where the hardware is attached. - -.SH BUGS -Some of the drivers may have bugs. See their manuals for more -information. - -.SH SEE ALSO - -.SS Server: -\fBupsd\fR(8) - -.SS Clients: -\fBupsc\fR(8), \fBupscmd\fR(8), -\fBupsrw\fR(8), \fBupslog\fR(8), \fBupsmon\fR(8) - -.SS CGI programs: -\fBupsset.cgi\fR(8), \fBupsstats.cgi\fR(8), \fBupsimage.cgi\fR(8) - -.SS Driver control: -\fBupsdrvctl\fR(8) - -.SS Drivers: -\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\fR(8), -\fBcyberpower\fR(8), -\fBdummy\(hyups\fR(8), -\fBetapro\fR(8), -\fBeverups\fR(8), -\fBgamatronic\fR(8), -\fBgenericups\fR(8), -\fBisbmex\fR(8), -\fBliebert\fR(8), -\fBmasterguard\fR(8), -\fBmegatec\fR(8), -\fBmegatec_usb\fR(8), -\fBmetasys\fR(8), -\fBmge\(hyshut\fR(8), -\fBmge\(hyutalk\fR(8), -\fBmge\(hyxml\fR(8), -\fBnewmge\(hyshut\fR(8), -\fBnitram\fR(8), -\fBoneac\fR(8), -\fBoptiups\fR(8), -\fBpowercom\fR(8), -\fBpowerman\(hypdu\fR(8), -\fBpowerpanel\fR(8), -\fBrhino\fR(8), -\fBrichcomm_usb\fR(8), -\fBsafenet\fR(8), -\fBsnmp\(hyups\fR(8), -\fBsolis\fR(8), -\fBtripplite\fR(8), -\fBtripplitesu\fR(8), -\fBtripplite_usb\fR(8), -\fBusbhid\(hyups\fR(8), -\fBupscode2\fR(8), -\fBvictronups\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/optiups.8 b/man/optiups.8 deleted file mode 100644 index 996c1f2..0000000 --- a/man/optiups.8 +++ /dev/null @@ -1,81 +0,0 @@ -.TH OPTIUPS 8 "Fri Jan 20 2006" "" "Network UPS Tools (NUT)" -.SH NAME -optiups \- Driver for Opti-UPS (Viewsonic) UPS and Zinto D (ONLINE-USV) equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -optiups driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -optiups was originally written against a PowerES 280es in nut-0.45. It was -revised for nut 2.0.1 and tested against a PowerES 420E. It is expected to -work with at least the PowerES, PowerPS, and PowerVS models. - -This driver additionally supports a Zinto D from ONLINE USV-Systeme AG -because of their very similar commands, but it's unknown if it also works -with other ups from them. - -This driver will not work with the PowerES stock serial cable. You will need -to construct your own three conductor cable: - -.RS -UPS 6 -> PC 3 -.RE -.RS -UPS 9 -> PC 2 -.RE -.RS -UPS 4 -> PC 5 -.RE - -The cable for Online-USV uses pin UPS 7 (not UPS 4) -> PC 5. - -.SH EXTRA ARGUMENTS - -This driver supports the following optional settings in the -\fBups.conf\fR(5): - -.IP "status_only" - -Only poll for critical status information. Without this, optiups (and -all nut drivers) poll all sorts of information from the UPS fairly often. -It is probably not often enough to hurt anything, so this option probably -is not very useful, unless you have a flaky serial connection or a highly -loaded machine. - -.IP "nowarn_noimp" - -Does not print warnings when the UPS reports that a variable is not -implemented or not pollable. Without the option you will get a message -sent to your system logs each time nut polls the ups. If you specify -\fBnowarn_noimp\fR, this message will only be logged once. - -.IP "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. - -.IP "powerup" - -Zinto D from ONLINE-USV cannot be identified when switched to standby. -Set this flag to allow the driver to power-up your Zinto UPS. -This will also power-up your equipment connected to the ups! - -.SH 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. - -.SH AUTHOR -Russell Kroll, Scott Heavner, Matthias Goebl - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/powercom.8 b/man/powercom.8 deleted file mode 100644 index 1c7a612..0000000 --- a/man/powercom.8 +++ /dev/null @@ -1,191 +0,0 @@ -.TH POWERCOM 8 "Fri Jan 25 2008" "" "Network UPS Tools (NUT)" -.SH NAME -powercom \- UPS driver for Powercom/Trust/Advice UPS equipment - -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -powercom driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -This driver supports many similar kinds of UPS hardware. The most common -ones are the Trust 425/625, Powercom, and Advice Partner/King PR750. -Others using the same protocol may also work. - -.SH EXTRA ARGUMENTS -This driver supports the following optional settings in the -\fBups.conf\fR(5): - -.IP "linevoltage=\fIvalue\fR" -An integer specifying the mains voltage. It can't be auto detected. -Acceptable values are in the range of 110\(hy120 or 220\(hy240. The default -is \fI230\fR. - -.IP "manufacturer=\fIname\fR" -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 -\fIPowerCom\fR. - -.IP "modelname=\fIname\fR" -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 -\fIUnknown\fR. - -.IP "serialnumber=\fIvalue\fR" -Like modelname above, but for the serial number. The default is -\fIUnknown\fR. - -.IP "type=\fIname\fR" -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 KP625AP, Trust, Egys, KIN, BNT, IMP and BNT-other. The default is -\fITrust\fR. -\fIBNT-other\fR - it's a special type for BNT 100-120V models -for this type you can (I think must!) specify voltage, batteryPercentage, -loadPercentage and validationSequence. - -.IP "numOfBytesFromUPS=\fIvalue\fR" -The number of bytes in a UPS frame. The default is type dependant and -is given below. - -.IP "methodOfFlowControl=\fIname\fR" -The method of serial communication flow control that is engaged by the -UPS. The default is type dependant and is given below. Acceptable names -are dtr0rts1, dtr1 or no_flow_control. - -.IP "shutdownArguments=\fI{{minutes,seconds},whether_minutes_should_be_used}\fR" -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 \fIn\fR only when the minutes value should be -skipped and not sent to the UPS. The default is type dependant and is -given below. The braces and commas are mandatory. Note that there should -be no white space characters. - -.IP "voltage=\fI{coefficient1,coefficient2,coefficient3,coefficient4}\fR" -Only for KP625AP, Trust, Egys, BNT-other -A quad that is used convert the raw data to human readable voltage -reading. The default is type dependant and is given below. Do note that -the braces and commas are mandatory, as well as the lack of white space -characters. - -.IP "frequency=\fI{coefficient1,coefficient2}\fR" -Only for KP625AP, Trust, Egys -A pair to convert the raw data to human readable frequency reading. The -default is type dependant and is given below. Do note that the braces -and commas are mandatory as well, as the lack of white space characters. - -.IP "batteryPercentage=\fI{coefficient1,coefficient2,coefficient3,coefficient4,coefficient5}\fR" -Only for KP625AP, Trust, Egys, BNT-other -A 5 tuple to convert the raw data to human readable battery percentage -reading. The default is type dependant and is given below. Do note that -the braces and commas are mandatory, as the lack of white space -characters. - -.IP "loadPercentage=\fI{coefficient1,coefficient2,coefficient3,coefficient4}\fR" -Only for KP625AP, Trust, Egys, BNT-other -A quad to convert the raw data to human readable load percentage -reading. The default is type dependant and is given below. Do note that -the braces and commas are mandatory, as the lack of white space -characters. - -.IP "validationSequence=\fI{{index1,value1},{index2,value2},{index3,value3}}\fR" -Only for KP625AP, Trust, Egys, BNT-other -3 pairs to be used for validating the UPS by comparing bytes of the raw -data with constant values. The default is type dependant and is given -below. The braces and commas are mandatory, as the lack of white space -characters. - -.SH DEFAULT VALUES FOR THE EXTRA ARGUMENTS -.IP "linevoltage = \fI230\fR" -.IP "manufacturer = \fIPowerCom\fR" -.IP "modelname = \fIUnknown\fR" -.IP "serialnumber = \fIUnknown\fR" -.IP "type = \fITrust\fR" - -.P -The rest of the default values for the extra arguments are type -dependant: - -.IP "Trust" -.RS -.IP "numOfBytesFromUPS = 11" -.IP "methodOfFlowControl = dtr0rts1" -.IP "validationSequence = {{5,0},{7,0},{8,0}}" -.IP "shutdownArguments = {{0,10},n}" -.IP "frequency = {0.00020997,0.00020928}" -.IP "loadPercentage = {6.1343,\-0.3808,4.3110,0.1811}" -.IP "batteryPercentage = {5.0000,0.3268,\-825.00,4.5639,\-835.82}" -.IP "voltage = {1.9216,\-0.0977,0.9545,0.0000}" -.RE - -.IP "KP625AP" -.RS -.IP "numOfBytesFromUPS = 16" -.IP "methodOfFlowControl = dtr0rts1" -.IP "validationSequence = {{5,0x80},{7,0},{8,0}}" -.IP "shutdownArguments = {{0,10},n}" -.IP "frequency = {0.00020997,0.00020928}" -.IP "loadPercentage = {6.1343,\-0.3808,4.3110,0.1811}" -.IP "batteryPercentage = {5.0000,0.3268,\-825.00,4.5639,\-835.82}" -.IP "voltage = {1.9216,\-0.0977,0.9545,0.0000}" -.RE - -.IP "Egys" -.RS -.IP "numOfBytesFromUPS = 16" -.IP "methodOfFlowControl = no_flow_control" -.IP "validationSequence = {{5,0x80},{7,0},{8,0}}" -.IP "shutdownArguments = {{0,10},n}" -.IP "frequency = {0.00020997,0.00020928}" -.IP "loadPercentage = {6.1343,\-0.3808,1.3333,0.6667}" -.IP "batteryPercentage = {5.0000,0.3268,\-825.00,2.2105,\-355.37}" -.IP "voltage = {1.9216,\-0.0977,0.9545,0.0000}" -.RE - -.IP "IMP" -.RS -.IP "numOfBytesFromUPS = 16" -.IP "methodOfFlowControl = no_flow_control" -.IP "validationSequence = {{5,0xFF},{7,0},{8,0}}" -.IP "shutdownArguments = {{1,30},y}" -.RE - -.IP "KIN" -.RS -.IP "numOfBytesFromUPS = 16" -.IP "methodOfFlowControl = no_flow_control" -.IP "validationSequence = {{11,0x4b},{8,0},{8,0}}" -.IP "shutdownArguments = {{1,30},y}" -.RE - -.IP "BNT" -.RS -.IP "numOfBytesFromUPS = 16" -.IP "methodOfFlowControl = no_flow_control" -.IP "validationSequence = {{11,0x42},{8,0},{8,0}}" -.IP "shutdownArguments = {{1,30},y}" -.RE - -.IP "BNT-other" -.RS -.IP "numOfBytesFromUPS = 16" -.IP "methodOfFlowControl = no_flow_control" -.IP "validationSequence = {{8,0},{8,0},{8,0}}" -.IP "shutdownArguments = {{1,30},y}" -.IP "loadPercentage = {1.4474,0.0,0.8594,0.0}" -.IP "batteryPercentage = {5.0000,0.3268,\-825.00,0.46511,0}" -.IP "voltage = {1.9216,\-0.0977,0.82857,0.0000}" -.RE - -.SH AUTHOR -Peter Bieringer -Alexey Sidorov - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/powerman-pdu.8 b/man/powerman-pdu.8 deleted file mode 100644 index 8e785ed..0000000 --- a/man/powerman-pdu.8 +++ /dev/null @@ -1,62 +0,0 @@ -.TH powerman\-pdu 8 "Wed Dec 24 2008" "" "Network UPS Tools (NUT)" -.SH NAME -powerman-pdu \- Driver for Powerman PDU -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -powerman-pdu driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -This driver supports a wide range of PDUs through the Powerman project. - -This includes various models from APC, Baytech, Cyclades, but also support -IPMI and various blade management modules from HP, IBM and Sun. - -.SH EXTRA ARGUMENTS -This driver doesn't support any optional setting. - -.SH VARIABLES -This driver doesn't (yet) support any changeable variable. - -.SH COMMANDS -The following commands are available for each outlet, with X for the outlet -number: -.TP 12 -.B outlet.X.load.on -power on the outlet. -.TP -.B outlet.X.load.off -power off the outlet. -.TP -.B outlet.X.load.cycle -cycle the outlet (power off then power on, possibly with a delay). -.PD - -.SH IMPLEMENTATION -The hostname of the Powerman server is specified using the "port" value in -\fBups.conf\fR, i.e.: - -.nf - [pdu] - driver = powerman\-pdu - port = host.example.com:port -.fi - -The port used to reach powermand is optional if the default port is used. - -.SH KNOWN ISSUES -ups.status is still exposed, with the value "WAIT". Some other values from the -ups collection are also exposed. - -.SH AUTHOR -Arnaud Quette - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ - -The PowerMan home page: http://powerman.sourceforge.net/ diff --git a/man/rhino.8 b/man/rhino.8 deleted file mode 100644 index be880ca..0000000 --- a/man/rhino.8 +++ /dev/null @@ -1,53 +0,0 @@ -.TH RHINO 8 "Wed Nov 30 2005" "" "Network UPS Tools (NUT)" -.SH NAME -rhino \- Driver for Brazilian Microsol RHINO UPS equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -rhino driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -This driver has been tested with : - - -Rhino 6000 VA - -Rhino 7500 VA - -Rhino 10000 VA - -Rhino 20000 VA - -All Rhino models are senoidal on\(hyline - -.SH EXTRA ARGUMENTS - -This driver support the following extra optional settings in the -\fBups.conf\fR(5). \fR - -\fBbattext = n\fR \(hy (default = 0, no extra battery, where n = Ampere*hour ) - -.SH UPSCMD - - -load.on \(hy Turn on the load immediately - -load.off \(hy Turn off the load immediately - -bypass.start \(hy Put the UPS in bypass mode - -bypass.stop \(hy Put the UPS out of bypass mode - -shutdown.stayoff \(hy Shut down in 3 minutes and do not return - - -.SH AUTHOR -Silvino B. Magalh\[~a]es - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/richcomm_usb.8 b/man/richcomm_usb.8 deleted file mode 100644 index 9390faa..0000000 --- a/man/richcomm_usb.8 +++ /dev/null @@ -1,35 +0,0 @@ -.TH RICHCOMM_USB 8 "Sat Dec 27 2008" "" "Network UPS Tools (NUT)" -.SH NAME -richcomm_usb \- Driver UPS equipment using Richcomm dry\(hycontact to USB -solution - -.SH NOTE -This man page only documents the specific features of the richcomm_usb -driver. For information about the core driver, see \fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -The Richcomm dry\(hycontact 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 -Most contact\(hyclosure 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. - -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 -Peter van Valderen -Dirk Teurlings - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/safenet.8 b/man/safenet.8 deleted file mode 100644 index ceb0bbf..0000000 --- a/man/safenet.8 +++ /dev/null @@ -1,88 +0,0 @@ -.TH SAFENET 8 "Mon Dec 29 2008" "" "Network UPS Tools (NUT)" -.SH NAME -safenet \- Driver for SafeNet compatible UPS equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -safenet driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -This driver supports UPS equipment which can be controlled via -SafeNet v1.0 for Windows (serial interface only). - -.SH EXTRA ARGUMENTS -This driver supports the following optional settings in the -\fBups.conf\fR(5): - -.IP "manufacturer=\fIvalue\fR" -Autodetection of this parameter is not possible yet (and it probably -never will be). Therefore, this user defined string accepts any name. The -default is \fIunknown\fR. - -.IP "modelname=\fIvalue\fR" -Like manufacturer above. The default is \fIunknown\fR. - -.IP "serialnumber=\fIvalue\fR" -Like manufacturer above. The default is \fIunknown\fR. - -.IP "ondelay=\fIvalue\fR" -Time to wait before switching on the UPS (minutes). Defaults to 1 minute. - -.IP "offdelay=\fIvalue\fR" -Time to wait before shutting down the UPS (seconds). Defaults to 30 seconds. - -.SH UPSCMD -This driver supports some instant commands (see \fBupscmd\fR(8)): - -.IP "test.battery.start" -Start UPS self test - -.IP "test.battery.stop" -Cancel UPS self test - -.IP "test.failure.start" -Start simulated power failure - -.IP "test.failure.stop" -Cancel simulated power failure - -.IP "beeper.enable" -Enable the UPS beeper - -.IP "beeper.mute" -Temporarily mute the UPS beeper - -.IP "beeper.toggle" -Toggle the UPS beeper - -.IP "shutdown.return" -Turn off the load and wait for the power to return. Uses the timer -defined by \fBoffdelay\fR. - -.IP "shutdown.reboot" -Turn off the load and return. Uses the timers defined by \fBoffdelay\fR -and \fBondelay\fR. - -.SH KNOWN PROBLEMS -If you run the \fBshutdown.return\fR command with mains present, the output -may stay on or switch off and not back on again. The \fBshutdown.reboot\fR -command will unconditionally switch on the load again (with or without mains -present). - -If the driver is called with the '\(hyk' option (or through \fBupsdrvctl -shutdown\fR) it tries to detect which command should be used in an attempt -to stay off until mains is present again or to cycle the output if the -power returned in the mean time. This isn't bullet proof and you should be -prepared that the power will either not be shutdown or that it doesn't -return when the power comes back. - -.SH AUTHOR -Arjen de Korte - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/skel.8 b/man/skel.8 deleted file mode 100644 index b940aaf..0000000 --- a/man/skel.8 +++ /dev/null @@ -1,82 +0,0 @@ -.TH SKEL 8 "Sat Dec 23 2006" "" "Network UPS Tools (NUT)" -.\" This line is a comment. -.\" -.\" When copying this man page for your new driver, be sure to replace all -.\" occurrances of "skel" and "SKEL" by your actual driver name. -.\" -.\" Another option is to embed the man page information into your driver source -.\" code. See the tripplite_usb.c file for one way of doing this, using Perl's -.\" pod2man translator. The advantage of this is that you can keep the -.\" documentation near the source code, which may help remind you to update the -.\" documentation after changing the driver. -.\" -.\" On most systems, you can test the formatting of your man page by running: -.\" man ./skel.8 -.\" (the dot-slash tells man not to search its usual path.) -.\" -.\" After writing a man page, be sure to add it to the appropriate variable in -.\" Makefile.am in this directory. -.\" -.\" On many systems, you can find a reference to the man macros by typing -.\" 'man 7 man'. -.\" -.\" In the "NAME" section, you must follow the format below, including -.\" separating the driver name from its description by "\-". This is to ensure -.\" that the apropos(8) database is properly rebuilt. -.SH NAME -skel \- skeleton driver man page - -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -\fBskel\fR driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -.B skel -supports ... - -.\" If the driver only works with certain cables, this is a good place to -.\" mention it: -.\" .SH CABLING - -.SH EXTRA ARGUMENTS -This driver also supports the following optional settings: - -.IP "option1=\fInum\fR" -Set the value of ... to \fInum\fR. Contrast with \fBoption2\fR. - -.IP "option2=\fIstring\fR" -Some other option. - -.\" Optional: list supported instant commands here: -.\" .SH INSTANT COMMANDS - -.\" Optional: use INSTALLATION if you need special parameters to the configure -.\" script. -.\" .SH INSTALLATION - -.\" You may leave this as "none known at this time", or describe any trouble -.\" encountered when implementing the protocol for your UPS. -.SH KNOWN ISSUES AND BUGS -.SS "Got EPERM: Operation not permitted upon driver startup" - -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. - -.\" An email address is not strictly necessary, but you may wish to provide -.\" some form of contact information so that users can report bugs. -.SH AUTHORS -J. Random User - -.\" If this driver is ever made obsolete by another driver, mention the -.\" replacement driver in the "SEE ALSO" section. You may also wish to point -.\" the user to other drivers which may better support their hardware, if there -.\" is ambiguity based on the driver name. -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/snmp-ups.8 b/man/snmp-ups.8 deleted file mode 100644 index 9236943..0000000 --- a/man/snmp-ups.8 +++ /dev/null @@ -1,106 +0,0 @@ -.TH snmp\-ups 8 "Fri May 15 2009" "" "Network UPS Tools (NUT)" -.SH NAME -snmp\(hyups \- Multi\(hyMIB Driver for SNMP UPS equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -snmp\(hyups driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -The snmp\(hyups driver automatically detects and supports a wide range of devices by loading various MIBS: -.IP "ietf:" -UPS that is RFC 1628 (UPS MIB) compliant, ie MGE UPS SYSTEMS, Liebert, perhaps others (default) -.IP "mge:" -MGE UPS SYSTEMS and MGE Office Protection Systems devices with SNMP cards (ref 66062, 66045, 66074 and 66244) -.IP "apcc:" -APC AP9606 APC Web/SNMP management card, perhaps others -.IP "netvision:" -Socomec Sicon UPS with Netvision Web/SNMP management card/external box -.IP "pw:" -Powerware devices with ConnectUPS SNMP cards -.IP "aphel_genesisII:" -Eaton Powerware ePDU Monitored -.IP "aphel_revelation:" -Eaton Powerware ePDU Managed -.IP "raritan:" -Various Raritan PDUs -.IP "baytech:" -Various BayTech PDUs -.IP "cpqpower:" -HP/Compaq AF401A management card, perhaps others - -.SH EXTRA ARGUMENTS - -This driver supports the following optional settings in the -\fBups.conf\fR(5): - -.IP "mibs=\fIname\fR" -Set MIB compliance (default=auto, allowed entries: refer to the above SUPPORTED HARDWARE). -With auto the driver will try a select set of objets until it finds one -that the device responds to. - -.IP "community=\fIname\fR" -Set community name (default = public). -Note that you require a RW community name to perform UPS settings (as for a powerdown). - -.IP "snmp_version=\fIversion\fR" -Set SNMP version (default = v1, the other allowed value is v2c) - -.IP "pollfreq=\fIvalue\fR" -Set polling frequency in seconds, to reduce network flow (default=30) - -.IP "notransferoids" -Disable the monitoring of the low and high voltage transfer OIDs in -the hardware. This will remove input.transfer.low and input.transfer.high -from the list of variables. This should only be used on APCC Symmetra -equipment which has strangeness in the three\(hyphase power reporting. - -.SH REQUIREMENTS -You will need to install the Net\(hySNMP package from -http://www.net\(hysnmp.org/ before building this driver. - -.SH LIMITATION -.SS Shutdown - -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 -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 -The hostname of the UPS is specified with the "port" value in -\fBups.conf\fR, i.e.: - -.nf - [snmp] - driver = snmp\-ups - port = snmp\-ups.example.com - community = public - snmp_version = v1 - mibs = ietf - pollfreq = 15 -.fi - -.SH AUTHORS -Arnaud Quette, Dmitry Frolov - -Sponsored by Eaton -and originally by MGE UPS SYSTEMS - - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS NUT SNMP Protocols Library -Available at: http://random.networkupstools.org/protocols/snmp/ - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/solis.8 b/man/solis.8 deleted file mode 100644 index 18efaf2..0000000 --- a/man/solis.8 +++ /dev/null @@ -1,49 +0,0 @@ -.TH SOLIS 8 "Wed Apr 13 2005" "" "Network UPS Tools (NUT)" -.SH NAME -solis \- Driver for Brazilian Microsol SOLIS UPS equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -solis driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -This driver has been tested with : - - -Solis 1000 VA - -Solis 1500 VA - -Solis 2000 VA - -Solis 3000 VA - -All Solis models are senoidal on\(hyline - -.SH EXTRA ARGUMENTS - -This driver support the following extra optional settings in the -\fBups.conf\fR(5). \fR - -\fBbattext = n\fR \(hy (default = 0, no extra battery, where n = Ampere*hour ) - -\fBprgshut = 1\fR \(hy (default = 0, no programable shutdown ) - -.SH UPSCMD - - -shutdown.return \(hy Shut down in .3 minutes and restart in .3 minutes - -shutdown.stayoff \(hy Shut down in .3 minutes and do not return - - -.SH AUTHOR -Silvino B. Magalh\[~a]es - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/tripplite_usb.8 b/man/tripplite_usb.8 deleted file mode 100644 index da55974..0000000 --- a/man/tripplite_usb.8 +++ /dev/null @@ -1,272 +0,0 @@ -.\" Automatically generated by Pod::Man 2.12 (Pod::Simple 3.05) -.\" -.\" Standard preamble: -.\" ======================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. -.de Sp \" Vertical space (when we can't use .PP) -.if t .sp .5v -.if n .sp -.. -.de Vb \" Begin verbatim text -.ft CW -.nf -.ne \\$1 -.. -.de Ve \" End verbatim text -.ft R -.fi -.. -.\" Set up some character translations and predefined strings. \*(-- will -.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. \*(C+ will -.\" give a nicer C++. Capital omega is used to do unbreakable dashes and -.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, -.\" nothing in troff, for use with C<>. -.tr \(*W- -.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' -.ie n \{\ -. ds -- \(*W- -. ds PI pi -. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch -. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch -. ds L" "" -. ds R" "" -. ds C` "" -. ds C' "" -'br\} -.el\{\ -. ds -- \|\(em\| -. ds PI \(*p -. ds L" `` -. ds R" '' -'br\} -.\" -.\" If the F register is turned on, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index -.\" entries marked with X<> in POD. Of course, you'll have to process the -.\" output yourself in some meaningful fashion. -.if \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" -.. -. nr % 0 -. rr F -.\} -.\" -.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). -.\" Fear. Run. Save yourself. No user-serviceable parts. -. \" fudge factors for nroff and troff -.if n \{\ -. ds #H 0 -. ds #V .8m -. ds #F .3m -. ds #[ \f1 -. ds #] \fP -.\} -.if t \{\ -. ds #H ((1u-(\\\\n(.fu%2u))*.13m) -. ds #V .6m -. ds #F 0 -. ds #[ \& -. ds #] \& -.\} -. \" simple accents for nroff and troff -.if n \{\ -. ds ' \& -. ds ` \& -. ds ^ \& -. ds , \& -. ds ~ ~ -. ds / -.\} -.if t \{\ -. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" -. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' -. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' -. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' -. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' -. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' -.\} -. \" troff and (daisy-wheel) nroff accents -.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' -.ds 8 \h'\*(#H'\(*b\h'-\*(#H' -.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] -.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' -.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' -.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] -.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] -.ds ae a\h'-(\w'a'u*4/10)'e -.ds Ae A\h'-(\w'A'u*4/10)'E -. \" corrections for vroff -.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' -.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' -. \" for low resolution devices (crt and lpr) -.if \n(.H>23 .if \n(.V>19 \ -\{\ -. ds : e -. ds 8 ss -. ds o a -. ds d- d\h'-1'\(ga -. ds D- D\h'-1'\(hy -. ds th \o'bp' -. ds Th \o'LP' -. ds ae ae -. ds Ae AE -.\} -.rm #[ #] #H #V #F C -.\" ======================================================================== -.\" -.IX Title "TRIPPLITE_USB 8" -.TH TRIPPLITE_USB 8 "2009-05-04" "$Rev: 1836$" "Network UPS Tools (NUT)" -.\" For nroff, turn off justification. Always turn off hyphenation; it makes -.\" way too many mistakes in technical documents. -.if n .ad l -.nh -.SH "NAME" -tripplite_usb \- Driver for older Tripp Lite USB UPSes (not PDC HID) -.SH "NOTE" -.IX Header "NOTE" -This man page only documents the hardware-specific features of the -tripplite_usb driver. For information about the core driver, see -\&\fInutupsdrv\fR\|(8). -.SH "SUPPORTED HARDWARE" -.IX Header "SUPPORTED HARDWARE" -This driver should work with older Tripp Lite UPSes which are detected as \s-1USB\s0 -HID-class devices, but are not true \s-1HID\s0 Power-Device Class devices. So far, -the devices supported by tripplite_usb have product \s-1ID\s0 0001, and the newer -units (such as those with \*(L"\s-1LCD\s0\*(R" in the model name) with product \s-1ID\s0 2001 require -the usbhid-ups 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 (\f(CW\*(C`\-DDD\*(C'\fR) -for more informative log messages. If your Tripp Lite \s-1UPS\s0 uses a serial port, -you may wish to investigate the \fItripplite\fR\|(8) or \fItripplite_su\fR\|(8) driver. -.PP -This driver has been tested with the following models: -.IP "\(bu" 4 -\&\s-1INTERNETOFFICE700\s0 -.IP "\(bu" 4 -\&\s-1OMNISV1000\s0 -.IP "\(bu" 4 -\&\s-1OMNISV1500XL\s0 (some warnings) -.IP "\(bu" 4 -\&\s-1SMART700USB\s0 -.IP "\(bu" 4 -\&\s-1SMART1500RM2U\s0 -.IP "\(bu" 4 -\&\s-1SMART2200RMXL2U\s0 -.IP "\(bu" 4 -\&\s-1SMART3000RM2U\s0 -.PP -If you have used Tripp Lite's PowerAlert software to connect to your \s-1UPS\s0, there -is a good chance that \fItripplite_usb\fR\|(8) will work if it uses one of the -following protocols: -.IP "\(bu" 4 -Protocol 0004 -.IP "\(bu" 4 -Protocol 1001 -.IP "\(bu" 4 -Protocol 2001 -.IP "\(bu" 4 -Protocol 3003 -.SH "EXTRA ARGUMENTS" -.IX Header "EXTRA ARGUMENTS" -This driver supports the following optional setting in the \fIups.conf\fR\|(5) file -(or with \f(CW\*(C`\-x\*(C'\fR on the command line): -.IP "offdelay" 4 -.IX Item "offdelay" -This setting controls the delay between receiving the \*(L"kill\*(R" command (\f(CW\*(C`\-k\*(C'\fR) -and actually cutting power to the computer. -.IP "bus" 4 -.IX Item "bus" -This regular expression is used to match the \s-1USB\s0 bus (as seen in -\&\f(CW\*(C`/proc/bus/usb/devices\*(C'\fR or \fIlsusb\fR\|(8); including leading zeroes). -.IP "product" 4 -.IX Item "product" -A regular expression to match the product string for the \s-1UPS\s0. This would be -useful if you have two different Tripp Lite \s-1UPS\s0 models connected to the -system, and you want to be sure that you shut them down in the correct order. -.Sp -Note that this regex is matched against the full \s-1USB\s0 product string as seen in -\&\fIlsusb\fR\|(8). The \f(CW\*(C`ups.model\*(C'\fR in the \f(CW\*(C`upsc\*(C'\fR output only lists the name after -\&\*(L"\s-1TRIPP\s0 \s-1LITE\s0\*(R", so to match a \s-1SMART2200RMXL2U\s0, you could use the regex -\&\*(L".*SMART2200.*\*(R". -.IP "productid" 4 -.IX Item "productid" -The productid is a regular expression which matches the \s-1UPS\s0 \s-1PID\s0 as four -hexadecimal digits. So far, the only devices that work with this driver have -\&\s-1PID\s0 \f(CW0001\fR. -.IP "serial" 4 -.IX Item "serial" -It does not appear that these particular Tripp Lite UPSes use the iSerial -descriptor field to return a serial number. However, in case your unit does, -you may specify it here. -.PP -For more information on regular expressions, see \fIregex\fR\|(7) -.SH "RUNTIME VARIABLES" -.IX Header "RUNTIME VARIABLES" -.IP "ups.delay.shutdown" 4 -.IX Item "ups.delay.shutdown" -This variable is the same as the \f(CW\*(C`offdelay\*(C'\fR setting, but it can be changed at -runtime by \fIupsrw\fR\|(8). -.IP "ups.id" 4 -.IX Item "ups.id" -Some \s-1SMARTPRO\s0 models feature an \s-1ID\s0 that can be set and retrieved. If your \s-1UPS\s0 -supports this feature, this variable will be listed in the output of \fIupsrw\fR\|(8). -.IP "outlet.1.switch" 4 -.IX Item "outlet.1.switch" -Some Tripp Lite units have a switchable outlet (usually outlet #1) which can be -turned on and off by writing \f(CW1\fR or \f(CW0\fR, respectively, to \f(CW\*(C`outlet.1.switch\*(C'\fR. -If your unit has multiple switchable outlets, substitute the outlet number for -\&\*(L"1\*(R" in the variable name. Be sure to test this first \- there is no other way to -be certain that the number used by the driver matches the label on the unit. -.SH "KNOWN ISSUES AND BUGS" -.IX Header "KNOWN ISSUES AND BUGS" -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 \f(CW\*(C`\-DDD\*(C'\fR to increase the verbosity. -.PP -So far, the Tripp Lite UPSes do not seem to have any serial number or other -unique identifier accessible through \s-1USB\s0. Thus, when monitoring several Tripp -Lite \s-1USB\s0 UPSes, you should use either the \f(CW\*(C`bus\*(C'\fR or \f(CW\*(C`product\*(C'\fR configuration -options to uniquely specify which \s-1UPS\s0 a given driver instance should control. -.PP -For instance, you can easily monitor an \s-1OMNIVS1000\s0 and a \s-1SMART1500RM2U\s0 at the -same time, since they have different \s-1USB\s0 Product \s-1ID\s0 strings. If you have two -\&\s-1SMART1500RM2U\s0 units, you would have to find which \s-1USB\s0 bus number each unit is -on (via \f(CW\*(C`lsusb\*(C'\fR), which may result in ambiguities if the available \s-1USB\s0 ports -are on the same bus. -.PP -Some of the SMART*2U models have an \s-1ID\s0 number, but because this \s-1ID\s0 is not -exposed as a \s-1USB\s0 string descriptor, there is no easy way to use this \s-1ID\s0 to -distinguish between multiple \s-1UPS\s0 units on a single machine. -.SH "AUTHORS" -.IX Header "AUTHORS" -Charles Lepple , based on the tripplite driver by -Rickard E. (Rik) Faith and Nicholas Kain -. Please do not email the authors directly \- use the -nut-upsdev mailing list. -.PP -A Tripp Lite \s-1OMNIVS1000\s0 was graciously donated to the \s-1NUT\s0 project by: -.Sp -.RS 4 -Relevant Evidence, \s-1LLC\s0. -.Sp -http://www.relevantevidence.com -.Sp -Email: info@relevantevidence.com -.RE -.SH "SEE ALSO" -.IX Header "SEE ALSO" -.Sh "The core driver:" -.IX Subsection "The core driver:" -\&\fInutupsdrv\fR\|(8), \fIregex\fR\|(7), \fIusbhid\-ups\fR\|(8) -.Sh "Internet resources:" -.IX Subsection "Internet resources:" -The \s-1NUT\s0 (Network \s-1UPS\s0 Tools) home page: http://www.networkupstools.org/ diff --git a/man/tripplitesu.8 b/man/tripplitesu.8 deleted file mode 100644 index bde1688..0000000 --- a/man/tripplitesu.8 +++ /dev/null @@ -1,31 +0,0 @@ -.TH TRIPPLITESU 8 "Mon Jul 21 2003" "" "Network UPS Tools (NUT)" -.SH NAME -tripplitesu \- Driver for Tripp\(hyLite SmartOnline (SU) UPS equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -tripplitesu driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -This driver supports the Tripp Lite SmartOnline family. - -.SH EXTRA ARGUMENTS -This driver supports the following optional settings in the -\fBups.conf\fR(5): - -.IP "lowbatt=\fInum\fR" -Set the low battery warning threshold in percent at which shutdown is -initiated by -\fBupsmon\fR(8). By default the UPS may not report low battery until -there are only a few seconds left. Common values are around 25 \(hy 30. - -.SH AUTHOR -Allan N. Hessenflow - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/ups.conf.5 b/man/ups.conf.5 deleted file mode 100644 index 0b9433d..0000000 --- a/man/ups.conf.5 +++ /dev/null @@ -1,134 +0,0 @@ -.TH UPS.CONF 5 "Sun Aug 24 2003" "" "Network UPS Tools (NUT)" -.SH NAME -ups.conf \- UPS definitions for Network UPS Tools - -.SH DESCRIPTION - -This file is read by the driver controller upsdrvctl, the UPS drivers -that use the common core (see \fBnutupsdrv\fR(8)) and \fBupsd\fR(8). -The file begins with global directives, and then each UPS has a -section which contains a number of directives that set parameters for -that UPS. - -A UPS section begins with the name of the ups in brackets, and continues -until the next UPS name in brackets or until EOF. The name "default" is -used internally in upsd, so you can't use it in this file. - -You must define the "driver" and "port" elements for each entry. Anything -after that in a section is optional. A simple example might look like -this: - -.IP -.nf - [myups] - driver = megatec - port = /dev/ttyS0 - desc = "Web server UPS" -.fi -.LP - -A slightly more complicated version includes some extras for the -hardware\(hyspecific part of the driver: - -.IP -.nf - [bigups] - driver = apcsmart - port = /dev/cua00 - cable = 940\-0095B - sdtype = 2 - desc = "Database server UPS" -.fi -.LP - -In this case, the \fBapcsmart\fR(8) driver will receive variables called -"cable" and "sdtype" which have special meanings. See the man pages of -your driver(s) to learn which variables are supported and what they do. - -.SH GLOBAL DIRECTIVES - -.IP chroot -Optional. The driver will \fBchroot\fR(2) to this directory during -initialization. This can be useful when securing systems. - -.IP driverpath -Optional. Path name of the directory in which the UPS driver executables -reside. If you don't specify this, the programs look in a built\(hyin default -directory, which is often /usr/local/ups/bin. - -.IP maxstartdelay -Optional. Same as the UPS field of the same name, but this is the -default for UPSes that don't have the field. - -.IP 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. - -.IP user -Optional. If started as root, the driver will \fBsetuid\fR(2) to the -user id associated with \fIusername\fR. - -.SH UPS FIELDS -.IP driver -Required. This specifies which program will be monitoring this UPS. You -need to specify the one that is compatible with your hardware. See -\fBnutupsdrv\fR(8) for more information on drivers in general and pointers -to the man pages of specific drivers. - -.IP port -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. - -.IP 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. - -.IP desc -Optional. This allows you to set a brief description that upsd will -provide to clients that ask for a list of connected equipment. - -.IP nolock -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. -.IP -You should only use this if your system won't work without it. -.IP -This may be needed on Mac OS X systems. - -.IP 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. -.IP -The default is 45 seconds. -.LP - -All other fields are passed through to the hardware\(hyspecific part of the -driver. See those manuals for the list of what is allowed. - -.SH INTEGRATION - -\fBupsdrvctl\fR(8) uses this file to start and stop the drivers. - -The drivers themselves also obtain configuration data from this file. -Each driver looks up its section and uses that to configure itself. - -\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 ups.conf called "snoopy", then you can monitor it -from \fBupsc\fR(8) or similar as "snoopy@doghouse". - -.SH SEE ALSO -\fBupsd\fR(8), \fBnutupsdrv\fR(8), \fBupsdrvctl\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/upsc.8 b/man/upsc.8 deleted file mode 100644 index 54aef63..0000000 --- a/man/upsc.8 +++ /dev/null @@ -1,86 +0,0 @@ -.TH UPSC 8 "Mon Mar 12 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upsc \- example lightweight UPS client -.SH SYNOPSIS -.B upsc \-l | \-L [\fIhost\fB] - -.B upsc \fIups\fB [\fIvariable\fB] - -.SH DESCRIPTION - -.B upsc -is provided as a quick way to poll the status of a UPS server. It can be -used inside shell scripts and other programs that need UPS data but don't -want to include the full interface. - -.SH OPTIONS -.IP \-l\ \fIhost\fR -List all UPS names configured at \fIhost\fR, one name per line. The hostname -defaults to "localhost". You may optionally add a colon and a port number. - -.IP \-L\ \fIhost\fR -As above, list all UPS names configured at \fIhost\fR, including their -description provided by the remote \fBupsd\fR(8) from \fBups.conf\fR(5). The -hostname defaults to "localhost". You may optionally add a colon and a port -number to override the default port. - -.IP \fIups\fR -Display the status of that UPS. The format for this option is -upsname[@hostname[:port]]. The default hostname is "localhost". - -.IP \fIvariable\fR -Display the value of this variable only. By default, upsc retrieves -the list of variables from the server and then displays the value for -each. This may be useful in shell scripts to save an additional pipe -into grep. - -.SH EXAMPLES - -To list all variables on an UPS named "myups" on a host -called "mybox", with \fBupsd\fR(8) running on port 1234: - -.nf - $ upsc myups@mybox:1234 - battery.charge: 100.0 - battery.voltage: 13.9 - battery.voltage.nominal: 13.6 - . . . -.fi - -To list the UPSes configured on this system, along with their descriptions: - -.nf - $ upsc -L - apc: Back-UPS 500 - ppro2: Patriot Pro II -.fi - -To retrieve the status for all UPSes connected to mybox, using Bourne-shell -syntax: - -.nf - $ for UPS in `upsc -l mybox:1234`; do - upsc $UPS ups.status - done -.fi - -.SH DIAGNOSTICS - -upsc will either print a list of UPS names, a list of all supported variables -and their values on the UPS, or an error message. If you receive an error, -make sure you have specified a valid UPS on the command line, that -\fBupsd\fR(8) is really running on the other host and that no firewalls are -blocking you. - -.SH HISTORY - -Earlier versions of this program used the \fBupsfetch\fR library and UDP -sockets to talk to upsd. This version of upsc uses the new -\fBupsclient\fR library, which only talks TCP. This is why \fBupsct\fR -no longer exists. - -.SH SEE ALSO -\fBupsd\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/upscli_connect.3 b/man/upscli_connect.3 deleted file mode 100644 index d7e5896..0000000 --- a/man/upscli_connect.3 +++ /dev/null @@ -1,33 +0,0 @@ -.TH UPSCLI_CONNECT 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upscli_connect \- Open a connection to a NUT upsd -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "int upscli_connect(UPSCONN *ups, const char *host, int port, int flags);" -.fi -.SH DESCRIPTION -The \fBupscli_connect()\fP function takes the pointer \fIups\fP to a -UPSCONN state structure and opens a TCP connection to the \fIhost\fP on -the given \fIport\fP. -.PP -\fIflags\fP may be either \fBUPSCLI_CONN_TRYSSL\fP to try a SSL -connection, or \fBUPSCLI_CONN_REQSSL\fP to require a SSL connection. -.PP -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't been compiled with SSL support. -.PP -You must call \fBupscli_disconnect\fP(3) when finished with a -connection, or your program will slowly leak memory and file -descriptors. -.SH "RETURN VALUE" -The \fBupscli_connect()\fP function modifies the UPSCONN structure and -returns 0 on success, or \-1 if an error occurs. -.SH "SEE ALSO" -.BR upscli_disconnect "(3), "upscli_fd "(3), " -.BR upscli_splitaddr "(3), "upscli_splitname "(3), " -.BR upscli_ssl "(3), "upscli_strerror "(3), " -.BR upscli_upserror "(3) " diff --git a/man/upscli_disconnect.3 b/man/upscli_disconnect.3 deleted file mode 100644 index 2f0d116..0000000 --- a/man/upscli_disconnect.3 +++ /dev/null @@ -1,23 +0,0 @@ -.TH UPSCLI_DISCONNECT 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upscli_disconnect \- disconnect from a UPS server -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "int upscli_disconnect(UPSCONN *ups);" -.fi -.SH DESCRIPTION -The \fBupscli_disconnect()\fP function takes the pointer \fIups\fP to a -UPSCONN state structure, shuts down the connection to the server, and -frees dynamic memory used by the state structure. The UPSCONN structure -is no longer valid after this function is called. -.PP -This function must be called, or your program will leak memory and -file descriptors. -.SH "RETURN VALUE" -The \fBupscli_disconnect()\fP function returns 0 on success, or \-1 if an -error occurs. -.SH "SEE ALSO" -.BR upscli_connect "(3), "upscli_fd "(3), " -.BR upscli_strerror "(3), "upscli_upserror "(3) " diff --git a/man/upscli_fd.3 b/man/upscli_fd.3 deleted file mode 100644 index 127442b..0000000 --- a/man/upscli_fd.3 +++ /dev/null @@ -1,22 +0,0 @@ -.TH UPSCLI_FD 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upscli_fd \- Get file descriptor for connection -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "int upscli_fd(UPSCONN *ups);" -.fi -.SH DESCRIPTION -The \fBupscli_fd()\fP function takes the pointer \fIups\fP to a -UPSCONN state structure and returns the value of the file descriptor -for that connection, if any. -.PP -This may be useful for determining if the connection to \fBupsd\fR(8) -has been lost. -.PP -.SH "RETURN VALUE" -The \fBupscli_fd()\fP function returns the file descriptor, which -may be any non\(hynegative number. It returns \-1 if an error occurs. -.SH "SEE ALSO" -.BR upscli_connect "(3), "upscli_strerror "(3), "upscli_upserror "(3) " diff --git a/man/upscli_get.3 b/man/upscli_get.3 deleted file mode 100644 index 467e079..0000000 --- a/man/upscli_get.3 +++ /dev/null @@ -1,91 +0,0 @@ -.TH UPSCLI_GET 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upscli_get \- retrieve data from a UPS -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "int upscli_get(UPSCONN *ups, int numq, const char **query," -.BI " int *numa, char ***answer)" -.fi -.SH DESCRIPTION -The \fBupscli_get()\fP function takes the pointer \fIups\fP to a -UPSCONN state structure, and the pointer \fIquery\fP to an array of -\fInumq\fP query elements. It builds a properly\(hyformatted request from -those elements and transmits it to \fBupsd\fP(8). -.PP -Upon success, the response will be split into separate components. A -pointer to those components will be returned in \fIanswer\fP. The -number of usable answer components will be returned in \fInuma\fP. -.PP -.SH "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. -Some examples are: -.PP - \(hy GET NUMLOGINS - \(hy GET UPSDESC - \(hy GET VAR - \(hy GET TYPE - \(hy GET DESC - \(hy GET CMDDESC - -.SH QUERY FORMATTING -To generate a request for "GET NUMLOGINS su700", you would populate -query and numq as follows: -.PP -.nf - int numq; - const char *query[2]; - - query[0] = "NUMLOGINS"; - query[1] = "su700"; - numq = 2; -.fi -.PP -All escaping of special characters and quoting of elements with spaces -is handled for you inside this function. -.PP -.SH ANSWER FORMATTING -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: -.PP -.nf - numa = 3; - answer[0] = "NUMLOGINS" - answer[1] = "su700" - answer[2] = "1" -.fi -.PP -Notice that the value which you seek typically starts at answer[numq]. -.PP -.SH "ERROR CHECKING" -This function will check your query against the response from -\fBupsd\fP. For example, if you send "VAR" "su700" "ups.status", it -will expect to see those at the beginning of the response. -.PP -If the results from \fBupsd\fP do not pass this case\(hyinsensitive test -against your request, this function will return an error. When this -happens, \fBupscli_upserror\fP(3) will return \fIUPSCLI_ERR_PROTOCOL\fP. -.PP -.SH ANSWER ARRAY LIFETIME -The pointers contained within the \fIanswer\fP array are only valid -until the next call to a \fBupsclient\fP function which references them. -If you need to use data from multiple calls, you must copy it somewhere -else first. -.PP -The \fIanswer\fP array and its elements may change locations, so you -must not rely on previous addresses. You must only use the addresses -which were returned by the most recent call. You also must not attempt -to use more than \fInuma\fP elements in \fIanswer\fP. Such behavior is -undefined, and may yield bogus data or a crash. -.PP -The array will be deleted after calling \fBupscli_disconnect\fP(3). Any -access after that point is also undefined. -.PP -.SH "RETURN VALUE" -The \fBupscli_get()\fP function returns 0 on success, or \-1 if an -error occurs. -.SH "SEE ALSO" -.BR upscli_list_start "(3), "upscli_list_next "(3), " -.BR upscli_strerror "(3), "upscli_upserror "(3) " diff --git a/man/upscli_list_next.3 b/man/upscli_list_next.3 deleted file mode 100644 index 8729e9f..0000000 --- a/man/upscli_list_next.3 +++ /dev/null @@ -1,52 +0,0 @@ -.TH UPSCLI_LIST_NEXT 3 "Tue May 13 2003" "" "Network UPS Tools (NUT)" -.SH NAME -upscli_list_next \- retrieve list items from a UPS -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "int upscli_list_next(UPSCONN *ups, int numq, const char **query, -.BI " int *numa, char ***answer)" -.fi -.SH DESCRIPTION -The \fBupscli_list_next()\fP function takes the pointer \fIups\fP to a -UPSCONN state structure, and the pointer \fIquery\fP to an array of -\fInumq\fP query elements. It performs a read from the network and -expects to find either another list item or the end of a list. -.PP -You must call \fBupscli_list_start\fP(3) before calling this function. -.PP -This function will return 1 and set values in \fInuma\fP and -\fIanswer\fP if a list item is received. If the list is done, it will -return 0, and the values in \fInuma\fP and \fIanswer\fP are undefined. -.PP -Calling this function after it returns something other than 1 is -undefined. -.PP -.SH QUERY FORMATTING -You may not change the values of \fInumq\fP or \fIquery\fP between the -call to \fBupscli_list_start\fP(3) and the first call to this function. -You also may not change the values between calls to this function. -.PP -.SH ANSWER FORMATTING -The contents of \fInuma\fP and \fIanswer\fP work just like a call to -\fBupscli_get\fP(3). The values returned by \fBupsd\fP are identical to -a single item request, so this is not surprising. -.PP -.SH "ERROR CHECKING" -This function checks the response from \fBupsd\fP against your query. -If the response is not part of the list you have requested, it will -return an error code. -.PP -When this happens, \fBupscli_upserror\fP(3) will return -\fIUPSCLI_ERR_PROTOCOL\fP. -.PP -.SH "RETURN VALUE" -The \fBupscli_list_next()\fP function returns 1 when list data is -present, 0 if the list is finished, or \-1 if an error occurs. -.PP -It is possible to have an empty list. The function will return 0 for -its first call in that case. -.SH "SEE ALSO" -.BR upscli_list_start "(3), " -.BR upscli_strerror "(3), "upscli_upserror "(3) " diff --git a/man/upscli_list_start.3 b/man/upscli_list_start.3 deleted file mode 100644 index be54b1b..0000000 --- a/man/upscli_list_start.3 +++ /dev/null @@ -1,65 +0,0 @@ -.TH UPSCLI_LIST_START 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upscli_list_start \- begin multi\(hyitem retrieval from a UPS -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "int upscli_list_start(UPSCONN *ups, int numq, const char **query)" -.fi -.SH DESCRIPTION -The \fBupscli_list_start()\fP function takes the pointer \fIups\fP to a -UPSCONN state structure, and the pointer \fIquery\fP to an array of -\fInumq\fP query elements. It builds a properly\(hyformatted request from -those elements and transmits it to \fBupsd\fP(8). -.PP -Upon success, the caller must call \fBupscli_list_next\fP(3) to retrieve -the elements of the list. Failure to retrieve the list will most likely -result in the client getting out of sync with the server due to buffered -data. -.PP -.SH "USES" -This function implements the "LIST" command in the protocol. As a -result, you can use it to request many different things from the server. -Some examples are: -.PP - \(hy LIST UPS - \(hy LIST VAR - \(hy LIST RW - \(hy LIST CMD - \(hy LIST ENUM - -.SH QUERY FORMATTING -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: -.PP -.nf - int numq; - const char *query[2]; - - query[0] = "VAR"; - query[1] = "su700"; - numq = 2; -.fi -.PP -All escaping of special characters and quoting of elements with spaces -is handled for you inside this function. -.PP -.SH "ERROR CHECKING" -This function checks the response from \fBupsd\fP against your query. -If it is not starting a list, or is starting the wrong type of list, it -will return an error code. -.PP -When this happens, \fBupscli_upserror\fP(3) will return -\fIUPSCLI_ERR_PROTOCOL\fP. -.PP -.SH "RETURN VALUE" -The \fBupscli_list_start()\fP function returns 0 on success, or \-1 if an -error occurs. -.SH "SEE ALSO" -.BR upscli_fd "(3), "upscli_get "(3), " -.BR upscli_readline "(3), "upscli_sendline "(3), " -.BR upscli_ssl "(3), " -.BR upscli_strerror "(3), "upscli_upserror "(3) " - diff --git a/man/upscli_readline.3 b/man/upscli_readline.3 deleted file mode 100644 index f069bd1..0000000 --- a/man/upscli_readline.3 +++ /dev/null @@ -1,26 +0,0 @@ -.TH UPSCLI_READLINE 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upscli_readline \- read a single response from a UPS -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "int upscli_readline(UPSCONN *ups, char *buf, size_t buflen);" -.fi -.SH DESCRIPTION -The \fBupscli_readline()\fP function takes the pointer \fIups\fP to a -UPSCONN state structure, receives a single line from the server, and -copies up to \fIbuflen\fP bytes of the response into the buffer -\fIbuf\fP. -.PP -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. -.SH "RETURN VALUE" -The \fBupscli_readline()\fP function returns 0 on success, or \-1 if an -error occurs. -.SH "SEE ALSO" -.BR upscli_fd "(3), "upscli_get "(3), " -.BR upscli_readline "(3), "upscli_sendline "(3), " -.BR upscli_ssl "(3), " -.BR upscli_strerror "(3), "upscli_upserror "(3) " diff --git a/man/upscli_sendline.3 b/man/upscli_sendline.3 deleted file mode 100644 index 9578d72..0000000 --- a/man/upscli_sendline.3 +++ /dev/null @@ -1,24 +0,0 @@ -.TH UPSCLI_SENDLINE 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upscli_sendline \- send a single command to a UPS -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "int upscli_sendline(UPSCONN *ups, const char *buf, size_t buflen);" -.fi -.SH DESCRIPTION -The \fBupscli_sendline()\fP function takes the pointer \fIups\fP to a -UPSCONN state structure and transmits a buffer \fIbuf\fP of size -\fIbuflen\fP to the server. -.PP -The data in \fIbuf\fP must be a fully formatted protocol command as no -parsing of the buffer occurs within this function. -.SH "RETURN VALUE" -The \fBupscli_sendline()\fP function returns 0 on success, or \-1 if an -error occurs. -.SH "SEE ALSO" -.BR upscli_fd "(3), "upscli_get "(3), " -.BR upscli_readline "(3), "upscli_sendline "(3), " -.BR upscli_ssl "(3), " -.BR upscli_strerror "(3), "upscli_upserror "(3) " diff --git a/man/upscli_splitaddr.3 b/man/upscli_splitaddr.3 deleted file mode 100644 index dcdb3d4..0000000 --- a/man/upscli_splitaddr.3 +++ /dev/null @@ -1,33 +0,0 @@ -.TH UPSCLI_SPLITADDR 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upscli_splitaddr \- split a listening address into its components -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "int upscli_splitaddr(const char *buf, char **hostname, " -.BI " int *port)" -.fi -.SH DESCRIPTION -The \fBupscli_splitaddr()\fP function takes a pointer to the raw UPS -definition \fIbuf\fP and returns pointers to dynamically allocated -memory in \fIupsname\fP and \fIhostname\fP. It also copies the port -number into \fIport\fP. -.SH FORMATTING -A listening address definition is specified according to this format: -.PP - [:] -.PP -Definitions without an explicit port value receive the default value of -3493. -.SH "MEMORY USAGE" -You must \fBfree\fP(3) the pointer \fIhostname\fP when you are done -with it to avoid memory leaks. -.SH "RETURN VALUE" -The \fBupscli_splitaddr()\fP function returns 0 on success, or \-1 if an -error occurs. -.SH "SEE ALSO" -.BR upscli_fd "(3), "upscli_get "(3), " -.BR upscli_readline "(3), "upscli_sendline "(3), " -.BR upscli_splitname "(3), "upscli_ssl "(3), " -.BR upscli_strerror "(3), "upscli_upserror "(3) " diff --git a/man/upscli_splitname.3 b/man/upscli_splitname.3 deleted file mode 100644 index 38ffb6c..0000000 --- a/man/upscli_splitname.3 +++ /dev/null @@ -1,36 +0,0 @@ -.TH UPSCLI_SPLITNAME 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upscli_splitname \- split a UPS definition into its components -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "int upscli_splitname(const char *buf, char **upsname, " -.BI " char **hostname, int *port)" -.fi -.SH DESCRIPTION -The \fBupscli_splitname()\fP function takes a pointer to the raw UPS -definition \fIbuf\fP and returns pointers to dynamically allocated -memory in \fIupsname\fP and \fIhostname\fP. It also copies the port -number into \fIport\fP. -.SH FORMATTING -A UPS definition is specified according to this format: -.PP - [@[:]] -.PP -When the UPS name is not given, this function will print an error to -stderr and return \-1 without changing anything. -.PP -Definitions without an explicit port value receive the default value of -3493. The default hostname is "localhost". -.SH "MEMORY USAGE" -You must \fBfree\fP(3) the pointers to \fIupsname\fP and \fIhostname\fP -when you are done with them to avoid memory leaks. -.SH "RETURN VALUE" -The \fBupscli_splitname()\fP function returns 0 on success, or \-1 if an -error occurs. -.SH "SEE ALSO" -.BR upscli_fd "(3), "upscli_get "(3), " -.BR upscli_readline "(3), "upscli_sendline "(3), " -.BR upscli_splitaddr "(3), "upscli_ssl "(3), " -.BR upscli_strerror "(3), "upscli_upserror "(3) " diff --git a/man/upscli_ssl.3 b/man/upscli_ssl.3 deleted file mode 100644 index 49eda94..0000000 --- a/man/upscli_ssl.3 +++ /dev/null @@ -1,23 +0,0 @@ -.TH UPSCLI_SSL 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upscli_ssl \- Check SSL mode for current connection -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "int upscli_ssl(UPSCONN *ups);" -.fi -.SH DESCRIPTION -The \fBupscli_ssl()\fP function takes the pointer \fIups\fP to a -UPSCONN state structure. It only returns 1 if SSL support has been -compiled into the \fBupsclient\fR library, and if it was successfully -enabled for this connection. -.PP -.SH "RETURN VALUE" -The \fBupscli_ssl()\fP function returns 1 if SSL is running, and 0 if -not. It returns \-1 in the event of an error. -.SH "SEE ALSO" -.BR upscli_fd "(3), "upscli_get "(3), " -.BR upscli_readline "(3), "upscli_sendline "(3), " -.BR upscli_ssl "(3), " -.BR upscli_strerror "(3), "upscli_upserror "(3) " diff --git a/man/upscli_strerror.3 b/man/upscli_strerror.3 deleted file mode 100644 index b99797b..0000000 --- a/man/upscli_strerror.3 +++ /dev/null @@ -1,22 +0,0 @@ -.TH UPSCLI_STRERROR 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upscli_strerror \- return string describing error condition -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "char *upscli_strerror(UPSCONN *ups);" -.fi -.SH DESCRIPTION -The \fBupscli_strerror()\fP function takes the pointer \fIups\fP to a -UPSCONN state structure and returns a string describing the last error -which occurred on this connection. The string is valid until the next -call to \fBupscli_strerror()\fP. -.SH "RETURN VALUE" -The \fBupscli_strerror()\fP function returns a description of the error, -or an unknown error message if the error code is not recognized. -.SH "SEE ALSO" -.BR upscli_fd "(3), "upscli_get "(3), " -.BR upscli_readline "(3), "upscli_sendline "(3), " -.BR upscli_ssl "(3), " -.BR upscli_strerror "(3), "upscli_upserror "(3) " diff --git a/man/upscli_upserror.3 b/man/upscli_upserror.3 deleted file mode 100644 index 7129fca..0000000 --- a/man/upscli_upserror.3 +++ /dev/null @@ -1,27 +0,0 @@ -.TH UPSCLI_UPSERROR 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upscli_upserror \- Get current error number for connection -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "int upscli_upserror(UPSCONN *ups);" -.fi -.SH DESCRIPTION -The \fBupscli_upserror()\fP function takes the pointer \fIups\fP to a -UPSCONN state structure and returns the value of the internal error -number, if any. -.PP -This is typically used to check for certain error values like -UPSCLI_ERR_UNKCOMMAND. That specific error can be used for detecting -older versions of \fBupsd\fR(8) which might not support a given command. -.PP -Some error messages have additional meanings, so you should use -\fBupscli_strerror\fR(3) to obtain readable error messages. -.PP -.SH "RETURN VALUE" -The \fBupscli_upserror()\fP function returns one of the UPSCLI_ERR_* -values from \fBupsclient.h\fR, or 0 if no error has occurred. -.SH "SEE ALSO" -.BR upscli_readline "(3), "upscli_sendline "(3), " -.BR upscli_strerror (3) diff --git a/man/upsclient.3 b/man/upsclient.3 deleted file mode 100644 index 16ea7b1..0000000 --- a/man/upsclient.3 +++ /dev/null @@ -1,53 +0,0 @@ -.TH UPSCLIENT 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upsclient \- Network UPS Tools client access library -.SH SYNOPSIS -.SH DESCRIPTION -The Network UPS Tools (NUT) \fBupsclient\fP library provides a number of -useful functions for programs to use when communicating with -\fBupsd\fP(8). Many of the low\(hylevel socket and protocol details are -handled automatically when using this interface. -.PP -State is maintained across calls in an opaque structure called UPSCONN. -Callers are expected to create one per connection. These will be -provided to most of the \fBupsclient\fP functions. The format of this -structure is subject to change, and client programs must not reference -elements within it directly. -.PP -.SH NETWORK FUNCTIONS -To create a new connection, use \fBupscli_connect\fP(3). This will also -initialize the UPSCONN structure. To verify that a connection has been -established later, \fBupscli_fd\fP(3) can be used to return the -file descriptor. Clients wishing to check for the presence and -operation of SSL on a connection may call \fBupscli_ssl\fR(3). -.PP -The majority of clients will use \fBupscli_get\fP(3) to retrieve single -items from the server. To retrieve a list, use -\fBupscli_list_start\fP(3) to get it started, then call -\fBupscli_list_next\fP(3) for each element. -.PP -Raw lines of text may be sent to \fBupsd\fP with -\fBupscli_sendline\fP(3). Reading raw lines is possible with -\fBupscli_readline\fP(3). Client programs are expected to format these -lines according to the protocol, as no checking will be performed before -transmission. -.PP -At the end of a connection, you must call \fBupsclient_disconnect\fR(3) -to disconnect from \fBupsd\fP and release any dynamic memory associated -with the UPSCONN structure. Failure to call this function will result -in memory and file descriptor leaks in your program. -.PP -.SH ERROR HANDLING -In the event of an error, \fBupscli_strerror\fR(3) will provide -human\(hyreadable details on what happened. \fBupscli_upserror\fR(3) may -also be used to retrieve the error number. These numbers are defined in -\fBupsclient.h\fP as \fIUPSCLI_ERR_*\fP. -.PP -.SH "SEE ALSO" -.BR upscli_connect "(3), "upscli_disconnect "(3), "upscli_fd "(3), " -.BR upscli_getvar "(3), "upscli_list_next "(3), " -.BR upscli_list_start "(3), "upscli_readline "(3), " -.BR upscli_sendline "(3), " -.BR upscli_splitaddr "(3), "upscli_splitname "(3), " -.BR upscli_ssl "(3), "upscli_strerror "(3), " -.BR upscli_upserror "(3) " diff --git a/man/upscode2.8 b/man/upscode2.8 deleted file mode 100644 index 6dc727c..0000000 --- a/man/upscode2.8 +++ /dev/null @@ -1,87 +0,0 @@ -.TH UPSCODE2 8 "Tue Oct 19 2004" "" "Network UPS Tools (NUT)" -.SH NAME -upscode2 \- Driver for UPScode II compatible UPS equipment -.SH NOTE -This man page only documents the hardware\(hyspecific features of the -upscode2 driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH 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. - -.SH EXTRA ARGUMENTS -This driver supports the following optional settings in the -\fBups.conf\fR(5): - -.IP "manufacturer=\fIvalue\fR" -Autodetection of this parameter is not possible yet (and it probably -never will be). Therefore this user defined string accepts any name. The -default is \fIunknown\fR. - -.IP "input_timeout=\fIvalue\fR" -The timeout waiting for a response from the UPS. Some UPS models have -shown to be rather slow, resulting in frequent messages about empty -responses from the UPS. If you see this, try increasing this value. - -.IP "output_pace=\fIvalue\fR" -Delay between characters sent to the UPS. This was added for completeness -with the above parameter. It has not shown to be needed yet. - -.IP "baudrate=\fIvalue\fR" -The default baudrate is 1200, which is the standard for the UPScode II -protocol. - -.IP "full_update_timer=\fIvalue\fR" -Number of seconds between collection of normative values. - -.IP "use_crlf" -Flag to set if commands towards to UPS need to be terminated with CR-LF, -and not just CR. - -.IP "use_pre_lf" -Flag to set if commands towards to UPS need to be introduced with an LF. -A Compaq T1500h is known to need this. - -.SH UPSCMD - -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. - -test.panel.start \(hy Start UPS self test - -test.battery.start \(hy Start battery self test - -beeper.enable \(hy Enable UPS beeper - -beeper.disable \(hy Disable UPS beeper - -shutdown.return \(hy Shut down in 1 second and wait for power to return - -shutdown.stayoff \(hy Shut down in 1 seconds - -shutdown.reboot \(hy Shut down in 1 seconds and reboot after 1 minute - -shutdown.reboot.graceful \(hy Shut down in 20 seconds and reboot after 1 minute - -.SH NOTES - -The Powerware UPS models that this driver has been tested against until now -has not returned a value for \fIbattery.charge\fR. Therefore the driver will -guesstimate a value based on the nominal battery min/max and the current -battery voltage. - -.SH AUTHOR -H\[oa]vard Lygre , -Niels Baggesen - -.SH SEE ALSO - -.SS The core driver: -\fBnutupsdrv\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/upsd.8 b/man/upsd.8 deleted file mode 100644 index 9c178b1..0000000 --- a/man/upsd.8 +++ /dev/null @@ -1,158 +0,0 @@ -.TH UPSD 8 "Mon Nov 30 2009" "" "Network UPS Tools (NUT)" -.SH NAME -upsd \- UPS information server -.SH SYNOPSIS -.B upsd \-h - -.B upsd [OPTIONS] - -.SH DESCRIPTION - -.B upsd -is responsible for serving the data from the drivers to the clients. It -connects to each driver and maintains a local cache of the current -state. Queries from the clients are served from this cache, so delays -are minimal. - -It also conveys administrative messages from the clients such as -starting tests or setting values back to the drivers. - -This program is essential, and must be running at all times to actually -make any use out of the drivers and clients. - -Controls in the configuration files allow you to limit access to the -server, but you should also use a firewall for extra protection. Client -processes such as \fBupsmon\fR(8) trust upsd for status information about -the UPS hardware, so keep it secure. - -.SH OPTIONS - -.IP "\-c \fIcommand\fR" -Send \fIcommand\fR to the background process as a signal. Valid commands -are: -.IP -.nf - reload \(hy reread configuration files - stop \(hy stop process and exit -.fi -.LP - -.IP "\-D" -Raise the debug level. Use this multiple times for additional details. - -.IP "\-h" -Display the help text. - -.IP "\-r \fIdirectory\fR" -upsd will \fBchroot\fR(2) to \fIdirectory\fR shortly after startup -and before parsing any configuration files with this option set. You -can use this to create a "jail" for greater security. - -You must coordinate this with your drivers, as upsd must be able to find -the state path within \fIdirectory\fR. See \fBupsdrvctl\fR(8) and -\fBnutupsdrv\fR(8). - -.IP "\-u \fIuser\fR" -Switch to user \fIuser\fR after startup if started as root. This -overrides whatever you may have compiled in with 'configure -\-\-with\-user'. - -.IP "\-V" -Display the version of the program. - -.SH RELOADING - -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 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\(hyreadable, 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 - -upsd expects the drivers to either update their status regularly or at -least answer periodic queries, called pings. If a driver doesn't -answer, upsd will declare it "stale" and no more information will be -provided to the clients. - -If upsd complains about staleness when you start it, then either your -driver or configuration files are probably broken. Be sure that the -driver is actually running, and that the UPS definition in -\fBups.conf\fR(5) is correct. Also make sure that you start your -driver(s) before starting upsd. - -Data can also be marked stale if the driver can no longer communicate -with the UPS. In this case, the driver should also provide diagnostic -information in the syslog. If this happens, check the serial or -USB cabling, or inspect the network path in the case of a SNMP UPS. - -.SH ACCESS CONTROL - -If the server is build with tcp-wrappers support enabled, it will check if -the NUT username is allowed to connect from the client address through the -\fB/etc/hosts.allow\fR and \fB/etc/hosts.deny\fR files. Note that this will -only be done for commands that require to be logged into the server. - -.IP -.nf - hosts.allow: - ------------ - upsd : admin@127.0.0.1/32 - upsd : monslave@127.0.0.1/32 monslave@192.168.1.0/24 - - hosts.deny: - ----------- - upsd : ALL -.fi -.LP - -Further details are described in \fBhosts_access\fR(5). - -.SH FILES - -The general upsd configuration file is \fBupsd.conf\fR(5). The -administrative functions like SET and INSTCMD for users are defined and -controlled in \fBupsd.users\fR(5). UPS definitions are found in -\fBups.conf\fR(5). - -.SH ENVIRONMENT VARIABLES - -\fBNUT_CONFPATH\fR is the path name of the directory that contains -\fBupsd.conf\fR and other configuration files. If this variable is not set, -\fBupsd\fR uses a built\(hyin default, which is often \fB/usr/local/ups/etc\fR. - -\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\(hyin default, which is often \fB/var/state/ups\fR. -The \fBSTATEPATH\fR directive in \fBupsd.conf\fR overrides this variable. - -.SH SEE ALSO - -.SS Clients: -\fBupsc\fR(8), \fBupscmd\fR(8), -\fBupsrw\fR(8), \fBupslog\fR(8), \fBupsmon\fR(8) - -.SS CGI programs: -\fBupsset.cgi\fR(8), \fBupsstats.cgi\fR(8), \fBupsimage.cgi\fR(8) - -.SS Drivers: -\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\(hyshut\fR(8), \fBmge\(hyutalk\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: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/upsimage.cgi.8 b/man/upsimage.cgi.8 deleted file mode 100644 index 7923741..0000000 --- a/man/upsimage.cgi.8 +++ /dev/null @@ -1,36 +0,0 @@ -.TH upsimage.cgi 8 "Wed Oct 16 2002" "" "Network UPS Tools (NUT)" -.SH NAME -upsimage.cgi \- Image\(hygenerating helper for upsstats.cgi -.SH SYNOPSIS -.B upsimage.cgi - -.SH NOTE -As a CGI program, this should be invoked through your web server. -If you run it from the command line, it will either complain about -unauthorized access or spew a PNG at you. - -.SH DESCRIPTION -.B upsimage.cgi -generates the graphical bars that make up the right side -of the page generated by \fBupsstats.cgi\fR(8). These represent the -current battery charge, utility voltage, and UPS load where available. - -The images are in PNG format, and are created by linking to Boutell's -excellent gd library. - -.SH ACCESS CONTROL -upsstats will only talk to \fBupsd\fR(8) servers that have been defined -in your \fBhosts.conf\fR(5). If it complains about "Access to that host -is not authorized", check that file first. - -.SH FILES -\fBhosts.conf\fR(5) - -.SH SEE ALSO -\fBupsstats.cgi\fR(8) - -.SS Internet resources: - -The gd home page: http://www.boutell.com/gd/ - -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/upslog.8 b/man/upslog.8 deleted file mode 100644 index d72b18c..0000000 --- a/man/upslog.8 +++ /dev/null @@ -1,96 +0,0 @@ -.TH UPSLOG 8 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)" -.SH NAME -upslog \- UPS status logger -.SH SYNOPSIS -.B upslog \-h - -.B upslog [OPTIONS] - -.SH DESCRIPTION - -.B upslog -is a daemon that will poll a UPS at periodic intervals, fetch the -variables that interest you, format them, and write them to a file. - -The default format string includes variables that are supported by many -common UPS models. See the description below to make your own. - -.SH OPTIONS - -.IP \-h -Display the help message. - -.IP "\-f \fIformat\fR" -Monitor the UPS using this format string. Be sure to enclose -\fIformat\fR in quotes so your shell doesn't split it up. Valid escapes -within this string are: - -%% \(hy insert a single % - -%TIME format% \(hy insert the time with strftime formatting - -%ETIME% \(hy insert the number of seconds, ala time_t. This is now a -10 digit number. - -%HOST% \(hy insert the local hostname - -%UPSHOST% \(hy insert the host of the UPS being monitored - -%PID% \(hy insert the pid of upslog - -%VAR varname% \(hy insert the value of variable varname - -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% -%VAR input.frequency% - -.IP "\-i \fIinterval\fR" - -Wait this many seconds between polls. This defaults to 30 seconds. - -If you require tighter timing, you should write your own logger using -the upsclient library. - -.IP "\-l \fIlogfile\fR" - -Store the results in this file. - -You can use \(hy for stdout, but upslog will remain in the foreground. - -.IP "\-s \fIups\fR" -Monitor this UPS. The format for this option is -upsname[@hostname[:port]]. The default hostname is "localhost". - -.IP "\-u \fIusername\fR" - -If started as root, upsmon will \fBsetuid\fR(2) to the user id -associated with \fIusername\fR for security. - -If it is not defined, it will use the value that was compiled into the -program. This defaults to 'nobody', which is less than ideal. - -.SH SERVICE DELAYS - -The interval value is merely the number given to sleep() 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 LOG ROTATION - -upslog 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. - -.SH SEE ALSO - -.SS Server: -\fBupsd\fR(8) - -.SS Clients: -\fBupsc\fR(8), \fBupscmd\fR(8), -\fBupsrw\fR(8), \fBupsmon\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/upssched.conf.5 b/man/upssched.conf.5 deleted file mode 100644 index 1acf603..0000000 --- a/man/upssched.conf.5 +++ /dev/null @@ -1,127 +0,0 @@ -.TH UPSSCHED.CONF 5 "Wed Sep 2 2009" "" "Network UPS Tools (NUT)" -.SH NAME -upssched.conf \- Configuration for upssched timer program - -.SH DESCRIPTION - -This file controls the operations of \fBupssched\fR(8), the timer\(hybased -helper program for \fBupsmon\fR(8). - -.SH CONFIGURATION DIRECTIVES - -.IP "CMDSCRIPT \fIscriptname\fR" -Required. This must be above any AT lines. This script is used to -invoke commands when your timers are triggered. It receives a single -argument which is the name of the timer that caused it to trigger. - -.IP "PIPEFN \fIfilename\fR" -Required. This sets the file name of the socket which will be used for -interprocess communications. This should be in a directory where normal -users can't create the file, due to the possibility of symlinking -and other evil. -.IP -Note: if you are running Solaris or similar, the permissions that -upssched sets on this file \fBare not enough\fR to keep you safe. If -your OS ignores the permissions on a FIFO, then you MUST put this in a -protected directory! -.IP -Note 2: by default, \fBupsmon\fR(8) will run upssched as whatever user -you have defined with RUN_AS_USER in \fBupsmon.conf\fR(8). Make sure -that user can create files and write to files in the path you use for -PIPEFN and LOCKFN. -.IP -My recommendation: create a special directory for upssched, make it -owned by your upsmon user, then use it for both. -.IP -The stock version of the upssched.conf ships with PIPEFN disabled -to make you visit this portion of the documentation and think about how -your system works before potentially opening a security hole. - -.IP "LOCKFN \fIfilename\fR" -Required. upssched attempts to create this file in order to avoid a -race condition when two events are dispatched from upsmon at nearly -the same time. This file will only exist briefly. It must not be -created by any other process. -.IP -You should put this in the same directory as PIPEFN. - -.IP "AT \fInotifytype\fR \fIupsname\fR \fIcommand\fR" -Define a handler for a specific event \fInotifytype\fR on UPS -\fIupsname\fR. \fIupsname\fR can be the special value * to apply this -handler to every UPS. -.IP -This will perform the command \fIcommand\fR when the \fInotifytype\fR -and \fIupsname\fR match the current activity. Possible values for -\fIcommand\fR are: -.IP -START\-TIMER \fItimername\fR \fIinterval\fR -.IP -.nf - Start a timer of \fIinterval\fR seconds. When it triggers, it - will pass the argument \fItimername\fR as an argument to your - CMDSCRIPT. -.fi -.LP -.IP -Example: -.IP -.nf - Start a timer that'll execute when any UPS (*) has been - gone for 10 seconds - - AT COMMBAD * START\-TIMER upsgone 10 -.fi -.LP - -.IP -CANCEL\-TIMER \fItimername\fR [cmd] -.IP -.nf - Cancel a running timer called , if possible. - If the timer has passed then pass the optional argument - to CMDSCRIPT. -.fi -.LP - -.IP -Example: -.IP -.nf - If a specific UPS (myups@localhost) comes back online, then - stop the timer before it triggers - - AT COMMOK myups@localhost CANCEL\-TIMER upsgone -.fi -.LP - -.IP -EXECUTE \fIcommand\fR -.IP -.nf - Immediately pass as an argument to CMDSCRIPT. -.fi -.LP - -.IP -Example: -.IP -.nf - If any UPS (*) reverts to utility power, then execute - 'ups\-back\-on\-line' via CMDSCRIPT. - - AT ONLINE * EXECUTE ups\-back\-on\-line -.fi -.LP - -.IP -Note that any AT that matches both the \fInotifytype\fR and the -\fIupsname\fR for the current event will be used. - -For a complete list of \fInotifytype\fR possible values, refer to the section -NOTIFY EVENTS in \fBupsmon\fR(8). - -.SH SEE ALSO -\fBupssched\fR(8), \fBupsmon\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/upsstats.html.5 b/man/upsstats.html.5 deleted file mode 100644 index 2a33326..0000000 --- a/man/upsstats.html.5 +++ /dev/null @@ -1,234 +0,0 @@ -.TH upsstats.html 5 "Thu Feb 9 2006" "" "Network UPS Tools (NUT)" -.SH NAME -upsstats.html \- HTML template for Network UPS Tools upsstats - -.SH DESCRIPTION - -This file is used by \fBupsstats.cgi\fR(8) to generate status pages. -Certain commands are recognized, and will be replaced with various -status elements on the fly. - -.SH FORMATTING - -Commands can be placed anywhere on a line, but must start and end with @. -Any extra characters before or after the commands will be passed through -unchanged. It is allowed to use more than one command on a single line, -as long as each command has its own start and end character. If you need -to use the @ sign, use @ to prevent it from being treated as a start -character. - -.SH BLOCK CONTROL - -Some commands begin blocks - sections of the template that will be -included, excluded, or repeated depending on certain parameters. - -.SH BLOCK CONTROL - ITERATION - -.IP @FOREACHUPS@ -Starts a block that will be repeated for each MONITOR directive in the -\fBhosts.conf\fR(5). This is how you can generate pages that monitor -all of your systems simultaneously. - -.IP @ENDFOR@ -Ends a FOREACHUPS block. - -.SH BLOCK CONTROL - MATCHING SPECIFIC CASES - -.IP "@IFSUPP var@" -Starts a block that will only be printed if the variable var is -supported by the current UPS. This is generally used to suppress "not -supported" messages by avoiding the label and variable call entirely. - -.IP "@IFEQ var value@" -Starts a block if the value returned from the variable var matches -value. - -.IP "@IFBETWEEN varlow varhigh varvalue@" -Starts a block if the value returned by the variable varvalue is between -the values returned by the variables varlow and varhigh. - -.IP @ELSE@ -If the previous IF-command did not match, perform this instead. - -.IP @ENDIF@ -Ends an IF/ELSE-block. - -.SH BLOCK CONTROL - ADVANCED EXPRESSIONS - -Even though the parser is pretty limited, it's still possible to create -rather advanced expressions. The key to this is the fact that -multiple block control commands are AND:ed. This is illustrated with an -example (more examples are available in upsstats.html). - -@IFSUPP ambient.humidity@ - -@IFSUPP ambient.temperature@ - -This UPS knows both ambient temperature and humidity. - -@ELSE@ - -@IFSUPP ambient.humidity@ - -This UPS only knows ambient humidity. - -@ELSE@ - -@IFSUPP ambient.temperature@ - -This UPS only knows ambient temperature. - -@ELSE - -This UPS knows nothing, how annoying. - -@ENDIF@ - -.P - -.SH OTHER COMMANDS - -.IP @AMBTEMP@ -Insert the ambient temperature in the current temperature scale. - -.IP "@DATE format@" -Insert the current date and time. The format string is passed to strftime, -so almost anything is possible. See \fBstrftime\fR(3) for possible values. - -.IP @DEGREES@ -Insert the entity for degrees (°) and either C or F depending on -the current temperature scale. - -.IP @HOST@ -Insert the designation of the host being monitored, like myups@localhost. - -.IP @HOSTDESC@ -Insert the host's description from \fBhosts.conf\fR(5). - -.IP @HOSTLINK@ -Insert a link to upsstats.cgi with the "host" variable set to the -current UPS. This is only useful within a FOREACHUPS block. - -.IP "@IMG varname [\fIextra\fR]@" -Insert an IMG SRC to \fBupsimage.cgi\fR(8) for one of these -status variables: - - battery.charge - Battery charge - a percentage - - battery.voltage - The charge on the battery in volts - - input.frequency - Incoming utility frequency (Hz) - - input.voltage - Incoming utility voltage - - input.L1-L2.voltage - Incoming voltage, L1-L2 (3phase) - - input.L2-L3.voltage - Incoming voltage, L2-L3 (3phase) - - input.L3-L1.voltage - Incoming voltage, L3-L1 (3phase) - - output.frequency - Outgoing utility frequency (Hz) - - output.voltage - Outgoing voltage (from the UPS) - - output.L1-L2.voltage - Outgoing voltage, L1-L2 (3phase) - - output.L2-L3.voltage - Outgoing voltage, L2-L3 (3phase) - - output.L3-L1.voltage - Outgoing voltage, L3-L1 (3phase) - - output.L1.power.percent - UPS load, L1 (3phase) - - output.L2.power.percent - UPS load, L2 (3phase) - - output.L3.power.percent - UPS load, L3 (3phase) - - ups.load - UPS load - percentage - - ups.temperature - UPS temperature - -\fIextra\fR is where you can put additional definitions. Right now -the valid definitions are colors for various parts of the bars drawn -by upsimage.cgi. Possible color names are: - - back_col - background color - - scale_num_col - scale number color - - summary_col - summary color (number at the bottom) - - ok_zone_maj_col - major scale color for the normal ("ok") zone - - ok_zone_min_col - minor scale color for the normal ("ok") zone - - neutral_zone_maj_col - major scale color for the neutral zone - - neutral_zone_min_col - minor scale color for the neutral zone - - warn_zone_maj_col - major scale color for the warning zone - - warn_zone_min_col - minor scale color for the warning zone - - bar_col - the color of the bar in the middle - -All colors are hex triplets - 0xff0000 is red, 0x00ff00 is green, and -0x0000ff is blue. - -Examples: - - @IMG battery.charge@ - - @IMG battery.charge back_col=0xff00ff bar_col=0xaabbcc@ - - @IMG input.voltage ok_zone_maj_col=0x123456@ - -.IP @REFRESH@ -Insert the META header magic for refreshing the page if that variable -has been set by the browser. This needs to be in the HEAD section of -the page. - -.IP @STATUS@ -Expand the abbreviations in the ups.status variable - OL becomes -"On line", OB becomes "On battery", and so on. - -.IP @STATUSCOLOR@ -Insert red, green, or yellow color triplets depending on the severity of -the current UPS status. Normal operations are green, warnings like -voltage trim/boost or "off" are yellow, and other events like being on -battery or having a low battery are red. - -.IP "@VAR varname@" -Insert the current value of the status variable varname on the host being -monitored, or "Not supported". - -.IP @RUNTIME@ -Inserts the current runtime, in hh:mm:ss format. - -.IP @TEMPC@ -Use the Celsius scale for temperature data (default). - -.IP @TEMPF@ -Use the Fahrenheit scale for temperature data. - -.IP @UPSTEMP@ -Insert the UPS temperature in the current scale. - -.IP @BATTTEMP@ -Insert the battery temperature in the current scale. - -.IP @UTILITYCOLOR@ -Obsoleted. Use IFBETWEEN instead (see example in upsstats.html). - -.IP @VERSION@ -Insert the version number of the software. - -.SH OTHER TEMPLATES -\fBupsstats.cgi\fR(8) will also open a file called upsstats-single.html -if you call it with "host=" set in the URL. That file uses the same -rules and techniques documented here. - -.SH SEE ALSO -\fBupsstats.cgi\fR(8), \fBupsimage.cgi\fR(8) - -.SS Internet resources: -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/man/victronups.8 b/man/victronups.8 deleted file mode 100644 index 305bdf8..0000000 --- a/man/victronups.8 +++ /dev/null @@ -1,47 +0,0 @@ -.TH VICTRONUPS 8 "Wed Oct 16 2002" "" "Network UPS Tools (NUT)" -.SH NAME -victronups \- Driver for IMV/Victron UPS unit Match, Match Lite, NetUps -.SH NOTE -This man page only documents the hardware\(hyspecific features of the the -victronups driver. For information about the core driver, see -\fBnutupsdrv\fR(8). - -.SH SUPPORTED HARDWARE -victronups should recognize all Victron models that use a serial protocol at -1200 bps. These include Match Lite, Match and the NetUps line. - -The Match Lite line may only report a handful of variables. This is -usually not a bug \(hy they just don't support anything else. - -.SH CABLING - -If your Victron cable is broken or missing, use this diagram to build -a clone: - -docs/cables/victron.txt - -.SH EXTRA ARGUMENTS -This driver supports the following optional setting in the -\fBups.conf\fR(5): - -.IP "modelname=" -Set model name - -.IP "usd=\fIdelay\fR" -Set delay before shutdown on UPS - - -.SH BUGS -The protocol for this UPS is not officially documented. - -.SH AUTHOR -Radek Benedikt , -Daniel Prynych ls /files/etc/nut/ + nut.conf/ = (none) + upsd.users/ = (none) + upsmon.conf = (none) + ups.conf/ = (none) + upsd.conf/ = (none ++ +or using: ++ + augtool> match /files/etc/nut/* + /files/etc/nut/nut.conf = (none) + /files/etc/nut/upsd.users = (none) + /files/etc/nut/upsmon.conf = (none) + /files/etc/nut/ups.conf = (none) + /files/etc/nut/upsd.conf = (none) + +NOTE: if you don't see anything, you may search for error messages by using: ++ + augtool> ls /augeas/files/etc/nut/*/errors +and + augtool> get /augeas/files/etc/nut/ups.conf/error/message + /augeas/files/etc/nut/ups.conf/error/message = Permission denied + +- create a new device entry (in ups.conf), called 'augtest': + + augtool> set /files/etc/nut/ups.conf/augtest/driver dummy-ups + augtool> set /files/etc/nut/ups.conf/augtest/port auto + augtool> save + +- list the devices using the 'usbhid-ups' driver: + + augtool> match /files/etc/nut/ups.conf/*/driver dummy-ups + + +C +~ + +A library is available for C programs, along with pkg-config support. + +You can get the compilation and link flags using the following code +in your configure script or Makefile: + + CFLAGS="`pkg-config --silence-errors --cflags augeas`" + LDFLAGS="`pkg-config --silence-errors --libs augeas`" + +Here is an code sample using this library for NUT configuration: + +-------------------------------------------------------------------------------- +augeas *a = aug_init(NULL, NULL, AUG_NONE); +ret = aug_match(a, "/files/etc/nut/*", &matches_p); +ret = aug_set(a, "/files/etc/nut/ups.conf/augtest/driver", "dummy-ups"); +ret = aug_set(a, "/files/etc/nut/ups.conf/augtest/port", "auto"); +ret = aug_save(a); +-------------------------------------------------------------------------------- + +Python +~~~~~~ + +The `augeas` class abstracts access to the configuration files. + + $ python + Python 2.5.1 (r251:54863, Apr 8 2008, 01:19:33) + [GCC 4.3.0 20080404 (Red Hat 4.3.0-6)] on linux2 + Type "help", "copyright", "credits" or "license" for more information. + >>> import augeas + >>> a = augeas.augeas() + >>> a.match("/files/etc/nut/*") + ['/files/etc/nut/upsd.users', '/files/etc/nut/upsmon.conf', '/files/etc/nut/ups.conf', '/files/etc/nut/upsd.conf'] + >>> a.set("/files/etc/nut/ups.conf/augtest/driver", "dummy-ups") + True + >>> a.set("/files/etc/nut/ups.conf/augtest/port", "auto") + True + >>> a.save() + True + >>> + + $ grep -A 2 augtest /etc/nut/ups.conf + [augtest] + driver=dummy-ups + port=auto + + +Perl +~~~~ + +The Perl binding is available through CPAN and packages. + + use Config::Augeas; + + my $aug = Config::Augeas->new( root => $aug_root ) ; + + my @a = $aug->match("/files/etc/nut/*") ; + my $nb = $aug->count_match("/files/etc/nut/*") ; + + $aug->set("/files/etc/nut/ups.conf/augtest/driver", "dummy-ups") ; + $aug->set("/files/etc/nut/ups.conf/augtest/port", "auto") ; + + $aug->save ; + + +Test the conformity testing module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Existing configuration files can be tested for conformity. To do so, use: + + $ augparse -I ./ ./test_nut.aug diff --git a/scripts/augeas/gen-nutupsconf-aug.py b/scripts/augeas/gen-nutupsconf-aug.py new file mode 100755 index 0000000..55db17a --- /dev/null +++ b/scripts/augeas/gen-nutupsconf-aug.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python +# Copyright (C) 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 +# 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 program extracts all drivers specific variables, declared +# using 'addvar()' and output a complete ups.conf lens for Augeas + +import sys +import re +import glob +import codecs + +# Return a sorted list of unique entries, based on the input 'list' +def sortUnique(list): + newVarList = [] + prevVar = '' + + # sort the list + list.sort() + + for curVariable in list: + if curVariable != prevVar: + newVarList.append(curVariable) + prevVar = curVariable + + return newVarList + +# Grep for 'string' pattern in the text 'list', +# excluding C/C++ styles comments +# Return the list of matching lines +def grep(string,list): + matchList = [] + expr = re.compile(string) + for text in list: + match = expr.search(text) + if match != None: + # Exclude comments + exprComment = re.compile('(/\*([^*]|(\*+[^*/]))*\*+/)|(//.*)') + if (exprComment.search(match.string) == None): + matchList.append(match.string) + + return matchList + +if __name__ == '__main__': + + rawCount = 0 + global finalCount + variableNames = [] + specificVars = "" + global inLensContent + global finalLensContent + Exceptionlist = ['../../drivers/main.c', '../../drivers/skel.c'] + outputFilename = 'nutupsconf.aug.in' + templateFilename = 'nutupsconf.aug.tpl' + dirPrefix = '' + + if (len(sys.argv) == 2): + dirPrefix = sys.argv[1] + print dirPrefix + + # 1/ Extract all specific drivers parameters, in a sorted list with unique entries + # 1.1/ List all drivers implementation files + for filename in glob.glob('../../drivers/*.c'): + # 1.2/ Exclude main.c, which defines addvar() and skel.c (example driver) + if filename not in Exceptionlist: + fd = codecs.open(filename, encoding='utf-8') + # 1.3/ Grep for the "addvar(..." pattern + matchResults = grep ('.*addvar[\ ]*\(.*(VAR_FLAG|VAR_VALUE)*,.*', fd) + + # 1.4/ Extract variable names + for line in matchResults: + row = line.split(',') + if len(row) >= 2: + # Absence of quotes indicate that we have a #define + # Let's grep in .ch related files + if (row[1].find('"') == -1): + for defFilename in glob.glob(filename.replace('.c', '.[ch]')): + defFd = codecs.open(defFilename, encoding='utf-8') + matchString = '^#define.*' + row[1].replace('"', '').lstrip() + '.*' + matchResult = grep (matchString, defFd) + for varDefine in matchResult: + # Now search for a string + defRow = re.findall(r'"([^"]*)",?', varDefine) + if (len(defRow) == 1): + variableNames.append(defRow[0]) + else: + # Remove quotes + variableNames.append(row[1].replace('"', '').lstrip()) + + # Filter multiply defined variables + variableNames = sortUnique(variableNames) + + # Create the formated list of specific variables + for name in variableNames: + specificVars += " | \"%s\"\n" %(name) + + # 2/ Load the template lens + tplFd = codecs.open(dirPrefix + templateFilename, encoding='utf-8') + + # 2.1/ Search for the pattern to replace + outputText = tplFd.read() + outputText = outputText.replace('@SPECIFIC_DRV_VARS@', specificVars) + + # 3/ Output final lens + outFd = codecs.open(outputFilename, mode='w', encoding='utf-8') + outFd.write(outputText) diff --git a/scripts/augeas/nuthostsconf.aug.in b/scripts/augeas/nuthostsconf.aug.in new file mode 100644 index 0000000..c5cd2d9 --- /dev/null +++ b/scripts/augeas/nuthostsconf.aug.in @@ -0,0 +1,45 @@ +(* +Module: NutHostsConf + Parses @CONFPATH@/hosts.conf + +Author: Frederic Bohe + +About: License + This file is licensed under the GPL. + +About: Lens Usage + Sample usage of this lens in augtool + + * Print all monitored upsd + > print /files@CONFPATH@/hosts.conf/MONITOR + +About: Configuration files + This lens applies to @CONFPATH@/hosts.conf. See . +*) + +module NutHostsConf = + autoload hosts_xfm + +(************************************************************************ + * Group: HOSTS.CONF + *************************************************************************) + +(* general *) +let del_spc = Util.del_opt_ws "" +let sep_spc = Util.del_ws_spc +let eol = Util.eol +let word = /[^"#; \t\n]+/ +let empty = Util.empty +let comment = Util.comment +let quoted_string = del "\"" "\"" . store /[^"\n]+/ . del "\"" "\"" + +let hosts_notify = [ del_spc . key "MONITOR" . sep_spc + . [ label "system" . store word . sep_spc ] + . [ label "description" . quoted_string ] . eol ] + +let hosts_lns = (hosts_notify|comment|empty)* + +let hosts_filter = ( incl "@CONFPATH@/hosts.conf" ) + . Util.stdexcl + +let hosts_xfm = transform hosts_lns hosts_filter diff --git a/scripts/augeas/nutnutconf.aug.in b/scripts/augeas/nutnutconf.aug.in new file mode 100644 index 0000000..69d6f78 --- /dev/null +++ b/scripts/augeas/nutnutconf.aug.in @@ -0,0 +1,48 @@ +(* +Module: NutNutConf + Parses @CONFPATH@/nut.conf + +Author: Frederic Bohe + +About: License + This file is licensed under the GPL. + +About: Lens Usage + Sample usage of this lens in augtool + + * Print NUT MODE start-up configuration: + > print /files@CONFPATH@/nut.conf/MODE + +About: Configuration files + This lens applies to @CONFPATH@/nut.conf. See . +*) + +module NutNutConf = + autoload nut_xfm + + +(************************************************************************ + * Group: NUT.CONF + *************************************************************************) + +(* general *) +let def_sep = IniFile.sep IniFile.sep_re IniFile.sep_default +let sep_spc = Util.del_opt_ws "" +let eol = Util.eol +let comment = Util.comment +let empty = Util.empty + + +let nut_possible_mode = "none" + | "standalone" + | "netserver" + | "netclient" + +let nut_mode = [ sep_spc . key "MODE" . def_sep . sep_spc . store nut_possible_mode . eol ] + +let nut_lns = (nut_mode|comment|empty)* + +let nut_filter = ( incl "@CONFPATH@/nut.conf" ) + . Util.stdexcl + +let nut_xfm = transform nut_lns nut_filter diff --git a/scripts/augeas/nutupsconf.aug.in b/scripts/augeas/nutupsconf.aug.in new file mode 100644 index 0000000..86afa99 --- /dev/null +++ b/scripts/augeas/nutupsconf.aug.in @@ -0,0 +1,159 @@ +(* +Module: NutUpsConf + Parses @CONFPATH@/ups.conf + +Author: Raphael Pinson + Frederic Bohe + Arnaud Quette + +About: License + This file is licensed under the GPL. + +About: Lens Usage + Sample usage of this lens in augtool + + * Print all drivers used + > print /files/@CONFPATH@/ups.conf/*/driver + +About: Configuration files + This lens applies to @CONFPATH@/ups.conf. See . +*) + +module NutUpsConf = + autoload ups_xfm + +(************************************************************************ + * Group: UPS.CONF + *************************************************************************) + +let ups_comment = IniFile.comment IniFile.comment_re IniFile.comment_default + +let ups_sep = IniFile.sep IniFile.sep_re IniFile.sep_default + +let ups_global = "chroot" + | "driverpath" + | "maxstartdelay" + | "pollinterval" + | "user" + +let ups_fields = "driver" + | "port" + | "sdorder" + | "desc" + | "nolock" + | "maxstartdelay" + | "CP" + | "CS" + | "ID" + | "LB" + | "LowBatt" + | "OL" + | "OffDelay" + | "OnDelay" + | "SD" + | "authPassword" + | "authProtocol" + | "batteryPercentage" + | "battext" + | "baud_rate" + | "baudrate" + | "bus" + | "cable" + | "cablepower" + | "chargetime" + | "community" + | "daysoff" + | "daysweek" + | "dumbterm" + | "explore" + | "fake_lowbatt" + | "flash" + | "frequency" + | "full_update" + | "houroff" + | "houron" + | "idleload" + | "input_timeout" + | "linevoltage" + | "load.off" + | "load.on" + | "load.status" + | "loadPercentage" + | "login" + | "lowbatt" + | "manufacturer" + | "max_load" + | "methodOfFlowControl" + | "mfr" + | "mibs" + | "mincharge" + | "minruntime" + | "model" + | "modelname" + | "nohang" + | "nombattvolt" + | "norating" + | "notification" + | "notransferoids" + | "novendor" + | "nowarn_noimp" + | "numOfBytesFromUPS" + | "offdelay" + | "oldmac" + | "ondelay" + | "output_pace" + | "password" + | "pollfreq" + | "pollonly" + | "powerup" + | "prefix" + | "prgshut" + | "privPassword" + | "privProtocol" + | "product" + | "productid" + | "protocol" + | "rebootdelay" + | "runtimecal" + | "sdtime" + | "sdtype" + | "secLevel" + | "secName" + | "serial" + | "serialnumber" + | "shutdownArguments" + | "shutdown_delay" + | "silent" + | "snmp_version" + | "startdelay" + | "status_only" + | "subdriver" + | "subscribe" + | "testtime" + | "timeout" + | "type" + | "ups.delay.shutdown" + | "ups.delay.start" + | "upstype" + | "usd" + | "use_crlf" + | "use_pre_lf" + | "validationSequence" + | "vendor" + | "vendorid" + | "voltage" + | "wait" + + +let ups_entry = IniFile.indented_entry (ups_global|ups_fields) ups_sep ups_comment + +let ups_title = IniFile.indented_title IniFile.record_re + +let ups_record = IniFile.record ups_title ups_entry + +let ups_lns = IniFile.lns ups_record ups_comment + +let ups_filter = (incl "@CONFPATH@/ups.conf") + . Util.stdexcl + +let ups_xfm = transform ups_lns ups_filter diff --git a/scripts/augeas/nutupsconf.aug.tpl b/scripts/augeas/nutupsconf.aug.tpl new file mode 100644 index 0000000..24f6bcc --- /dev/null +++ b/scripts/augeas/nutupsconf.aug.tpl @@ -0,0 +1,58 @@ +(* +Module: NutUpsConf + Parses @CONFPATH@/ups.conf + +Author: Raphael Pinson + Frederic Bohe + Arnaud Quette + +About: License + This file is licensed under the GPL. + +About: Lens Usage + Sample usage of this lens in augtool + + * Print all drivers used + > print /files/@CONFPATH@/ups.conf/*/driver + +About: Configuration files + This lens applies to @CONFPATH@/ups.conf. See . +*) + +module NutUpsConf = + autoload ups_xfm + +(************************************************************************ + * Group: UPS.CONF + *************************************************************************) + +let ups_comment = IniFile.comment IniFile.comment_re IniFile.comment_default + +let ups_sep = IniFile.sep IniFile.sep_re IniFile.sep_default + +let ups_global = "chroot" + | "driverpath" + | "maxstartdelay" + | "pollinterval" + | "user" + +let ups_fields = "driver" + | "port" + | "sdorder" + | "desc" + | "nolock" + | "maxstartdelay" +@SPECIFIC_DRV_VARS@ + +let ups_entry = IniFile.indented_entry (ups_global|ups_fields) ups_sep ups_comment + +let ups_title = IniFile.indented_title IniFile.record_re + +let ups_record = IniFile.record ups_title ups_entry + +let ups_lns = IniFile.lns ups_record ups_comment + +let ups_filter = (incl "@CONFPATH@/ups.conf") + . Util.stdexcl + +let ups_xfm = transform ups_lns ups_filter diff --git a/scripts/augeas/nutupsdconf.aug.in b/scripts/augeas/nutupsdconf.aug.in new file mode 100644 index 0000000..d3aef1d --- /dev/null +++ b/scripts/augeas/nutupsdconf.aug.in @@ -0,0 +1,65 @@ +(* +Module: NutUpsdConf + Parses @CONFPATH@/upsd.conf + +Author: Raphael Pinson + Frederic Bohe + Arnaud Quette + +About: License + This file is licensed under the GPL. + +About: Lens Usage + Sample usage of this lens in augtool + + * Print all network interface upsd will listen to + > print /files@CONFPATH@/upsd.conf/LISTEN + +About: Configuration files + This lens applies to @CONFPATH@/upsd.conf. See . + +*) + +module NutUpsdConf = + autoload upsd_xfm + +(************************************************************************ + * Group: UPSD.CONF + *************************************************************************) + +(* general *) +let sep_spc = Util.del_ws_spc +let opt_spc = Util.del_opt_ws "" +let eol = Util.eol +let ip = /[0-9A-Za-z\.:]+/ +let num = /[0-9]+/ +let word = /[^"#; \t\n]+/ +let empty = Util.empty +let comment = Util.comment +let path = word + +let upsd_maxage = [ opt_spc . key "MAXAGE" . 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 ] + . [ sep_spc . label "port" . store num]? ] +let upsd_listen_list = upsd_listen . eol +let upsd_maxconn = [ opt_spc . key "MAXCONN" . sep_spc . store num . eol ] +let upsd_certfile = [ opt_spc . key "CERTFILE" . sep_spc . store path . eol ] + +(************************************************************************ + * MAXAGE seconds + * 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_statepath | upsd_listen_list | upsd_maxconn | upsd_certfile + +let upsd_lns = (upsd_other|comment|empty)* + +let upsd_filter = (incl "@CONFPATH@/upsd.conf") + . Util.stdexcl + +let upsd_xfm = transform upsd_lns upsd_filter diff --git a/scripts/augeas/nutupsdusers.aug.in b/scripts/augeas/nutupsdusers.aug.in new file mode 100644 index 0000000..242e64e --- /dev/null +++ b/scripts/augeas/nutupsdusers.aug.in @@ -0,0 +1,83 @@ +(* +Module: NutUpsdUsers + Parses @CONFPATH@/upsd.users + +Author: Raphael Pinson + Frederic Bohe + +About: License + This file is licensed under the GPL. + +About: Lens Usage + Sample usage of this lens in augtool + + * Print all users granted to send commands to UPS + > /files@CONFPATH@/upsd.users/fred/actions/SET + +About: Configuration files + This lens applies to @CONFPATH@/upsd.users. See . +*) + +module NutUpsdUsers = + autoload upsd_users_xfm + +(************************************************************************ + * Group: UPSD.USERS + *************************************************************************) + +(* general *) +let del_spc = Util.del_opt_ws "" +let sep_spc = Util.del_ws_spc +let eol = Util.eol +let ip = /[0-9A-Za-z\.:]+/ +let num = /[0-9]+/ +let word = /[^"#; \t\n]+/ +let empty = Util.empty +(* let netblock = /[0-9A-Za-z\.:\/]+/ *) +let netblock = word +let path = word + +let upsd_users_comment = IniFile.comment IniFile.comment_re IniFile.comment_default + +let upsd_users_sep = IniFile.sep IniFile.sep_re IniFile.sep_default + +let upsd_users_fields = "password" + | "instcmds" + +let upsd_users_entry = IniFile.indented_entry upsd_users_fields upsd_users_sep upsd_users_comment + +let upsd_users_actions_entry = [ key /SET|FSD/ ] + +let upsd_users_actions = [ del_spc + . key "actions" . upsd_users_sep + . del_spc + . upsd_users_actions_entry + . ( sep_spc . upsd_users_actions_entry )* + . ( upsd_users_comment|eol ) ] + +(* FIXME: NEEDED? can be all, or a list of instant commands *) +let upsd_users_instcmds_entry = [ key /ALL|FSD/ ] + +let upsd_users_instcmds = [ del_spc + . key "instcmds" . upsd_users_sep + . del_spc + . upsd_users_instcmds_entry + . ( sep_spc . upsd_users_instcmds_entry )* + . ( upsd_users_comment|eol ) ] + +let upsd_users_upsmon = [ del_spc + . key "upsmon" . sep_spc + . store /master|slave/ . eol ] + +let upsd_users_title = IniFile.indented_title IniFile.record_re + +let upsd_users_record = IniFile.record upsd_users_title (upsd_users_entry|upsd_users_actions|upsd_users_upsmon) + +let upsd_users_lns = IniFile.lns upsd_users_record upsd_users_comment + +let upsd_users_filter = ( incl "@CONFPATH@/upsd.users" ) + . Util.stdexcl + +let upsd_users_xfm = transform upsd_users_lns upsd_users_filter + + diff --git a/scripts/augeas/nutupsmonconf.aug.in b/scripts/augeas/nutupsmonconf.aug.in new file mode 100644 index 0000000..e394176 --- /dev/null +++ b/scripts/augeas/nutupsmonconf.aug.in @@ -0,0 +1,122 @@ +(* +Module: NutUpsmonConf + Parses @CONFPATH@/upsmon.conf + +Author: Raphael Pinson + Frederic Bohe + +About: License + This file is licensed under the GPL. + +About: Lens Usage + Sample usage of this lens in augtool + + * Print all notification messages + > print /files@CONFPATH@/upsmon.conf/NOTIFYMSG + +About: Configuration files + This lens applies to @CONFPATH@/upsmon.conf. See . +*) + +module NutUpsmonConf = + autoload upsmon_xfm + + +(************************************************************************ + * Group: UPSMON.CONF + *************************************************************************) + +(* general *) +let del_spc = Util.del_opt_ws "" +let sep_spc = Util.del_ws_spc +let eol = Util.eol +let num = /[0-9]+/ +let word = /[^"#; \t\n]+/ +let empty = Util.empty +let comment = Util.comment +let quoted_string = del "\"" "\"" . store /[^"\n]+/ . del "\"" "\"" + +(* UPS identifier + * [@[:]] + * + * There might be a cleaner way to write this + * but I'm stuck with (hostname | hostname . port)? + *) +let hostname = [ label "hostname" . store /[^ \t\n:]+/ ] +let port = [ label "port" . store num ] +let identifier = [ label "upsname" . store /[^ \t\n@]+/ ] + . ( ( Util.del_str "@" . hostname ) + | ( Util.del_str "@" . hostname + . Util.del_str ":" . port ) )? + + +let upsmon_num_re = "DEADTIME" + | "FINALDELAY" + | "HOSTSYNC" + | "MINSUPPLIES" + | "NOCOMMWARNTIME" + | "POLLFREQ" + | "POLLFREQALERT" + | "RBWARNTIME" + +let upsmon_num = [ del_spc . key upsmon_num_re . sep_spc . store num . eol ] + +let upsmon_word = [ del_spc . key "RUN_AS_USER" . sep_spc . store word . eol ] + +let upsmon_file_re = "NOTIFYCMD" + | "POWERDOWNFLAG" + | "SHUTDOWNCMD" + +let sto_to_eol = IniFile.sto_to_eol +(* here we should support both quoted and not quotted + * string but I can't manage to find the right way of doing this + *) +let upsmon_file = [ del_spc . key upsmon_file_re . sto_to_eol . eol ] + +(* MONITOR system powervalue username password type *) +let upsmon_monitor = [ del_spc . key "MONITOR" . sep_spc + . [ label "system" . identifier ] . sep_spc + . [ label "powervalue" . store num ] . sep_spc + . [ label "username" . store word ] . sep_spc + . [ label "password" . store word ] . sep_spc + . [ label "type" . store word ] . eol ] + +let upsmon_notify_type = "ONLINE" + | "ONBATT" + | "LOWBATT" + | "FSD" + | "COMMOK" + | "COMMBAD" + | "SHUTDOWN" + | "REPLBATT" + | "NOCOMM" + | "NOPARENT" + +let upsmon_notify = [ del_spc . key "NOTIFYMSG" . sep_spc + . [ label "type" . store upsmon_notify_type . sep_spc ] + . [ label "message" . quoted_string ] . eol ] + + let flags = "IGNORE" + | "SYSLOG" + | "WALL" + | "EXEC" + +let plus = [ del /\+*/ "" ] + +(*let entries = /IGNORE|SYSLOG|WALL|EXEC+/*) + +let record = [ seq "record" . plus . store flags ] + +let upsmon_notify_flag = [ counter "record" + . del_spc . key "NOTIFYFLAG" . sep_spc + . [ label "type" . store upsmon_notify_type . sep_spc ] + . record+ . eol ] + +let upsmon_record = upsmon_num|upsmon_word|upsmon_file|upsmon_monitor|upsmon_notify|upsmon_notify_flag + +let upsmon_lns = (upsmon_record|comment|empty)* + +let upsmon_filter = ( incl "@CONFPATH@/upsmon.conf" ) + . Util.stdexcl + +let upsmon_xfm = transform upsmon_lns upsmon_filter diff --git a/scripts/augeas/nutupsschedconf.aug.in b/scripts/augeas/nutupsschedconf.aug.in new file mode 100644 index 0000000..9dfa5b3 --- /dev/null +++ b/scripts/augeas/nutupsschedconf.aug.in @@ -0,0 +1,75 @@ +(* +Module: NutUpsSchedConf + Parses @CONFPATH@/upssched.conf + +Author: Raphael Pinson + Frederic Bohe + +About: License + This file is licensed under the GPL. + +About: Lens Usage + Sample usage of this lens in augtool + + * Print the command script: + > print /files@CONFPATH@/upssched.conf/CMDSCRIPT + +About: Configuration files + This lens applies to @CONFPATH@/upssched.conf. See . +*) + +module NutUpsschedConf = + autoload upssched_xfm + + +(************************************************************************ + * Group: UPSSCHED.CONF + *************************************************************************) + +(* general *) +let sep_spc = Util.del_ws_spc +let eol = Util.eol +let num = /[0-9]+/ +let word = /[^"#; \t\n]+/ +let empty = Util.empty +let comment = Util.comment + +(* Variable: quoted_word *) +let word_space = /"[^"\n]+"/ +let quoted_word = /"[^" \t\n]+"/ + +(* Variable: word_all *) +let word_all = word_space | word | quoted_word + +let upssched_re = "CMDSCRIPT" + | "PIPEFN" + | "LOCKFN" + +let upssched_opt = [ key upssched_re . sep_spc . store word_all . eol ] + +let upssched_start_timer = [ key "START-TIMER" . sep_spc + . [ label "timername" . store word ] . sep_spc + . [ label "interval" . store num ] ] + + +let upssched_cancel_timer = [ key "CANCEL-TIMER" . sep_spc + . [ label "timername" . store word ] + . ( sep_spc . [ label "cmd" . store word_all ])* ] + +let upssched_execute_timer = [ key "EXECUTE" . sep_spc + . [ label "command" . store word_all ] ] + + +let upssched_command = (upssched_start_timer|upssched_cancel_timer|upssched_execute_timer) + +let upssched_at = [ key "AT" . sep_spc + . [ label "notifytype" . store word ] . sep_spc + . [ label "upsname" . store word ] . sep_spc + . upssched_command . eol ] + +let upssched_lns = (upssched_at|upssched_opt|comment|empty)* + +let upssched_filter = ( incl "@CONFPATH@/upssched.conf" ) + . Util.stdexcl + +let upssched_xfm = transform upssched_lns upssched_filter diff --git a/scripts/augeas/nutupssetconf.aug.in b/scripts/augeas/nutupssetconf.aug.in new file mode 100644 index 0000000..d9b7549 --- /dev/null +++ b/scripts/augeas/nutupssetconf.aug.in @@ -0,0 +1,46 @@ +(* +Module: NutUpssetConf + Parses @CONFPATH@/upsset.conf + +Author: Raphael Pinson + Frederic Bohe + +About: License + This file is licensed under the GPL. + +About: Lens Usage + Sample usage of this lens in augtool + + * Print the string declaring secured cgi directory: + > print /files@CONFPATH@/upsset.conf/auth + +About: Configuration files + This lens applies to @CONFPATH@/upsset.conf. See . +*) + +module NutUpssetConf = + autoload upsset_xfm + + +(************************************************************************ + * Group: UPSSET.CONF + *************************************************************************) + +(* general *) +let sep_spc = Util.del_opt_ws "" +let eol = Util.eol +let comment = Util.comment +let empty = Util.empty + + +let upsset_key_word = "I_HAVE_SECURED_MY_CGI_DIRECTORY" + +let upsset_key = [ label "auth" . sep_spc . store upsset_key_word . eol ] + +let upsset_lns = (upsset_key|comment|empty)* + +let upsset_filter = ( incl "@CONFPATH@/upsset.conf" ) + . Util.stdexcl + +let upsset_xfm = transform upsset_lns upsset_filter + diff --git a/scripts/augeas/tests/test_nut.aug b/scripts/augeas/tests/test_nut.aug new file mode 100644 index 0000000..4153ed7 --- /dev/null +++ b/scripts/augeas/tests/test_nut.aug @@ -0,0 +1,187 @@ +(* Tests for the Nut module *) + +module Test_nut = + +let nut_conf = " +MODE=standalone +" + +test NutNutConf.nut_lns get nut_conf = + { } + { "MODE" = "standalone" } + +let ups_conf = " +[testups] + driver = dummy-ups + port = auto + desc = \"Dummy UPS\" +" + +test NutUpsConf.ups_lns get ups_conf = + { } + { "testups" + { "driver" = "dummy-ups" } + { "port" = "auto" } + { "desc" = "\"Dummy UPS\"" } } + + +let upsd_conf = " +MAXAGE 30 +LISTEN 0.0.0.0 3493 +MAXCONN 1024 +" + +test NutUpsdConf.upsd_lns get upsd_conf = + { } + { "MAXAGE" = "30" } + { "LISTEN" + { "interface" = "0.0.0.0" } + { "port" = "3493" } } + { "MAXCONN" = "1024" } + +let upsd_users = " + [admin] + password = upsman + actions = SET FSD + instcmds = ALL + + [pfy] + password = duh + instcmds = test.panel.start + instcmds = test.panel.stop + + [monmaster] + password = blah + upsmon master + + [monslave] + password = abcd + upsmon slave +" + +test NutUpsdUsers.upsd_users_lns get upsd_users = + { } + { "admin" + { "password" = "upsman" } + { "actions" + { "SET" } + { "FSD" } } + { "instcmds" = "ALL" } + { } } + { "pfy" + { "password" = "duh" } + { "instcmds" = "test.panel.start" } + { "instcmds" = "test.panel.stop" } + { } } + { "monmaster" + { "password" = "blah" } + { "upsmon" = "master" } + { } } + { "monslave" + { "password" = "abcd" } + { "upsmon" = "slave" } } + +let upsmon_conf = " +MONITOR testups@localhost 1 monmaster blah master + +MINSUPPLIES 1 +SHUTDOWNCMD /sbin/shutdown -h +0 +POLLFREQ 5 +POLLFREQALERT 5 +HOSTSYNC 30 +DEADTIME 15 +POWERDOWNFLAG /etc/killpower +RBWARNTIME 43200 +NOCOMMWARNTIME 300 +FINALDELAY 5 +" + +test NutUpsmonConf.upsmon_lns get upsmon_conf = + { } + { "MONITOR" + { "system" + { "upsname" = "testups" } + { "hostname" = "localhost" } } + { "powervalue" = "1" } + { "username" = "monmaster" } + { "password" = "blah" } + { "type" = "master" } } + { } + { "MINSUPPLIES" = "1" } + { "SHUTDOWNCMD" = "/sbin/shutdown -h +0" } + { "POLLFREQ" = "5" } + { "POLLFREQALERT" = "5" } + { "HOSTSYNC" = "30" } + { "DEADTIME" = "15" } + { "POWERDOWNFLAG" = "/etc/killpower" } + { "RBWARNTIME" = "43200" } + { "NOCOMMWARNTIME" = "300" } + { "FINALDELAY" = "5" } + +let upsset_conf = " + I_HAVE_SECURED_MY_CGI_DIRECTORY +" + +test NutUpssetConf.upsset_lns get upsset_conf = + { } + { "auth" = "I_HAVE_SECURED_MY_CGI_DIRECTORY" } + + +let upssched_conf = " +CMDSCRIPT /upssched-cmd +PIPEFN /var/state/ups/upssched/upssched.pipe +LOCKFN /var/state/ups/upssched/upssched.lock +AT COMMBAD * START-TIMER upsgone 10 +AT COMMOK myups@localhost CANCEL-TIMER upsgone +AT ONLINE * EXECUTE ups-back-on-line +" + +test NutUpsschedConf.upssched_lns get upssched_conf = + { } + { "CMDSCRIPT" = "/upssched-cmd" } + { "PIPEFN" = "/var/state/ups/upssched/upssched.pipe" } + { "LOCKFN" = "/var/state/ups/upssched/upssched.lock" } + { "AT" + { "notifytype" = "COMMBAD" } + { "upsname" = "*" } + { "START-TIMER" + { "timername" = "upsgone" } + { "interval" = "10" } + } + } + { "AT" + { "notifytype" = "COMMOK" } + { "upsname" = "myups@localhost" } + { "CANCEL-TIMER" + { "timername" = "upsgone" } + } + } + { "AT" + { "notifytype" = "ONLINE" } + { "upsname" = "*" } + { "EXECUTE" + { "command" = "ups-back-on-line" } + } + } + + +let hosts_conf = " +MONITOR myups@localhost \"Local UPS\" +MONITOR su2200@10.64.1.1 \"Finance department\" +MONITOR matrix@shs-server.example.edu \"Sierra High School data room #1\" +" + +test NutHostsConf.hosts_lns get hosts_conf = + { } + { "MONITOR" + { "system" = "myups@localhost" } + { "description" = "Local UPS" } + } + { "MONITOR" + { "system" = "su2200@10.64.1.1" } + { "description" = "Finance department" } + } + { "MONITOR" + { "system" = "matrix@shs-server.example.edu" } + { "description" = "Sierra High School data room #1" } + } diff --git a/scripts/hal/Makefile.in b/scripts/hal/Makefile.in index c566baf..f362c11 100644 --- a/scripts/hal/Makefile.in +++ b/scripts/hal/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -39,12 +39,13 @@ 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_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -54,6 +55,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -89,9 +91,11 @@ am__base_list = \ am__installdirs = "$(DESTDIR)$(halfdidir)" DATA = $(halfdi_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -104,8 +108,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -122,7 +128,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -133,22 +138,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ diff --git a/scripts/hal/ups-nut-device.fdi.in b/scripts/hal/ups-nut-device.fdi.in index fa87c55..147edf1 100644 --- a/scripts/hal/ups-nut-device.fdi.in +++ b/scripts/hal/ups-nut-device.fdi.in @@ -35,6 +35,20 @@ hald-addon-usbhid-ups ups + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + battery @@ -42,6 +56,20 @@ hald-addon-usbhid-ups ups + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + @@ -149,6 +177,13 @@ hald-addon-usbhid-ups ups + + + battery + battery + hald-addon-usbhid-ups + ups + @@ -205,6 +240,17 @@ + + + + + battery + battery + hald-addon-usbhid-ups + ups + + + @@ -269,6 +315,20 @@ hald-addon-usbhid-ups ups + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + battery @@ -283,6 +343,83 @@ 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 @@ -291,12 +428,26 @@ ups + + battery + battery + hald-addon-usbhid-ups + ups + + battery battery hald-addon-usbhid-ups ups + + + battery + battery + hald-addon-usbhid-ups + ups + battery @@ -318,6 +469,41 @@ 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 + diff --git a/scripts/hotplug/Makefile.in b/scripts/hotplug/Makefile.in index ebbbd46..0630762 100644 --- a/scripts/hotplug/Makefile.in +++ b/scripts/hotplug/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -41,12 +41,13 @@ 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_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -56,6 +57,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -94,9 +96,11 @@ DIST_SOURCES = am__dist_hotplugusb_DATA_DIST = libhid.usermap DATA = $(dist_hotplugusb_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -109,8 +113,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -127,7 +133,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -138,22 +143,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ diff --git a/scripts/hotplug/libhid.usermap b/scripts/hotplug/libhid.usermap index 2f22cf6..facf548 100644 --- a/scripts/hotplug/libhid.usermap +++ b/scripts/hotplug/libhid.usermap @@ -14,8 +14,16 @@ libhidups 0x0003 0x03f0 0x1f01 0x0000 0x0000 0x00 libhidups 0x0003 0x03f0 0x1f02 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # HP T750 INTL libhidups 0x0003 0x03f0 0x1f06 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# HP T1000 INTL +libhidups 0x0003 0x03f0 0x1f08 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# HP T1500 INTL +libhidups 0x0003 0x03f0 0x1f09 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # HP R/T 2200 INTL (like SMART2200RMXL2U) libhidups 0x0003 0x03f0 0x1f0a 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# HP R1500 G2 INTL +libhidups 0x0003 0x03f0 0x1fe0 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# HP T750 G2 +libhidups 0x0003 0x03f0 0x1fe1 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # Eaton # various models @@ -50,6 +58,8 @@ libhidups 0x0003 0x050d 0x1100 0x0000 0x0000 0x00 # APC # various models libhidups 0x0003 0x051d 0x0002 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# various 5G models +libhidups 0x0003 0x051d 0x0003 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # Powerware # various models @@ -67,6 +77,10 @@ libhidups 0x0003 0x06da 0x0003 0x0000 0x0000 0x00 # various models libhidups 0x0003 0x06da 0xffff 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# iDowell +# iDowell +libhidups 0x0003 0x075d 0x0300 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 + # Cyber Power Systems # 900AVR/BC900D, CP1200AVR/BC1200D libhidups 0x0003 0x0764 0x0005 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 @@ -86,20 +100,60 @@ libhidups 0x0003 0x09ae 0x1003 0x0000 0x0000 0x00 libhidups 0x0003 0x09ae 0x1007 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # e.g. TrippLite ECO550UPS libhidups 0x0003 0x09ae 0x1008 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. TrippLite ECO550UPS +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 OMNI1000LCD libhidups 0x0003 0x09ae 0x2005 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # e.g. TrippLite OMNI900LCD libhidups 0x0003 0x09ae 0x2007 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x2008 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. TrippLite Smart1000LCD +libhidups 0x0003 0x09ae 0x2009 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x2010 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x2011 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x2012 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x2013 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x2014 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x3008 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x3009 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x3010 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x3011 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # e.g. TrippLite smart2200RMXL2U libhidups 0x0003 0x09ae 0x3012 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # e.g. ? +libhidups 0x0003 0x09ae 0x3013 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? libhidups 0x0003 0x09ae 0x3014 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x3015 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? libhidups 0x0003 0x09ae 0x4002 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # e.g. TrippLite SmartOnline SU1500RTXL2ua libhidups 0x0003 0x09ae 0x4003 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. TrippLite SmartOnline SU1000XLA +libhidups 0x0003 0x09ae 0x4004 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x4005 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x4006 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x4007 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# e.g. ? +libhidups 0x0003 0x09ae 0x4008 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # PowerCOM # PowerCOM IMP - IMPERIAL Series diff --git a/scripts/python/Makefile.am b/scripts/python/Makefile.am index f8467d3..a6f75b2 100644 --- a/scripts/python/Makefile.am +++ b/scripts/python/Makefile.am @@ -1,11 +1,17 @@ # Network UPS Tools: data/html EXTRA_DIST = README \ - app/gui.glade \ + 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 \ module/PyNUT.py \ module/test_nutclient.py diff --git a/scripts/python/Makefile.in b/scripts/python/Makefile.in index 831649f..d3b1f4e 100644 --- a/scripts/python/Makefile.in +++ b/scripts/python/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -39,12 +39,13 @@ 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_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -54,6 +55,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -66,9 +68,11 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -81,8 +85,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -99,7 +105,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -110,22 +115,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ @@ -222,11 +227,17 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ EXTRA_DIST = README \ - app/gui.glade \ + 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 \ module/PyNUT.py \ module/test_nutclient.py diff --git a/scripts/python/app/NUT-Monitor b/scripts/python/app/NUT-Monitor index 26d9d0b..42d861b 100755 --- a/scripts/python/app/NUT-Monitor +++ b/scripts/python/app/NUT-Monitor @@ -1,423 +1,903 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2008 David Goncalves +# 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 # -# 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. +# 2010-02-26 David Goncalves +# Added UPS vars display and the possibility to change values +# when user double-clicks on a RW var. # -# 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. +# 2010-05-01 David Goncalves +# Added support for PyNotify (if available) # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# 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 -# 2008-02-01 David Goncalves -# A gui to monitor UPSes via NUT using PyNUT class. - -# 2009-02-12 David Goncalves -# Modified the status report method to allow 'composite' UPS status -# ( OL + TRIM, OL + OFF, etc... ) - -import gtk, gtk.glade, gobject, pango -import sys, os, time +import gtk, gtk.glade, gobject +import sys +import base64 +import os, os.path +import platform +import time import threading +import optparse +import ConfigParser +import locale +import gettext import PyNUT -# Activate use of threadings + +# Activate threadings on glib gobject.threads_init() -class gui : +class interface : - __widgets = {} - __callbacks = {} - __ups_handler = None - __ups_thread = None - __ups_name = "" - __ups_commands = list() - __ups_connected = False - - __version = "1.1" - __release = "2009-02-12" + __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 ) : - if os.path.exists( "gui.glade" ) : - glade_file = "gui.glade" - else : - glade_file = "/usr/share/nut-monitor/gui.glade" - self.__widgets["interface"] = gtk.glade.XML( glade_file ) - self.__widgets["main_window"] = self.__widgets["interface"].get_widget("window1") - self.__widgets["button_ups_refresh"] = self.__widgets["interface"].get_widget("button1") - self.__widgets["button_ups_connect"] = self.__widgets["interface"].get_widget("button2") - self.__widgets["button_ups_disconnect"] = self.__widgets["interface"].get_widget("button4") - self.__widgets["button_ups_list"] = self.__widgets["interface"].get_widget("combobox1") - self.__widgets["button_ups_command_list"] = self.__widgets["interface"].get_widget("combobox3") - self.__widgets["button_ups_command_apply"] = self.__widgets["interface"].get_widget("button3") - self.__widgets["button_authentication"] = self.__widgets["interface"].get_widget("checkbutton1") - self.__widgets["entry_login"] = self.__widgets["interface"].get_widget("entry2") - self.__widgets["entry_password"] = self.__widgets["interface"].get_widget("entry3") - self.__widgets["login_password_frame"] = self.__widgets["interface"].get_widget("hbox2") - self.__widgets["entry_host"] = self.__widgets["interface"].get_widget("entry1") - self.__widgets["entry_port"] = self.__widgets["interface"].get_widget("spinbutton1") - self.__widgets["progress_battery_charge"] = self.__widgets["interface"].get_widget("progressbar1") - self.__widgets["progress_ups_load"] = self.__widgets["interface"].get_widget("progressbar2") - self.__widgets["label_battery_runtime"] = self.__widgets["interface"].get_widget("label2") - self.__widgets["label_ups_infos_left"] = self.__widgets["interface"].get_widget("label15") - self.__widgets["label_ups_infos_right"] = self.__widgets["interface"].get_widget("label16") - self.__widgets["status_bar"] = self.__widgets["interface"].get_widget("statusbar1") - self.__widgets["ups_status_frame"] = self.__widgets["interface"].get_widget("frame1") - self.__widgets["ups_hostport_table"] = self.__widgets["interface"].get_widget("table1") + # 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" ) - self.__widgets["main_window"].show() + ( cmd_opts, args ) = opt_parser.parse_args() - # Define the callbacks - self.__callbacks = { "on_window1_destroy" : self.quit, - "on_imagemenuitem5_activate" : self.quit, - "on_imagemenuitem2_activate" : self.about, - "on_entry1_changed" : self.__host_changed, - "on_entry2_changed" : self.__login_pass_changed, - "on_entry3_changed" : self.__login_pass_changed, - "on_button1_clicked" : self.__gui_refresh_ups_list, - "on_button2_clicked" : self.__connect_to_ups, - "on_button3_clicked" : self.__apply_ups_command, - "on_button4_clicked" : self.__disconnect_from_ups, - "on_checkbutton1_toggled" : self.__use_authentication_changed + + 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") + self.__widgets["status_bar"] = self.__widgets["interface"].get_widget("statusbar2") + self.__widgets["ups_host_entry"] = self.__widgets["interface"].get_widget("entry1") + self.__widgets["ups_port_entry"] = self.__widgets["interface"].get_widget("spinbutton1") + self.__widgets["ups_refresh_button"] = self.__widgets["interface"].get_widget("button1") + self.__widgets["ups_authentication_check"] = self.__widgets["interface"].get_widget("checkbutton1") + self.__widgets["ups_authentication_frame"] = self.__widgets["interface"].get_widget("hbox1") + self.__widgets["ups_authentication_login"] = self.__widgets["interface"].get_widget("entry2") + self.__widgets["ups_authentication_password"] = self.__widgets["interface"].get_widget("entry3") + self.__widgets["ups_list_combo"] = self.__widgets["interface"].get_widget("combobox1") + self.__widgets["ups_commands_button"] = self.__widgets["interface"].get_widget("button8") + self.__widgets["ups_connect"] = self.__widgets["interface"].get_widget("button2") + self.__widgets["ups_disconnect"] = self.__widgets["interface"].get_widget("button7") + self.__widgets["ups_params_box"] = self.__widgets["interface"].get_widget("vbox6") + self.__widgets["ups_infos"] = self.__widgets["interface"].get_widget("notebook1") + self.__widgets["ups_vars_tree"] = self.__widgets["interface"].get_widget("treeview1") + self.__widgets["ups_vars_refresh"] = self.__widgets["interface"].get_widget("button9") + self.__widgets["ups_status_image"] = self.__widgets["interface"].get_widget("image1") + self.__widgets["ups_status_left"] = self.__widgets["interface"].get_widget("label10") + self.__widgets["ups_status_right"] = self.__widgets["interface"].get_widget("label11") + self.__widgets["ups_status_time"] = self.__widgets["interface"].get_widget("label15") + self.__widgets["menu_favorites_root"] = self.__widgets["interface"].get_widget("menuitem3") + self.__widgets["menu_favorites"] = self.__widgets["interface"].get_widget("menu2") + self.__widgets["menu_favorites_add"] = self.__widgets["interface"].get_widget("menuitem4") + self.__widgets["menu_favorites_del"] = self.__widgets["interface"].get_widget("menuitem5") + self.__widgets["progress_battery_charge"] = self.__widgets["interface"].get_widget("progressbar1") + self.__widgets["progress_battery_load"] = self.__widgets["interface"].get_widget("progressbar2") + + # 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_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" ) ) + + # Define interface callbacks actions + self.__callbacks = { "on_window1_destroy" : self.quit, + "on_imagemenuitem1_activate" : self.gui_about_dialog, + "on_imagemenuitem5_activate" : self.quit, + "on_entry1_changed" : self.__check_gui_fields, + "on_entry2_changed" : self.__check_gui_fields, + "on_entry3_changed" : self.__check_gui_fields, + "on_checkbutton1_toggled" : self.__check_gui_fields, + "on_spinbutton1_value_changed" : self.__check_gui_fields, + "on_button1_clicked" : self.__update_ups_list, + "on_button2_clicked" : self.connect_to_ups, + "on_button7_clicked" : self.disconnect_from_ups, + "on_button9_clicked" : self.__gui_update_ups_vars_view, + "on_menuitem4_activate" : self.__gui_add_favorite, + "on_menuitem5_activate" : self.__gui_delete_favorite, + "on_treeview1_button_press_event" : self.__gui_ups_vars_selected } - # Removes the dummy entry in the combobox - self.__widgets["button_ups_list"].remove_text( 0 ) - self.__widgets["button_ups_command_list"].remove_text( 0 ) - # Connect the callbacks self.__widgets["interface"].signal_autoconnect( self.__callbacks ) - def run( self ) : - gtk.main() + # Remove the dummy combobox entry on UPS List and Commands + self.__widgets["ups_list_combo"].remove_text( 0 ) - def about( self, widget=None ) : - dial = self.__widgets["interface"].get_widget( "aboutdialog1" ) - dial.run() - dial.destroy() + # Set UPS vars treeview properties ----------------------------- + store = gtk.ListStore( gtk.gdk.Pixbuf, gobject.TYPE_STRING, gobject.TYPE_STRING ) + self.__widgets["ups_vars_tree"].set_model( store ) + self.__widgets["ups_vars_tree"].set_headers_visible( True ) + + # Column 0 + cr = gtk.CellRendererPixbuf() + column = gtk.TreeViewColumn( '', cr ) + column.add_attribute( cr, 'pixbuf', 0 ) + self.__widgets["ups_vars_tree"].append_column( column ) + + # Column 1 + cr = gtk.CellRendererText() + cr.set_property( 'editable', False ) + column = gtk.TreeViewColumn( _('Var name'), cr ) + column.set_sort_column_id( 1 ) + column.add_attribute( cr, 'text', 1 ) + self.__widgets["ups_vars_tree"].append_column( column ) + + # Column 2 + cr = gtk.CellRendererText() + cr.set_property( 'editable', False ) + column = gtk.TreeViewColumn( _('Value'), cr ) + column.add_attribute( cr, 'text', 2 ) + self.__widgets["ups_vars_tree"].append_column( column ) + + self.__widgets["ups_vars_tree"].get_model().set_sort_column_id( 1, gtk.SORT_ASCENDING ) + self.__widgets["ups_vars_tree_store"] = store + + self.__widgets["ups_vars_tree"].set_size_request( -1, 50 ) + #--------------------------------------------------------------- + + # UPS Commands combo box creation ------------------------------ + container = self.__widgets["ups_commands_button"].get_parent() + self.__widgets["ups_commands_button"].destroy() + self.__widgets["ups_commands_combo"] = gtk.ComboBox() + + list_store = gtk.ListStore( gobject.TYPE_STRING ) + + self.__widgets["ups_commands_combo"].set_model( list_store ) + cell_renderer = gtk.CellRendererText() + cell_renderer.set_property( "xalign", 0 ) + self.__widgets["ups_commands_combo"].pack_start( cell_renderer, True ) + self.__widgets["ups_commands_combo"].add_attribute( cell_renderer, "markup", 0 ) + + container.pack_start( self.__widgets["ups_commands_combo"], True ) + self.__widgets["ups_commands_combo"].set_active( 0 ) + self.__widgets["ups_commands_combo"].show_all() + + self.__widgets["ups_commands_button"] = gtk.Button( stock=gtk.STOCK_EXECUTE ) + container.pack_start( self.__widgets["ups_commands_button"], True ) + self.__widgets["ups_commands_button"].show() + self.__widgets["ups_commands_button"].connect( "clicked", self.__gui_send_ups_command ) + + self.__widgets["ups_commands_combo_store"] = list_store + #--------------------------------------------------------------- + + 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 ( self.__favorites.has_key( cmd_opts.favorite ) ) : + 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"].set_text( "localhost" ) + self.__update_ups_list() + if ( len( self.__widgets["ups_list_combo"].get_model() ) == 1 ) : + self.connect_to_ups() + + # 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"].get_active() != -1 : + self.__widgets["ups_list_combo"].get_model().clear() + self.__widgets["ups_connect"].set_sensitive( False ) + self.__widgets["menu_favorites_add"].set_sensitive( False ) + + # Host/Port selection + if len( self.__widgets["ups_host_entry"].get_text() ) > 0 : + sensitive = True + + # If authentication is selected, check that we have a login and password + if self.__widgets["ups_authentication_check"].get_active() : + if len( self.__widgets["ups_authentication_login"].get_text() ) == 0 : + sensitive = False + + if len( self.__widgets["ups_authentication_password"].get_text() ) == 0 : + sensitive = False + + self.__widgets["ups_refresh_button"].set_sensitive( sensitive ) + if not sensitive : + self.__widgets["ups_connect"].set_sensitive( False ) + self.__widgets["menu_favorites_add"].set_sensitive( False ) + else : + self.__widgets["ups_refresh_button"].set_sensitive( False ) + self.__widgets["ups_connect"].set_sensitive( False ) + self.__widgets["menu_favorites_add"].set_sensitive( False ) + + # Use authentication fields... + if self.__widgets["ups_authentication_check"].get_active() : + self.__widgets["ups_authentication_frame"].set_sensitive( True ) + else : + self.__widgets["ups_authentication_frame"].set_sensitive( 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"].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_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"].get_text() + port = int( self.__widgets["ups_port_entry"].get_value() ) + login = None + password = None + + if self.__widgets["ups_authentication_check"].get_active() : + login = self.__widgets["ups_authentication_login"].get_text() + password = self.__widgets["ups_authentication_password"].get_text() - def quit( self, widget=None ) : try : - if self.__ups_thread.isAlive() : - self.__ups_thread.stop_thread() - self.__ups_thread.join() + nut_handler = PyNUT.PyNUTClient( host=host, port=port, login=login, password=password ) + upses = nut_handler.GetUPSList() + + ups_list = upses.keys() + ups_list.sort() + + # If UPS list contains something, clear it + self.__widgets["ups_list_combo"].get_model().clear() + + for current in ups_list : + self.__widgets["ups_list_combo"].append_text( current ) + + self.__widgets["ups_list_combo"].set_active( 0 ) + + self.__widgets["ups_connect"].set_sensitive( True ) + self.__widgets["menu_favorites_add"].set_sensitive( True ) + + self.gui_status_message( _("Found {0} devices on {1}").format( len( ups_list ), host ) ) + except : - pass + 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() gtk.main_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_interface = gtk.glade.XML( self.__glade_file, "dialog1" ) + dialog = dialog_interface.get_widget( "dialog1" ) + + self.__widgets["favorites_dialog_button_add"] = dialog_interface.get_widget("button3") + + # Define interface callbacks actions + callbacks = { "on_entry4_changed" : self.__gui_add_favorite_check_gui_fields } + dialog_interface.signal_autoconnect( callbacks ) + + self.__widgets["main_window"].set_sensitive( False ) + rc = dialog.run() + if rc == 1 : + fav_data = {} + fav_data["host"] = self.__widgets["ups_host_entry"].get_text() + fav_data["port"] = "%d" % self.__widgets["ups_port_entry"].get_value() + fav_data["ups"] = self.__widgets["ups_list_combo"].get_active_text() + fav_data["auth"] = self.__widgets["ups_authentication_check"].get_active() + if fav_data["auth"] : + fav_data["login"] = self.__widgets["ups_authentication_login"].get_text() + fav_data["password"] = base64.b64encode( self.__widgets["ups_authentication_password"].get_text() ) + + fav_name = dialog_interface.get_widget("entry4").get_text() + self.__favorites[ fav_name ] = fav_data + self.__gui_refresh_favorites_menu() + + # Save all favorites + self.__save_favorites() + + dialog.destroy() + self.__widgets["main_window"].set_sensitive( True ) + + #------------------------------------------------------------------- + # Method called when user wants to delete an entry from favorites + def __gui_delete_favorite( self, widget=None ) : + + dialog_interface = gtk.glade.XML( self.__glade_file, "dialog2" ) + dialog = dialog_interface.get_widget( "dialog2" ) + + # Remove the dummy combobox entry on list + dialog_interface.get_widget("combobox2").remove_text( 0 ) + + favs = self.__favorites.keys() + favs.sort() + for current in favs : + dialog_interface.get_widget("combobox2").append_text( current ) + + dialog_interface.get_widget("combobox2").set_active( 0 ) + + self.__widgets["main_window"].set_sensitive( False ) + rc = dialog.run() + fav_name = dialog_interface.get_widget("combobox2").get_active_text() + dialog.destroy() + self.__widgets["main_window"].set_sensitive( True ) + + if ( rc == 1 ) : + # Remove entry, show confirmation dialog + md = gtk.MessageDialog( None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, _("Are you sure that you want to remove this favorite ?") ) + resp = md.run() + md.destroy() + + if ( resp == gtk.RESPONSE_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 ( self.__favorites.has_key( fav_name ) ) : + # 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"].set_active( True ) + self.__widgets["ups_authentication_login"].set_text( self.__favorites[fav_name].get("login","") ) + self.__widgets["ups_authentication_password"].set_text( self.__favorites[fav_name].get("password","") ) + + self.__widgets["ups_host_entry"].set_text( self.__favorites[fav_name].get("host","") ) + self.__widgets["ups_port_entry"].set_value( float(self.__favorites[fav_name].get("port",3493.0)) ) + + # Clear UPS list and add current UPS name + self.__widgets["ups_list_combo"].get_model().clear() + + self.__widgets["ups_list_combo"].append_text( self.__favorites[fav_name].get("ups","") ) + self.__widgets["ups_list_combo"].set_active( 0 ) + + # Activate the connect button + self.__widgets["ups_connect"].set_sensitive( 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"].get_active() + cmd = self.__ups_commands[ offset ] + + md = gtk.MessageDialog( None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, _("Are you sure that you want to send\n'%s' to the device ?") % cmd ) + self.__widgets["main_window"].set_sensitive( False ) + resp = md.run() + md.destroy() + self.__widgets["main_window"].set_sensitive( True ) + + if ( resp == gtk.RESPONSE_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, widget, event ) : + # Check if it's a double click... + if ( (event.button == 1) and (event.type == gtk.gdk._2BUTTON_PRESS) ) : + treeselection = self.__widgets["ups_vars_tree"].get_selection() + (model,iter) = treeselection.get_selected() + try : + ups_var = model.get_value( iter, 1 ) + if ( ups_var in self.__ups_rw_vars ) : + # The selected var is RW, then we can show the update dialog + dialog_interface = gtk.glade.XML( self.__glade_file, "dialog3" ) + dialog = dialog_interface.get_widget( "dialog3" ) + + lab = dialog_interface.get_widget( "label9" ) + lab.set_markup( _("Enter a new value for the variable.\n\n{0} = {1} (current value)").format( ups_var, self.__ups_rw_vars.get(ups_var)) ) + + str = dialog_interface.get_widget( "entry5" ) + str.set_text( self.__ups_rw_vars.get(ups_var) ) + + self.__widgets["main_window"].set_sensitive( False ) + rc = dialog.run() + new_val = str.get_text() + dialog.destroy() + self.__widgets["main_window"].set_sensitive( True ) + + if ( rc == 1 ) : + try : + self.__ups_handler.SetRWVar( ups=self.__current_ups, var=ups_var, 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 + 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 informations 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 : + current.destroy() + + self.__fav_menu_items = list() + + items = self.__favorites.keys() + items.sort() + + for current in items : + menu_item = gtk.MenuItem( current ) + menu_item.show() + self.__fav_menu_items.append( menu_item ) + self.__widgets["menu_favorites"].append( menu_item ) + + menu_item.connect_object( "activate", self.__gui_load_favorite, current ) + + if len( items ) > 0 : + self.__widgets["menu_favorites_del"].set_sensitive( True ) + else : + self.__widgets["menu_favorites_del"].set_sensitive( 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, widget=None ) : + fav_name = widget.get_text() + if ( len( fav_name ) > 0 ) and ( fav_name not in self.__favorites.keys() ) : + self.__widgets["favorites_dialog_button_add"].set_sensitive( True ) + else : + self.__widgets["favorites_dialog_button_add"].set_sensitive( 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 : + 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.decodestring( conf.get( current, "password" ) ) + + 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=0700 ) + except : + self.gui_status_message( _("Error while creating configuration folder (%s)") % sys.exc_info()[1] ) + + save_conf = ConfigParser.ConfigParser() + for current in self.__favorites.keys() : + save_conf.add_section( current ) + for k, v in self.__favorites[ current ].iteritems() : + 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 ) : + dialog_interface = gtk.glade.XML( self.__glade_file, "aboutdialog1" ) + dialog = dialog_interface.get_widget( "aboutdialog1" ) + + self.__widgets["main_window"].set_sensitive( False ) + dialog.run() + dialog.destroy() + self.__widgets["main_window"].set_sensitive( True ) + + #------------------------------------------------------------------- + # 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="" ) : + context_id = self.__widgets["status_bar"].get_context_id("Infos") + self.__widgets["status_bar"].pop( context_id ) + + if ( platform.system() == "Windows" ) : + text = msg.decode("cp1250").encode("utf8") + else : + text = msg + + message_id = self.__widgets["status_bar"].push( context_id, text.replace("\n", "") ) + self.__widgets["status_bar"].set_tooltip_text( text ) + + #------------------------------------------------------------------- + # Display a notification using PyNotify with an optional icon + def gui_status_notification( self, message="", icon_file="" ) : + # Try to init pynotify + try : + import pynotify + pynotify.init( "NUT Monitor" ) + + if ( icon_file != "" ) : + icon = "file://%s" % os.path.abspath( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", icon_file ) ) + else : + icon = None + + notif = pynotify.Notification( "NUT Monitor", message, icon ) + notif.show() + + except : + pass + + #------------------------------------------------------------------- + # Let GTK refresh GUI :) def refresh_gui( self ) : while gtk.events_pending() : gtk.main_iteration( False ) return( True ) - # If host string is modified, check if there is a value to activate the "Refresh" button. - def __host_changed( self, widget=None ) : - value = widget.get_text() - if value != "" : - self.__widgets["button_ups_refresh"].set_sensitive( True ) - self.__widgets["button_authentication"].set_sensitive( True ) - if self.__widgets["button_authentication"].toggled() : - self.__widgets["login_password_frame"].set_sensitive( True ) + #------------------------------------------------------------------- + # Connect to the selected UPS using parameters (host,port,login,pass) + def connect_to_ups( self, widget=None ) : - if self.__widgets["button_ups_list"].get_active() != -1 : - self.__widgets["button_ups_connect"].set_sensitive( True ) + host = self.__widgets["ups_host_entry"].get_text() + port = int( self.__widgets["ups_port_entry"].get_value() ) + login = None + password = None - else : - self.__widgets["button_ups_refresh"].set_sensitive( False ) - self.__widgets["button_ups_connect"].set_sensitive( False ) - self.__widgets["button_authentication"].set_sensitive( False ) - self.__widgets["login_password_frame"].set_sensitive( False ) - - - def __use_authentication_changed( self, widget=None ) : - if widget.get_active() : - self.__widgets["login_password_frame"].set_sensitive( True ) - # Clear UPS List - while self.__widgets["button_ups_list"].get_active() != -1 : - self.__widgets["button_ups_list"].remove_text( 0 ) - self.__widgets["button_ups_list"].set_active( 0 ) - - self.__widgets["button_ups_connect"].set_sensitive( False ) - if ( self.__widgets["entry_login"].get_text() == "" ) or ( self.__widgets["entry_password"].get_text() == "" ) : - self.__widgets["button_ups_refresh"].set_sensitive( False ) - else : - self.__widgets["button_ups_refresh"].set_sensitive( True ) - else : - self.__widgets["login_password_frame"].set_sensitive( False ) - self.__widgets["button_ups_refresh"].set_sensitive( True ) - - def __login_pass_changed( self, widget=None ) : - # Get the values for login/pass fields in order to check that there is something typed - self.__host_changed( self.__widgets["entry_host"] ) - - def __gui_refresh_ups_list( self, widget=None ) : - host = self.__widgets["entry_host"].get_text() - port = int( self.__widgets["entry_port"].get_value() ) + if self.__widgets["ups_authentication_check"].get_active() : + login = self.__widgets["ups_authentication_login"].get_text() + password = self.__widgets["ups_authentication_password"].get_text() try : - # If the authentication is active, try to log into the UPS using login/password - if self.__widgets["button_authentication"].get_active() : - login = self.__widgets["entry_login"].get_text() - password = self.__widgets["entry_password"].get_text() - else : - login = None - password = None - self.__ups_handler = PyNUT.PyNUTClient( host=host, port=port, login=login, password=password ) - result = self.__ups_handler.GetUPSList() - - # Clear UPS List - while self.__widgets["button_ups_list"].get_active() != -1 : - self.__widgets["button_ups_list"].remove_text( 0 ) - self.__widgets["button_ups_list"].set_active( 0 ) - - if len( result.keys() ) > 0 : - for current_ups in result.keys() : - self.__widgets["button_ups_list"].append_text( current_ups ) - - self.__widgets["button_ups_list"].set_active( 0 ) - self.__widgets["button_ups_refresh"].set_sensitive( False ) - self.__widgets["button_ups_connect"].set_sensitive( True ) - self.__widgets["button_authentication"].set_sensitive( False ) - self.__widgets["login_password_frame"].set_sensitive( False ) except : - self.status_message( "%s : %s" % ( sys.exc_info()[0], sys.exc_info()[1] ) ) + 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 - def __gui_refresh_ups_commands( self, widget=None ) : - # Clear the command list - while self.__widgets["button_ups_command_list"].get_active() != -1 : - self.__widgets["button_ups_command_list"].remove_text( 0 ) - self.__widgets["button_ups_command_list"].set_active( 0 ) + # Check if selected UPS exists on server... + srv_upses = self.__ups_handler.GetUPSList() + self.__current_ups = self.__widgets["ups_list_combo"].get_active_text() - self.__ups_commands = list() + if not srv_upses.has_key( self.__current_ups ) : + 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 - try : - commands = self.__ups_handler.GetUPSCommands( self.__ups_name ) - self.__ups_commands = commands.keys() - self.__ups_commands.sort() + self.__connected = True + self.__widgets["ups_connect"].hide() + self.__widgets["ups_disconnect"].show() + self.__widgets["ups_infos"].show() + self.__widgets["ups_params_box"].set_sensitive( False ) + self.__widgets["menu_favorites_root"].set_sensitive( False ) + self.__widgets["ups_params_box"].hide() - for desc in self.__ups_commands : - self.__widgets["button_ups_command_list"].append_text( commands[desc] ) + commands = self.__ups_handler.GetUPSCommands( self.__current_ups ) + self.__ups_commands = commands.keys() + self.__ups_commands.sort() - self.__widgets["button_ups_command_list"].set_active( 0 ) - self.__widgets["button_ups_command_apply"].set_sensitive( True ) - except : - self.__widgets["button_ups_command_apply"].set_sensitive( False ) + # Refresh UPS commands combo box + self.__widgets["ups_commands_combo_store"].clear() + for desc in self.__ups_commands : + self.__widgets["ups_commands_combo_store"].append( [ "%s\n%s" % ( desc, commands[desc] ) ] ) + + self.__widgets["ups_commands_combo"].set_active( 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... + self.__widgets["main_window"].resize( 1, 1 ) + + # 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 - def __disconnect_from_ups( self, widget=None ) : - if self.__ups_thread.isAlive() : - self.__ups_thread.stop_thread() - self.__ups_thread.join() + self.__widgets["ups_vars_tree_store"].clear() - def __apply_ups_command( self, widget=None ) : - id = self.__widgets["button_ups_command_list"].get_active() + 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" ) + else : + icon_file = os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "var-ro.png" ) - # Display a confirmation dialog - dial = gtk.MessageDialog( parent=self.__widgets["main_window"], - flags=gtk.DIALOG_MODAL, - type=gtk.MESSAGE_INFO, - buttons=gtk.BUTTONS_YES_NO, - message_format=None ) - - dial.set_markup( "Action confirmation" ) - msg = "Are you sur that you want to perform a %s on %s ?\n" % ( self.__ups_commands[id], self.__ups_name ) - dial.format_secondary_markup( msg ) - - resp = dial.run() - dial.destroy() - - if resp == gtk.RESPONSE_YES : - try : - self.__ups_handler.RunUPSCommand( self.__ups_name, self.__ups_commands[id] ) - except : - self.error_message( "Send command failed", "Something went wrong while sending command to server.\n\n%s" % sys.exc_info()[1] ) + icon = gtk.gdk.pixbuf_new_from_file( icon_file ) + self.__widgets["ups_vars_tree_store"].append( [ icon, k, v ] ) - # When the 'connect' button is clicked... - def __connect_to_ups( self, widget=None ) : - # Get the selected UPS name - self.__ups_name = self.__widgets["button_ups_list"].get_active_text() + #------------------------------------------------------------------- + # Disconnect from the UPS + def disconnect_from_ups( self, widget=None ) : - self.__ups_thread = ups_updater( self ) - self.__ups_thread.start() + self.__connected = False + self.__widgets["ups_connect"].show() + self.__widgets["ups_disconnect"].hide() + self.__widgets["ups_infos"].hide() + self.__widgets["ups_params_box"].set_sensitive( True ) + self.__widgets["menu_favorites_root"].set_sensitive( True ) + self.__widgets["status_icon"].set_tooltip_markup( _("Not connected") ) + self.__widgets["ups_params_box"].show() + # Try to resize the main window... + self.__widgets["main_window"].resize( 1, 1 ) - def error_message( self, message1 = "", message2 = "" ) : - dial = gtk.MessageDialog( parent=self.__widgets["main_window"], flags=gtk.DIALOG_MODAL, type=gtk.MESSAGE_WARNING, - buttons=gtk.BUTTONS_CLOSE, message_format=None ) - dial.set_markup( message1 ) - dial.format_secondary_markup( message2 ) - dial.run() - dial.destroy() + # Stop the GUI updater thread + self.__gui_thread.stop_thread() - def status_message( self, message = "" ) : - context_id = self.__widgets["status_bar"].get_context_id("Infos") - message_id = self.__widgets["status_bar"].push( context_id, message ) - self.refresh_gui() + 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 - -class ups_updater( threading.Thread ) : +#----------------------------------------------------------------------- +# GUI Updater class +# This class updates the main gui with data from connected UPS +class gui_updater( threading.Thread ) : __parent_class = None __stop_thread = False - __ups_status_mapper = { "LB" : "Low batteries", - "RB" : "Replace batteries !", - "BYPASS" : "Running bypass (no battery protection)", - "CAL" : "Performing runtime calibration", - "OFF" : "output offline (not providing power to the load)", - "OVER" : "Overloaded ! (there is too much load for UPS)", - "TRIM" : "Triming (UPS is triming incoming voltage)", - "BOOST" : "Boost (UPS is boosting incoming voltage)" - } - def __init__( self, parent_class ) : threading.Thread.__init__( self ) self.__parent_class = parent_class def run( self ) : - self.__parent_class.status_message( "Connecting to %s" % self.__parent_class._gui__ups_name ) - self.__parent_class._gui__gui_refresh_ups_commands() + + ups = self.__parent_class._interface__current_ups + was_online = True + + # Define a dict containing different UPS status + status_mapper = { "LB" : "%s" % _("Low batteries"), + "RB" : "%s" % _("Replace batteries !"), + "BYPASS" : "Bypass %s" % _("(no battery protection)"), + "CAL" : _("Performing runtime calibration"), + "OFF" : "%s (%s)" % ( _("Offline"), _("not providing power to the load") ), + "OVER" : "%s (%s)" % ( _("Overloaded !"), _("there is too much load for device") ), + "TRIM" : _("Triming (UPS is triming incoming voltage)"), + "BOOST" : _("Boost (UPS is boosting incoming voltage)") + } while not self.__stop_thread : - vars = {} - try : - vars = self.__parent_class._gui__ups_handler.GetUPSVars( self.__parent_class._gui__ups_name ) - self.__parent_class.status_message( "Connected to %s" % self.__parent_class._gui__ups_name ) - self.__parent_class._gui__widgets["ups_status_frame"].set_sensitive( True ) - self.__parent_class._gui__widgets["ups_hostport_table"].set_sensitive( False ) - self.__parent_class._gui__widgets["button_ups_connect"].hide() - self.__parent_class._gui__widgets["button_ups_disconnect"].show() - self.__parent_class._gui__widgets["button_authentication"].set_sensitive( False ) - self.__parent_class._gui__widgets["login_password_frame"].set_sensitive( False ) + 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 = "" - # Update the battery charge progress bar - if not vars.has_key( "battery.charge" ) : - self.__parent_class._gui__widgets["progress_battery_charge"].set_fraction( 0.0 ) - self.__parent_class._gui__widgets["progress_battery_charge"].set_text( "Not available" ) - else : - charge = vars.get( "battery.charge", "0" ) - self.__parent_class._gui__widgets["progress_battery_charge"].set_fraction( float( charge ) / 100.0 ) - self.__parent_class._gui__widgets["progress_battery_charge"].set_text( "%s %%" % int( float( charge ) ) ) + text_left += "%s\n" % _("Device status :") - # Update the UPS load progress bar - if not vars.has_key( "ups.load" ) : - self.__parent_class._gui__widgets["progress_ups_load"].set_fraction( 0.0 ) - self.__parent_class._gui__widgets["progress_ups_load"].set_text( "Not available" ) - else : - load = vars.get( "ups.load", "0" ) - self.__parent_class._gui__widgets["progress_ups_load"].set_fraction( float( load ) / 100.0 ) - self.__parent_class._gui__widgets["progress_ups_load"].set_text( "%s %%" % int( float( load ) ) ) + if ( vars.get("ups.status").find("OL") != -1 ) : + text_right += "%s" % _("Online") + if not was_online : + self.__parent_class.change_status_icon( "on_line", blink=False ) + was_online = True - # Update the UPS remaining battery time - if not vars.has_key( "battery.runtime" ) : - self.__parent_class._gui__widgets["label_battery_runtime"].set_text( "Not available" ) - else : - runtime = int( float( vars.get( "battery.runtime", "0" ) ) ) - H = runtime / 3600 - M = ( runtime - ( H * 3600 ) ) / 60 - S = runtime - ( H * 3600 ) - ( M * 60 ) + if ( vars.get("ups.status").find("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 - if H > 0 : - string = "%s hour(s) %s minutes %s seconds" % ( H, M, S ) - elif ( H == 0 ) and ( M > 0 ) : - string = "%s minutes %s seconds" % ( M, S ) - else : - string = "%s seconds" % S - - self.__parent_class._gui__widgets["label_battery_runtime"].set_text( string ) - - text_left = "" - text_right = "" - - # Update UPS informations fields - if vars.has_key("ups.status") : - text_left += "UPS Status :\n\n" - - if vars["ups.status"].find( "OL" ) != -1 : - # UPS is online - text_right += "Online" - - if vars["ups.status"].find( "OB" ) != -1 : - # UPS is on batteries - text_right += "On batteries" - - # Check for additionnal informations - for k,v in self.__ups_status_mapper.iteritems() : - if vars["ups.status"].find(k) != -1 : + # Check for additionnal informations + for k,v in status_mapper.iteritems() : + if vars.get("ups.status").find(k) != -1 : + if ( text_right != "" ) : text_right += " - %s" % v + else : + text_right += "%s" % v - text_right += "\n\n" + # CHRG and DISCHRG cannot be trated with the previous loop ;) + if ( vars.get("ups.status").find("DISCHRG") != -1 ) : + text_right += " - %s" % _("discharging") + elif ( vars.get("ups.status").find("CHRG") != -1 ) : + text_right += " - %s" % _("charging") - text_left += "UPS Model :\n" + status_text += text_right + text_right += "\n" - if vars.has_key("ups.mfr") : - text_right += "%s " % vars.get( "ups.mfr", "" ) + if ( vars.has_key( "ups.mfr" ) ) : + text_left += "%s\n\n" % _("Model :") + text_right += "%s\n%s\n" % ( vars.get("ups.mfr",""), vars.get("ups.model","") ) - if vars.has_key("ups.model") : - text_right += "%s\n" % vars.get( "ups.model", "" ) - - if vars.has_key("ups.serial") : - text_left += "S/N :\n" - text_right += "%s\n" % vars.get( "ups.serial", "" ) - - if vars.has_key("ups.id") : - text_left += "Identifier :\n" - text_right += "%s\n" % vars.get( "ups.id", "" ) - - if vars.has_key("ups.temperature") : - text_left += "Temperature :\n" + if ( vars.has_key( "ups.temperature" ) ) : + text_left += "%s\n" % _("Temperature :") text_right += "%s\n" % int( float( vars.get( "ups.temperature", 0 ) ) ) - if vars.has_key("battery.voltage") : - text_left += "Battery voltage :\n" - text_right += "%sv\n" % vars.get( "battery.voltage", "0" ) + if ( vars.has_key( "battery.voltage" ) ) : + text_left += "%s\n" % _("Battery voltage :") + text_right += "%sv\n" % vars.get( "battery.voltage", 0 ) - self.__parent_class._gui__widgets["label_ups_infos_left"].set_markup( text_left[:-1] ) - self.__parent_class._gui__widgets["label_ups_infos_right"].set_markup( text_right[:-1] ) + self.__parent_class._interface__widgets["ups_status_left"].set_markup( text_left[:-1] ) + self.__parent_class._interface__widgets["ups_status_right"].set_markup( text_right[:-1] ) + + # UPS load and battery charge progress bars + if ( vars.has_key( "battery.charge" ) ) : + charge = vars.get( "battery.charge", "0" ) + self.__parent_class._interface__widgets["progress_battery_charge"].set_fraction( float( charge ) / 100.0 ) + self.__parent_class._interface__widgets["progress_battery_charge"].set_text( "%s %%" % int( float( charge ) ) ) + status_text += "\n%s %s%%" % ( _("Battery charge :"), int( float( charge ) ) ) + else : + self.__parent_class._interface__widgets["progress_battery_charge"].set_fraction( 0.0 ) + self.__parent_class._interface__widgets["progress_battery_charge"].set_text( _("Not available") ) + + if ( vars.has_key( "ups.load" ) ) : + load = vars.get( "ups.load", "0" ) + self.__parent_class._interface__widgets["progress_battery_load"].set_fraction( float( load ) / 100.0 ) + self.__parent_class._interface__widgets["progress_battery_load"].set_text( "%s %%" % int( float( load ) ) ) + status_text += "\n%s %s%%" % ( _("UPS load :"), int( float( load ) ) ) + else : + self.__parent_class._interface__widgets["progress_battery_load"].set_fraction( 0.0 ) + self.__parent_class._interface__widgets["progress_battery_load"].set_text( _("Not available") ) + + if ( vars.has_key( "battery.runtime" ) ) : + autonomy = int(vars.get("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"].set_markup( info ) + + # Display UPS status as tooltip for tray icon + self.__parent_class._interface__widgets["status_icon"].set_tooltip_markup( status_text ) except : - self.__parent_class.status_message( repr(sys.exc_info()[1]) ) - self.__parent_class._gui__widgets["ups_status_frame"].set_sensitive( False ) + 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" ) time.sleep( 1 ) - # The thread stops... - self.__parent_class._gui__widgets["ups_status_frame"].set_sensitive( False ) - self.__parent_class._gui__widgets["ups_hostport_table"].set_sensitive( True ) - self.__parent_class._gui__widgets["button_ups_disconnect"].hide() - self.__parent_class._gui__widgets["button_ups_connect"].show() - self.__parent_class.status_message( "Disconnected from %s" % self.__parent_class._gui__ups_name ) - - # Clear all data fields - self.__parent_class._gui__widgets["label_ups_infos_right"].set_markup( "" ) - self.__parent_class._gui__widgets["label_battery_runtime"].set_text( "" ) - self.__parent_class._gui__widgets["progress_battery_charge"].set_fraction( 0.0 ) - self.__parent_class._gui__widgets["progress_ups_load"].set_fraction( 0.0 ) - self.__parent_class._gui__widgets["progress_battery_charge"].set_text( "0 %" ) - self.__parent_class._gui__widgets["progress_ups_load"].set_text( "0 %" ) - - def stop_thread( self ) : self.__stop_thread = True +#----------------------------------------------------------------------- +# The main program starts here :-) if __name__ == "__main__" : - app = gui() - app.run() + # Init the localisation + APP = "NUT-Monitor" + DIR = "locale" + + gettext.bindtextdomain( APP, DIR ) + gettext.textdomain( APP ) + _ = gettext.gettext + + for module in ( gettext, gtk.glade ) : + module.bindtextdomain( APP, DIR ) + module.textdomain( APP ) + + gui = interface() + gtk.main() + diff --git a/scripts/python/app/gui-1.3.glade b/scripts/python/app/gui-1.3.glade new file mode 100644 index 0000000..ffe9b7d --- /dev/null +++ b/scripts/python/app/gui-1.3.glade @@ -0,0 +1,1072 @@ + + + + + + NUT Monitor + center + battery + + + + True + + + True + + + True + _File + True + + + True + + + gtk-about + True + True + True + + + + + + True + + + + + gtk-quit + True + True + True + + + + + + + + + + True + F_avorites + True + + + True + + + gtk-add + True + False + True + True + + + + + + gtk-delete + True + False + True + True + + + + + + True + + + + + + + + + False + 0 + + + + + True + + + True + 0.5 + in + + + True + 2 + + + True + + + True + + + True + 2 + 3 + + + True + 1 + Host / Port : + + + GTK_FILL + + + + + True + 1 + Device : + + + 1 + 2 + GTK_FILL + + + + + True + True + + + + + 1 + 2 + + + + + True + True + 5 + + 5 + 3493 0 65535 1 10 0 + True + + + + 2 + 3 + GTK_FILL + + + + + True + None + + + 1 + 2 + 1 + 2 + + + + + gtk-refresh + True + False + True + True + True + + + + 2 + 3 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + False + False + 0 + + + + + Use authentication + True + True + False + True + + + + False + 1 + + + + + True + False + + + True + 1 + Login / Password : + + + 0 + + + + + True + True + + + + + 1 + + + + + True + True + False + + + + + 2 + + + + + False + 2 + + + + + True + + + False + 4 + 3 + + + + + 0 + + + + + True + + + gtk-connect + True + False + True + True + True + + + + 0 + + + + + gtk-disconnect + True + True + True + + + + 1 + + + + + False + 1 + + + + + + + + + True + NUT Server + True + + + label_item + + + + + False + 0 + + + + + True + True + + + True + 2 + + + True + + + True + gtk-missing-image + 6 + + + False + 0 + + + + + True + 0 + in + + + True + 2 + 2 + 2 + 2 + + + True + + + True + 1 + 0 + 2 + label + right + + + False + 0 + + + + + True + 0 + 0 + 2 + label + + + 1 + + + + + + + + + + label_item + + + + + 1 + + + + + 0 + + + + + True + 4 + 2 + 4 + + + True + 1 + 2 + Battery charge : + True + right + + + GTK_FILL + + + + + True + 1 + 2 + Current load : + True + right + + + 1 + 2 + GTK_FILL + + + + + True + + + 1 + 2 + + + + + True + + + 1 + 2 + 1 + 2 + + + + + True + 1 + 2 + Remaining time : + right + + + 2 + 3 + GTK_FILL + + + + + True + 0 + in + + + True + + + True + N/A + True + + + + + + + + label_item + + + + + 1 + 2 + 2 + 3 + + + + + True + 1 + 2 + Device commands : + True + right + + + 3 + 4 + GTK_FILL + + + + + True + + + + + + gtk-execute + True + True + True + True + + + + False + False + 1 + + + + + 1 + 2 + 3 + 4 + + + + + False + 1 + + + + + + + + + + True + 2 + Device status + + + False + tab + + + + + True + 2 + + + True + 0 + in + + + True + 1 + 1 + 1 + 1 + + + True + True + automatic + automatic + + + True + True + + + + + + + + + + + label_item + + + + + 0 + + + + + gtk-refresh + True + True + True + True + + + + False + 1 + + + + + 1 + + + + + True + Device vars + + + 1 + False + tab + + + + + 1 + + + + + 1 + + + + + True + 2 + + + False + 2 + + + + + + + 5 + True + center-always + normal + + + True + 2 + + + True + 0 + in + + + True + 4 + 4 + 4 + 4 + + + True + + + True + Enter a name for this favorite + +<span color="#808080">You cannot re-use a name from another entry</span> + + True + + + 0 + + + + + True + True + + + + + False + 1 + + + + + + + + + + label_item + + + + + 1 + + + + + True + spread + + + gtk-add + 1 + True + False + True + True + True + + + False + False + 0 + + + + + gtk-cancel + True + True + True + True + + + False + False + 1 + + + + + False + end + 0 + + + + + + + 5 + True + center-always + normal + + + True + 2 + + + True + 0 + in + + + True + 4 + 4 + 4 + 4 + + + True + + + True + +Please select the favorite that you +want to delete from list... + + True + + + 0 + + + + + True + 0 + <None> + + + False + 1 + + + + + + + + + + label_item + + + + + 1 + + + + + True + spread + + + gtk-delete + 1 + True + True + True + True + + + False + False + 0 + + + + + gtk-cancel + True + True + True + True + + + False + False + 1 + + + + + False + end + 0 + + + + + + + 5 + True + center-always + normal + + + True + 2 + + + True + 0 + in + + + True + 4 + 4 + 4 + 4 + + + True + + + True + 4 + + + True + gtk-edit + 6 + + + False + 4 + 0 + + + + + True + Enter a new value for the variable. + + True + + + 2 + 1 + + + + + 0 + + + + + True + True + + + + False + 1 + + + + + + + + + + label_item + + + + + 1 + + + + + True + spread + + + gtk-save + 1 + True + True + True + True + + + False + False + 0 + + + + + gtk-cancel + True + True + True + True + + + False + False + 1 + + + + + False + end + 0 + + + + + + + 5 + True + center-always + normal + NUT-Monitor + 1.3 + Copyright (c) 2010 David Goncalves + GUI to manage devices connected a NUT server. + +For more information about NUT (Network UPS Tools) +please visit the author's website. + +http://www.networkupstools.org + + http://www.lestat.st/informatique/projets/nut-monitor-en + http://www.lestat.st + Copyright (C) 2010 David Goncalves <david@lestat.st> + +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 <http://www.gnu.org/licenses/>. + David Goncalves <david@lestat.st> + David Goncalves <david@lestat.st> - Français + + + True + 2 + + + + + + True + spread + + + False + end + 0 + + + + + + diff --git a/scripts/python/app/gui.glade b/scripts/python/app/gui.glade deleted file mode 100644 index 8916d95..0000000 --- a/scripts/python/app/gui.glade +++ /dev/null @@ -1,658 +0,0 @@ - - - - - - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - _File - True - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-about - True - True - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-quit - True - True - - - - - - - - - - False - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0.5 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 2 - 2 - 2 - 2 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 2 - 3 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - Host / Port : - - - GTK_FILL - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - UPS : - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 3493 0 65535 1 10 10 - True - - - 2 - 3 - GTK_FILL - GTK_FILL - - - - - True - False - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Get list of UPSs from server - gtk-refresh - True - 0 - - - - 2 - 3 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - - 1 - 2 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <None> - - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - False - - - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Use authentication - 0 - True - - - - False - 1 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - Login / Password : - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - - False - 1 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - - False - 2 - - - - - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - False - 4 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - False - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Connect to the selected UPS - gtk-connect - True - 0 - - - - False - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-disconnect - True - 0 - - - - False - 1 - - - - - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - Delay between refresh : - - - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Delay in seconds between refreshs - 0.5 0.5 10 0.10000000000000001 10 10 - 1 - - - False - 3 - - - - - False - 4 - - - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - NUT Server - True - - - label_item - - - - - False - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0.5 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 2 - 2 - 2 - 2 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - 2 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <None> - - - - - - True - False - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-apply - True - 0 - - - - False - 1 - - - - - 1 - 2 - 4 - 5 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - UPS Commands : - - - 4 - 5 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - 0 - GTK_SHADOW_IN - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 4 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - True - GTK_JUSTIFY_RIGHT - - - False - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - True - - - 1 - - - - - - - - label_item - - - - - 1 - 2 - 2 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - UPS informations : - - - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - 0 % - - - 1 - 2 - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - Battery charge : - - - 1 - 2 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - UPS Load : - - - 2 - 3 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - 0 % - - - 1 - 2 - 2 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - 0 - GTK_SHADOW_IN - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0:00 - True - GTK_JUSTIFY_CENTER - - - - - - label_item - - - - - 1 - 2 - 3 - 4 - 2 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - Time remaining : - - - 3 - 4 - GTK_FILL - - - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - UPS Status - True - - - label_item - - - - - 1 - - - - - False - 2 - 1 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 2 - - - False - GTK_PACK_END - 2 - - - - - - - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - About UPS Monitor - False - True - GTK_WIN_POS_CENTER_ON_PARENT - GDK_WINDOW_TYPE_HINT_DIALOG - False - NUT Monitor - 0.1beta - Copyright (c) David Goncalves - GUI to manage UPS trough a NUT server - http://www.lestat.st - www.lestat.st - Copyright (C) 2008 David Goncalves <david@lestat.st> - -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 <http://www.gnu.org/licenses/>. - David Goncalves - <david@lestat.st> - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 2 - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_BUTTONBOX_SPREAD - - - False - GTK_PACK_END - - - - - - diff --git a/scripts/python/app/locale/fr/LC_MESSAGES/NUT-Monitor.mo b/scripts/python/app/locale/fr/LC_MESSAGES/NUT-Monitor.mo new file mode 100644 index 0000000..ede50eb Binary files /dev/null and b/scripts/python/app/locale/fr/LC_MESSAGES/NUT-Monitor.mo differ diff --git a/scripts/python/app/pixmaps/on_battery.png b/scripts/python/app/pixmaps/on_battery.png new file mode 100644 index 0000000..ea000eb Binary files /dev/null and b/scripts/python/app/pixmaps/on_battery.png differ diff --git a/scripts/python/app/pixmaps/on_line.png b/scripts/python/app/pixmaps/on_line.png new file mode 100644 index 0000000..fdc3a9c Binary files /dev/null and b/scripts/python/app/pixmaps/on_line.png differ diff --git a/scripts/python/app/pixmaps/var-ro.png b/scripts/python/app/pixmaps/var-ro.png new file mode 100644 index 0000000..8e24c20 Binary files /dev/null and b/scripts/python/app/pixmaps/var-ro.png differ diff --git a/scripts/python/app/pixmaps/var-rw.png b/scripts/python/app/pixmaps/var-rw.png new file mode 100644 index 0000000..77c07b4 Binary files /dev/null and b/scripts/python/app/pixmaps/var-rw.png differ diff --git a/scripts/python/app/pixmaps/warning.png b/scripts/python/app/pixmaps/warning.png new file mode 100644 index 0000000..5262ee4 Binary files /dev/null and b/scripts/python/app/pixmaps/warning.png differ diff --git a/scripts/python/module/PyNUT.py b/scripts/python/module/PyNUT.py index 595714d..af09fac 100644 --- a/scripts/python/module/PyNUT.py +++ b/scripts/python/module/PyNUT.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2008 David Goncalves @@ -21,6 +21,13 @@ # # 2008-06-09 David Goncalves # Added 'GetRWVars' and 'SetRWVar' commands. +# +# 2009-02-19 David Goncalves +# Changed class PyNUT to PyNUTClient +# +# 2010-07-23 David Goncalves - Version 1.2 +# Changed GetRWVars function that fails is the UPS is not +# providing such vars. import telnetlib @@ -35,8 +42,8 @@ class PyNUTClient : __timeout = None __srv_handler = None - __version = "1.0" - __release = "2008-06-09" + __version = "1.2" + __release = "2010-07-23" def __init__( self, host="127.0.0.1", port=3493, login=None, password=None, debug=False, timeout=5 ) : @@ -98,7 +105,7 @@ if something goes wrong. def GetUPSList( self ) : """ Returns the list of available UPS from the NUT server -The result is a dictionnary containing 'key->val' pairs of 'UPSName' and 'UPS Description' +The result is a dictionary containing 'key->val' pairs of 'UPSName' and 'UPS Description' """ if self.__debug : print( "[DEBUG] GetUPSList from server" ) @@ -121,7 +128,7 @@ The result is a dictionnary containing 'key->val' pairs of 'UPSName' and 'UPS De def GetUPSVars( self, ups="" ) : """ Get all available vars from the specified UPS -The result is a dictionnary containing 'key->val' pairs of all +The result is a dictionary containing 'key->val' pairs of all available vars. """ if self.__debug : @@ -185,7 +192,7 @@ of the command as value def GetRWVars( self, ups="" ) : """ Get a list of all writable vars from the selected UPS -The result is presented as a dictionnary containing 'key->val' pairs +The result is presented as a dictionary containing 'key->val' pairs """ if self.__debug : print( "[DEBUG] GetUPSVars from '%s'..." % ups ) @@ -200,10 +207,14 @@ The result is presented as a dictionnary containing 'key->val' pairs end_offset = 0 - ( len( "END LIST RW %s\n" % ups ) + 1 ) rw_vars = {} - for current in result[:end_offset].split( "\n" ) : - var = current[ offset: ].split( '"' )[0].replace( " ", "" ) - data = current[ offset: ].split( '"' )[1] - rw_vars[ var ] = data + try : + for current in result[:end_offset].split( "\n" ) : + var = current[ offset: ].split( '"' )[0].replace( " ", "" ) + data = current[ offset: ].split( '"' )[1] + rw_vars[ var ] = data + + except : + pass return( rw_vars ) diff --git a/scripts/python/module/test_nutclient.py b/scripts/python/module/test_nutclient.py index 0e5db89..39993e0 100755 --- a/scripts/python/module/test_nutclient.py +++ b/scripts/python/module/test_nutclient.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- # This source code is provided for testing/debuging purpose ;) diff --git a/scripts/subdriver/path-to-subdriver.sh b/scripts/subdriver/path-to-subdriver.sh index d5c61e5..7bdcf29 100755 --- a/scripts/subdriver/path-to-subdriver.sh +++ b/scripts/subdriver/path-to-subdriver.sh @@ -247,15 +247,15 @@ cat >> "$CFILE" <Product; } -static char *${LDRIVER}_format_mfr(HIDDevice_t *hd) { +static const char *${LDRIVER}_format_mfr(HIDDevice_t *hd) { return hd->Vendor ? hd->Vendor : "${DRIVER}"; } -static char *${LDRIVER}_format_serial(HIDDevice_t *hd) { +static const char *${LDRIVER}_format_serial(HIDDevice_t *hd) { return hd->Serial; } diff --git a/scripts/udev/Makefile.in b/scripts/udev/Makefile.in index 9064a05..9594e8d 100644 --- a/scripts/udev/Makefile.in +++ b/scripts/udev/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -39,12 +39,13 @@ subdir = scripts/udev DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/nut-usbups.rules.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -54,6 +55,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -89,9 +91,11 @@ am__base_list = \ am__installdirs = "$(DESTDIR)$(udevrulesdir)" DATA = $(udevrules_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -104,8 +108,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -122,7 +128,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -133,22 +138,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ diff --git a/scripts/udev/nut-usbups.rules.in b/scripts/udev/nut-usbups.rules.in index 2f03744..2be5a41 100644 --- a/scripts/udev/nut-usbups.rules.in +++ b/scripts/udev/nut-usbups.rules.in @@ -1,9 +1,9 @@ # This file is generated and installed by the Network UPS Tools package. -ACTION!="add", 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" -BUS!="usb", GOTO="nut-usbups_rules_end" +SUBSYSTEM!="usb", GOTO="nut-usbups_rules_end" LABEL="nut-usbups_rules_real" # Krauler UP-M500VA - blazer_usb @@ -16,8 +16,16 @@ ATTR{idVendor}=="03f0", ATTR{idProduct}=="1f01", MODE="664", GROUP="@RUN_AS_GROU ATTR{idVendor}=="03f0", ATTR{idProduct}=="1f02", MODE="664", GROUP="@RUN_AS_GROUP@" # HP T750 INTL - usbhid-ups ATTR{idVendor}=="03f0", ATTR{idProduct}=="1f06", MODE="664", GROUP="@RUN_AS_GROUP@" +# HP T1000 INTL - usbhid-ups +ATTR{idVendor}=="03f0", ATTR{idProduct}=="1f08", MODE="664", GROUP="@RUN_AS_GROUP@" +# HP T1500 INTL - usbhid-ups +ATTR{idVendor}=="03f0", ATTR{idProduct}=="1f09", MODE="664", GROUP="@RUN_AS_GROUP@" # HP R/T 2200 INTL (like SMART2200RMXL2U) - usbhid-ups ATTR{idVendor}=="03f0", ATTR{idProduct}=="1f0a", MODE="664", GROUP="@RUN_AS_GROUP@" +# HP R1500 G2 INTL - usbhid-ups +ATTR{idVendor}=="03f0", ATTR{idProduct}=="1fe0", MODE="664", GROUP="@RUN_AS_GROUP@" +# HP T750 G2 - usbhid-ups +ATTR{idVendor}=="03f0", ATTR{idProduct}=="1fe1", MODE="664", GROUP="@RUN_AS_GROUP@" # Eaton # various models - usbhid-ups @@ -52,6 +60,8 @@ ATTR{idVendor}=="050d", ATTR{idProduct}=="1100", MODE="664", GROUP="@RUN_AS_GROU # APC # various models - usbhid-ups ATTR{idVendor}=="051d", ATTR{idProduct}=="0002", MODE="664", GROUP="@RUN_AS_GROUP@" +# various 5G models - usbhid-ups +ATTR{idVendor}=="051d", ATTR{idProduct}=="0003", MODE="664", GROUP="@RUN_AS_GROUP@" # Powerware # various models - bcmxcp_usb @@ -69,6 +79,10 @@ ATTR{idVendor}=="06da", ATTR{idProduct}=="0003", MODE="664", GROUP="@RUN_AS_GROU # various models - usbhid-ups ATTR{idVendor}=="06da", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROUP@" +# iDowell +# iDowell - usbhid-ups +ATTR{idVendor}=="075d", ATTR{idProduct}=="0300", MODE="664", GROUP="@RUN_AS_GROUP@" + # Cyber Power Systems # 900AVR/BC900D, CP1200AVR/BC1200D - usbhid-ups ATTR{idVendor}=="0764", ATTR{idProduct}=="0005", MODE="664", GROUP="@RUN_AS_GROUP@" @@ -88,20 +102,60 @@ ATTR{idVendor}=="09ae", ATTR{idProduct}=="1003", MODE="664", GROUP="@RUN_AS_GROU ATTR{idVendor}=="09ae", ATTR{idProduct}=="1007", MODE="664", GROUP="@RUN_AS_GROUP@" # e.g. TrippLite ECO550UPS - usbhid-ups ATTR{idVendor}=="09ae", ATTR{idProduct}=="1008", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. TrippLite ECO550UPS - usbhid-ups +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 OMNI1000LCD - usbhid-ups ATTR{idVendor}=="09ae", ATTR{idProduct}=="2005", MODE="664", GROUP="@RUN_AS_GROUP@" # e.g. TrippLite OMNI900LCD - usbhid-ups ATTR{idVendor}=="09ae", ATTR{idProduct}=="2007", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="2008", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. TrippLite Smart1000LCD - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="2009", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="2010", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="2011", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="2012", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="2013", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="2014", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="3008", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="3009", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="3010", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="3011", MODE="664", GROUP="@RUN_AS_GROUP@" # e.g. TrippLite smart2200RMXL2U - usbhid-ups ATTR{idVendor}=="09ae", ATTR{idProduct}=="3012", MODE="664", GROUP="@RUN_AS_GROUP@" # e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="3013", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups ATTR{idVendor}=="09ae", ATTR{idProduct}=="3014", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="3015", 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 ATTR{idVendor}=="09ae", ATTR{idProduct}=="4002", MODE="664", GROUP="@RUN_AS_GROUP@" # e.g. TrippLite SmartOnline SU1500RTXL2ua - usbhid-ups ATTR{idVendor}=="09ae", ATTR{idProduct}=="4003", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. TrippLite SmartOnline SU1000XLA - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="4004", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="4005", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="4006", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="4007", MODE="664", GROUP="@RUN_AS_GROUP@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="09ae", ATTR{idProduct}=="4008", MODE="664", GROUP="@RUN_AS_GROUP@" # PowerCOM # PowerCOM IMP - IMPERIAL Series - usbhid-ups diff --git a/scripts/upower/95-upower-hid.rules b/scripts/upower/95-upower-hid.rules new file mode 100644 index 0000000..ac1138c --- /dev/null +++ b/scripts/upower/95-upower-hid.rules @@ -0,0 +1,110 @@ +############################################################################################################## +# 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}=="050d", ENV{UPOWER_VENDOR}="Belkin" +ATTRS{idVendor}=="051d", ENV{UPOWER_VENDOR}="APC" +ATTRS{idVendor}=="06da", ENV{UPOWER_VENDOR}="Liebert" +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}=="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" + +# 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" + +# 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" + +# Liebert +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}=="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}=="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/server/Makefile.am b/server/Makefile.am index dc41626..1c9c789 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -10,12 +10,12 @@ endif if WITH_SSL AM_CFLAGS += $(LIBSSL_CFLAGS) endif -LDADD = ../common/libcommon.a ../common/libparseconf.la $(NETLIBS) +LDADD = ../common/libcommon.la ../common/libparseconf.la $(NETLIBS) if WITH_WRAP - LDADD += $(LIBWRAP_LDFLAGS) + LDADD += $(LIBWRAP_LIBS) endif if WITH_SSL - LDADD += $(LIBSSL_LDFLAGS) + LDADD += $(LIBSSL_LIBS) endif sbin_PROGRAMS = upsd diff --git a/server/Makefile.in b/server/Makefile.in index 561a63e..ed50361 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -39,19 +39,20 @@ host_triplet = @host@ target_triplet = @target@ @WITH_WRAP_TRUE@am__append_1 = $(LIBWRAP_CFLAGS) @WITH_SSL_TRUE@am__append_2 = $(LIBSSL_CFLAGS) -@WITH_WRAP_TRUE@am__append_3 = $(LIBWRAP_LDFLAGS) -@WITH_SSL_TRUE@am__append_4 = $(LIBSSL_LDFLAGS) +@WITH_WRAP_TRUE@am__append_3 = $(LIBWRAP_LIBS) +@WITH_SSL_TRUE@am__append_4 = $(LIBSSL_LIBS) 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_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -61,6 +62,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -78,7 +80,7 @@ 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 = ../common/libcommon.a \ +sockdebug_DEPENDENCIES = ../common/libcommon.la \ ../common/libparseconf.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) am_upsd_OBJECTS = upsd.$(OBJEXT) user.$(OBJEXT) conf.$(OBJEXT) \ @@ -87,7 +89,7 @@ am_upsd_OBJECTS = upsd.$(OBJEXT) user.$(OBJEXT) conf.$(OBJEXT) \ netset.$(OBJEXT) netinstcmd.$(OBJEXT) upsd_OBJECTS = $(am_upsd_OBJECTS) upsd_LDADD = $(LDADD) -upsd_DEPENDENCIES = ../common/libcommon.a ../common/libparseconf.la \ +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 @@ -108,9 +110,11 @@ DIST_SOURCES = $(sockdebug_SOURCES) $(upsd_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -123,8 +127,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -141,7 +147,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -152,22 +157,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ @@ -268,7 +273,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 = ../common/libcommon.a ../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 ssl.c sstate.c desc.c \ netget.c netmisc.c netlist.c netuser.c netset.c netinstcmd.c \ diff --git a/server/conf.c b/server/conf.c index f2046e5..3e348e2 100644 --- a/server/conf.c +++ b/server/conf.c @@ -30,59 +30,33 @@ /* add another UPS for monitoring from ups.conf */ static void ups_create(const char *fn, const char *name, const char *desc) { - upstype_t *temp, *last; - - temp = last = firstups; - - /* find end of linked list */ - while (temp != NULL) { - last = temp; + upstype_t *temp; + for (temp = firstups; temp != NULL; temp = temp->next) { if (!strcasecmp(temp->name, name)) { - upslogx(LOG_ERR, "UPS name [%s] is already in use!", - name); + upslogx(LOG_ERR, "UPS name [%s] is already in use!", name); return; } - - temp = temp->next; } /* grab some memory and add the info */ - temp = xmalloc(sizeof(upstype_t)); - - temp->name = xstrdup(name); + temp = xcalloc(1, sizeof(*temp)); temp->fn = xstrdup(fn); + temp->name = xstrdup(name); - if (desc) + if (desc) { temp->desc = xstrdup(desc); - else - temp->desc = NULL; + } temp->stale = 1; - - temp->numlogins = 0; - temp->fsd = 0; temp->retain = 1; - temp->next = NULL; - - temp->dumpdone = 0; - temp->data_ok = 0; + temp->sock_fd = sstate_connect(temp); /* preload this to the current time to avoid false staleness */ time(&temp->last_heard); - temp->last_ping = 0; - temp->last_connfail = 0; - temp->inforoot = NULL; - temp->cmdlist = NULL; - - if (last == NULL) - firstups = temp; - else - last->next = temp; - - temp->sock_fd = sstate_connect(temp); - + temp->next = firstups; + firstups = temp; num_ups++; } @@ -272,48 +246,38 @@ void load_upsdconf(int reloading) /* callback during parsing of ups.conf */ void do_upsconf_args(char *upsname, char *var, char *val) { - ups_t *tmp, *last; + ups_t *temp; /* no "global" stuff for us */ - if (!upsname) + if (!upsname) { return; - - last = tmp = upstable; - - while (tmp) { - last = tmp; - - if (!strcmp(tmp->upsname, upsname)) { - if (!strcmp(var, "driver")) - tmp->driver = xstrdup(val); - if (!strcmp(var, "port")) - tmp->port = xstrdup(val); - if (!strcmp(var, "desc")) - tmp->desc = xstrdup(val); - return; - } - - tmp = tmp->next; } - tmp = xmalloc(sizeof(ups_t)); - tmp->upsname = xstrdup(upsname); - tmp->driver = NULL; - tmp->port = NULL; - tmp->desc = NULL; - tmp->next = NULL; + /* check if UPS is already listed */ + for (temp = upstable; temp != NULL; temp = temp->next) { + if (!strcmp(temp->upsname, upsname)) { + break; + } + } - if (!strcmp(var, "driver")) - tmp->driver = xstrdup(val); - if (!strcmp(var, "port")) - tmp->port = xstrdup(val); - if (!strcmp(var, "desc")) - tmp->desc = xstrdup(val); + /* if not listed, create a new entry and prepend it to the list */ + if (temp == NULL) { + temp = xcalloc(1, sizeof(*temp)); + temp->upsname = xstrdup(upsname); + temp->next = upstable; + upstable = temp; + } - if (last) - last->next = tmp; - else - upstable = tmp; + if (!strcmp(var, "driver")) { + free(temp->driver); + temp->driver = xstrdup(val); + } else if (!strcmp(var, "port")) { + free(temp->port); + temp->port = xstrdup(val); + } else if (!strcmp(var, "desc")) { + free(temp->desc); + temp->desc = xstrdup(val); + } } /* add valid UPSes from ups.conf to the internal structures */ diff --git a/server/desc.c b/server/desc.c index c2a3db7..b74df72 100644 --- a/server/desc.c +++ b/server/desc.c @@ -26,17 +26,17 @@ extern const char *datapath; -struct dlist_t { +typedef struct dlist_s { char *name; char *desc; - struct dlist_t *next; -}; + struct dlist_s *next; +} dlist_t; - static struct dlist_t *cmd_list = NULL, *var_list = NULL; +static dlist_t *cmd_list = NULL, *var_list = NULL; -static void list_free(struct dlist_t *ptr) +static void list_free(dlist_t *ptr) { - struct dlist_t *next; + dlist_t *next; while (ptr) { next = ptr->next; @@ -49,51 +49,39 @@ static void list_free(struct dlist_t *ptr) } } -static const char *list_get(const struct dlist_t *list, const char *name) +static const char *list_get(const dlist_t *list, const char *name) { - const struct dlist_t *tmp; + const dlist_t *temp; - tmp = list; + for (temp = list; temp != NULL; temp = temp->next) { - while (tmp) { - if (!strcasecmp(tmp->name, name)) - return tmp->desc; - - tmp = tmp->next; + if (!strcasecmp(temp->name, name)) { + return temp->desc; + } } return NULL; } -static void desc_add(struct dlist_t **list, const char *name, const char *desc) +static void desc_add(dlist_t **list, const char *name, const char *desc) { - struct dlist_t *tmp, *last; + dlist_t *temp; - tmp = last = *list; - - while (tmp) { - last = tmp; - - /* replace duplicates */ - if (!strcasecmp(tmp->name, name)) { - free(tmp->desc); - tmp->desc = xstrdup(desc); - return; + for (temp = *list; temp != NULL; temp = temp->next) { + if (!strcasecmp(temp->name, name)) { + break; } - - tmp = tmp->next; } - tmp = xmalloc(sizeof(struct dlist_t)); + if (temp == NULL) { + temp = xcalloc(1, sizeof(*temp)); + temp->name = xstrdup(name); + temp->next = *list; + *list = temp; + } - tmp->name = xstrdup(name); - tmp->desc = xstrdup(desc); - tmp->next = NULL; - - if (last) - last->next = tmp; - else - *list = tmp; + free(temp->desc); + temp->desc = xstrdup(desc); } static void desc_file_err(const char *errmsg) @@ -121,14 +109,13 @@ void desc_load(void) while (pconf_file_next(&ctx)) { if (pconf_parse_error(&ctx)) { - upslogx(LOG_ERR, "Parse error: %s:%d: %s", - fn, ctx.linenum, ctx.errmsg); - + upslogx(LOG_ERR, "Parse error: %s:%d: %s", fn, ctx.linenum, ctx.errmsg); continue; } - - if (ctx.numargs < 3) + + if (ctx.numargs < 3) { continue; + } if (!strcmp(ctx.arglist[0], "CMDDESC")) { desc_add(&cmd_list, ctx.arglist[1], ctx.arglist[2]); diff --git a/server/netcmds.h b/server/netcmds.h index ee20d10..a001f70 100644 --- a/server/netcmds.h +++ b/server/netcmds.h @@ -29,14 +29,11 @@ #define FLAG_USER 0x0001 /* username and password must be set */ -struct netcmds_t { +struct { const char *name; void (*func)(ctype_t *client, int numargs, const char **arg); int flags; -}; - -struct netcmds_t netcmds[] = -{ +} netcmds[] = { { "VER", net_ver, 0 }, { "HELP", net_help, 0 }, { "STARTTLS", net_starttls, 0 }, diff --git a/server/netget.c b/server/netget.c index df16c6b..a10a011 100644 --- a/server/netget.c +++ b/server/netget.c @@ -120,7 +120,7 @@ static void get_type(ctype_t *client, const char *upsname, const char *var) { char buf[SMALLBUF]; const upstype_t *ups; - const struct st_tree_t *node; + const st_tree_t *node; ups = get_ups_ptr(upsname); diff --git a/server/netinstcmd.c b/server/netinstcmd.c index 2a3fcae..90275ca 100644 --- a/server/netinstcmd.c +++ b/server/netinstcmd.c @@ -33,7 +33,7 @@ static void send_instcmd(ctype_t *client, const char *upsname, { int found; upstype_t *ups; - const struct cmdlist_t *ctmp; + const cmdlist_t *ctmp; char sockcmd[SMALLBUF]; ups = get_ups_ptr(upsname); diff --git a/server/netlist.c b/server/netlist.c index a40ff45..39ff826 100644 --- a/server/netlist.c +++ b/server/netlist.c @@ -28,7 +28,7 @@ extern upstype_t *firstups; /* for list_ups */ -static int tree_dump(struct st_tree_t *node, ctype_t *client, const char *ups, +static int tree_dump(st_tree_t *node, ctype_t *client, const char *ups, int rw, int fsd) { int ret; @@ -127,7 +127,7 @@ static void list_var(ctype_t *client, const char *upsname) static void list_cmd(ctype_t *client, const char *upsname) { const upstype_t *ups; - struct cmdlist_t *ctmp; + cmdlist_t *ctmp; ups = get_ups_ptr(upsname); @@ -153,8 +153,8 @@ static void list_cmd(ctype_t *client, const char *upsname) static void list_enum(ctype_t *client, const char *upsname, const char *var) { const upstype_t *ups; - const struct st_tree_t *node; - const struct enum_t *etmp; + const st_tree_t *node; + const enum_t *etmp; ups = get_ups_ptr(upsname); diff --git a/server/netset.c b/server/netset.c index 3c0be1d..ae5a681 100644 --- a/server/netset.c +++ b/server/netset.c @@ -32,7 +32,7 @@ static void set_var(ctype_t *client, const char *upsname, const char *var, { upstype_t *ups; const char *val; - const struct enum_t *etmp; + const enum_t *etmp; char cmd[SMALLBUF], esc[SMALLBUF]; ups = get_ups_ptr(upsname); diff --git a/server/sockdebug.c b/server/sockdebug.c index 32b2e3c..7829292 100644 --- a/server/sockdebug.c +++ b/server/sockdebug.c @@ -118,10 +118,11 @@ static void read_sock(int fd) int main(int argc, char **argv) { + const char *prog = xbasename(argv[0]); int ret, sockfd; if (argc != 2) { - fprintf(stderr, "usage: %s \n", argv[0]); + fprintf(stderr, "usage: %s \n", prog); fprintf(stderr, " %s /var/state/ups/apcsmart-ttyS1.newsock\n", argv[0]); exit(EXIT_SUCCESS); diff --git a/server/ssl.c b/server/ssl.c index eabbf08..21614d9 100644 --- a/server/ssl.c +++ b/server/ssl.c @@ -115,42 +115,52 @@ void net_starttls(ctype_t *client, int numarg, const char **arg) void ssl_init(void) { +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + const SSL_METHOD *ssl_method; +#else + SSL_METHOD *ssl_method; +#endif if (!certfile) { return; } check_perms(certfile); - SSL_library_init(); SSL_load_error_strings(); - OpenSSL_add_ssl_algorithms(); + SSL_library_init(); - if ((ssl_ctx = SSL_CTX_new(TLSv1_server_method())) == NULL) { - fatal_with_errno(EXIT_FAILURE, "SSL_CTX_new"); + if ((ssl_method = TLSv1_server_method()) == NULL) { + ssl_debug(); + fatalx(EXIT_FAILURE, "TLSv1_server_method failed"); } - if (SSL_CTX_use_RSAPrivateKey_file(ssl_ctx, certfile, SSL_FILETYPE_PEM) != 1) { + if ((ssl_ctx = SSL_CTX_new(ssl_method)) == NULL) { ssl_debug(); - upslogx(LOG_ERR, "SSL_CTX_use_RSAPrivateKey_file(%s) failed", certfile); - return; + fatalx(EXIT_FAILURE, "SSL_CTX_new failed"); } if (SSL_CTX_use_certificate_chain_file(ssl_ctx, certfile) != 1) { - upslogx(LOG_ERR, "SSL_CTX_use_certificate_chain_file(%s) failed", certfile); - return; + ssl_debug(); + fatalx(EXIT_FAILURE, "SSL_CTX_use_certificate_chain_file(%s) failed", certfile); + } + + if (SSL_CTX_use_PrivateKey_file(ssl_ctx, certfile, SSL_FILETYPE_PEM) != 1) { + ssl_debug(); + fatalx(EXIT_FAILURE, "SSL_CTX_use_PrivateKey_file(%s) failed", certfile); } if (SSL_CTX_check_private_key(ssl_ctx) != 1) { - upslogx(LOG_ERR, "SSL_CTX_check_private_key(%s) failed", certfile); - return; + ssl_debug(); + fatalx(EXIT_FAILURE, "SSL_CTX_check_private_key(%s) failed", certfile); + } + + if (SSL_CTX_set_cipher_list(ssl_ctx, "HIGH:@STRENGTH") != 1) { + ssl_debug(); + fatalx(EXIT_FAILURE, "SSL_CTX_set_cipher_list failed"); } SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_NONE, NULL); - if (SSL_CTX_set_cipher_list(ssl_ctx, "HIGH:@STRENGTH") != 1) { - fatalx(EXIT_FAILURE, "SSL_CTX_set_cipher_list"); - } - ssl_initialized = 1; } diff --git a/server/sstate.c b/server/sstate.c index 4aa13c6..dfbc2b6 100644 --- a/server/sstate.c +++ b/server/sstate.c @@ -19,6 +19,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "common.h" + +#include "timehead.h" + +#include "sstate.h" +#include "upstype.h" + #include #include #include @@ -27,14 +34,6 @@ #include #include -#include "common.h" - -#include "timehead.h" - -#include "upstype.h" -#include "sstate.h" -#include "state.h" - static int parse_args(upstype_t *ups, int numargs, char **arg) { if (numargs < 1) @@ -297,12 +296,12 @@ int sstate_getaux(const upstype_t *ups, const char *var) return state_getaux(ups->inforoot, var); } -const struct enum_t *sstate_getenumlist(const upstype_t *ups, const char *var) +const enum_t *sstate_getenumlist(const upstype_t *ups, const char *var) { return state_getenumlist(ups->inforoot, var); } -const struct cmdlist_t *sstate_getcmdlist(const upstype_t *ups) +const cmdlist_t *sstate_getcmdlist(const upstype_t *ups) { return ups->cmdlist; } @@ -376,7 +375,7 @@ int sstate_sendline(upstype_t *ups, const char *buf) return 0; /* failed */ } -const struct st_tree_t *sstate_getnode(const upstype_t *ups, const char *varname) +const st_tree_t *sstate_getnode(const upstype_t *ups, const char *varname) { return state_tree_find(ups->inforoot, varname); } diff --git a/server/sstate.h b/server/sstate.h index 0f82b1f..622b848 100644 --- a/server/sstate.h +++ b/server/sstate.h @@ -19,6 +19,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef SSTATE_H_SEEN +#define SSTATE_H_SEEN + +#include "state.h" #include "upstype.h" #define SS_CONNFAIL_INT 300 /* complain about a dead driver every 5 mins */ @@ -30,8 +34,8 @@ 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); int sstate_getaux(const upstype_t *ups, const char *var); -const struct enum_t *sstate_getenumlist(const upstype_t *ups, const char *var); -const struct cmdlist_t *sstate_getcmdlist(const upstype_t *ups); +const enum_t *sstate_getenumlist(const upstype_t *ups, const char *var); +const cmdlist_t *sstate_getcmdlist(const upstype_t *ups); void sstate_makeinfolist(const upstype_t *ups, char *buf, size_t bufsize); void sstate_makerwlist(const upstype_t *ups, char *buf, size_t bufsize); void sstate_makeinstcmdlist_t(const upstype_t *ups, char *buf, size_t bufsize); @@ -39,5 +43,6 @@ int sstate_dead(upstype_t *ups, int maxage); void sstate_infofree(upstype_t *ups); void sstate_cmdfree(upstype_t *ups); int sstate_sendline(upstype_t *ups, const char *buf); -const struct st_tree_t *sstate_getnode(const upstype_t *ups, const char *varname); +const st_tree_t *sstate_getnode(const upstype_t *ups, const char *varname); +#endif /* SSTATE_H_SEEN */ diff --git a/server/upsd.c b/server/upsd.c index c9e0b02..a5a0c42 100644 --- a/server/upsd.c +++ b/server/upsd.c @@ -70,9 +70,7 @@ static ctype_t *firstclient = NULL; /* default is to listen on all local interfaces */ static stype_t *firstaddr = NULL; -#ifdef HAVE_IPV6 static int opt_af = AF_UNSPEC; -#endif typedef enum { DRIVER = 1, @@ -95,7 +93,6 @@ static char pidfn[SMALLBUF]; /* set by signal handlers */ static int reload_flag = 0, exit_flag = 0; -#ifdef HAVE_IPV6 static const char *inet_ntopW (struct sockaddr_storage *s) { static char str[40]; @@ -111,7 +108,6 @@ static const char *inet_ntopW (struct sockaddr_storage *s) return NULL; } } -#endif /* return a pointer to the named ups if possible */ upstype_t *get_ups_ptr(const char *name) @@ -181,59 +177,6 @@ void listen_add(const char *addr, const char *port) /* create a listening socket for tcp connections */ static void setuptcp(stype_t *server) { -#ifndef HAVE_IPV6 - struct hostent *host; - struct sockaddr_in sockin; - int res, one = 1; - - host = gethostbyname(server->addr); - - if (!host) { - struct in_addr listenaddr; - - if (!inet_aton(server->addr, &listenaddr)) { - fatal_with_errno(EXIT_FAILURE, "inet_aton"); - } - - host = gethostbyaddr(&listenaddr, sizeof(listenaddr), AF_INET); - - if (!host) { - fatal_with_errno(EXIT_FAILURE, "gethostbyaddr"); - } - } - - if ((server->sock_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - fatal_with_errno(EXIT_FAILURE, "socket"); - } - - res = setsockopt(server->sock_fd, SOL_SOCKET, SO_REUSEADDR, (void *) &one, sizeof(one)); - - if (res != 0) { - fatal_with_errno(EXIT_FAILURE, "setsockopt(SO_REUSEADDR)"); - } - - memset(&sockin, '\0', sizeof(sockin)); - sockin.sin_family = AF_INET; - sockin.sin_port = htons(atoi(server->port)); - - memcpy(&sockin.sin_addr, host->h_addr, host->h_length); - - if (bind(server->sock_fd, (struct sockaddr *) &sockin, sizeof(sockin)) == -1) { - fatal_with_errno(EXIT_FAILURE, "Can't bind TCP port %s", server->port); - } - - if ((res = fcntl(server->sock_fd, F_GETFL, 0)) == -1) { - fatal_with_errno(EXIT_FAILURE, "fcntl(get)"); - } - - if (fcntl(server->sock_fd, F_SETFL, res | O_NDELAY) == -1) { - fatal_with_errno(EXIT_FAILURE, "fcntl(set)"); - } - - if (listen(server->sock_fd, 16)) { - fatal_with_errno(EXIT_FAILURE, "listen"); - } -#else struct addrinfo hints, *res, *ai; int v = 0, one = 1; @@ -290,7 +233,6 @@ static void setuptcp(stype_t *server) } freeaddrinfo(res); -#endif /* don't fail silently */ if (server->sock_fd < 0) { @@ -468,7 +410,8 @@ static void check_command(int cmdnum, ctype_t *client, int numarg, } #ifdef HAVE_WRAP - request_init(&req, RQ_DAEMON, progname, RQ_CLIENT_ADDR, client->addr, RQ_USER, client->username, 0); + request_init(&req, RQ_DAEMON, progname, RQ_FILE, client->sock_fd, RQ_USER, client->username, 0); + fromhost(&req); if (!hosts_access(&req)) { /* tcp-wrappers says access should be denied */ @@ -508,11 +451,7 @@ static void parse_net(ctype_t *client) /* answer incoming tcp connections */ static void client_connect(stype_t *server) { -#ifndef HAVE_IPV6 - struct sockaddr_in csock; -#else struct sockaddr_storage csock; -#endif socklen_t clen; int fd; ctype_t *client; @@ -530,11 +469,7 @@ static void client_connect(stype_t *server) time(&client->last_heard); -#ifndef HAVE_IPV6 - client->addr = xstrdup(inet_ntoa(csock.sin_addr)); -#else client->addr = xstrdup(inet_ntopW(&csock)); -#endif pconf_init(&client->ctx, NULL); @@ -610,7 +545,6 @@ void server_load(void) /* default behaviour if no LISTEN addres has been specified */ if (!firstaddr) { -#ifdef HAVE_IPV6 if (opt_af != AF_INET) { listen_add("::1", string_const(PORT)); } @@ -618,9 +552,6 @@ void server_load(void) if (opt_af != AF_INET6) { listen_add("127.0.0.1", string_const(PORT)); } -#else - listen_add("127.0.0.1", string_const(PORT)); -#endif } for (server = firstaddr; server; server = server->next) { @@ -879,12 +810,11 @@ static void help(const char *progname) printf(" -D raise debugging level\n"); printf(" -h display this help\n"); printf(" -r chroots to \n"); + printf(" -q raise log level threshold\n"); printf(" -u switch to (if started as root)\n"); printf(" -V display the version of this software\n"); -#ifdef HAVE_IPV6 printf(" -4 IPv4 only\n"); printf(" -6 IPv6 only\n"); -#endif exit(EXIT_SUCCESS); } @@ -943,24 +873,21 @@ int main(int argc, char **argv) { int i, cmd = 0; char *chroot_path = NULL; - const char *user = NULL; + const char *user = RUN_AS_USER; struct passwd *new_uid = NULL; progname = xbasename(argv[0]); - /* pick up a default from configure --with-user */ - user = RUN_AS_USER; - /* yes, xstrdup - the conf handlers call free on this later */ statepath = xstrdup(dflt_statepath()); datapath = xstrdup(DATADIR); /* set up some things for later */ - snprintf(pidfn, sizeof(pidfn), "%s/upsd.pid", altpidpath()); + snprintf(pidfn, sizeof(pidfn), "%s/%s.pid", altpidpath(), progname); - printf("Network UPS Tools upsd %s\n", UPS_VERSION); + printf("Network UPS Tools %s %s\n", progname, UPS_VERSION); - while ((i = getopt(argc, argv, "+h46p:r:i:fu:Vc:D")) != -1) { + while ((i = getopt(argc, argv, "+h46p:qr:i:fu:Vc:D")) != -1) { switch (i) { case 'h': help(progname); @@ -970,6 +897,9 @@ int main(int argc, char **argv) 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."); + case 'q': + nut_log_level++; + break; case 'r': chroot_path = optarg; break; @@ -977,7 +907,6 @@ int main(int argc, char **argv) user = optarg; break; case 'V': - /* do nothing - we already printed the banner */ exit(EXIT_SUCCESS); @@ -996,15 +925,13 @@ int main(int argc, char **argv) nut_debug_level++; break; -#ifdef HAVE_IPV6 - case '4': + case '4': opt_af = AF_INET; break; - case '6': + case '6': opt_af = AF_INET6; break; -#endif default: help(progname); @@ -1028,7 +955,7 @@ int main(int argc, char **argv) setup_signals(); - open_syslog("upsd"); + open_syslog(progname); /* send logging to the syslog pre-background for later use */ syslogbit_set(); @@ -1049,6 +976,9 @@ int main(int argc, char **argv) /* 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)) { @@ -1067,8 +997,6 @@ int main(int argc, char **argv) fatalx(EXIT_FAILURE, "Fatal error: at least one UPS must be defined in ups.conf"); } - ssl_init(); - /* try to bring in the var/cmd descriptions */ desc_load(); @@ -1089,3 +1017,4 @@ int main(int argc, char **argv) upslogx(LOG_INFO, "Signal %d: exiting", exit_flag); return EXIT_SUCCESS; } + diff --git a/server/upstype.h b/server/upstype.h index f6a79e2..18c0c42 100644 --- a/server/upstype.h +++ b/server/upstype.h @@ -38,8 +38,8 @@ typedef struct upstype_s { time_t last_ping; time_t last_connfail; PCONF_CTX_t sock_ctx; - struct st_tree_t *inforoot; - struct cmdlist_t *cmdlist; + struct st_tree_s *inforoot; + struct cmdlist_s *cmdlist; int numlogins; int fsd; /* forced shutdown in effect? */ diff --git a/tools/Makefile.am b/tools/Makefile.am index 41c7caa..c46f27c 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,9 +1,20 @@ -EXTRA_DIST = nut-usbinfo.pl device-recorder.sh +EXTRA_DIST = nut-usbinfo.pl nut-hclinfo.py device-recorder.sh svn2cl.authors + +website: + @if python -c pass; then \ + echo "Regenerating the HTML and JSON formated HCL tables."; \ + ./nut-hclinfo.py; \ + else \ + echo "----------------------------------------------------------------------"; \ + echo "Warning: Python is not available."; \ + echo "Skipping the HTML and JSON formated HCL tables regeneration."; \ + echo "----------------------------------------------------------------------"; \ + fi # only call the USB info script upon "make dist", and if Perl is present dist-hook: - @if test -x /usr/bin/perl; then \ + @if perl -e 1; then \ echo "Regenerating the USB helper files."; \ $(distdir)/nut-usbinfo.pl; \ else \ diff --git a/tools/Makefile.in b/tools/Makefile.in index 09ac631..9eba5b4 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -37,12 +37,13 @@ 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_create_stdint_h.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.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_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_asciidoc.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ @@ -52,6 +53,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.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_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ $(top_srcdir)/configure.in @@ -64,9 +66,11 @@ CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ +ASCIIDOC = @ASCIIDOC@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -79,8 +83,10 @@ CONFPATH = @CONFPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ +DBLATEX = @DBLATEX@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DOC_BUILD_LIST = @DOC_BUILD_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -97,7 +103,6 @@ HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ HAL_FDI_PATH = @HAL_FDI_PATH@ HAL_USER = @HAL_USER@ -HAVE_GLIB_2_14 = @HAVE_GLIB_2_14@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -108,22 +113,22 @@ LDFLAGS = @LDFLAGS@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ LIBOBJS = @LIBOBJS@ LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LDFLAGS = @LIBPOWERMAN_LDFLAGS@ +LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LDFLAGS = @LIBWRAP_LDFLAGS@ +LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ @@ -219,7 +224,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -EXTRA_DIST = nut-usbinfo.pl device-recorder.sh +EXTRA_DIST = nut-usbinfo.pl nut-hclinfo.py device-recorder.sh svn2cl.authors all: all-am .SUFFIXES: @@ -409,9 +414,20 @@ uninstall-am: uninstall uninstall-am +website: + @if python -c pass; then \ + echo "Regenerating the HTML and JSON formated HCL tables."; \ + ./nut-hclinfo.py; \ + else \ + echo "----------------------------------------------------------------------"; \ + echo "Warning: Python is not available."; \ + echo "Skipping the HTML and JSON formated HCL tables regeneration."; \ + echo "----------------------------------------------------------------------"; \ + fi + # only call the USB info script upon "make dist", and if Perl is present dist-hook: - @if test -x /usr/bin/perl; then \ + @if perl -e 1; then \ echo "Regenerating the USB helper files."; \ $(distdir)/nut-usbinfo.pl; \ else \ diff --git a/tools/nut-hclinfo.py b/tools/nut-hclinfo.py new file mode 100755 index 0000000..925873f --- /dev/null +++ b/tools/nut-hclinfo.py @@ -0,0 +1,268 @@ +#!/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 + +# 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 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) + +deviceData = buildData(rawHCL) + +# Dump device data as JSON +jsonData = "var UPSData = %s" % json.dumps(deviceData, encoding="utf-8") +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-usbinfo.pl b/tools/nut-usbinfo.pl index 6d0f8ee..1bbf3aa 100755 --- a/tools/nut-usbinfo.pl +++ b/tools/nut-usbinfo.pl @@ -1,6 +1,6 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Current Version : 1.0 -# Copyright (C) 2008 +# Copyright (C) 2008 - 2010 # Arnaud Quette # dloic (loic.dardant AT gmail DOT com) # @@ -36,12 +36,12 @@ my $outputHotplug="../scripts/hotplug/libhid.usermap"; # udev output file my $outputUdev="../scripts/udev/nut-usbups.rules.in"; -# DeviceKit-power output file -my $outputDKp="../scripts/dkp/95-devkit-power-hid.rules"; -# tmp output, to allow generating the ENV{DKP_VENDOR} header list -my $tmpOutputDKp; +# UPower output file +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 $dkpMfrHeaderDone = 0; +my $upowerMfrHeaderDone = 0; # array of products indexed by vendorID my %vendor; @@ -79,20 +79,20 @@ 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!="add", 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 'BUS!="usb", 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"; - # DeviceKit-power file header - open my $outputDKp, ">$outputDKp" || die "error $outputDKp : $!"; - print $outputDKp '##############################################################################################################'."\n"; - print $outputDKp '# Uninterruptible Power Supplies with USB HID interfaces'."\n#\n"; - print $outputDKp '# to keep up to date, monitor: http://svn.debian.org/wsvn/nut/trunk/scripts/dkp/95-devkit-power-hid.rules'."\n\n"; - print $outputDKp '# only support USB, else ignore'."\n".'SUBSYSTEM!="usb", GOTO="dkp_hid_end"'."\n\n"; - print $outputDKp '# if usbraw device, ignore'."\n".'KERNEL!="hiddev*", GOTO="dkp_hid_end"'."\n\n"; - print $outputDKp '# if an interface, ignore'."\n".'ENV{DEVTYPE}=="usb_interface", GOTO="dkp_hid_end"'."\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 '# 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"; # generate the file in alphabetical order (first for VendorID, then for ProductID) foreach my $vendorId (sort { lc $a cmp lc $b } keys %vendorName) @@ -113,8 +113,8 @@ sub gen_usb_files print $outUdev "\n# ".$vendorName{$vendorId}."\n"; } - # DeviceKit-power vendor header flag - $dkpMfrHeaderDone = 0; + # UPower vendor header flag + $upowerMfrHeaderDone = 0; foreach my $productId (sort { lc $a cmp lc $b } keys %{$vendor{$vendorId}}) { @@ -138,21 +138,21 @@ sub gen_usb_files print $outUdev "\", ATTR{idProduct}==\"".removeHexPrefix($productId)."\","; print $outUdev ' MODE="664", GROUP="@RUN_AS_GROUP@"'."\n"; - # DeviceKit-power device entry (only for USB/HID devices!) + # UPower device entry (only for USB/HID devices!) if ($vendor{$vendorId}{$productId}{"driver"} eq "usbhid-ups") { - if ($dkpMfrHeaderDone == 0) + if ($upowerMfrHeaderDone == 0) { - # DeviceKit-power vendor header + # UPower vendor header if ($vendorName{$vendorId}) { - $tmpOutputDKp = $tmpOutputDKp."\n# ".$vendorName{$vendorId}."\n"; + $tmpOutputUPower = $tmpOutputUPower."\n# ".$vendorName{$vendorId}."\n"; } - print $outputDKp "ATTRS{idVendor}==\"".removeHexPrefix($vendorId)."\", ENV{DKP_VENDOR}=\"".$vendorName{$vendorId}."\"\n"; - $dkpMfrHeaderDone = 1; + print $outputUPower "ATTRS{idVendor}==\"".removeHexPrefix($vendorId)."\", ENV{UPOWER_VENDOR}=\"".$vendorName{$vendorId}."\"\n"; + $upowerMfrHeaderDone = 1; } - $tmpOutputDKp = $tmpOutputDKp."ATTRS{idVendor}==\"".removeHexPrefix($vendorId); - $tmpOutputDKp = $tmpOutputDKp."\", ATTRS{idProduct}==\"".removeHexPrefix($productId)."\","; - $tmpOutputDKp = $tmpOutputDKp.' ENV{DKP_BATTERY_TYPE}="ups"'."\n"; + $tmpOutputUPower = $tmpOutputUPower."ATTRS{idVendor}==\"".removeHexPrefix($vendorId); + $tmpOutputUPower = $tmpOutputUPower."\", ATTRS{idProduct}==\"".removeHexPrefix($productId)."\","; + $tmpOutputUPower = $tmpOutputUPower.' ENV{UPOWER_BATTERY_TYPE}="ups"'."\n"; } } # HAL vendor footer @@ -166,11 +166,11 @@ sub gen_usb_files # Udev footer print $outUdev "\n".'LABEL="nut-usbups_rules_end"'."\n"; - # DeviceKit-power... + # UPower... # ...flush device table - print $outputDKp $tmpOutputDKp; + print $outputUPower $tmpOutputUPower; # ...and print footer - print $outputDKp "\n".'LABEL="dkp_hid_end"'."\n"; + print $outputUPower "\n".'LABEL="up_hid_end"'."\n"; } sub find_usbdevs @@ -244,9 +244,6 @@ sub find_usbdevs elsif ($nameFile eq "tripplite_usb.c") { $driver="tripplite_usb"; } - elsif ($nameFile eq "megatec_usb.c") { - $driver="megatec_usb"; - } elsif ($nameFile eq "blazer_usb.c") { $driver="blazer_usb"; } diff --git a/tools/svn2cl.authors b/tools/svn2cl.authors new file mode 100644 index 0000000..bc5252f --- /dev/null +++ b/tools/svn2cl.authors @@ -0,0 +1,5 @@ +clepple-guest:Charles Lepple +adkorte-guest:Arjen de Korte +aquette:Arnaud Quette +lestat-guest:David Goncalves +chetanagarwal-guest: Chetan Agarwal