From fefe62b2bd5e37ccc38d0da8d0aeb545dc3d8094 Mon Sep 17 00:00:00 2001 From: Arnaud Quette Date: Fri, 1 Jun 2012 15:55:19 +0200 Subject: [PATCH] Imported Upstream version 2.6.4 --- ChangeLog | 1134 +++++++++++++++-- INSTALL | 2 +- Makefile.am | 2 +- Makefile.in | 13 +- NEWS | 119 ++ UPGRADING | 9 +- clients/Makefile.in | 3 + clients/upsc.c | 51 +- clients/upsmon.c | 36 +- clients/upsmon.h | 24 +- clients/upsrw.c | 60 + clients/upssched.c | 6 +- common/Makefile.am | 11 +- common/Makefile.in | 15 +- common/common.c | 25 +- common/parseconf.c | 22 + common/state.c | 114 ++ common/upsconf.c | 13 +- conf/Makefile.in | 3 + conf/nut.conf.sample | 6 +- configure | 53 +- configure.in | 25 +- data/Makefile.in | 3 + data/driver.list.in | 165 ++- data/html/Makefile.in | 3 + docs/Makefile.am | 2 +- docs/Makefile.in | 5 +- docs/cables/apc.txt | 30 +- docs/config-notes.txt | 34 +- docs/design.txt | 2 +- docs/developer-guide.txt | 4 +- docs/developers.txt | 13 +- docs/download.txt | 5 +- docs/man/Makefile.am | 6 +- docs/man/Makefile.in | 9 +- docs/man/apcsmart-old.8 | 4 +- docs/man/apcsmart.8 | 38 +- docs/man/apcsmart.txt | 41 +- docs/man/bcmxcp.8 | 4 +- docs/man/bcmxcp_usb.8 | 4 +- docs/man/belkin.8 | 4 +- docs/man/belkinunv.8 | 4 +- docs/man/bestfcom.8 | 4 +- docs/man/bestfortress.8 | 4 +- docs/man/bestuferrups.8 | 4 +- docs/man/bestups.8 | 4 +- docs/man/blazer.8 | 8 +- docs/man/blazer.txt | 9 +- docs/man/clone.8 | 4 +- docs/man/dummy-ups.8 | 4 +- docs/man/etapro.8 | 4 +- docs/man/everups.8 | 4 +- docs/man/gamatronic.8 | 4 +- docs/man/genericups.8 | 4 +- docs/man/hosts.conf.5 | 4 +- docs/man/isbmex.8 | 4 +- docs/man/ivtscd.8 | 4 +- docs/man/libupsclient-config.1 | 4 +- docs/man/liebert-esp2.8 | 4 +- docs/man/liebert.8 | 4 +- docs/man/masterguard.8 | 4 +- docs/man/metasys.8 | 4 +- docs/man/mge-shut.8 | 4 +- docs/man/mge-utalk.8 | 4 +- docs/man/microdowell.8 | 4 +- docs/man/netxml-ups.8 | 4 +- docs/man/nut-ipmipsu.8 | 4 +- docs/man/nut-recorder.8 | 103 ++ docs/man/nut-recorder.txt | 73 ++ docs/man/nut-scanner.8 | 7 +- docs/man/nut-scanner.txt | 10 +- docs/man/nut.conf.5 | 17 +- docs/man/nut.conf.txt | 16 +- docs/man/nutscan.3 | 4 +- docs/man/nutscan_add_device_to_device.3 | 4 +- docs/man/nutscan_add_option_to_device.3 | 4 +- docs/man/nutscan_cidr_to_ip.3 | 4 +- docs/man/nutscan_display_parsable.3 | 4 +- docs/man/nutscan_display_ups_conf.3 | 4 +- docs/man/nutscan_free_device.3 | 4 +- docs/man/nutscan_init.3 | 4 +- docs/man/nutscan_new_device.3 | 4 +- docs/man/nutscan_scan_avahi.3 | 4 +- docs/man/nutscan_scan_ipmi.3 | 4 +- docs/man/nutscan_scan_nut.3 | 4 +- docs/man/nutscan_scan_snmp.3 | 4 +- docs/man/nutscan_scan_usb.3 | 4 +- docs/man/nutscan_scan_xml_http.3 | 4 +- docs/man/nutupsdrv.8 | 4 +- docs/man/oneac.8 | 156 ++- docs/man/oneac.txt | 85 +- docs/man/optiups.8 | 4 +- docs/man/powercom.8 | 4 +- docs/man/powerman-pdu.8 | 4 +- docs/man/powerpanel.8 | 4 +- docs/man/rhino.8 | 4 +- docs/man/richcomm_usb.8 | 4 +- docs/man/safenet.8 | 4 +- docs/man/snmp-ups.8 | 6 +- docs/man/snmp-ups.txt | 2 +- docs/man/solis.8 | 4 +- docs/man/tripplite.8 | 4 +- docs/man/tripplite_usb.8 | 4 +- docs/man/tripplitesu.8 | 4 +- docs/man/ups.conf.5 | 4 +- docs/man/upsc.8 | 27 +- docs/man/upsc.txt | 15 + docs/man/upscli_connect.3 | 4 +- docs/man/upscli_disconnect.3 | 4 +- docs/man/upscli_fd.3 | 4 +- docs/man/upscli_get.3 | 4 +- docs/man/upscli_list_next.3 | 4 +- docs/man/upscli_list_start.3 | 15 +- docs/man/upscli_list_start.txt | 1 + docs/man/upscli_readline.3 | 4 +- docs/man/upscli_sendline.3 | 4 +- docs/man/upscli_splitaddr.3 | 4 +- docs/man/upscli_splitname.3 | 4 +- docs/man/upscli_ssl.3 | 4 +- docs/man/upscli_strerror.3 | 4 +- docs/man/upscli_upserror.3 | 4 +- docs/man/upsclient.3 | 4 +- docs/man/upscmd.8 | 4 +- docs/man/upscode2.8 | 4 +- docs/man/upsd.8 | 4 +- docs/man/upsd.conf.5 | 4 +- docs/man/upsd.users.5 | 17 +- docs/man/upsd.users.txt | 10 +- docs/man/upsdrvctl.8 | 4 +- docs/man/upsimage.cgi.8 | 4 +- docs/man/upslog.8 | 4 +- docs/man/upsmon.8 | 8 +- docs/man/upsmon.conf.5 | 4 +- docs/man/upsmon.txt | 4 +- docs/man/upsrw.8 | 6 +- docs/man/upsrw.txt | 4 +- docs/man/upssched.8 | 4 +- docs/man/upssched.conf.5 | 4 +- docs/man/upsset.cgi.8 | 4 +- docs/man/upsset.conf.5 | 4 +- docs/man/upsstats.cgi.8 | 4 +- docs/man/upsstats.html.5 | 4 +- docs/man/usbhid-ups.8 | 4 +- docs/man/victronups.8 | 4 +- docs/net-protocol.txt | 68 +- docs/new-drivers.txt | 25 +- docs/nut-names.txt | 95 +- docs/security.txt | 9 +- docs/sock-protocol.txt | 14 + docs/stable-hcl.txt | 29 +- docs/website/Makefile.in | 3 + docs/website/news.txt | 5 + docs/website/projects.txt | 6 + docs/website/ups-protocols.txt | 9 + drivers/Makefile.in | 3 + drivers/apc-mib.c | 7 + drivers/apcsmart.c | 172 ++- drivers/apcsmart.h | 18 +- drivers/bcmxcp.c | 132 +- drivers/bcmxcp.h | 35 +- drivers/bcmxcp_ser.c | 5 +- drivers/bcmxcp_usb.c | 10 +- drivers/belkin-hid.c | 152 ++- drivers/bestfortress.c | 24 +- drivers/bestups.c | 3 +- drivers/blazer.c | 43 +- drivers/blazer_ser.c | 8 +- drivers/blazer_usb.c | 10 +- drivers/compaq-mib.c | 207 ++- drivers/cps-hid.c | 2 +- drivers/dstate.c | 40 +- drivers/dstate.h | 6 +- drivers/dummy-ups.c | 2 +- drivers/dummy-ups.h | 68 +- drivers/ietf-mib.c | 10 +- drivers/libshut.c | 34 +- drivers/liebert-hid.c | 2 +- drivers/metasys.c | 41 +- drivers/mge-hid.c | 167 ++- drivers/mge-mib.c | 240 +++- drivers/mge-shut.c | 13 +- drivers/mge-utalk.c | 3 +- drivers/netvision-mib.c | 84 +- drivers/oneac.c | 1091 +++++++++++++--- drivers/oneac.h | 217 +++- drivers/rhino.c | 7 +- drivers/snmp-ups.c | 176 ++- drivers/snmp-ups.h | 13 +- drivers/solis.c | 14 +- drivers/tripplite-hid.c | 107 +- drivers/tripplite_usb.c | 20 +- drivers/upscode2.c | 12 +- drivers/upshandler.h | 4 +- drivers/usbhid-ups.c | 26 +- include/Makefile.am | 6 + include/Makefile.in | 18 +- include/common.h | 1 + include/config.h.in | 6 + include/extstate.h | 7 + include/nut_version.h | 3 - include/state.h | 8 +- lib/Makefile.in | 3 + scripts/Makefile.am | 2 + scripts/Makefile.in | 5 + scripts/augeas/Makefile.am | 2 +- scripts/augeas/Makefile.in | 5 +- scripts/augeas/nutupsconf.aug.in | 1 + scripts/hal/Makefile.in | 3 + scripts/hal/ups-nut-device.fdi.in | 80 +- scripts/hotplug/Makefile.in | 3 + scripts/hotplug/libhid.usermap | 28 +- scripts/java/Makefile.in | 3 + .../org/networkupstools/jnut/Variable.java | 2 +- scripts/logrotate/nutlogd | 24 + scripts/python/Makefile.in | 3 + scripts/python/module/PyNUT.py | 86 +- scripts/systemd/Makefile.am | 5 - scripts/systemd/Makefile.in | 25 +- scripts/systemd/nut-driver.service.in | 4 +- scripts/systemd/nut-monitor.service.in | 4 +- scripts/systemd/nut-server.service.in | 2 +- scripts/systemd/nutshutdown.in | 2 +- scripts/udev/Makefile.in | 3 + scripts/udev/nut-usbups.rules.in | 28 +- scripts/ufw/README | 30 + scripts/ufw/nut.ufw.profile.in | 4 + scripts/upower/95-upower-hid.rules | 11 +- server/Makefile.in | 3 + server/netcmds.h | 1 + server/netget.c | 8 +- server/netlist.c | 84 +- server/netmisc.c | 14 +- server/netmisc.h | 1 + server/netset.c | 24 + server/sstate.c | 21 +- server/sstate.h | 2 + server/upsd.c | 17 +- server/upsd.h | 1 + server/user.c | 6 + tools/Makefile.am | 22 +- tools/Makefile.in | 25 +- tools/{device-recorder.sh => nut-recorder.sh} | 16 +- tools/nut-scanner/Makefile.am | 2 +- tools/nut-scanner/Makefile.in | 11 +- tools/nut-scanner/nut-scanner.c | 3 + tools/nut-scanner/nutscan-init.c | 27 +- tools/nut-scanner/nutscan-init.h | 1 + tools/nut-scanner/nutscan-snmp.h | 2 +- tools/nut-scanner/nutscan-usb.h | 12 +- tools/nut-scanner/scan_avahi.c | 7 +- tools/nut-scanner/scan_ipmi.c | 6 +- tools/nut-scanner/scan_nut.c | 84 +- tools/nut-scanner/scan_snmp.c | 26 +- tools/nut-scanner/scan_usb.c | 6 +- tools/nut-scanner/scan_xml_http.c | 8 +- tools/nut-usbinfo.pl | 13 +- tools/svn2cl.authors | 8 + 257 files changed, 6020 insertions(+), 1394 deletions(-) create mode 100644 docs/man/nut-recorder.8 create mode 100644 docs/man/nut-recorder.txt delete mode 100644 include/nut_version.h create mode 100644 scripts/logrotate/nutlogd create mode 100644 scripts/ufw/README create mode 100644 scripts/ufw/nut.ufw.profile.in rename tools/{device-recorder.sh => nut-recorder.sh} (80%) diff --git a/ChangeLog b/ChangeLog index ceb1271..398ebcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,961 @@ +2012-05-31 Arnaud Quette + + * [r3643] NEWS, UPGRADING, configure.in, docs/website/news.txt: + Final update for 2.6.4 release + +2012-05-30 Arnaud Quette + + * [r3642] data/driver.list.in: Add support for Cyber Power Systems + CP1000PFCLCD + + Add CyberPower Systems CP1000PFCLCD (USB ID 0x0764:0x0501) to the + list of usbhid-ups supported models (reported by David Owen) + * [r3641] drivers/apc-mib.c: Track more APC SNMP sysOID values, as + comments + * [r3640] drivers/upshandler.h: Fix code spacing (no functional + change) + * [r3639] drivers/bcmxcp_ser.c, drivers/bcmxcp_usb.c: Add some + debug traces on incoming / outgoing data + * [r3638] INSTALL: Add missing reference to nut.conf manual page + * [r3637] drivers/bestfortress.c: Improve Best Fortress LI675VA + support + + Apply an old missed patch: all responses are preceded and + terminated by "CR LF". But bestfortress driver discards anything + after the first "CR LF". This patch trims everything up to the + first LF. (patch from Jørgen Thomsen) + * [r3636] drivers/metasys.c: Remove extraneous spaces (no + functional changes) + +2012-05-29 Arnaud Quette + + * [r3633] common/parseconf.c: Fix CVE-2012-2944: upsd can be + remotely crashed + + NUT server (upsd), from versions 2.4.0 to 2.6.3, are exposed to + crashes when receiving random data from the network. + + This issue is related to the way NUT parses characters, + especially from the network. Non printable characters were missed + from strings operation (such as strlen), but still copied to the + buffer, causing an overflow. + + Thus, fix NUT parser, to only allow the subset Ascii charset from + Space to ~ + + (Reported by Sebastian Pohle, Alioth bug #313636, CVE-2012-2944) + * [r3632] data/driver.list.in: Add support for Lexis X-power Tigra + 1kVA + + Add Lexis X-power Tigra 1kVA to the list of blazer_ser or bestups + supported models (reported by Tmima Pliroforikis Perifereiakis + Enotitas Pierias) + * [r3631] data/driver.list.in: Encourage the use of blazer_ser + instead of bestups + + Mention blazer_ser as prefered compared to bestups. Recent + changes to blazer_ser have made it possible to use it instead of + bestups. In the end, bestups will be replaced by blazer_ser, as + for other Megatec/Q1 drivers + * [r3629] drivers/blazer.c, drivers/blazer_ser.c: Improve Best UPS + support in blazer + + Best UPS units, which use a subset of the Megatec/Q1 protocol, + supported by the blazer drivers, can now work with blazer_ser. + This support is still limited, but already offers a decent set of + features + +2012-05-25 Arnaud Quette + + * [r3628] server/user.c: Add debug traces for instcmds and actions + + Whenever upsd adds an instant command or an action, from + upsd.users, display a debug trace + * [r3627] docs/man/upsd.users.txt: Clarify multiple actions + specification + + Add more details and an example, to illustrate multiple actions + specification (reported by Emilien Kia, from Eaton) + +2012-05-24 Arnaud Quette + + * [r3626] data/driver.list.in: Add support for Eaton Management + Card Contact + + Add Eaton Management Card Contact (ref 66104) to the list of + mge-shut or mge-utalk supported models + * [r3625] drivers/compaq-mib.c: HP SNMP completion + + Complete HP SNMP mapping table, with thresholds, nominal values + and more commands + +2012-05-23 Arnaud Quette + + * [r3623] clients/upsrw.c, common/state.c, + docs/man/upscli_list_start.txt, docs/man/upsrw.txt, + docs/net-protocol.txt, docs/new-drivers.txt, + docs/sock-protocol.txt, drivers/dstate.c, drivers/dstate.h, + include/extstate.h, include/state.h, + scripts/java/jNut/src/main/java/org/networkupstools/jnut/Variable.java, + server/netget.c, server/netlist.c, server/netset.c, + server/sstate.c, server/sstate.h: Support of ranges of values for + writable variables + + Merge branch that implement [RFC]: new dstate_addrange() and + "LIST RANGE" command: it is now possible to specify one or more + ranges of values for writable variables, using dstate_addrange() + in drivers. upsd also supports the new type 'RANGE' for 'GET + TYPE', along with the 'LIST RANGE' command. Finally, users can + interact through upsrw, which displays the supported ranges, and + enforces new value checking against the provided boundaries + * [r3622] docs/website/projects.txt: Reference Thecus NAS in + Related projects + + Add a reference in the Related projects, on Thecus NAS range, + which uses NUT for power protection + +2012-05-22 Arnaud Quette + + * [r3621] drivers/apcsmart.c, drivers/apcsmart.h: Complete r3620 + for HP-UX + + HP-UX does not support VREPRINT, so make it conditional + * [r3620] drivers/apcsmart.c, drivers/apcsmart.h: Fix commit r3603 + + Commit r3603 (fix tcsetattr() / tcgetattr() issue) has introduced + some incompatibility with older Unix systems, such as Solaris, + Aix and HP-UX. The present commit should address it + * [r3618] configure.in, docs/net-protocol.txt, server/netcmds.h, + server/netmisc.c, server/netmisc.h: Add versioning to the network + protocol + + Due to the number of recent evolutions to the network protocol, + along with other possible future changes, NUT network protocol is + now versioned. The chapter "Network protocol information", of the + developer guide, stores the revision history, while a new + "NETVER" command serves this information through the protocol + +2012-05-21 Arnaud Quette + + * [r3617] data/driver.list.in: Complete the supported PowerWalker + ranges + + Add PowerWalker Online VFI LCD, Line-Interactive VI LCD and + Line-Interactive VI models to the list of blazer_usb supported + models + * [r3616] data/driver.list.in: Add support for Microline C-Lion + Innova ranges + + Add Microline C-Lion Innova models to the list of blazer_usb + supported models + * [r3614] data/driver.list.in: Add support for KOLFF ranges + + Add KOLFF BLACK NOVA models to the list of blazer_usb supported + models + * [r3613] data/driver.list.in: Add support Ippon INNOVA RT range + + Add Ippon INNOVA RT models to the list of blazer_usb supported + models + * [r3612] data/driver.list.in: Add support for Gtec ranges + + Add Gtec models to the list of blazer_ser or blazer_usb supported + models + * [r3611] data/driver.list.in: Complete the supported EVER ranges + + Add EVER POWERLINE RT / 11 / 31 and DUO II Pro models to the list + of blazer_ser or blazer_usb supported models + * [r3610] data/driver.list.in: Add support for COVER ENERGY SA + ranges + + Add COVER ENERGY SA models to the list of blazer_usb supported + models + * [r3609] data/driver.list.in: Add support for Borri ranges + + Add Borri models to the list of blazer_usb supported models + * [r3608] data/driver.list.in: Add support for ARTronic ranges + + Add ARTronic models, both serial and USB, to the list of + blazer_ser and blazer_usb supported models + * [r3607] drivers/belkin-hid.c: Fix Liebert firmware (incorrect + exponents) + + There are at least two Liebert firmware types which both report a + VID:PID of 10af:0001. The newer ones tend not to have the Belkin + broken Usage Pages (and therefore use standard HID PDC paths) but + they have incorrect exponents for some fields. This patch fixes + the values for the latter implementation + + Author: Charles Lepple + * [r3606] data/driver.list.in, drivers/netvision-mib.c: Add + 3-phases support to Socomec Netvision MIB + + Improve Socomec Netvision MIB, by adding support for 3-phases UPS + (patch from Manuel Bouyer) + * [r3605] data/driver.list.in: Add support for PowerShield Defender + 1200VA + + Add PowerShield Defender 1200VA (USB ID 0665:5161) to the list of + blazer_usb supported models (reported by Tom Clarkson) + * [r3604] drivers/blazer.c, drivers/blazer_ser.c, + drivers/blazer_usb.c: beeper.status belongs to the "ups" data + collection + +2012-05-16 Arnaud Quette + + * [r3603] drivers/apcsmart.c, drivers/apcsmart.h: Final fix to the + tcsetattr() / tcgetattr() issue + + The most likely cause of all spurious differences between what + was set on the port with tcsetattr() and what tcgetattr() shows + are likely to do with the c_local PENDIN flag, which is a status + bit, not a control bit. It will change when there's unread + pending input, which can be quite often on an APC UPS. + + The right way to compare struct termios values is to clear the + status flags _after_ the tcsetattr() and of course after the + tcgetattr() call and then compare the result with what was set. + + Also set NOKERNINFO, if available, as we don't want the UPS or + noise on the line to accidentally trigger status output back to + the UPS, and finally make sure IEXTEN is also cleared along with + ISIG since it too can cause weird things to happen. + + This change also adds some debug code to show any differences in + the structures in a logical manner in debug output (and squashes + one tiny compiler warning) (patch from Greg A. Woods) + * [r3602] docs/config-notes.txt, docs/man/upsmon.txt: Whitespace + fixes + + Remove some extraneous spaces, suggested by "git diff --check", + and improve a bit formatting (patch #36 from Greg A. Woods) + +2012-05-15 Arnaud Quette + + * [r3601] drivers/snmp-ups.c, drivers/snmp-ups.h: Remove dead code + + Remove dead code, related to shutdown handling (no functional + changes) (based on patch #29 from Greg A. Woods) + * [r3599] docs/nut-names.txt: Fix formating issue + * [r3598] docs/nut-names.txt: Add missing battery.voltage data to + the namespace + + Add missing battery.voltage.{low,high} to the standard NUT + namespace + * [r3597] docs/nut-names.txt, drivers/upscode2.c: Rename + peakcurrent to current.peak (as per RFC) + + Rename peakcurrent to current.peak, since it is more coherent and + suitable + * [r3596] drivers/dummy-ups.c, drivers/dummy-ups.h: Update and + cleanup + + Convert flags defitions to bitwise left shift, convert some + comments about variables to actual values, and do a bit of + cleanup (patch #27 from Greg A. Woods) + * [r3594] drivers/blazer.c: Add comment on shutdown.return ondelay + value + + Add a comment reinforcing the need for ondelay=3 (partial patch + #26 from Greg A. Woods) + * [r3593] docs/man/snmp-ups.txt: Complete APC SNMP compatibility + information + + Mention more varieties of APC SNMP cards, and mention the + POWERNET MIB (patch #25 from Greg A. Woods) + * [r3590] drivers/netvision-mib.c: Fix status processing for "ECO + mode" + + When running in "ECO mode", the driver should report an + ups.status set to "OL", or it otherwise ends up with an empty + string that confuses upsmon (patch from Ivan Kuznetsov) + +2012-05-14 Arnaud Quette + + * [r3589] docs/man/blazer.txt: Mention General Electric in blazer + manual page + + Mention General Electric as a user of the Megatec/Q1 protocol + (patch #24 from Greg A. Woods) + * [r3588] clients/upsmon.h: Use bitwise left shift for flags + definitions + + Use (1 << N) to define a bit flag at bit N, which is more + coherent with other similar implementations in NUT (patch #23 + from Greg A. Woods) + * [r3587] clients/upsmon.c: Cosmetic changes + + Remove dead / redundant #defines, and enable interesting debug + traces that were commented out (based on patch #22 from Greg A. + Woods) + * [r3586] drivers/apcsmart.h: Use bitwise left shift for status + flags definitions + + Use (1 << N) to define a bit flag at bit N, which is more + coherent with other similar implementations in NUT (patch #21 + from Greg A. Woods) + * [r3585] drivers/apcsmart.c, drivers/apcsmart.h: Don't be too + strict about terminal settings + + Don't log an error when tcgetattr() reports different settings on + the port (patch #20 from Greg A. Woods) + * [r3584] tools/nut-usbinfo.pl: Better filtering on USB related + files + + The current USB information extraction script is not optimal at + filtering files that need to be inspected. While waiting for a + proper rewrite, improve a bit more filenames filtering (patch #18 + from Greg A. Woods) + * [r3583] drivers/blazer_ser.c: Quote the debug output for space + visibility + + Quote the debug output so one can see how many spaces there are + (patch #16 from Greg A. Woods) + * [r3582] docs/cables/apc.txt: Update APC cabling information + + Update information about APC cable model numbering and revisions + (patch #16 from Greg A. Woods) + * [r3581] data/driver.list.in: GE Digital Energy updates + + Rename "GE" to "GE Digital Energy", which is more appropriate in + this context. Also add GT Series 1000-3000 VA to the list of + blazer_ser supported models (patch #15 from Greg A. Woods) + * [r3580] docs/developers.txt: Complete notes on spaces for + alignements + + Add complementary note on the use of spaces for alignements + (patch #14 from Greg A. Woods) + * [r3577] docs/design.txt: Use more suitable examples + + Use an example driver name matching the unified NUT drivers + generic manual page name (patch #13 from Greg A. Woods) + * [r3576] drivers/mge-hid.c: Complete and update Eaton HID usages + table + +2012-05-11 Arnaud Quette + + * [r3574] tools/Makefile.am: Fix typo in comment + + Fix a typo error in comment (reported by Fred Bohé, from Eaton) + * [r3573] scripts/upower/95-upower-hid.rules: Update upower script + + Update upower script with recent changes and updates (redundant + with patch #6 from Greg A. Woods) + * [r3572] tools/Makefile.am: Explicit mention of Makefiles + brokenness + + Document that, at least, this Makefile.am is broken by design + (patch #5 from Greg A. Woods) + * [r3571] docs/man/apcsmart.txt: Fix documentation wording + + "there're" is not a valid contraction, especially not in a + technical document (patch #4 from Greg A. Woods) + * [r3570] docs/man/apcsmart.txt: Always use upper case for the + acronym "UPS" + + Be consistent in using all upper case for the acronym "UPS" (Ie + Uninterruptible Power Supply) (patch #3 from Greg A. Woods) + * [r3569] docs/man/apcsmart.txt: Fix SmartUPS cabling nomenclature + + Correct the nomenclature of the SmartUPS cabling part numbers + (patch #2 from Greg A. Woods) + * [r3568] configure.in: Fix a configure error message + + Asciidoc might actually be installed but documentation might + still not be build-able (earlier messages should hint at exactly + what was missing) (patch #1 from Greg A. Woods) + * [r3567] data/driver.list.in: Add support for ATEK Defensor range + + Add ATEK Defensor range (Innova series) to the list of blazer_usb + supported models + * [r3566] data/driver.list.in: Fix EVER brand name + + The correct name is "EVER", not "EVER UPS", as per a request from + the manufacturer + +2012-05-10 Arnaud Quette + + * [r3565] docs/website/news.txt: Update for WMNut 0.63 publication + * [r3564] docs/website/ups-protocols.txt: Official Riello protocols + publication + +2012-05-03 Arnaud Quette + + * [r3558] drivers/libshut.c, drivers/mge-shut.c: Forgotten driver + version bump + * [r3557] clients/upsmon.c: Coverity fix on upsmon + + Remove an unneeded null check, that cause a Coverity error + (reported by Michal Hlavinka from RedHat) + * [r3556] drivers/libshut.c, drivers/mge-shut.c: Coverity fix on + Eaton SHUT + + Fix some tests that are always false, regardless of the values of + operands (reported by Michal Hlavinka from RedHat) + * [r3555] clients/upssched.c, drivers/bcmxcp.c, + drivers/bcmxcp_usb.c, drivers/dstate.c, drivers/mge-utalk.c, + drivers/rhino.c, drivers/solis.c, drivers/tripplite_usb.c, + tools/nut-scanner/scan_nut.c, tools/nut-scanner/scan_xml_http.c: + Merge Coverity branch + + Merge all work done part of the Coverity static analysis scan, + done by Michal Hlavinka from RedHat + +2012-05-02 Arnaud Quette + + * [r3553] docs/download.txt, docs/website/news.txt: Update Windows + package publications + * [r3552] common/Makefile.am, include/Makefile.am: Better handling + of nut_version.h + + nut_version.h should not be distributed, since it is + automatically built. Moreover, hard dependency in common/ is not + needed since BUILT_SOURCES reference ensure generation before any + other target: + http://www.gnu.org/software/automake/manual/automake.html#Sources + (Reported by Regid Ichira, Debian bug #613643) + +2012-04-27 Arnaud Quette + + * [r3547] data/driver.list.in, drivers/cps-hid.c: Add support for + CyberPower Systems PR6000LCDRTXL5U + + Add CyberPower Systems PR6000LCDRTXL5U (USB ID 0x0764:0x0601) to + the list of usbhid-ups supported models (reported by Dax Kelson) + * [r3546] data/driver.list.in: Complete HP supported devices list + + Add HP UPS Management Module to the list of snmp-ups supported + models. Also complete serial compatibility for some models, using + mge-shut + +2012-04-25 Arnaud Quette + + * [r3542] docs/man/nut-scanner.txt: Clarify nut-scanner compilation + and distribution + + Document explicitely how nut-scanner is compiled, and how its + features are made available, according to its dependencies (both + compile time and runtime) + +2012-04-24 Frederic Bohe + + * [r3539] tools/nut-scanner/nut-scanner.c, + tools/nut-scanner/nutscan-init.c, + tools/nut-scanner/nutscan-init.h, tools/nut-scanner/scan_avahi.c, + tools/nut-scanner/scan_ipmi.c, tools/nut-scanner/scan_nut.c, + tools/nut-scanner/scan_snmp.c, tools/nut-scanner/scan_usb.c, + tools/nut-scanner/scan_xml_http.c: Cleaner exit for nut-scanner + +2012-04-23 Frederic Bohe + + * [r3538] tools/nut-scanner/scan_avahi.c, + tools/nut-scanner/scan_ipmi.c, tools/nut-scanner/scan_nut.c, + tools/nut-scanner/scan_snmp.c, tools/nut-scanner/scan_usb.c, + tools/nut-scanner/scan_xml_http.c: Be more verbose when failing + to dynamically load a library + +2012-04-14 Arnaud Quette + + * [r3534] docs/man, docs/man/Makefile.am, docs/man/index.txt, + docs/man/nut-recorder.txt, tools/nut-recorder.sh: Create + nut-recorder manual page + * [r3533] drivers/tripplite-hid.c: HP USB UPS completion #3 + + Remove R/T3000 USB ID (0x03f0:0x1fe5) from the TrippLite HID + mapping, since it is supported by the Eaton HID mapping. This + completes commit r3525. Also adds ups.firmware and device.part + * [r3532] drivers/usbhid-ups.c: Correct Celsius temperatures that + should be in Kelvin + + Check if raw value is in the Kelvin range, to detect buggy values + that are already expressed in Celsius degrees, as found on some + HP devices + * [r3531] docs/developer-guide.txt, tools/Makefile.am, + tools/device-recorder.sh, tools/nut-recorder.sh: Rename + device-recorder to nut-recorder + * [r3530] data/driver.list.in: Reorder Dell devices by connection + type + +2012-04-10 Arnaud Quette + + * [r3529] scripts/systemd/nut-driver.service.in, + scripts/systemd/nut-monitor.service.in, + scripts/systemd/nut-server.service.in, + scripts/systemd/nutshutdown.in: Fix broken systemd integration in + the build system + + Step 2: add the theoretical path templates to the systemd + scripts. This however requires adjustments to the RPM package. + Namely, upsd and upsmon will have to be installed in /sbin, + instead of the current /usr/sbin + * [r3528] configure.in, scripts/systemd/Makefile.am: Fix broken + systemd integration in the build system + + Step 1: remove Makefile rules that were both useless, and causing + warning. Generate nut-*.service files from .in templates in + configure, as it should be, which is currently void since there + is no target to substitute. This has however required to export + SBINDIR and PIDPATH through AC_SUBST, in configure + * [r3525] drivers/mge-hid.c: HP USB UPS completion #2 + + Address HP USB/HID devices, that use the Eaton HID definitions. + This includes the latest products range (USB IDs 0x1fe5, 0x1fe6, + 0x1fe7 and 0x1fe8), and few more variables and commands + * [r3524] drivers/mge-hid.c: Fix Eaton / MGE outlet.2.switchable + flags + + outlet.2.switchable should only be writable to enable ECO mode on + Ellipse ECO, Protection Station and some 3S. Other models should + only expose it as read only (reported by Prachi Gandhi from + Eaton, Alioth bug #313587) + +2012-04-04 Arnaud Quette + + * [r3520] scripts/Makefile.am, scripts/logrotate, + scripts/logrotate/nutlogd: Provide log rotation configuration for + NUT + + Provide a basic configuration file for managing rotation + (logrotate) of NUT log files, generated by upslog + +2012-04-02 Arnaud Quette + + * [r3518] docs/nut-names.txt: Update the namespace + + Complete the namespace with missing variables and commands, that + are either known or have had an RFC + * [r3517] docs/man: Subversion ignored files completion + + Mark nutscan_init.html as Subversion ignored (no functional + changes) + +2012-03-31 Arnaud Quette + + * [r3516] data/driver.list.in: Add support for AEG Power Solutions + PROTECT HOME + + Add AEG Power Solutions PROTECT HOME (USB ID 0x0665:0x5161) to + the list of blazer_ser and blazer_usb supported models (reported + by Joachim Schiele) + +2012-03-30 Arnaud Quette + + * [r3514] drivers/bcmxcp_usb.c: Add debug traces for read / write + commands + * [r3512] common/common.c, include/common.h: Improve support + functions for trimming strings + + Enforce verifications in rtrim, and add an ltrim function + +2012-03-29 Arnaud Quette + + * [r3511] data/driver.list.in, drivers/blazer_usb.c: Add support + Innova online UPS family + + Add Innova T (0x06da:0x0201), Innova RT (0x06da:0x0005) and + Innova 3/1 T (0x06da:0x0004) to the list of of blazer_usb and + blazer_ser supported models. Innova series are online UPS + supporting Q1 for compatibility, and many more commands. Better + support, either through blazer_* rewrite or through a new driver, + is considered as a future possibility + +2012-03-24 Arnaud Quette + + * [r3508] configure.in, docs/Makefile.am, docs/security.txt, + scripts/Makefile.am, scripts/ufw, scripts/ufw/README, + scripts/ufw/nut.ufw.profile.in: Uncomplicated Firewall (UFW) + support + + Provide an Uncomplicated Firewall (UFW) profile (nut.ufw.profile) + to tightly integrate NUT, along with some documentation + completion for the Security chapter of the user manual + +2012-03-23 Arnaud Quette + + * [r3507] conf/nut.conf.sample, docs/man/nut.conf.txt: Fix nut.conf + documentation and sample file + + Since nut.conf is intended to be sourced by shell scripts, spaces + must not be added around the equal sign. Fix documentation and + sample file to conform to this purpose, and add bold warning + (reported by Tim Rice, Alioth bug #312452) + * [r3506] clients/upsmon.c, server/upsd.c: Detect duplicate + instances of upsd / upsmon + + Fix a long standing issue, that is the lack of detection of + duplicate upsd / upsmon instances when starting another one of + these daemons. This previously resulted in inconsistencies, such + as being unable to stop the daemon, due to its .pid file being + removed by the newly started instance (last reported by Andrew + Min Chang) + +2012-03-21 Frederic Bohe + + * [r3503] drivers/libshut.c: Avoid stack corruption on invalid + frame + + In the protocol, the frame size can be 8 bytes max. That is why + the frame buffer is only 8 bytes long. If the frame is corrupted, + the size read may be up to 15, which may corrupt the stack while + writing into the frame buffer. This patch add a simple sanity + check on the size to avoid a crash and enforce protocol + limitation. + * [r3501] drivers/libshut.c: Fix SHUT variables read (from Arnaud + Quette) + * [r3500] drivers/bcmxcp.c, drivers/bcmxcp.h, drivers/bcmxcp_usb.c: + Change timeout for PW9120 + + Current timeout (1 sec) is too short for PW9120: numerous frames + are lost. Setting this to 2 seconds fix this. + * [r3499] drivers/libshut.c: Deactivate UPS notification + + Currently this driver is ignoring notification by automatically + sending NACK when they are received. Nevertheless,this behavior + creates communication errors with some UPS (M2200). So this patch + completly disable the sending of notification from the UPS. + Ideally we should correclty implement notifications managment for + optimal performance, but with this patch, at least, communiaton + works. + * [r3498] drivers/libshut.c: Fix shut notification mask + +2012-03-09 Arnaud Quette + + * [r3495] docs/config-notes.txt: Emphasize special characters + * [r3494] data/driver.list.in, drivers/tripplite-hid.c: HP USB UPS + completion #1 + + Address HP USB/HID devices, that use the TrippLite HID + definitions. This includes new ProductIDs, and few more variables + and commands + * [r3493] drivers/oneac.h: Remove extraneous comment start + +2012-03-08 Frederic Bohe + + * [r3487] common/parseconf.c, common/upsconf.c, + docs/config-notes.txt: More flexible '=' character managment in + conf files + + This allow to support the following forms : 'foo = bar', + 'foo=bar', 'foo =bar' and 'foo= bar' + +2012-03-06 Arnaud Quette + + * [r3485] docs/man/oneac.txt, drivers/oneac.c, drivers/oneac.h: + Improve general OneAC support (oneac 0.80) + + Improve support for all families of Oneac (EG, ON, OZ and OB), + including support for more data and instant commands (patch from + Bill Elliot) + +2012-03-05 Arnaud Quette + + * [r3484] drivers/blazer.c, drivers/blazer_ser.c, + drivers/blazer_usb.c: Guesstimate battery high and low voltages + + Add an automatic estimation for high and low voltages, to be able + to determine battery charge. This should cover most cases, but a + bold mention has been added at driver startup, to inform the + user. Driver version (USB and serial) have been bumped to reflect + this change + * [r3483] drivers/blazer.c: Set 'FSD' status flag upon need + + As per the recent decision to allow driver to set 'FSD' status + flag, set 'FSD' upon "Shutdown imminent" detection + +2012-03-02 Arnaud Quette + + * [r3481] autogen.sh, scripts/augeas/Makefile.am: Sanity check + before python script execution + + Only generate Augeas ups.conf lens if we can import required + Python modules (re,glob,codecs) + * [r3480] docs/man/blazer.txt: Fix typo error in runtimecal example + values + * [r3479] docs/stable-hcl.txt: Improve formating + * [r3478] docs/new-drivers.txt: Formalize the use of the FSD status + flag + + As an exception, drivers are now allowed to set the "FSD" (Forced + ShutDown) status flag when an imminent shutdown has been detected + +2012-02-29 Charles Lepple + + * [r3477] clients/upsc.c, docs/man/upsc.txt: Client side + implementation of "LIST CLIENT" + + Implement "LIST CLIENT" in upsc, using "-c " + + Author: Arnaud Quette + * [r3476] docs/net-protocol.txt, server/netlist.c: Adjust server + side implementation of "LIST CLIENT" + + Commands of the "LIST" family have to be coherent with the + command name. Ie, "LIST CLIENT" should use the same "CLIENT" + prefix, or it will otherwise break client side verification + mechanism + + Author: Arnaud Quette + * [r3475] server/netlist.c: Adjust "LIST CLIENTS" implementation + + Adjust "LIST CLIENTS" implementation to be more coherent with + other network protocol commands + + Author: Arnaud Quette + * [r3474] docs/net-protocol.txt: Document new "LIST CLIENTS" + command + + Author: Arnaud Quette + * [r3473] server/upsd.c, server/upsd.h: Remove upsd "info" command + + Adjust initial "LIST CLIENTS" commit, by removing the upsd "info" + command, which is not suitable, and redundant with the "LIST + CLIENT" command of the network protocol + + [Fixed compilation error] + + Author: Arnaud Quette + * [r3472] scripts/python/module/PyNUT.py: Add support for LIST + CLIENTS, etc. to PyNUT. + + Patch by Rene Martín Rodríguez . Merged with + typo fixes in repository. + + Covers LIST CLIENTS, FSD, HELP and VER. Module version bumped to + 1.2.2. + + Discussion: + http://article.gmane.org/gmane.comp.monitoring.nut.devel/5871 + * [r3471] server/netlist.c, server/upsd.c, server/upsd.h: Add new + "LIST CLIENTS" command to NUT protocol. + + Patch by Rene Martín Rodríguez , with + indentation changed to tabs. + + Discussion: + http://article.gmane.org/gmane.comp.monitoring.nut.devel/5870 + * [r3470] drivers/blazer.c: Update URL to Megatec protocol + description. + +2012-02-28 Arnaud Quette + + * [r3469] drivers/liebert-hid.c: UPower optimization + + Always spell manufacturer names the same way across the various + USB drivers. This avoids duplication of manufacturer entries in + scripts/upower/95-upower-hid.rules, during automatic generation + +2012-02-27 Arnaud Quette + + * [r3468] data/driver.list.in, drivers/cps-hid.c: Add support for + CyberPower OR700LCDRM1U + + Add CyberPower OR700LCDRM1U (0x0764:0x0601) to the list of + usbhid-ups supported models (reported by Brian McCann) + +2012-02-22 Michal Soltys + + * [r3467] drivers/apcsmart.c: drivers/apcsmart.c: setvar_string() + and apc_write_long() bugfixes + + setvar_string() couldn't function properly, due to the use of + wrong variable. + + Not associated with any bugreport (reported directly to email). + * [r3466] drivers/apcsmart.c: drivers/apcsmart.c: make + tcsetattr()/tcgetattr() difference not fatal + + This is follow up from earlier bug report (#313395). Earlier + commit should have fixed the issue, but the original submitter + never commented on it. + + Just in case - instead of making it fatal, we only log the issue. + +2012-02-20 Arnaud Quette + + * [r3450] drivers/snmp-ups.c, tools/nut-scanner/scan_snmp.c: Better + handling of Net-SNMP AES PrivProtocol + + Handle smartly issues related to Net-SNMP support and declaration + of AES PrivProtocol + +2012-02-19 Charles Lepple + + * [r3449] drivers/snmp-ups.c, drivers/snmp-ups.h: Don't allocate + storage for variables in snmp-ups.h + + The header files should declare variables as extern, and they + should be allocated in only one .c file (not all of the files + which include the .h file). While this is not an immediate + problem when only one .c file includes the .h file, it still + should be fixed in case that changes in the future. + + Patch by Daniel Macks: + http://fink.cvs.sourceforge.net/viewvc/fink/experimental/dmacks/finkinfo/nut.patch?revision=1.1&view=markup + * [r3448] drivers/bcmxcp.c, drivers/bcmxcp.h: Don't allocate + storage for variables in bcmxcp.h + + The header files should declare variables as extern, and they + should be allocated in only one .c file (not all of the files + which include the .h file). This was causing multiple symbol + definitions on Mac OS X. + + Patch by Daniel Macks: + http://fink.cvs.sourceforge.net/viewvc/fink/experimental/dmacks/finkinfo/nut.patch?revision=1.1&view=markup + +2012-02-16 Arnaud Quette + + * [r3447] data/driver.list.in, drivers/blazer_usb.c: Add support + for Online Yunto YQ450 + + Add Online Yunto YQ450 (0x06da:0x0002) to the list of blazer_usb + supported models (reported by Thomas Maisl) + +2012-02-16 Charles Lepple + + * [r3445] tools/git-svn.authors, tools/svn2cl.authors: Update SVN + username mappings + +2012-02-14 Arnaud Quette + + * [r3440] data/driver.list.in: Add support for Tripp-Lite + OMNISMART500 + + Add Tripp-Lite OMNISMART500 (productID 0001) to the list of + tripplite_usb supported models (reported by Matt Schulte) + +2012-02-10 Arnaud Quette + + * [r3439] data/driver.list.in: Support for Dell UPS Network + Management Card + + Add Dell UPS Network Management Card to the list of snmp-ups and + netxml-ups supported models. SNMP support currently relies on + IETF (RFC-1628) MIB, and not on Dell UPS MIB + +2012-02-09 Frederic Bohe + + * [r3435] tools/nut-scanner/scan_snmp.c: Remove useless lib_mutex + and buggy dev_mutex + +2012-02-03 Arnaud Quette + + * [r3431] Makefile.am: Update ChangeLog generation and fix text + wrapping + + Adapt the ChangeLog file generation process to correctly wrap + text, even with the new 'git style' format, used for Subversion + commit messages + +2012-02-02 Arnaud Quette + + * [r3426] drivers/bcmxcp.c, drivers/bcmxcp.h: Improve XCP support + for battery status + + Add support for battery test publication in ups.test.result, and + RB (replace battery) in ups.status + +2012-01-31 Arnaud Quette + + * [r3424] drivers/bestfortress.c: Add more debug traces + + Add more debug traces, again, to work on the checksum corruption + issue + +2012-01-23 Arnaud Quette + + * [r3411] drivers/mge-mib.c: Clean and complete MGE MIB + + Complete MGE MIB for status, variables and commands, using IETF + MIB OIDs when needed. Macro have also been replaced by actual + numeric OID paths for better clarity. + * [r3410] drivers/snmp-ups.c, drivers/snmp-ups.h: snmp-ups shutdown + support + + snmp-ups now provides support for UPS shutdown, based on + usbhid-ups mechanisms (composite commands and fallback). + Composite commands are also supported. This means, for example, + that if 'shutdown.return' is not supported, a combination of + 'load.off' + 'load.on' may be used. + * [r3409] drivers/ietf-mib.c: Fix invalid variable name + + Beeper status belongs to the 'ups' data collection + * [r3408] drivers/snmp-ups.c: Check validity of instant commands + before addition + + Prior to adding new instant commands, referenced OIDs are now + checked for existance. This avoid adding commands that are not + supported + * [r3407] docs/man/upsmon.txt: Fix upsmon synopsis + + Add the missing '-K' (Test for the shutdown flag) to upsmon + synopsis (reported by Regid Ichira) + +2012-01-20 Arnaud Quette + + * [r3406] data/driver.list.in: Support for Riello Netman Plus 102 + SNMP Card + + Add Riello Netman Plus 102 SNMP Card, and attached Sentinel SDL + 6000-7 and Sentinel Dual SDH 1000-7 UPS, to the list of snmp-ups + supported models (reported by Rainer Stumbaum) + +2012-01-19 Arnaud Quette + + * [r3400] drivers/bestfortress.c: Add more debug traces, to work on + the checksum corruption issue + +2012-01-18 Arnaud Quette + + * [r3399] docs/nut-names.txt, drivers/usbhid-ups.c: Adjust + ups.start.auto value for shutdown commands + + When present, ups.start.auto value needs to be adjusted for + shutdown.{return,stayoff} to behave as expected. This is limited + to Eaton devices (reported by Rich Wrenn) + +2012-01-11 Arnaud Quette + + * [r3395] UPGRADING: Cleanup garbage line + + Remove garbage line that was added by accident during the + AsciiDoc branch merge or work + * [r3394] tools/nut-scanner/Makefile.am, + tools/nut-scanner/nutscan-init.c, tools/nut-scanner/scan_nut.c: + Move libupsclient to weak runtime dependencies + + libupsclient, as other libraries used by nut-scanner, is now a + weak runtime dependency, through the use of lt_dl*() functions. + This means that libupsclient is not anymore required, but only + suggested. This should also solve the distcheck-light compilation + on Aix (on behalf of Frédéric Bohe, from Eaton) + +2012-01-09 Arnaud Quette + + * [r3382] drivers/bestups.c: Add the missing driver variable + "battvoltmult" (patch from Sadara Kael) + +2012-01-06 Arnaud Quette + + * [r3379] drivers/snmp-ups.c: Reword the message when sysOID + detection fails + * [r3378] drivers/compaq-mib.c: Add the sysOID value, and bump the + MIB version to 1.1 (reported by Jack Challen) + * [r3377] docs/download.txt: Remove inline SHA-256 sum, and provide + links to MD5 and SHA-256 sums + +2012-01-05 Arnaud Quette + + * [r3376] server/netget.c: GET UPSDESC does not need device sanity + checks (Ie connected, with fresh data) to answer (reported by + Emilien Kia, Alioth bug #313323) + * [r3374] data/driver.list.in: Add Dynamix 1000VA USB to the list + of blazer_usb supported models (requires "langid_fix=0x0409" in + ups.conf ; reported by Glen Ogilvie) + 2012-01-04 Arnaud Quette + * [r3372] docs/download.txt: Add the missing SHA-256 sum on the + Download page / section (need to be generated after the + distribution package) * [r3371] docs/website/news.txt: Update 2.6.3 release date 2012-01-03 Arnaud Quette @@ -140,8 +1096,7 @@ minor documentation update Broken diagram link and 940-0024E cable mention (reported by - Jonathan - Laventhol). + Jonathan Laventhol). 2011-11-05 Arnaud Quette @@ -216,8 +1171,7 @@ Assigning 0 directly was wrong (actually, a leftover from earlier version of the code that was removed) - ser_set_speed() prepares - the - port initially, we only adjust certain options. + the port initially, we only adjust certain options. 2011-10-24 Frederic Bohe @@ -500,10 +1454,8 @@ macro warnings This should be fixed properly upstream, but in the mean time, the - SNMP-based - tools can't use these macros properly (since they will have the - values for - Net-SNMP, not NUT). + SNMP-based tools can't use these macros properly (since they will + have the values for Net-SNMP, not NUT). 2011-09-14 Frederic Bohe @@ -743,8 +1695,8 @@ * [r3150] configure.in: configure.in: minor changes to output - * Capitalized "UPS" - * --with-drivers= : Only *build* specific drivers + * Capitalized "UPS" * --with-drivers= : Only *build* specific + drivers 2011-07-30 Arnaud Quette @@ -1079,8 +2031,7 @@ * [r2934] drivers/bcmxcp_usb.c, drivers/microdowell.c, drivers/rhino.c, drivers/solis.c: Fix remaining C++ style comments, to conform to the NUT coding rules (no functional - change) - on behalf of Prachi Gandhi (prachisgandhi@eaton.com) + change) on behalf of Prachi Gandhi (prachisgandhi@eaton.com) 2011-03-14 Arjen de Korte @@ -1104,8 +2055,8 @@ * [r2927] drivers/apcsmart.c: Flush the input buffer before sending a command [on behalf of Michal Soltys ] * [r2926] drivers/apcsmart.c, drivers/apcsmart.h: protocol_verify() - only cares about explicitly specified commands - and variables [on behalf of Michal Soltys ] + only cares about explicitly specified commands and variables [on + behalf of Michal Soltys ] * [r2925] drivers/apcsmart.c: Additional driver variables that can be set to influence shutdown behavior [on behalf of Michal Soltys ] @@ -1114,9 +2065,8 @@ * [r2923] drivers/apcsmart.c: Deal with more different shutdown methods [on behalf of Michal Soltys ] * [r2922] drivers/apcsmart.c: As 'b' can return different things - than firmware version on some old - models, prefer 'V' over 'b' [on behalf of Michal Soltys - ] + than firmware version on some old models, prefer 'V' over 'b' [on + behalf of Michal Soltys ] * [r2921] drivers/apcsmart.c: remove superfluous status_commit() [on behalf of Michal Soltys ] * [r2920] drivers/apcsmart.c, drivers/apcsmart.h: adjust ignored @@ -1194,9 +2144,9 @@ Reported by Noel David Torres Taño: http://lists.alioth.debian.org/pipermail/nut-upsuser/2010-August/006163.html - Other models may be supported as well. - * http://www.mustek.com.tw/Yukai/html/prod_ups/PowerMust1000.html - * http://www.mustek.com.tw/Yukai/html/UPS.html + Other models may be supported as well. * + http://www.mustek.com.tw/Yukai/html/prod_ups/PowerMust1000.html * + http://www.mustek.com.tw/Yukai/html/UPS.html 2011-02-17 Arnaud Quette @@ -1216,8 +2166,7 @@ driver.list.in from r2516 These entries seem to have been dropped, potentially due to the - rename from - driver.list to driver.list.in, and the format change. + rename from driver.list to driver.list.in, and the format change. 2011-02-11 Arjen de Korte @@ -1377,14 +2326,11 @@ Python and Perl interpreter paths Useful for systems like FreeBSD where Python is optional, and - pulled in from - the ports tree. + 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. + improvement would be to add a configure script argument, although + that might be annoying for the nut-autoreconf script. 2010-12-24 Arnaud Quette @@ -1575,8 +2521,8 @@ [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 + 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 @@ -1713,104 +2659,76 @@ 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 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 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, + 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 + 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 + 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 + 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 + 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 + 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 + 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 @@ -2232,12 +3150,10 @@ ` 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. + 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 @@ -2373,9 +3289,8 @@ 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. + 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, @@ -2428,8 +3343,7 @@ * [r2363] ChangeLog, configure.in: Final update for 2.4.2 release * [r2362] NEWS, data/driver.list: Add HP R1500 G2 to compatibility - list for bcmxcp - (reported by Stephan Schupfer) + list for bcmxcp (reported by Stephan Schupfer) 2010-02-19 Arjen de Korte diff --git a/INSTALL b/INSTALL index 1e58c4c..7762f5b 100644 --- a/INSTALL +++ b/INSTALL @@ -222,7 +222,7 @@ the 'nut' package, and optionaly the following: //////////////////////////////////////////////////////////////////////////////// Configuration files are located in /etc/nut. -nut.conf must be edited to be able to invoke /etc/init.d/nut +linkman:nut.conf[5] must be edited to be able to invoke /etc/init.d/nut NOTE: Ubuntu users can access the APT URL installation by clicking on link:apt://nut[this link]. diff --git a/Makefile.am b/Makefile.am index 8701f2a..f9e3cd9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,7 +41,7 @@ MAINTAINERCLEAN_FILES = ChangeLog # in case it has already been generated previously dummy-stamp: ChangeLog: tools/svn2cl.authors dummy-stamp - svn2cl --group-by-day --include-rev --authors=$< --revision 'HEAD:2332' --output=$@ || \ + svn2cl --group-by-day --include-rev --authors=$< --reparagraph --revision 'HEAD:2332' --output=$@ || \ echo "svn2cl failed to generate the ChangeLog. See http://trac.networkupstools.org/projects/nut/timeline" > $@ if HAVE_ASCIIDOC diff --git a/Makefile.in b/Makefile.in index 884f95e..ac24401 100644 --- a/Makefile.in +++ b/Makefile.in @@ -40,7 +40,8 @@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure \ $(top_srcdir)/scripts/HP-UX/nut.psf.in \ - $(top_srcdir)/scripts/avahi/nut.service.in AUTHORS COPYING \ + $(top_srcdir)/scripts/avahi/nut.service.in \ + $(top_srcdir)/scripts/ufw/nut.ufw.profile.in AUTHORS COPYING \ ChangeLog INSTALL NEWS TODO compile config.guess config.sub \ depcomp install-sh ltmain.sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -72,7 +73,8 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = scripts/avahi/nut.service scripts/HP-UX/nut.psf +CONFIG_CLEAN_FILES = scripts/avahi/nut.service scripts/HP-UX/nut.psf \ + scripts/ufw/nut.ufw.profile CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = @@ -207,6 +209,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -220,6 +223,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -227,6 +231,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ @@ -373,6 +378,8 @@ scripts/avahi/nut.service: $(top_builddir)/config.status $(top_srcdir)/scripts/a cd $(top_builddir) && $(SHELL) ./config.status $@ scripts/HP-UX/nut.psf: $(top_builddir)/config.status $(top_srcdir)/scripts/HP-UX/nut.psf.in cd $(top_builddir) && $(SHELL) ./config.status $@ +scripts/ufw/nut.ufw.profile: $(top_builddir)/config.status $(top_srcdir)/scripts/ufw/nut.ufw.profile.in + cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo @@ -816,7 +823,7 @@ distcleancheck: # in case it has already been generated previously dummy-stamp: ChangeLog: tools/svn2cl.authors dummy-stamp - svn2cl --group-by-day --include-rev --authors=$< --revision 'HEAD:2332' --output=$@ || \ + svn2cl --group-by-day --include-rev --authors=$< --reparagraph --revision 'HEAD:2332' --output=$@ || \ echo "svn2cl failed to generate the ChangeLog. See http://trac.networkupstools.org/projects/nut/timeline" > $@ @HAVE_ASCIIDOC_TRUE@website: diff --git a/NEWS b/NEWS index c4d0c74..0fd98a7 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,125 @@ 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.4 - what's new since 2.6.3: + + - This release Fix an important vulnerability in upsd + (CVE-2012-2944: upsd can be remotely crashed) + + NUT server (upsd), from versions 2.4.0 to 2.6.3, are exposed to + crashes when receiving random data from the network. + This issue is related to the way NUT parses characters, + especially from the network. Non printable characters were missed + from strings operation (such as strlen), but still copied to the + buffer, causing an overflow. + Thus, fix NUT parser, to only allow the subset Ascii charset from + Space to ~ + (Reported by Sebastian Pohle, Alioth bug #313636, CVE-2012-2944) + + A separate patch, which applies to any faulty version, is also available: + http://trac.networkupstools.org/projects/nut/changeset/3633 + + For more information, refer to the Common Vulnerabilities and Exposures: + http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-2944 + + - A static source code analysis has been done by Michal Hlavinka from RedHat, + using Coverity (12 issues fixed). + + - Add new "LIST CLIENTS" and "NETVER" commands to NUT network protocol. + "NETVER" allows to retrieve the Network protocol version, while + "LIST CLIENTS" provides the list of clients connected to a device. + Refer to the developer guide, "Network protocol information" section for + more information. + + - Support of ranges of values for writable variables has been added, to + complete the existing enumerated values mechanism. This will start to + appear in some drivers soon, beginning with Eaton. Refer to the developer + guide, "Creating a new driver..." section for more information. + + - PyNUT.py has been updated to version 1.2.2, adding support for + LIST CLIENTS, FSD, HELP and VER (Rene Martín Rodríguez) + + - support for new devices: + AEG Power Solutions PROTECT HOME + more APC SNMP cards + ATEK Defensor range + all Borri models + all COVER ENERGY SA + CyberPower OR700LCDRM1U, PR6000LCDRTXL5U and CP1000PFCLCD + Dell UPS Network Management Card + Dynamix 1000VA USB + Eaton Management Card Contact (ref 66104) + EVER POWERLINE RT / 11 / 31 and DUO II Pro + GE Digital Energy GT Series 1000-3000 VA + Gtec models + all recent HP serial / USB UPS (G2, G3 and R/T models, ) and HP UPS + Management Module + Ippon INNOVA RT + KOLFF BLACK NOVA + Lexis X-power Tigra 1kVA + Microline C-Lion Innova + Online Yunto YQ450 + PowerShield Defender 1200VA + PowerWalker Online VFI LCD, Line-Interactive VI LCD and Line-Interactive VI + Riello Netman Plus 102 SNMP Card + Tripp-Lite OMNISMART500 + + - apcsmart has received some fixes to work better on Mac OS X, and in general + + - bcmxcp has improved support for battery status, and better supports + PW9120 units + + - bestfortress has improved Best Fortress LI675VA support + + - blazer_ser and blazer_usb now try to automatically estimate high and low + voltages, to be able to calculate battery charge ; support for online + Innova UPS (T, RT and 3/1 T) has been added ; Best UPS support has been + improved, to prepare for superseeding bestups driver + + - bestups has also received some care, though users are encouraged to switch + to blazer_ser, since bestups will soon be deprecated. + + - newmge-shut has been heavilly improved. However, replacement of the + current mge-shut has been postponed to the next release, due to the CVE + issue. + + - oneac 0.80 improves support for all families of Oneac (EG, ON, OZ and OB), + including more data and instant commands (Bill Elliot). + + - usbhid-ups: for Eaton devices, ups.start.auto is now automatically adjusted + for shutdown.{return,stayoff} to behave as expected ; Liebert firmwares with + incorrect exponents have also been addressed. + + - snmp-ups now provides support for UPS shutdown, based on usbhid-ups + mechanisms (composite commands and fallback). Composite commands are also + supported now. This means, for example, that if 'shutdown.return' is not + supported, a combination of 'load.off' + 'load.on' may be used ; + Actual validity of instant commands is now tested before commands addition ; + Eaton/MGE MIB has been cleaned and completed ; 3-phases support has been + added to Socomec Netvision MIB ; HP/Compaq MIB has been completed, with + thresholds, nominal values and more commands. + + - nut-scanner now also has libupsclient has a weak runtime dependency ; more + docs and bugfixes have also happened. + + - Provide an Uncomplicated Firewall (UFW) profile (nut.ufw.profile) + + - Riello protocols have been officially published in NUT protocols library: + http://www.networkupstools.org/ups-protocols.html#_riello + + - Duplicate instances of upsd / upsmon are now detected upon startup + + - NUT variables namespace has been completed with missing variables and + commands that are already known and standard + + - upslog now comes with a companion file, for logrotate configuration + + - more devices embed NUT for power protection, now including Thecus NAS range + + - more bugfixes, cleanup and improvements, on both source code and + documentation, with a good bunch from Greg A. Woods. + --------------------------------------------------------------------------- Release notes for NUT 2.6.3 - what's new since 2.6.2: diff --git a/UPGRADING b/UPGRADING index 6ea3627..d00143d 100644 --- a/UPGRADING +++ b/UPGRADING @@ -7,6 +7,14 @@ 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.6.3 to 2.6.4 +--------------------------- + +- users are encouraged to update to NUT 2.6.4, to fix upsd vulnerability +(CVE-2012-2944: upsd can be remotely crashed) +- users of the bestups driver are encouraged to switch to blazer_ser, +since bestups will soon be deprecated. + Changes from 2.6.2 to 2.6.3 --------------------------- @@ -202,7 +210,6 @@ 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. - The newapc driver has been renamed to apcsmart. If you previously used newapc, make sure you delete the old binary and fix your diff --git a/clients/Makefile.in b/clients/Makefile.in index 1aec493..48e0dae 100644 --- a/clients/Makefile.in +++ b/clients/Makefile.in @@ -268,6 +268,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -281,6 +282,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -288,6 +290,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ diff --git a/clients/upsc.c b/clients/upsc.c index e07490b..19c9739 100644 --- a/clients/upsc.c +++ b/clients/upsc.c @@ -1,6 +1,7 @@ /* upsc - simple "client" to test communications Copyright (C) 1999 Russell Kroll + Copyright (C) 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,6 +35,7 @@ static void usage(const char *prog) printf("usage: %s -l | -L [[:port]]\n", prog); printf(" %s []\n", prog); + printf(" %s -c \n", prog); printf("\nDemo program to display UPS variables.\n\n"); @@ -46,6 +48,10 @@ static void usage(const char *prog) printf(" - upsd server, [@[:]] form\n"); printf(" - optional, display this variable only.\n"); printf(" Default: list all variables for \n"); + + printf("\nThird form (lists clients connected to a device):\n"); + printf(" -c - lists each client connected on , one per line.\n"); + printf(" - upsd server, [@[:]] form\n"); } static void printvar(const char *var) @@ -155,6 +161,39 @@ static void list_upses(int verbose) } } +static void list_clients(const char *devname) +{ + int ret; + unsigned int numq, numa; + const char *query[4]; + char **answer; + + query[0] = "CLIENT"; + query[1] = devname; + numq = 2; + + ret = upscli_list_start(ups, numq, query); + + if (ret < 0) { + /* check for an old upsd */ + 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)); + } + + while ((ret=upscli_list_next(ups, numq, query, &numa, &answer)) == 1) { + + /* CLIENT
*/ + if (numa < 3) { + fatalx(EXIT_FAILURE, "Error: insufficient data (got %d args, need at least 3)", numa); + } + + printf("%s\n", answer[2]); + } +} + static void clean_exit(void) { if (ups) { @@ -169,10 +208,10 @@ static void clean_exit(void) int main(int argc, char **argv) { int i, port; - int varlist = 0, verbose = 0; + int varlist = 0, clientlist = 0, verbose = 0; const char *prog = xbasename(argv[0]); - while ((i = getopt(argc, argv, "+hlLV")) != -1) { + while ((i = getopt(argc, argv, "+hlLcV")) != -1) { switch (i) { @@ -181,6 +220,9 @@ int main(int argc, char **argv) case 'l': varlist = 1; break; + case 'c': + clientlist = 1; + break; case 'V': fatalx(EXIT_SUCCESS, "Network UPS Tools upscmd %s", UPS_VERSION); @@ -219,6 +261,11 @@ int main(int argc, char **argv) exit(EXIT_SUCCESS); } + if (clientlist) { + list_clients(upsname); + exit(EXIT_SUCCESS); + } + if (argc > 1) { printvar(argv[1]); } else { diff --git a/clients/upsmon.c b/clients/upsmon.c index fe3f5fb..e3016fe 100644 --- a/clients/upsmon.c +++ b/clients/upsmon.c @@ -1,6 +1,8 @@ /* upsmon - monitor power status over the 'net (talks to upsd via TCP) - Copyright (C) 1998 Russell Kroll + Copyright (C) + 1998 Russell Kroll + 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -79,12 +81,6 @@ static int opt_af = AF_UNSPEC; static struct sigaction sa; static sigset_t nut_upsmon_sigmask; -#ifdef SHUT_RDWR -#define shutdown_how SHUT_RDWR -#else -#define shutdown_how 2 -#endif - static void setflag(int *val, int flag) { *val |= flag; @@ -696,7 +692,7 @@ static void recalc(void) } /* note: we assume that a UPS that isn't critical must be OK * - * * + * * * this means a UPS we've never heard from is assumed OL * * whether this is really the best thing to do is undecided */ @@ -709,12 +705,12 @@ static void recalc(void) ups = ups->next; } - /* upsdebugx(3, "Current power value: %d", val_ol); - upsdebugx(3, "Minimum power value: %d", minsupplies); */ + upsdebugx(3, "Current power value: %d", val_ol); + upsdebugx(3, "Minimum power value: %d", minsupplies); if (val_ol < minsupplies) forceshutdown(); -} +} static void ups_low_batt(utype_t *ups) { @@ -792,10 +788,7 @@ static void redefine_ups(utype_t *ups, int pv, const char *un, free(ups->un); - if (un) - ups->un = xstrdup(un); - else - ups->un = NULL; + ups->un = xstrdup(un); /* * if not logged in force a reconnection since this @@ -954,7 +947,7 @@ static void addups(int reloading, const char *sys, const char *pvs, else upslogx(LOG_INFO, "UPS: %s (monitoring only)", tmp->sys); - tmp->upsname = tmp->hostname = NULL; + tmp->upsname = tmp->hostname = NULL; if (upscli_splitname(tmp->sys, &tmp->upsname, &tmp->hostname, &tmp->port) != 0) { @@ -1945,6 +1938,15 @@ int main(int argc, char *argv[]) exit(EXIT_SUCCESS); } + /* otherwise, we are being asked to start. + * so check if a previous instance is running by sending signal '0' + * (Ie 'kill 0') */ + if (sendsignal(prog, 0) == 0) { + printf("Fatal error: A previous upsmon instance is already running!\n"); + printf("Either stop the previous instance first, or use the 'reload' command.\n"); + exit(EXIT_FAILURE); + } + argc -= optind; argv += optind; @@ -1961,6 +1963,8 @@ int main(int argc, char *argv[]) /* we may need to get rid of a flag from a previous shutdown */ if (powerdownflag != NULL) clear_pdflag(); + /* FIXME (else): POWERDOWNFLAG is not defined!! + * => fallback to a default value */ if (totalpv < minsupplies) { printf("\nFatal error: insufficient power configured!\n\n"); diff --git a/clients/upsmon.h b/clients/upsmon.h index 92634bc..3193027 100644 --- a/clients/upsmon.h +++ b/clients/upsmon.h @@ -19,15 +19,13 @@ /* flags for ups->status */ -#define ST_ONLINE 0x001 /* UPS is on line (OL) */ -#define ST_ONBATT 0x002 /* UPS is on battery (OB) */ -#define ST_LOWBATT 0x004 /* UPS has a low battery (LB) */ -#define ST_FSD 0x008 /* master has set forced shutdown flag */ -#define ST_MASTER 0x010 /* we are the master on this UPS */ -/* was ST_ALIVE 0x020 */ -#define ST_LOGIN 0x040 /* we are logged into this UPS */ -/* was ST_FIRST 0x080 */ -#define ST_CONNECTED 0x100 /* upscli_connect returned OK */ +#define ST_ONLINE (1 << 0) /* UPS is on line (OL) */ +#define ST_ONBATT (1 << 1) /* UPS is on battery (OB) */ +#define ST_LOWBATT (1 << 2) /* UPS has a low battery (LB) */ +#define ST_FSD (1 << 3) /* master has set forced shutdown flag */ +#define ST_MASTER (1 << 4) /* we are the master on this UPS */ +#define ST_LOGIN (1 << 5) /* we are logged into this UPS */ +#define ST_CONNECTED (1 << 6) /* upscli_connect returned OK */ /* required contents of flag file */ #define SDMAGIC "upsmon-shutdown-file" @@ -74,10 +72,10 @@ typedef struct { /* notify flag values */ -#define NOTIFY_IGNORE 1 /* don't do anything */ -#define NOTIFY_SYSLOG 2 /* send the msg to the syslog */ -#define NOTIFY_WALL 4 /* send the msg to all users */ -#define NOTIFY_EXEC 8 /* send the msg to NOTIFYCMD script */ +#define NOTIFY_IGNORE (1 << 0) /* don't do anything */ +#define NOTIFY_SYSLOG (1 << 1) /* send the msg to the syslog */ +#define NOTIFY_WALL (1 << 2) /* send the msg to all users */ +#define NOTIFY_EXEC (1 << 3) /* send the msg to NOTIFYCMD script */ /* flags are set to NOTIFY_SYSLOG | NOTIFY_WALL at program init */ /* the user can override with NOTIFYFLAGS in the upsmon.conf */ diff --git a/clients/upsrw.c b/clients/upsrw.c index aacbfe8..ca02b99 100644 --- a/clients/upsrw.c +++ b/clients/upsrw.c @@ -267,6 +267,61 @@ static void do_enum(const char *varname) } } +static void do_range(const char *varname) +{ + int ret; + unsigned int numq, numa; + char **answer; + const char *query[4], *val; + int ival, min, max; + + /* get current value */ + val = get_data("VAR", varname); + + if (!val) { + fatalx(EXIT_FAILURE, "do_range: can't get current value of %s", varname); + } + + ival = atoi(val); + + query[0] = "RANGE"; + query[1] = upsname; + query[2] = varname; + numq = 3; + + ret = upscli_list_start(ups, numq, query); + + if (ret < 0) { + fatalx(EXIT_FAILURE, "Error: %s", upscli_strerror(ups)); + } + + ret = upscli_list_next(ups, numq, query, &numa, &answer); + + printf("Type: RANGE\n"); + + while (ret == 1) { + + /* RANGE */ + + if (numa < 5) { + fatalx(EXIT_FAILURE, "Error: insufficient data (got %d args, need at least 4)", numa); + } + + min = atoi(answer[3]); + max = atoi(answer[4]); + + printf("Option: \"%i-%i\"", min, max); + + if ((ival >= min) && (ival <= max)) { + printf(" SELECTED"); + } + + printf("\n"); + + ret = upscli_list_next(ups, numq, query, &numa, &answer); + } +} + static void do_type(const char *varname) { int ret; @@ -294,6 +349,11 @@ static void do_type(const char *varname) return; } + if (!strcasecmp(answer[i], "RANGE")) { + do_range(varname); + return; + } + if (!strncasecmp(answer[i], "STRING:", 7)) { do_string(varname); return; diff --git a/clients/upssched.c b/clients/upssched.c index 6fcb5c3..675a3d0 100644 --- a/clients/upssched.c +++ b/clients/upssched.c @@ -694,7 +694,7 @@ static void sendcmd(const char *cmd, const char *arg1, const char *arg2) snprintfcat(buf, sizeof(buf), " \"%s\"", pconf_encode(arg2, enc, sizeof(enc))); - snprintfcat(buf, sizeof(buf), "\n"); + snprintfcat(enc, sizeof(enc), "%s\n", buf); /* see if the parent needs to be started (and maybe start it) */ @@ -715,10 +715,10 @@ static void sendcmd(const char *cmd, const char *arg1, const char *arg2) /* we're connected now */ - ret = write(pipefd, buf, strlen(buf)); + ret = write(pipefd, enc, strlen(enc)); /* if we can't send the whole thing, loop back and try again */ - if ((ret < 1) || (ret != (int) strlen(buf))) { + if ((ret < 1) || (ret != (int) strlen(enc))) { upslogx(LOG_ERR, "write failed, trying again"); close(pipefd); continue; diff --git a/common/Makefile.am b/common/Makefile.am index 43d09ca..6dda04a 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -2,15 +2,14 @@ AM_CFLAGS = -I$(top_srcdir)/include -../include/nut_version.h: FORCE - (cd ../include/ && $(MAKE) $(AM_MAKEFLAGS) nut_version.h) - -FORCE: - noinst_LTLIBRARIES = libparseconf.la libcommon.la libparseconf_la_SOURCES = parseconf.c -libcommon_la_SOURCES = common.c state.c upsconf.c ../include/nut_version.h +# do not hard depend on '../include/nut_version.h', since it blocks +# 'dist', and is only required for actual build, in which case +# BUILT_SOURCES (in ../include) will ensure nut_version.h will +# be built before anything else +libcommon_la_SOURCES = common.c state.c upsconf.c # ensure inclusion of local implementation of missing systems functions # using LTLIBOBJS. Refer to configure.in -> AC_REPLACE_FUNCS libcommon_la_LIBADD = libparseconf.la @LTLIBOBJS@ diff --git a/common/Makefile.in b/common/Makefile.in index 8ba1221..9ccd162 100644 --- a/common/Makefile.in +++ b/common/Makefile.in @@ -174,6 +174,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -187,6 +188,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -194,6 +196,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ @@ -270,7 +273,12 @@ udevdir = @udevdir@ AM_CFLAGS = -I$(top_srcdir)/include noinst_LTLIBRARIES = libparseconf.la libcommon.la libparseconf_la_SOURCES = parseconf.c -libcommon_la_SOURCES = common.c state.c upsconf.c ../include/nut_version.h + +# do not hard depend on '../include/nut_version.h', since it blocks +# 'dist', and is only required for actual build, in which case +# BUILT_SOURCES (in ../include) will ensure nut_version.h will +# be built before anything else +libcommon_la_SOURCES = common.c state.c upsconf.c # ensure inclusion of local implementation of missing systems functions # using LTLIBOBJS. Refer to configure.in -> AC_REPLACE_FUNCS libcommon_la_LIBADD = libparseconf.la @LTLIBOBJS@ @@ -562,11 +570,6 @@ uninstall-am: pdf pdf-am ps ps-am tags uninstall uninstall-am -../include/nut_version.h: FORCE - (cd ../include/ && $(MAKE) $(AM_MAKEFLAGS) nut_version.h) - -FORCE: - # 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/common/common.c b/common/common.c index e8004d7..ef680b0 100644 --- a/common/common.c +++ b/common/common.c @@ -527,11 +527,28 @@ char *rtrim(char *in, const char sep) { char *p; - p = &in[strlen(in) - 1]; + if (in) { + p = &in[strlen(in) - 1]; - while ((p >= in) && (*p == sep)) - *p-- = '\0'; - + while ((p >= in) && (*p == sep)) + *p-- = '\0'; + } + return in; +} + +/* modify in - strip all leading instances of */ +char* ltrim(char *in, const char sep) +{ + char *p; + + if (in) { + p = in; + + while ((*p != '\0') && (*p == sep)) + *p++ = *in++; + + p = '\0'; + } return in; } diff --git a/common/parseconf.c b/common/parseconf.c index bc6d6a1..7073eb1 100644 --- a/common/parseconf.c +++ b/common/parseconf.c @@ -171,6 +171,13 @@ static void addchar(PCONF_CTX_t *ctx) wbuflen = strlen(ctx->wordbuf); + /* CVE-2012-2944: only allow the subset Ascii charset from Space to ~ */ + if ((ctx->ch < 0x20) || (ctx->ch > 0x7f)) { + fprintf(stderr, "addchar: discarding invalid character (0x%02x)!\n", + ctx->ch); + return; + } + if (ctx->wordlen_limit != 0) { if (wbuflen >= ctx->wordlen_limit) { @@ -240,6 +247,13 @@ static int findwordstart(PCONF_CTX_t *ctx) /* at this point the word just started */ addchar(ctx); + + /* if the first character is a '=' this is considered a whole word */ + if (ctx->ch == '=') { + endofword(ctx); + return STATE_FINDWORDSTART; + } + return STATE_COLLECT; } @@ -326,6 +340,14 @@ static int collect(PCONF_CTX_t *ctx) return STATE_FINDWORDSTART; } + /* '=' means the word is done and the = is a single char word*/ + if (ctx->ch == '=') { + endofword(ctx); + findwordstart(ctx); + + return STATE_FINDWORDSTART; + } + /* \ = literal = accept the next char blindly */ if (ctx->ch == '\\') return STATE_COLLECTLITERAL; diff --git a/common/state.c b/common/state.c index 0e728a7..cb79e0f 100644 --- a/common/state.c +++ b/common/state.c @@ -3,6 +3,7 @@ Copyright (C) 2003 Russell Kroll 2008 Arjen de Korte + 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -65,6 +66,17 @@ static void st_tree_enum_free(enum_t *list) free(list); } +static void st_tree_range_free(range_t *list) +{ + if (!list) { + return; + } + + st_tree_range_free(list->next); + + free(list); +} + /* free all memory associated with a node */ static void st_tree_node_free(st_tree_t *node) { @@ -77,6 +89,9 @@ static void st_tree_node_free(st_tree_t *node) /* blow away the list of enums */ st_tree_enum_free(node->enum_list); + /* and the list of ranges */ + st_tree_range_free(node->range_list); + /* now finally kill the node itself */ free(node); } @@ -237,6 +252,54 @@ int state_addenum(st_tree_t *root, const char *var, const char *val) return st_tree_enum_add(&sttmp->enum_list, enc); } +static int st_tree_range_add(range_t **list, const int min, const int max) +{ + range_t *item; + + while (*list) { + + if (((*list)->min != min) && ((*list)->max != max)) { + list = &(*list)->next; + continue; + } + + return 0; /* duplicate */ + } + + item = xcalloc(1, sizeof(*item)); + item->min = min; + item->max = max; + item->next = *list; + + /* now we're done creating it, add it to the list */ + *list = item; + + return 1; /* added */ +} + +int state_addrange(st_tree_t *root, const char *var, const int min, const int max) +{ + st_tree_t *sttmp; + + /* sanity check */ + if (min > max) { + upslogx(LOG_ERR, "state_addrange: min is superior to max! (%i, %i)", + min, max); + return 0; + } + + /* find the tree node for var */ + sttmp = state_tree_find(root, var); + + if (!sttmp) { + upslogx(LOG_ERR, "state_addrange: base variable (%s) " + "does not exist", var); + return 0; /* failed */ + } + + return st_tree_range_add(&sttmp->range_list, min, max); +} + int state_setaux(st_tree_t *root, const char *var, const char *auxs) { st_tree_t *sttmp; @@ -319,6 +382,20 @@ const enum_t *state_getenumlist(st_tree_t *root, const char *var) return sttmp->enum_list; } +const range_t *state_getrangelist(st_tree_t *root, const char *var) +{ + st_tree_t *sttmp; + + /* find the tree node for var */ + sttmp = state_tree_find(root, var); + + if (!sttmp) { + return NULL; + } + + return sttmp->range_list; +} + void state_setflags(st_tree_t *root, const char *var, int numflags, char **flag) { int i; @@ -471,6 +548,43 @@ int state_delenum(st_tree_t *root, const char *var, const char *val) return st_tree_del_enum(&sttmp->enum_list, val); } +static int st_tree_del_range(range_t **list, const int min, const int max) +{ + while (*list) { + + range_t *item = *list; + + /* if this is not the right value, go on to the next */ + if (((*list)->min != min) && ((*list)->max != max)) { + list = &item->next; + continue; + } + + /* we found it! */ + *list = item->next; + + free(item); + + return 1; /* deleted */ + } + + return 0; /* not found */ +} + +int state_delrange(st_tree_t *root, const char *var, const int min, const int max) +{ + st_tree_t *sttmp; + + /* find the tree node for var */ + sttmp = state_tree_find(root, var); + + if (!sttmp) { + return 0; + } + + return st_tree_del_range(&sttmp->range_list, min, max); +} + st_tree_t *state_tree_find(st_tree_t *node, const char *var) { while (node) { diff --git a/common/upsconf.c b/common/upsconf.c index 3504150..867163b 100644 --- a/common/upsconf.c +++ b/common/upsconf.c @@ -31,8 +31,6 @@ /* handle arguments separated by parseconf */ static void conf_args(int numargs, char **arg) { - char *ep; - if (numargs < 1) return; @@ -46,15 +44,6 @@ static void conf_args(int numargs, char **arg) return; } - /* handle 'foo=bar' (compressed form) */ - ep = strchr(arg[0], '='); - if (ep) { - *ep = '\0'; - - do_upsconf_args(ups_section, arg[0], ep+1); - return; - } - /* handle 'foo' (flag) */ if (numargs == 1) { do_upsconf_args(ups_section, arg[0], NULL); @@ -64,7 +53,7 @@ static void conf_args(int numargs, char **arg) if (numargs < 3) return; - /* handle 'foo = bar' (split form) */ + /* handle 'foo = bar', 'foo=bar', 'foo =bar' or 'foo= bar' forms */ if (!strcmp(arg[1], "=")) { do_upsconf_args(ups_section, arg[0], arg[2]); return; diff --git a/conf/Makefile.in b/conf/Makefile.in index 98596dc..be4cd06 100644 --- a/conf/Makefile.in +++ b/conf/Makefile.in @@ -179,6 +179,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -192,6 +193,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -199,6 +201,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ diff --git a/conf/nut.conf.sample b/conf/nut.conf.sample index 5c5a4a6..9309825 100644 --- a/conf/nut.conf.sample +++ b/conf/nut.conf.sample @@ -24,5 +24,9 @@ # Since this MODE is opened to the network, a special care should be applied # to security concerns. # - netclient: this mode only requires upsmon. +# +# IMPORTANT NOTE: +# This file is intended to be sourced by shell scripts. +# You MUST NOT use spaces around the equal sign! -MODE = none +MODE=none diff --git a/configure b/configure index 7e936e8..68b465c 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for nut 2.6.3. +# Generated by GNU Autoconf 2.68 for nut 2.6.4. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='nut' PACKAGE_TARNAME='nut' -PACKAGE_VERSION='2.6.3' -PACKAGE_STRING='nut 2.6.3' +PACKAGE_VERSION='2.6.4' +PACKAGE_STRING='nut 2.6.4' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -626,9 +626,11 @@ SUN_LIBUSB RUN_AS_GROUP RUN_AS_USER PORT +SBINDIR BINDIR CONFPATH STATEPATH +PIDPATH SERLIBS NETLIBS DRIVER_INSTALL_TARGET @@ -661,6 +663,7 @@ LIBGD_LDFLAGS LIBGD_CFLAGS LIBSSL_LIBS LIBSSL_CFLAGS +NUT_NETVERSION TREE_VERSION OS_NAME MANUALUPDATE_FALSE @@ -1449,7 +1452,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.6.3 to adapt to many kinds of systems. +\`configure' configures nut 2.6.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1520,7 +1523,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of nut 2.6.3:";; + short | recursive ) echo "Configuration of nut 2.6.4:";; esac cat <<\_ACEOF @@ -1706,7 +1709,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -nut configure 2.6.3 +nut configure 2.6.4 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2171,7 +2174,7 @@ 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.6.3, which was +It was created by nut $as_me 2.6.4, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -3241,7 +3244,7 @@ fi # Define the identity of the package. PACKAGE='nut' - VERSION='2.6.3' + VERSION='2.6.4' cat >>confdefs.h <<_ACEOF @@ -4753,6 +4756,7 @@ fi + TREE_VERSION="`echo ${PACKAGE_VERSION} | awk '{ print substr($0,1,3) }'`" cat >>confdefs.h <<_ACEOF @@ -4760,6 +4764,13 @@ cat >>confdefs.h <<_ACEOF _ACEOF +NUT_NETVERSION="1.2" + +cat >>confdefs.h <<_ACEOF +#define NUT_NETVERSION "${NUT_NETVERSION}" +_ACEOF + + test "${prefix}" = "NONE" && prefix="${ac_default_prefix}" test "${exec_prefix}" = "NONE" && exec_prefix='${prefix}' @@ -10352,7 +10363,7 @@ 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 + as_fn_error $? "\"Unable to build ${DOC_NOBUILD_LIST} documentation\"" "$LINENO" 5 fi ;; esac @@ -18438,6 +18449,14 @@ cat >>confdefs.h <<_ACEOF _ACEOF +conftemp="${sbindir}" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +SBINDIR=${conftemp} + +cat >>confdefs.h <<_ACEOF +#define SBINDIR "${conftemp}" +_ACEOF @@ -18489,7 +18508,12 @@ _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 data/driver.list docs/Makefile docs/man/Makefile docs/website/Makefile drivers/Makefile include/Makefile lib/libupsclient-config lib/libupsclient.pc lib/libnutscan.pc lib/Makefile scripts/augeas/Makefile scripts/augeas/nutnutconf.aug scripts/augeas/nutupsconf.aug scripts/augeas/nutupsdconf.aug scripts/augeas/nutupsdusers.aug scripts/augeas/nutupsmonconf.aug scripts/augeas/nutupsschedconf.aug scripts/augeas/nuthostsconf.aug scripts/augeas/nutupssetconf.aug scripts/avahi/nut.service scripts/hal/Makefile scripts/hal/ups-nut-device.fdi scripts/hotplug/Makefile scripts/hotplug/libhidups scripts/HP-UX/nut.psf scripts/java/Makefile scripts/python/Makefile scripts/systemd/Makefile scripts/udev/Makefile scripts/udev/nut-ipmipsu.rules scripts/udev/nut-usbups.rules scripts/Makefile server/Makefile tools/Makefile tools/nut-scanner/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/libnutscan.pc lib/Makefile scripts/augeas/Makefile scripts/augeas/nutnutconf.aug scripts/augeas/nutupsconf.aug scripts/augeas/nutupsdconf.aug scripts/augeas/nutupsdusers.aug scripts/augeas/nutupsmonconf.aug scripts/augeas/nutupsschedconf.aug scripts/augeas/nuthostsconf.aug scripts/augeas/nutupssetconf.aug scripts/avahi/nut.service scripts/hal/Makefile scripts/hal/ups-nut-device.fdi scripts/hotplug/Makefile scripts/hotplug/libhidups scripts/HP-UX/nut.psf scripts/java/Makefile scripts/python/Makefile scripts/systemd/Makefile scripts/systemd/nut-driver.service scripts/systemd/nut-monitor.service scripts/systemd/nut-server.service scripts/systemd/nutshutdown scripts/udev/Makefile scripts/udev/nut-ipmipsu.rules scripts/udev/nut-usbups.rules scripts/ufw/nut.ufw.profile scripts/Makefile server/Makefile tools/Makefile tools/nut-scanner/Makefile Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -19130,7 +19154,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by nut $as_me 2.6.3, which was +This file was extended by nut $as_me 2.6.4, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -19196,7 +19220,7 @@ _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.6.3 +nut config.status 2.6.4 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" @@ -19640,9 +19664,14 @@ do "scripts/java/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/java/Makefile" ;; "scripts/python/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/python/Makefile" ;; "scripts/systemd/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/systemd/Makefile" ;; + "scripts/systemd/nut-driver.service") CONFIG_FILES="$CONFIG_FILES scripts/systemd/nut-driver.service" ;; + "scripts/systemd/nut-monitor.service") CONFIG_FILES="$CONFIG_FILES scripts/systemd/nut-monitor.service" ;; + "scripts/systemd/nut-server.service") CONFIG_FILES="$CONFIG_FILES scripts/systemd/nut-server.service" ;; + "scripts/systemd/nutshutdown") CONFIG_FILES="$CONFIG_FILES scripts/systemd/nutshutdown" ;; "scripts/udev/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/udev/Makefile" ;; "scripts/udev/nut-ipmipsu.rules") CONFIG_FILES="$CONFIG_FILES scripts/udev/nut-ipmipsu.rules" ;; "scripts/udev/nut-usbups.rules") CONFIG_FILES="$CONFIG_FILES scripts/udev/nut-usbups.rules" ;; + "scripts/ufw/nut.ufw.profile") CONFIG_FILES="$CONFIG_FILES scripts/ufw/nut.ufw.profile" ;; "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; "server/Makefile") CONFIG_FILES="$CONFIG_FILES server/Makefile" ;; "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; diff --git a/configure.in b/configure.in index f906a30..2bcf7df 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.6.3) +AC_INIT(nut, 2.6.4) AC_CONFIG_SRCDIR(server/upsd.c) AC_CONFIG_MACRO_DIR([m4]) echo "Network UPS Tools version ${PACKAGE_VERSION}" @@ -28,6 +28,9 @@ AM_MAINTAINER_MODE dnl PKG_PROG_PKG_CONFIG +dnl Various version related processing +dnl ---------------------------------- + dnl # the following is commented out, because the UPS_VERSION macro now dnl # resides in include/nut_version.h, which is generated by Makefile.am, dnl # rather than in include/config.h, which is generated by configure. The @@ -39,6 +42,9 @@ dnl However, automatically define the tree version (mostly for AC_SUBST) TREE_VERSION="`echo ${PACKAGE_VERSION} | awk '{ print substr($0,1,3) }'`" AC_DEFINE_UNQUOTED(TREE_VERSION, "${TREE_VERSION}", [NUT tree version]) +NUT_NETVERSION="1.2" +AC_DEFINE_UNQUOTED(NUT_NETVERSION, "${NUT_NETVERSION}", [NUT network protocol version]) + dnl Fix this early so we can expand with eval later test "${prefix}" = "NONE" && prefix="${ac_default_prefix}" @@ -594,7 +600,7 @@ no) if test -z "${DOC_NOBUILD_LIST}"; then nut_with_doc="yes" else - AC_MSG_ERROR(["Asciidoc is required for documentation support and missing"]) + AC_MSG_ERROR(["Unable to build ${DOC_NOBUILD_LIST} documentation"]) fi ;; esac @@ -1028,8 +1034,16 @@ eval conftemp=\"${conftemp}\" BINDIR=${conftemp} AC_DEFINE_UNQUOTED(BINDIR, "${conftemp}", [Default path for user executables]) +dnl same for sbindir +conftemp="${sbindir}" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +SBINDIR=${conftemp} +AC_DEFINE_UNQUOTED(SBINDIR, "${conftemp}", [Default path for system executables]) + AC_SUBST(OS_NAME) AC_SUBST(TREE_VERSION) +AC_SUBST(NUT_NETVERSION) AC_SUBST(LIBSSL_CFLAGS) AC_SUBST(LIBSSL_LIBS) AC_SUBST(LIBGD_CFLAGS) @@ -1062,9 +1076,11 @@ AC_SUBST(DRIVER_MAN_LIST) AC_SUBST(DRIVER_INSTALL_TARGET) AC_SUBST(NETLIBS) AC_SUBST(SERLIBS) +AC_SUBST(PIDPATH) AC_SUBST(STATEPATH) AC_SUBST(CONFPATH) AC_SUBST(BINDIR) +AC_SUBST(SBINDIR) AC_SUBST(PORT) AC_SUBST(RUN_AS_USER) AC_SUBST(RUN_AS_GROUP) @@ -1115,9 +1131,14 @@ AC_OUTPUT([ scripts/java/Makefile scripts/python/Makefile scripts/systemd/Makefile + scripts/systemd/nut-driver.service + scripts/systemd/nut-monitor.service + scripts/systemd/nut-server.service + scripts/systemd/nutshutdown scripts/udev/Makefile scripts/udev/nut-ipmipsu.rules scripts/udev/nut-usbups.rules + scripts/ufw/nut.ufw.profile scripts/Makefile server/Makefile tools/Makefile diff --git a/data/Makefile.in b/data/Makefile.in index 9296e6d..0bd3feb 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -215,6 +215,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -228,6 +229,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -235,6 +237,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ diff --git a/data/driver.list.in b/data/driver.list.in index 0d47616..b305b92 100644 --- a/data/driver.list.in +++ b/data/driver.list.in @@ -46,6 +46,8 @@ "AEC" "ups" "1" "MiniGuard UPS 700" "Megatec M2501 cable" "genericups upstype=21" +"AEG Power Solutions" "ups" "2" "PROTECT HOME" "" "blazer_ser or blazer_usb" + "APC" "ups" "1" "Back-UPS Pro" "" "apcsmart" "APC" "ups" "1" "Matrix-UPS" "" "apcsmart" "APC" "ups" "1" "Smart-UPS" "" "apcsmart" @@ -76,6 +78,22 @@ "Appro" "pdu" "1" "SWPDU" "48 outlets" "powerman-pdu (experimental)" +"ARTronic" "ups" "2" "ARTon Millenium 1/2/3/6/10 kVA" "Serial" "blazer_ser" +"ARTronic" "ups" "2" "ARTon Millenium 3.1 10/15/20 kVA" "Serial" "blazer_ser" +"ARTronic" "ups" "2" "ARTon Titanium 6/10 kVA" "Serial" "blazer_ser" +"ARTronic" "ups" "2" "ARTon Titanium 3.1 10/15/20 kVA" "Serial" "blazer_ser" +"ARTronic" "ups" "2" "ARTon Optimum 1/2/3/6/10 kVA" "Serial" "blazer_ser" +"ARTronic" "ups" "2" "ARTon Titanium Plus 1/2/3 kVA" "USB" "blazer_usb" +"ARTronic" "ups" "2" "ARTon Platinium 6/10 kVA" "USB" "blazer_usb" +"ARTronic" "ups" "2" "ARTon Platinium Combo 3.1 10/15/20 kVA" "USB" "blazer_usb" +"ARTronic" "ups" "2" "ARTon Platinium RT 1/2/3/6/10 kVA" "USB" "blazer_usb" + +"ATEK" "ups" "2" "Defensor 1K Tower / Rack" "USB" "blazer_usb" +"ATEK" "ups" "2" "Defensor 2K Tower / Rack" "USB" "blazer_usb" +"ATEK" "ups" "2" "Defensor 3K Tower / Rack" "USB" "blazer_usb" +"ATEK" "ups" "2" "Defensor 6K Tower / Rack" "USB" "blazer_usb" +"ATEK" "ups" "2" "Defensor 10K Tower / Rack" "USB" "blazer_usb" + "Atlantis Land" "ups" "2" "A03-P826" "" "blazer_ser" "Baytech" "pdu" "1" "RPC3" "8 outlets" "powerman-pdu (experimental)" @@ -111,15 +129,21 @@ "Belkin" "ups" "2" "F6S600auUSB" "USB" "blazer_usb" "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" "Fortress (newer)" "" "blazer_ser or bestups" +"Best Power" "ups" "1" "Fortress Telecom" "" "blazer_ser or bestups" +"Best Power" "ups" "1" "Axxium Rackmount" "" "blazer_ser or bestups" +"Best Power" "ups" "1" "Patriot Pro" "" "blazer_ser or bestups" +"Best Power" "ups" "1" "Patriot Pro II" "" "blazer_ser or 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" +"Borri" "ups" "2" "B400-010-B/B400-020-B/B400-030-B/B400-010-C/B400-020-C/B400-030-C" "" "blazer_usb" +"Borri" "ups" "2" "B400-R010-B/B400-R020-B/B400-R030-B/B400-R010-C/B400-R020-C/B400-R030-C" "" "blazer_usb" +"Borri" "ups" "2" "B500-060-B/B500-100-B/B500-060-C/B500-100-C" "" "blazer_usb" +"Borri" "ups" "2" "B500-R060-B/B500-R100-B" "" "blazer_usb" +"Borri" "ups" "2" "B500EVO-100-B/B500EVO-200-B" "" "blazer_usb" + "Chloride" "ups" "2" "Desk Power 650" "serial port" "blazer_ser" "Cito Power" "ups" "2" "CPG-SR1000" "" "blazer_ser" @@ -131,6 +155,10 @@ "Compaq" "ups" "4" "R3000 XR" "" "bcmxcp" "Compaq" "ups" "4" "R5500 XR" "" "bcmxcp" +"COVER ENERGY SA" "ups" "2" "COVER PRM 1K/2K/3K/6K/10K" "" "blazer_usb" +"COVER ENERGY SA" "ups" "2" "COVER PRM 1K/2K/3K/6K/10K EC" "" "blazer_usb" +"COVER ENERGY SA" "ups" "2" "COVER PRM 6K/10K PR" "" "blazer_usb" + "Cyber Power Systems" "ups" "1" "320AVR" "" "powerpanel" "Cyber Power Systems" "ups" "1" "500AVR" "" "powerpanel" "Cyber Power Systems" "ups" "1" "650AVR" "" "powerpanel" @@ -154,12 +182,15 @@ "Cyber Power Systems" "ups" "2" "AE550" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "3" "CP 1500C" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "3" "OR2200LCDRM2U" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "3" "OR700LCDRM1U" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "3" "PR6000LCDRTXL5U" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "2" "Value 400E" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "2" "Value 600E" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "2" "Value 800E" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "2" "CP1000AVRLCD" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "2" "CP1350AVRLCD" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "2" "CP1500AVRLCD" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "2" "CP1000PFCLCD" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "3" "RMCARD100" "" "snmp-ups" "Cyber Power Systems" "ups" "3" "RMCARD201" "" "snmp-ups" "Cyber Power Systems" "ups" "3" "RMCARD202" "" "snmp-ups" @@ -168,26 +199,28 @@ "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" +"Dell" "ups" "5" "Tower 500W LV / HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack/Tower 1000W LV / HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack/Tower 1500W LV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack/Tower 1920W LV / HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack/Tower 2300W LV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack/Tower 2700W LV / HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Short Depth Rack 2700W Online LV / HV" "High Efficiency, USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack 3750W High Efficiency Online HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack 4200W High Efficiency Online HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Rack 5600W HV" "USB port" "usbhid-ups" +"Dell" "ups" "5" "Various (SNMP mode)" "UPS Network Management Card " "snmp-ups" +"Dell" "ups" "5" "Various (XML/HTTP mode)" "UPS Network Management Card " "netxml-ups (experimental)" "Delta" "ups" "1" "GES602N" "" "belkin" @@ -200,7 +233,7 @@ "Dynamix" "ups" "2" "UPS1700D" "" "blazer_ser" "Dynamix" "ups" "2" "UPS-650VA" "" "blazer_ser" -"Dynamix" "ups" "2" "650VA" "USB" "blazer_usb langid_fix=0x0409" +"Dynamix" "ups" "2" "650VA/1000VA" "USB" "blazer_usb langid_fix=0x0409" "Dynex" "ups" "1" "975AVR" "" "genericups upstype=7" "Dynex" "ups" "2" "DX-800U" "USB" "usbhid-ups" @@ -235,10 +268,11 @@ "Eaton" "ups" "5" "E Series DX UPS 1-20 kVA" "" "mge-utalk" "Eaton" "ups" "4" "NetUPS SE 450/700/1000/1500" "" "upscode2" "Eaton" "ups" "5" "BladeUPS (SNMP)" "ConnectUPS Web/SNMP Card" "snmp-ups (experimental)" -"Eaton" "ups" "5" "various models (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)" "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" "ups" "5" "various models (serial mode)" "Management Card Contact (ref 66104)" "mge-shut or mge-utalk" "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" @@ -257,10 +291,16 @@ "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" +"EVER" "ups" "1" "NET DPC series" "Serial port" "everups" +"EVER" "ups" "1" "AP Pro series" "Serial port" "everups" +"EVER" "ups" "1" "625/1000" "" "safenet" +"EVER" "ups" "2" "POWERLINE RT 1-3kVA series" "Serial port" "blazer_ser" +"EVER" "ups" "2" "POWERLINE RT 6-10kVA series" "Serial port" "blazer_ser" +"EVER" "ups" "2" "POWERLINE 11 series" "Serial port" "blazer_ser" +"EVER" "ups" "2" "POWERLINE 31 series" "Serial port" "blazer_ser" +"EVER" "ups" "2" "DUO II Pro series" "USB port" "blazer_usb" +"EVER" "ups" "2" "POWERLINE RT 1-3kVA series" "USB port" "blazer_usb" +"EVER" "ups" "2" "POWERLINE RT 6-10kVA series" "USB port" "blazer_usb" "Exide" "ups" "1" "NetUPS SE" "" "genericups upstype=15" "Exide" "ups" "4" "NetUPS SE 450/700/1000/1500" "" "upscode2" @@ -291,24 +331,41 @@ "Gamatronic" "ups" "5" "MS" "" "gamatronic" "Gamatronic" "ups" "5" "µPS3/1" "" "gamatronic" -"GE" "ups" "2" "EP series" "" "blazer_usb" +"GE Digital Energy" "ups" "2" "EP Series" "" "blazer_usb" +"GE Digital Energy" "ups" "2" "GT Series 1000/1500/2000/3000 VA Rack/Tower" "UL-version" "blazer_ser" "Geek Squad" "ups" "2" "GS1285U" "USB" "usbhid-ups" "Gemini" "ups" "1" "UPS625/UPS1000" "" "safenet" +"Gtec" "ups" "2" "ZP120N-1K / ZP120N-1KS / ZP120N-2K / ZP120N-2KS / ZP120N-3K / ZP120N-3KS" "" "blazer_usb" +"Gtec" "ups" "2" "ZP120N-6K / ZP120N-6KS / ZP120N-10K-11 / ZP120N-10KS-11" "" "blazer_usb" +"Gtec" "ups" "2" "ZP120N-10K-31-00 / ZP120N-10K-31-07 / ZP120N-10K-31-09 / ZP120N-10K-31-99 / ZP120N-20K" "USB port" "blazer_usb" +"Gtec" "ups" "2" "AP160N-1K / AP160LCD-1K-KS / AP160N-2K / AP160LCD-2K-KS / AP160N-3K / AP160LCD-3K-KS / AP160N-6K-PDU / AP160N-10K-PDU" "USB port" "blazer_usb" +"Gtec" "ups" "2" "ZP120N-10K-31-00 / ZP120N-10K-31-07 / ZP120N-10K-31-09 / ZP120N-10K-31-99 / ZP120N-20K" "Serial port" "blazer_ser" +"Gtec" "ups" "2" "AP160N-1K / AP160LCD-1K-KS / AP160N-2K / AP160LCD-2K-KS / AP160N-3K / AP160LCD-3K-KS / AP160N-6K-PDU / AP160N-10K-PDU" "Serial port" "blazer_ser" + "HP" "ups" "1" "PowerTrust 2997A" "HP 5061-2575 cable" "apcsmart" +"HP" "ups" "3" "T750 G2" "Serial port" "bcmxcp" +"HP" "ups" "3" "T1000 G3" "Serial port" "bcmxcp" +"HP" "ups" "3" "T1500 G3" "Serial port" "bcmxcp" +"HP" "ups" "3" "R1500 G2" "Serial port" "bcmxcp" "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" "ups" "3" "T500 / T750" "older models, USB port" "bcmxcp_usb" +"HP" "ups" "3" "R/T3000" "Serial port" "mge-shut or newmge-shut" +"HP" "ups" "3" "R5000 / R7000" "Serial port" "mge-shut or newmge-shut" +"HP" "ups" "3" "T750 INTL" "" "usbhid-ups" +"HP" "ups" "3" "T1000 INTL" "" "usbhid-ups" +"HP" "ups" "3" "T1500 INTL" "" "usbhid-ups" +"HP" "ups" "3" "T750 G2" "USB port" "usbhid-ups" +"HP" "ups" "3" "T1000 G3" "USB port" "usbhid-ups" +"HP" "ups" "3" "T1500 G3" "USB port" "usbhid-ups" +"HP" "ups" "3" "R1500 G2 INTL" "USB port" "usbhid-ups" +"HP" "ups" "3" "R/T 2200 G2" "" "usbhid-ups" +"HP" "ups" "3" "R/T3000" "USB port" "usbhid-ups" +"HP" "ups" "3" "R5000 / R7000" "USB port" "usbhid-ups" +"HP" "ups" "4" "Various (SNMP mode)" "HP UPS Management Module " "snmp-ups" "HP" "pdu" "1" "HP3488 Switch/Control Unit" "" "powerman-pdu (experimental)" "IBM" "pdu" "1" "Blade Center Management Module" "15 outlets" "powerman-pdu (experimental)" @@ -347,6 +404,7 @@ "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" +"Ippon" "ups" "2" "INNOVA RT 1K/1.5K/2K/3K" "" "blazer_usb" "IVT" "scd" "1" "SCD series" "" "ivtscd" @@ -354,6 +412,11 @@ "Kebo" "ups" "2" "1200D/D Series" "" "blazer_ser" +"KOLFF" "ups" "2" "BLACK NOVA 1K/2K/3K/6K/10K/20K TOWER" "" "blazer_usb" +"KOLFF" "ups" "2" "BLACK NOVA 1K/2K/3K/6K/10K/20K XL TOWER" "" "blazer_usb" +"KOLFF" "ups" "2" "BLACK NOVA 1K/1.5K/2K/3K/6K/10K RACK" "" "blazer_usb" +"KOLFF" "ups" "2" "BLACK NOVA 1K/1.5K/2K/3K/6K/10K XL RACK" "" "blazer_usb" + "Krauler" "ups" "2" "UP-D1200VA" "USB" "blazer_usb" "Krauler" "ups" "2" "UP-M500VA" "USB" "blazer_usb" @@ -361,6 +424,8 @@ "Lestar" "ups" "2" "MD-800E" "" "blazer_ser" +"Lexis" "ups" "2" "X-Power Tigra 1kVA" "" "blazer_ser or bestups" + "Liebert" "ups" "2" "ITON 600VA" "" "blazer_ser" "Liebert" "ups" "5" "UPStation GXT2" "contact-closure cable" "liebert" "Liebert" "ups" "1" "GXT2-3000RT230" "" "liebert-esp2 (experimental)" @@ -560,6 +625,11 @@ "MicroDowell" "ups" "5" "Enterprise N60" "" "microdowell" "MicroDowell" "ups" "5" "Enterprise HiBox ST" "" "microdowell" +"Microline" "ups" "2" "C-Lion Innova RT 2K/3K" "" "blazer_usb" +"Microline" "ups" "2" "C-Lion Innova RT 6K/10K (Parallel)" "" "blazer_usb" +"Microline" "ups" "2" "C-Lion Innova Tower 6K/10K" "" "blazer_usb" +"Microline" "ups" "2" "C-Lion Innova Combo 10K/20K (3/1)" "" "blazer_usb" + "Microsol" "ups" "4" "Solis 1.0" "1000VA" "solis" "Microsol" "ups" "4" "Solis 1.5" "1500VA" "solis" "Microsol" "ups" "4" "Solis 2.0" "2000VA" "solis" @@ -608,6 +678,7 @@ "Online" "ups" "1" "P-Series" "" "genericups upstype=14" "Online" "ups" "1" "Zinto D" "" "optiups" +"Online" "ups" "2" "Yunto YQ450" "" "blazer_usb" "OnLite" "ups" "2" "AQUA" "50" "blazer_ser" @@ -651,14 +722,21 @@ "PowerMan" "ups" "2" "RealSmart 1000" "" "blazer_ser" "PowerMan" "ups" "1" "BackPro" "" "genericups upstype=4" +"PowerShield" "ups" "2" "Defender 1200VA" "" "blazer_usb" + "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 600 SE" "" "blazer_usb" +"PowerWalker" "ups" "2" "Line-Interactive VI 800 SE" "" "blazer_usb" "PowerWalker" "ups" "2" "Line-Interactive VI 1400" "" "blazer_usb" +"PowerWalker" "ups" "2" "Line-Interactive VI 2000" "" "blazer_usb" "PowerWalker" "ups" "2" "Line-Interactive VI 850 LCD" "" "blazer_usb" +"PowerWalker" "ups" "2" "Online VFI 1000RT/1500RT/2000RT/3000RT/6000RT/10000RT LCD" "" "blazer_usb" +"PowerWalker" "ups" "2" "Line-Interactive VI 1000RT/1500RT/2000RT/3000RT LCD" "" "blazer_usb" "Powerware" "ups" "4" "3110" "" "genericups upstype=7" "Powerware" "ups" "4" "3115" "" "genericups upstype=11" @@ -693,6 +771,10 @@ "Repotec" "ups" "1" "RPT-800A" "" "genericups upstype=13" "Repotec" "ups" "1" "RPT-162A" "" "genericups upstype=13" +"Riello" "ups" "3" "Riello Sentinel SDL 6000-7" "Netman Plus 102 SNMP Card" "snmp-ups" +"Riello" "ups" "3" "Riello Sentinel Dual SDH 1000-7" "Netman Plus 102 SNMP Card" "snmp-ups" +"Riello" "ups" "3" "(various)" "Netman Plus 102 SNMP Card" "snmp-ups" + "Rocketfish" "ups" "2" "RF-1000VA / RF-1025VA" "" "usbhid-ups" "SmartLabs" "pdu" "1" "2412S Power Line Modem" "for X10/Insteon" "powerman-pdu (experimental)" @@ -700,16 +782,17 @@ "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" "1" "325" "" "blazer_ser or bestups" +"SOLA" "ups" "1" "520" "" "blazer_ser or bestups" +"SOLA" "ups" "1" "610" "use ID= in ups.conf" "blazer_ser or bestups" +"SOLA" "ups" "1" "620" "" "blazer_ser or 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" "2" "NeTYS-PE 600VA" "" "blazer_ser" "Socomec Sicon" "ups" "1" "Egys" "420 VA" "powercom" +"Socomec Sicon" "ups" "3" "MASTERYS 3/3 SYSTEM 60 kVA" "Net Vision v5.05 SNMP card" "snmp-ups (experimental)" "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" @@ -744,6 +827,7 @@ "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" "OMNISMART500" "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" @@ -783,10 +867,15 @@ "Various" "ups" "1" "(various)" "Generic RUPS 2000 (Megatec M2501 cable)" "genericups upstype=21" "Various" "ups" "2" "(various serial)" "Q1 / Megatec protocol" "blazer_ser" "Various" "ups" "2" "(various USB)" "Q1 / Megatec protocol" "blazer_usb" -"Various" "ups" "2" "(various)" "PhoenixTec protocol" "bestups" +"Various" "ups" "2" "(various)" "PhoenixTec protocol" "blazer_ser or bestups" "Various" "ups" "3" "(various)" "SNMP - RFC 1628" "snmp-ups (experimental)" "Various" "ups" "1" "(various)" "Safenet software" "safenet" "Various" "ups" "2" "(Various USB)" "UPSilon 2000 software" "blazer_usb langid_fix=0x409" +"Various" "ups" "2" "(Various serial)" "WinPower software" "blazer_ser" +"Various" "ups" "2" "(Various USB)" "WinPower software" "blazer_usb" +"Various" "ups" "2" "Various Innova T" "(USB ID 06da:0201)" "blazer_ser or blazer_usb" +"Various" "ups" "2" "Various Innova RT" "(USB ID 06da:0005)" "blazer_ser or blazer_usb" +"Various" "ups" "2" "Various Innova 3/1 T" "(USB ID 06da:0004)" "blazer_ser or blazer_usb" "Victron/IMV" "ups" "1" "(various)" "" "victronups" "Victron/IMV" "ups" "1" "Lite" "crack cable" "genericups upstype=10" diff --git a/data/html/Makefile.in b/data/html/Makefile.in index 750195b..49fc9f7 100644 --- a/data/html/Makefile.in +++ b/data/html/Makefile.in @@ -174,6 +174,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -187,6 +188,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -194,6 +196,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ diff --git a/docs/Makefile.am b/docs/Makefile.am index 65d3b73..6521b3b 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -85,7 +85,7 @@ ups-html.txt: ### TODO: automatic dependency generation # Add other directory deps (not for local EXTRA_DIST) and generated contents FULL_USER_MANUAL_DEPS = $(USER_MANUAL_DEPS) $(SHARED_DEPS) ../README \ - ../INSTALL ../UPGRADING ../TODO + ../INSTALL ../UPGRADING ../TODO ../scripts/ufw/README FULL_DEVELOPER_GUIDE_DEPS = $(DEVELOPER_GUIDE_DEPS) $(SHARED_DEPS) \ ../scripts/augeas/README ../TODO ../lib/README \ ../tools/nut-scanner/README diff --git a/docs/Makefile.in b/docs/Makefile.in index 87057a6..5f04658 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -188,6 +188,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -201,6 +202,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -208,6 +210,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ @@ -344,7 +347,7 @@ SUFFIXES = .txt .html .pdf ### TODO: automatic dependency generation # Add other directory deps (not for local EXTRA_DIST) and generated contents FULL_USER_MANUAL_DEPS = $(USER_MANUAL_DEPS) $(SHARED_DEPS) ../README \ - ../INSTALL ../UPGRADING ../TODO + ../INSTALL ../UPGRADING ../TODO ../scripts/ufw/README FULL_DEVELOPER_GUIDE_DEPS = $(DEVELOPER_GUIDE_DEPS) $(SHARED_DEPS) \ ../scripts/augeas/README ../TODO ../lib/README \ diff --git a/docs/cables/apc.txt b/docs/cables/apc.txt index ef927e0..5803779 100644 --- a/docs/cables/apc.txt +++ b/docs/cables/apc.txt @@ -1,10 +1,37 @@ Desc: APC UPS cables File: apc.txt -Date: 12 Februari 2010 +Date: 12 February 2010 Auth: Arjen de Korte > step. If you reconfigure the driver, use 'upsdrvctl stop' to stop it, then start it again as shown in the <> step. diff --git a/docs/design.txt b/docs/design.txt index dfaeae8..4e39eca 100644 --- a/docs/design.txt +++ b/docs/design.txt @@ -128,7 +128,7 @@ This scenario requires some configuration, obviously: 2. upsd has a valid UPS entry in ups.conf for this UPS. [myups] - driver = upsdriver + driver = nutupsdrv port = /dev/ttySx 3. upsd has a valid user for upsmon in upsd.users. diff --git a/docs/developer-guide.txt b/docs/developer-guide.txt index e3c3bbe..7b0a823 100644 --- a/docs/developer-guide.txt +++ b/docs/developer-guide.txt @@ -119,7 +119,7 @@ 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-recorder.sh' and located in the 'tools/' directory of the NUT source tree. This script uses 'upsc' to record device information, and stores @@ -131,7 +131,7 @@ Its usage is the following: For example, to record information from the device 'myups' every 10 seconds: - tools/device-recorder.sh myups@localhost myups.seq 10 + nut-recorder.sh myups@localhost myups.seq 10 During the recording, you will want to generate power events, such as power failure and restoration. These will be tracked in the simulation files, and be diff --git a/docs/developers.txt b/docs/developers.txt index f26dd17..fa0f169 100644 --- a/docs/developers.txt +++ b/docs/developers.txt @@ -145,15 +145,15 @@ int open_subspace(char *ship, int privacy) } -------------------------------------------------------------------------------- -The basic idea is that I try to group things into functions, and then +The basic idea is that we try to group things into functions, and then find ways to drop out of them when we can't go any further. There's another way to program this involving a big else chunk and a bunch of braces, and it can be hard to follow. You can read this from top to bottom and have a pretty good idea of what's going on without having to track too much { } nesting and indenting. -I don't really care for pretentiousVariableNamingSchemes, but you can -probably get away with it in your own driver that I will never have to +We don't really care for pretentiousVariableNamingSchemes, but you can +probably get away with it in your own driver that we will never have to touch. If your function or variable names start pushing important code off the right margin of the screen, expect them to meet the byte chainsaw sooner or later. @@ -171,8 +171,13 @@ without inflicting much pain on other developers. If you use a space, then you've fixed the spacing in stone and have really annoyed half of the people out there. +Note that tabs apply only to *indenting*. Alignment of text after any +non-tab character has appeared on the line must be done by spaces in +order for it to remain at the same alignment when someone views tabs at +a different widths. + If you write something that uses spaces, you may get away with it in a -driver that's relatively secluded. However, if I have to work on that +driver that's relatively secluded. However, if we have to work on that code, expect it to get reformatted according to the above. Patches to existing code that don't conform to the coding style being diff --git a/docs/download.txt b/docs/download.txt index 79b5d82..33c6edf 100644 --- a/docs/download.txt +++ b/docs/download.txt @@ -25,7 +25,8 @@ Stable tree: {tree_version} - link:http://www.networkupstools.org/source/{tree_version}/nut-{revision}.tar.gz[nut-{revision}.tar.gz] - link:http://www.networkupstools.org/source/{tree_version}/nut-{revision}.tar.gz.sig[PGP/GPG signature] -- SHA-256 sum: 343554add0713348f8b09bca8d83eee2eb2ae8bad9cdad9a39e0f0e2d0f5d375 +- link:http://www.networkupstools.org/source/{tree_version}/nut-{revision}.tar.gz.sha256[SHA-256 sum] +- link:http://www.networkupstools.org/source/{tree_version}/nut-{revision}.tar.gz.md5[MD5 sum] - link:http://www.networkupstools.org/source/{tree_version}/new-{revision}.txt[Release notes] - link:http://www.networkupstools.org/source/{tree_version}/ChangeLog[ChangeLog] @@ -114,7 +115,7 @@ link:http://pdb.finkproject.org/pdb/package.php/nut[Fink], link:http://trac.macports.org/browser/trunk/dports/sysutils/nut/Portfile[MacPorts] - Windows (complete port, Beta): -link:http://www.networkupstools.org/source/2.6/NUT-Installer-2.6.1-1.msi[Windows MSI installer 2.6.1-1] +link:http://www.networkupstools.org/source/2.6/NUT-Installer-2.6.3-3.msi[Windows MSI installer 2.6.3-3] Java packages diff --git a/docs/man/Makefile.am b/docs/man/Makefile.am index 2eefef9..a8c54a4 100644 --- a/docs/man/Makefile.am +++ b/docs/man/Makefile.am @@ -74,13 +74,13 @@ HTML_CLIENT_MANS = \ upsrw.html \ upssched.html -SRC_TOOL_PAGES = nut-scanner.txt +SRC_TOOL_PAGES = nut-scanner.txt nut-recorder.txt -MAN_TOOL_PAGES = nut-scanner.8 +MAN_TOOL_PAGES = nut-scanner.8 nut-recorder.8 man8_MANS += $(MAN_TOOL_PAGES) -HTML_TOOL_MANS = nut-scanner.html +HTML_TOOL_MANS = nut-scanner.html nut-recorder.html # CGI (--with-cgi) related manpages SRC_CGI_PAGES = \ diff --git a/docs/man/Makefile.in b/docs/man/Makefile.in index d7d8114..ef331f9 100644 --- a/docs/man/Makefile.in +++ b/docs/man/Makefile.in @@ -204,6 +204,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -217,6 +218,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -224,6 +226,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ @@ -361,9 +364,9 @@ HTML_CLIENT_MANS = \ upsrw.html \ upssched.html -SRC_TOOL_PAGES = nut-scanner.txt -MAN_TOOL_PAGES = nut-scanner.8 -HTML_TOOL_MANS = nut-scanner.html +SRC_TOOL_PAGES = nut-scanner.txt nut-recorder.txt +MAN_TOOL_PAGES = nut-scanner.8 nut-recorder.8 +HTML_TOOL_MANS = nut-scanner.html nut-recorder.html # CGI (--with-cgi) related manpages SRC_CGI_PAGES = \ diff --git a/docs/man/apcsmart-old.8 b/docs/man/apcsmart-old.8 index 7c1999d..9c44b72 100644 --- a/docs/man/apcsmart-old.8 +++ b/docs/man/apcsmart-old.8 @@ -2,12 +2,12 @@ .\" Title: apcsmart-old .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "APCSMART\-OLD" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "APCSMART\-OLD" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/apcsmart.8 b/docs/man/apcsmart.8 index b129620..692e2ba 100644 --- a/docs/man/apcsmart.8 +++ b/docs/man/apcsmart.8 @@ -2,12 +2,12 @@ .\" Title: apcsmart .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 11/17/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "APCSMART" "8" "11/17/2011" "Network UPS Tools" "NUT Manual" +.TH "APCSMART" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -96,17 +96,17 @@ These models usually come from late 1990s / pre\-2009 times\&. They are often re .RS 4 WARNING: these are not \fInatively\fR -supported by apcsmart (or apcupsd for that matter, if you\(cqre wondering)\&. Around 2007 APC (now APC Schneider) decided to go back to its proprietry roots and all the new models (SMT, SMX, SURTD) use completely different protocol and cables\&. If you purchased a new APC ups, that uses cable with rj45 on the one end, and db\-9 on the other \- then you have such model\&. Your only option to support it through +supported by apcsmart (or apcupsd for that matter, if you\(cqre wondering)\&. Around 2007 APC (now APC Schneider) decided to go back to its proprietry roots and all the new models (SMT, SMX, SURTD) use completely different protocol and cables\&. If you purchased a new APC UPS, that uses cable with rj45 on the one end, and db\-9 on the other \- then you have such model\&. Your only option to support it through \fBNUT\fR is to purchase "legacy communications card" \- part #AP9620 (google \*(AqAP9620\*(Aq for more details)\&. Or if that\*(Aqs not an option, rely on official software\&. .RE .sp -Another thing to remember is that Smart protocol is not USB protocol\&. If you have ups with both USB and serial ports, then depending on how you connect it, you will need either apcsmart or usbhid\-ups driver\&. +Another thing to remember is that Smart protocol is not USB protocol\&. If you have UPS with both USB and serial ports, then depending on how you connect it, you will need either apcsmart or usbhid\-ups driver\&. .SH "CABLING" .sp This driver expects to see a 940\-0024C cable or a clone by default\&. You can switch to the 940\-0095B dual\-mode cable support with the \*(Aqcable=\*(Aq definition described below\&. .sp -If your 940\-0024C cable is broken or missing, use this diagram to build a clone: +If your 940\-xx24X cable is broken or missing, use this diagram to build a clone: .sp http://www\&.networkupstools\&.org/cables\&.html#_940_0024c_clone .if n \{\ @@ -122,7 +122,7 @@ http://www\&.networkupstools\&.org/cables\&.html#_940_0024c_clone .ps -1 .br .sp -It was reported, that the 940\-0024E cable uses the same wiring as the 940\-0024C one\&. +The "xx" is either "00" for a short cable, or the number of feet of a longer cable\&. The "X" is a letter representing the minor revision of the physical cable and its connectors ("C" and "E" are commonly found revisions)\&. All minor revisions should use the same pin\-outs and wiring\&. .sp .5v .RE .sp @@ -144,12 +144,12 @@ This is most basic command present in probably all APC models\&. It will hiberna .PP "old" models .RS 4 -The behaviour here is unfortunately pretty primitive \- when the power returns, the ups just wakes up\&. No grace periods, no min\&. battery charge condition, etc\&. This is probably not what you want\&. +The behaviour here is unfortunately pretty primitive \- when the power returns, the UPS just wakes up\&. No grace periods, no min\&. battery charge condition, etc\&. This is probably not what you want\&. .RE .PP "new" models .RS 4 -The behaviour here is as expected \- the power is cut off after the eeprom defined grace period\&. The ups will wake up when the power returns, after the eeprom defined delay AND if the eeprom defined min\&. battery charge level is met\&. The delay is counted from the power\*(Aqs return\&. +The behaviour here is as expected \- the power is cut off after the eeprom defined grace period\&. The UPS will wake up when the power returns, after the eeprom defined delay AND if the eeprom defined min\&. battery charge level is met\&. The delay is counted from the power\*(Aqs return\&. .RE .RE .PP @@ -173,9 +173,9 @@ This is basic command used to hibernate UPS regardless if it\*(Aqs running on ba "old" models .RS 4 The behaviour is \- unfortunately \- similary primitive to -\fBS\fR\&. The ups unconditionally wakes up after nnn*6 minutes \- +\fBS\fR\&. The UPS unconditionally wakes up after nnn*6 minutes \- \fBit doesn\*(Aqt care if the power returned !\fR -If nnn = 000, then UPS will do precisely nothing\&. On those models you\*(Aqre better specifying nnn > 0, if you can estimate the kind of power problems that might be happening in your environment\&. Another thing to consider with "old" models \- you might lose the connection with the ups, until it wakes up (with +If nnn = 000, then UPS will do precisely nothing\&. On those models you\*(Aqre better specifying nnn > 0, if you can estimate the kind of power problems that might be happening in your environment\&. Another thing to consider with "old" models \- you might lose the connection with the UPS, until it wakes up (with \fBS\fR, the serial connection is kept alive)\&. .RE .PP @@ -191,16 +191,16 @@ option, or argument to one of the supported instant commands)\&. .PP \fBK\fR (delayed poweroff) .RS 4 -This is permanent poweroff \- the ups will not wake up automatically\&. On newer units, it will respect applicable eeprom variables\&. +This is permanent poweroff \- the UPS will not wake up automatically\&. On newer units, it will respect applicable eeprom variables\&. .RE .PP \fBZ\fR (instant poweroff) .RS 4 -This is also permanent poweroff \- the ups will not wake up automatically\&. The poweroff is executed immediately\&. +This is also permanent poweroff \- the UPS will not wake up automatically\&. The poweroff is executed immediately\&. .RE .SH "SHUTDOWN CONTROL BY NUT" .sp -There\*(Aqre 3 options used to control shutdown behaviour\&. +There are three options used to control the shutdown behaviour\&. .PP \fBsdtype\fR=[0\-5] .RS 4 @@ -229,7 +229,7 @@ The values permitted are from 0 to 5\&. Only one can be specified\&. Anything el .PP 0 .RS 4 -issue soft hibernate (\fBS\fR) if the ups is running on batteries, otherwise issue hard hibernate (\fB@\fR) +issue soft hibernate (\fBS\fR) if the UPS is running on batteries, otherwise issue hard hibernate (\fB@\fR) .RE .PP 1 @@ -274,7 +274,7 @@ Hard hibernate\*(Aqs additional wakeup delay can be provided by \fBawd\fR\&. .RE .SS "ADVORDER" .sp -The argument is either a word \*(Aqno\*(Aq, or a string of 1 \- 5 digits in [0 \- 4] range\&. Each digit maps to the one of shutdown methods supported by APC upses\&. Methods listed in this way are tried in order, until one of them succedes\&. +The argument is either a word \*(Aqno\*(Aq, or a string of 1 \- 5 digits in [0 \- 4] range\&. Each digit maps to the one of shutdown methods supported by APC UPSes\&. Methods listed in this way are tried in order, until one of them succedes\&. .sp If \fBadvorder\fR is undefined or set to \*(Aqno\*(Aq, \fBsdtype\fR is used instead\&. .sp @@ -351,9 +351,9 @@ battery\&.runtime < battery\&.runtime\&.low .sp Of course \- if any of the variables are not available, the appropriate condition is not checked\&. If you want to explicitly disable one of the conditions, simply override the right hand variable causing the condition to always evaluate to false (you can even provide negative numbers)\&. .sp -APC upses don\*(Aqt have battery\&.charge\&.low \- you will have to define it if you want to use such condition (prefix the variable with override\&. or default\&.)\&. +APC UPSes don\*(Aqt have battery\&.charge\&.low \- you will have to define it if you want to use such condition (prefix the variable with override\&. or default\&.)\&. .sp -"New" units have battery\&.runtime\&.low, but depending on battery quality, firmware version, calibration and ups load \- this variable can be underestimated quite a bit \- especially right after going into OB state\&. This in turn can cause LB to be asserted, which under normal conditions will cause \fBNUT\fR to initiate the shutdown\&. You might want to disable this condition entirely, when relying on \fBignorelb\fR option (this was actually the main motivation behind introduction of such feature)\&. +"New" units have battery\&.runtime\&.low, but depending on battery quality, firmware version, calibration and UPS load \- this variable can be underestimated quite a bit \- especially right after going into OB state\&. This in turn can cause LB to be asserted, which under normal conditions will cause \fBNUT\fR to initiate the shutdown\&. You might want to disable this condition entirely, when relying on \fBignorelb\fR option (this was actually the main motivation behind introduction of such feature)\&. .sp Simple example: .sp @@ -372,7 +372,7 @@ Simple example: .sp This would cause apcsmart to go into shutdown \fIonly\fR if detected battery charge < 15%\&. Runtime condition is always false in this example\&. .sp -You could ask \- why bother ? Well, the reason is already hinted above\&. APC units can be very picky about the batteries, and their firmware can underestimate the remaining runtime (especially right after going into OB state)\&. \fBignorelb\fR option and \fBoverride\&.*\fR let you remain in control of the ups, not ups in control of you\&. +You could ask \- why bother ? Well, the reason is already hinted above\&. APC units can be very picky about the batteries, and their firmware can underestimate the remaining runtime (especially right after going into OB state)\&. \fBignorelb\fR option and \fBoverride\&.*\fR let you remain in control of the UPS, not UPS in control of you\&. .sp Furthermore, this allows to specify conditions similary to how it\(cqs done in apcupsd daemon, so it should be welcome by people used to that software\&. .SH "SUPPORTED INSTANT COMMANDS" @@ -406,7 +406,7 @@ load\&.off executes "instant poweroff" .RE .sp -All the above commands must be issued 2nd time to have any effect (no less than 3 seconds, and no more than 15 seconds after the initial call)\&. Those commands are mostly useful for manual testing, when your machine is not powered by the ups you\*(Aqre testing\&. +All the above commands must be issued 2nd time to have any effect (no less than 3 seconds, and no more than 15 seconds after the initial call)\&. Those commands are mostly useful for manual testing, when your machine is not powered by the UPS you\*(Aqre testing\&. .sp Other supported commands: .sp diff --git a/docs/man/apcsmart.txt b/docs/man/apcsmart.txt index 52cf0b4..ab99624 100644 --- a/docs/man/apcsmart.txt +++ b/docs/man/apcsmart.txt @@ -53,14 +53,14 @@ division isn\'t strict by any means, and the borders between those are pretty fu WARNING: these are not _natively_ supported by apcsmart (or apcupsd for that matter, if you\'re wondering). Around 2007 APC (now APC Schneider) decided to go back to its proprietry roots and all the new models (SMT, SMX, SURTD) use - completely different protocol and cables. If you purchased a new APC ups, + completely different protocol and cables. If you purchased a new APC UPS, that uses cable with rj45 on the one end, and db-9 on the other - then you have such model. Your only option to support it through *NUT* is to purchase "legacy communications card" - part #AP9620 (google \'AP9620' for more details). Or if that\'s not an option, rely on official software. Another thing to remember is that Smart protocol is not USB protocol. If you -have ups with both USB and serial ports, then depending on how you connect it, +have UPS with both USB and serial ports, then depending on how you connect it, you will need either apcsmart or usbhid-ups driver. CABLING @@ -70,13 +70,16 @@ This driver expects to see a 940-0024C cable or a clone by default. You can switch to the 940-0095B dual-mode cable support with the \'cable=' definition described below. -If your 940-0024C cable is broken or missing, use this diagram to build +If your 940-xx24X cable is broken or missing, use this diagram to build a clone: http://www.networkupstools.org/cables.html#_940_0024c_clone -NOTE: It was reported, that the 940-0024E cable uses the same wiring as the -940-0024C one. +NOTE: The "xx" is either "00" for a short cable, or the number of feet +of a longer cable. The "X" is a letter representing the minor revision +of the physical cable and its connectors ("C" and "E" are commonly found +revisions). All minor revisions should use the same pin-outs and +wiring. You can specify alternate cable in linkman:ups.conf[5]: @@ -99,12 +102,12 @@ behaviour quite a bit, depending on the model. "old" models::: The behaviour here is unfortunately pretty primitive - when the power - returns, the ups just wakes up. No grace periods, no min. battery + returns, the UPS just wakes up. No grace periods, no min. battery charge condition, etc. This is probably not what you want. "new" models::: The behaviour here is as expected - the power is cut off after the - eeprom defined grace period. The ups will wake up when the power + eeprom defined grace period. The UPS will wake up when the power returns, after the eeprom defined delay AND if the eeprom defined min. battery charge level is met. The delay is counted from the power\'s return. @@ -125,13 +128,13 @@ command if your UPS supports it (and is not too old, see below). + -- "old" models::: - The behaviour is - unfortunately - similary primitive to *S*. The ups + The behaviour is - unfortunately - similary primitive to *S*. The UPS unconditionally wakes up after $$nnn*6$$ minutes - *it doesn\'t care if the power returned !* If nnn = 000, then UPS will do precisely nothing. On those models you\'re better specifying nnn > 0, if you can estimate the kind of power problems that might be happening in your environment. Another thing to consider with "old" models - you might lose the - connection with the ups, until it wakes up (with *S*, the serial + connection with the UPS, until it wakes up (with *S*, the serial connection is kept alive). "new" models::: @@ -147,17 +150,17 @@ NUT also supports such variation. You have to provide exactly 2 digits to trigger it (*awd* option, or argument to one of the supported instant commands). *K* (delayed poweroff):: - This is permanent poweroff - the ups will not wake up automatically. On + This is permanent poweroff - the UPS will not wake up automatically. On newer units, it will respect applicable eeprom variables. *Z* (instant poweroff):: - This is also permanent poweroff - the ups will not wake up automatically. The - poweroff is executed immediately. + This is also permanent poweroff - the UPS will not wake up automatically. + The poweroff is executed immediately. SHUTDOWN CONTROL BY NUT ----------------------- -There\'re 3 options used to control shutdown behaviour. +There are three options used to control the shutdown behaviour. *sdtype*=[0-5]:: This option takes a single digit (0-5) as an argument. See below for @@ -188,7 +191,7 @@ The values permitted are from 0 to 5. Only one can be specified. Anything else will cause apcsmart to exit. 0:: -issue soft hibernate (*S*) if the ups is running on batteries, otherwise issue +issue soft hibernate (*S*) if the UPS is running on batteries, otherwise issue hard hibernate (*@*) 1:: issue soft hibernate (*S*) (if on batteries), and if it fails (or on mains) - @@ -208,7 +211,7 @@ ADVORDER ~~~~~~~~ The argument is either a word \'no', or a string of 1 - 5 digits in [0 - 4] -range. Each digit maps to the one of shutdown methods supported by APC upses. +range. Each digit maps to the one of shutdown methods supported by APC UPSes. Methods listed in this way are tried in order, until one of them succedes. If *advorder* is undefined or set to \'no', *sdtype* is used instead. @@ -245,11 +248,11 @@ is not checked. If you want to explicitly disable one of the conditions, simply override the right hand variable causing the condition to always evaluate to false (you can even provide negative numbers). -APC upses don\'t have battery.charge.low - you will have to define it if you want +APC UPSes don\'t have battery.charge.low - you will have to define it if you want to use such condition (prefix the variable with override. or default.). "New" units have battery.runtime.low, but depending on battery quality, firmware -version, calibration and ups load - this variable can be underestimated quite a bit - +version, calibration and UPS load - this variable can be underestimated quite a bit - especially right after going into OB state. This in turn can cause LB to be asserted, which under normal conditions will cause *NUT* to initiate the shutdown. You might want to disable this condition entirely, when relying on @@ -272,7 +275,7 @@ This would cause apcsmart to go into shutdown _only_ if detected battery charge You could ask - why bother ? Well, the reason is already hinted above. APC units can be very picky about the batteries, and their firmware can underestimate the remaining runtime (especially right after going into OB state). *ignorelb* -option and *$$override.*$$* let you remain in control of the ups, not ups in control +option and *$$override.*$$* let you remain in control of the UPS, not UPS in control of you. Furthermore, this allows to specify conditions similary to how it's done in @@ -298,7 +301,7 @@ executes "instant poweroff" All the above commands must be issued 2nd time to have any effect (no less than 3 seconds, and no more than 15 seconds after the initial call). Those commands are -mostly useful for manual testing, when your machine is not powered by the ups +mostly useful for manual testing, when your machine is not powered by the UPS you\'re testing. Other supported commands: diff --git a/docs/man/bcmxcp.8 b/docs/man/bcmxcp.8 index 8ebc50d..bee2f2c 100644 --- a/docs/man/bcmxcp.8 +++ b/docs/man/bcmxcp.8 @@ -2,12 +2,12 @@ .\" Title: bcmxcp .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "BCMXCP" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "BCMXCP" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/bcmxcp_usb.8 b/docs/man/bcmxcp_usb.8 index 4423f21..0f31d4f 100644 --- a/docs/man/bcmxcp_usb.8 +++ b/docs/man/bcmxcp_usb.8 @@ -2,12 +2,12 @@ .\" Title: bcmxcp_usb .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "BCMXCP_USB" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "BCMXCP_USB" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/belkin.8 b/docs/man/belkin.8 index bc70d65..2b9862f 100644 --- a/docs/man/belkin.8 +++ b/docs/man/belkin.8 @@ -2,12 +2,12 @@ .\" Title: belkin .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "BELKIN" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "BELKIN" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/belkinunv.8 b/docs/man/belkinunv.8 index cbec5e2..626e5ca 100644 --- a/docs/man/belkinunv.8 +++ b/docs/man/belkinunv.8 @@ -2,12 +2,12 @@ .\" Title: belkinunv .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "BELKINUNV" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "BELKINUNV" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/bestfcom.8 b/docs/man/bestfcom.8 index 3c238fc..dd57320 100644 --- a/docs/man/bestfcom.8 +++ b/docs/man/bestfcom.8 @@ -2,12 +2,12 @@ .\" Title: bestfcom .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "BESTFCOM" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "BESTFCOM" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/bestfortress.8 b/docs/man/bestfortress.8 index 56e2137..e26767f 100644 --- a/docs/man/bestfortress.8 +++ b/docs/man/bestfortress.8 @@ -2,12 +2,12 @@ .\" Title: bestfortress .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "BESTFORTRESS" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "BESTFORTRESS" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/bestuferrups.8 b/docs/man/bestuferrups.8 index b687c5c..03319a1 100644 --- a/docs/man/bestuferrups.8 +++ b/docs/man/bestuferrups.8 @@ -2,12 +2,12 @@ .\" Title: bestuferrups .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "BESTUFERRUPS" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "BESTUFERRUPS" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/bestups.8 b/docs/man/bestups.8 index e2f8ed2..0f2f6af 100644 --- a/docs/man/bestups.8 +++ b/docs/man/bestups.8 @@ -2,12 +2,12 @@ .\" Title: bestups .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "BESTUPS" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "BESTUPS" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/blazer.8 b/docs/man/blazer.8 index 4aa6382..67d718a 100644 --- a/docs/man/blazer.8 +++ b/docs/man/blazer.8 @@ -2,12 +2,12 @@ .\" Title: blazer .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 12/17/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "BLAZER" "8" "12/17/2011" "Network UPS Tools" "NUT Manual" +.TH "BLAZER" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,7 +34,7 @@ blazer \- Driver for Megatec/Q1 protocol serial (blazer_ser) and USB (blazer_usb This man page only documents the hardware\-specific features of the blazer driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. .SH "SUPPORTED HARDWARE" .sp -The blazer 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\(cqt been tested\&. +The blazer driver is known to work with various UPSes from Blazer, Energy Sistem, Fenton Technologies, General Electric, Mustek and many others\&. The NUT compatibility table lists all the known supported models\&. Keep in mind, however, that other models not listed there may also be supported, but haven\(cqt been tested\&. .sp All devices with a serial interface (use the \fBblazer_ser\fR driver) and many with a USB interface (use the \fBblazer_usb\fR driver) are supported\&. .SH "EXTRA ARGUMENTS" @@ -109,7 +109,7 @@ Parameter used in the (optional) runtime estimation\&. This takes two runtimes a .RS 4 .\} .nf -runtimecal = 270,100,720,50 +runtimecal = 240,100,720,50 .fi .if n \{\ .RE diff --git a/docs/man/blazer.txt b/docs/man/blazer.txt index 3e0e46b..5a155b8 100644 --- a/docs/man/blazer.txt +++ b/docs/man/blazer.txt @@ -16,9 +16,10 @@ SUPPORTED HARDWARE ------------------ The blazer 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. +Sistem, Fenton Technologies, General Electric, Mustek and many others. +The NUT compatibility table lists all the known supported models. Keep +in mind, however, that other models not listed there may also be supported, +but haven't been tested. All devices with a serial interface (use the *blazer_ser* driver) and many with a USB interface (use the *blazer_usb* driver) are supported. @@ -90,7 +91,7 @@ at different loads. Typically, this uses the runtime at full load and the runtime at half load. For instance, if your UPS has a rated runtime of 240 seconds at full load and 720 seconds at half load, you would enter + - runtimecal = 270,100,720,50 + runtimecal = 240,100,720,50 + The first load should always be higher than the second. If you have values available for loads other than 100 and 50 % respectively, you can use those diff --git a/docs/man/clone.8 b/docs/man/clone.8 index d971078..a19e23c 100644 --- a/docs/man/clone.8 +++ b/docs/man/clone.8 @@ -2,12 +2,12 @@ .\" Title: clone .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "CLONE" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "CLONE" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/dummy-ups.8 b/docs/man/dummy-ups.8 index acb5fc9..fd0bc6f 100644 --- a/docs/man/dummy-ups.8 +++ b/docs/man/dummy-ups.8 @@ -2,12 +2,12 @@ .\" Title: dummy-ups .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "DUMMY\-UPS" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "DUMMY\-UPS" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/etapro.8 b/docs/man/etapro.8 index b241076..121131b 100644 --- a/docs/man/etapro.8 +++ b/docs/man/etapro.8 @@ -2,12 +2,12 @@ .\" Title: etapro .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "ETAPRO" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "ETAPRO" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/everups.8 b/docs/man/everups.8 index 0e66fdb..de926f2 100644 --- a/docs/man/everups.8 +++ b/docs/man/everups.8 @@ -2,12 +2,12 @@ .\" Title: everups .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "EVERUPS" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "EVERUPS" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/gamatronic.8 b/docs/man/gamatronic.8 index 4c687ea..ed1a1b0 100644 --- a/docs/man/gamatronic.8 +++ b/docs/man/gamatronic.8 @@ -2,12 +2,12 @@ .\" Title: gamatronic .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "GAMATRONIC" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "GAMATRONIC" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/genericups.8 b/docs/man/genericups.8 index 683fbbe..4d77ca4 100644 --- a/docs/man/genericups.8 +++ b/docs/man/genericups.8 @@ -2,12 +2,12 @@ .\" Title: genericups .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "GENERICUPS" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "GENERICUPS" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/hosts.conf.5 b/docs/man/hosts.conf.5 index 3d3dcce..dafb543 100644 --- a/docs/man/hosts.conf.5 +++ b/docs/man/hosts.conf.5 @@ -2,12 +2,12 @@ .\" Title: hosts.conf .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "HOSTS\&.CONF" "5" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "HOSTS\&.CONF" "5" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/isbmex.8 b/docs/man/isbmex.8 index e6216a6..04a46d4 100644 --- a/docs/man/isbmex.8 +++ b/docs/man/isbmex.8 @@ -2,12 +2,12 @@ .\" Title: isbmex .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "ISBMEX" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "ISBMEX" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/ivtscd.8 b/docs/man/ivtscd.8 index 01835c8..66b5ae9 100644 --- a/docs/man/ivtscd.8 +++ b/docs/man/ivtscd.8 @@ -2,12 +2,12 @@ .\" Title: ivtscd .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "IVTSCD" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "IVTSCD" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/libupsclient-config.1 b/docs/man/libupsclient-config.1 index 8b37d24..e6d281e 100644 --- a/docs/man/libupsclient-config.1 +++ b/docs/man/libupsclient-config.1 @@ -2,12 +2,12 @@ .\" Title: libupsclient-config .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "LIBUPSCLIENT\-CONFIG" "1" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "LIBUPSCLIENT\-CONFIG" "1" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/liebert-esp2.8 b/docs/man/liebert-esp2.8 index 9f8faf6..db12ebc 100644 --- a/docs/man/liebert-esp2.8 +++ b/docs/man/liebert-esp2.8 @@ -2,12 +2,12 @@ .\" Title: liebert-esp2 .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "LIEBERT\-ESP2" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "LIEBERT\-ESP2" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/liebert.8 b/docs/man/liebert.8 index cab4379..cc4ab97 100644 --- a/docs/man/liebert.8 +++ b/docs/man/liebert.8 @@ -2,12 +2,12 @@ .\" Title: liebert .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "LIEBERT" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "LIEBERT" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/masterguard.8 b/docs/man/masterguard.8 index f4b9bd3..4dd5aca 100644 --- a/docs/man/masterguard.8 +++ b/docs/man/masterguard.8 @@ -2,12 +2,12 @@ .\" Title: masterguard .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "MASTERGUARD" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "MASTERGUARD" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/metasys.8 b/docs/man/metasys.8 index 4c77eb7..4bcbaf0 100644 --- a/docs/man/metasys.8 +++ b/docs/man/metasys.8 @@ -2,12 +2,12 @@ .\" Title: metasys .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "METASYS" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "METASYS" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/mge-shut.8 b/docs/man/mge-shut.8 index accde1b..a2188cd 100644 --- a/docs/man/mge-shut.8 +++ b/docs/man/mge-shut.8 @@ -2,12 +2,12 @@ .\" Title: mge-shut .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "MGE\-SHUT" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "MGE\-SHUT" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/mge-utalk.8 b/docs/man/mge-utalk.8 index 7bdabe1..670c4be 100644 --- a/docs/man/mge-utalk.8 +++ b/docs/man/mge-utalk.8 @@ -2,12 +2,12 @@ .\" Title: mge-utalk .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "MGE\-UTALK" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "MGE\-UTALK" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/microdowell.8 b/docs/man/microdowell.8 index fe31f6b..f888340 100644 --- a/docs/man/microdowell.8 +++ b/docs/man/microdowell.8 @@ -2,12 +2,12 @@ .\" Title: microdowell .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "MICRODOWELL" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "MICRODOWELL" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/netxml-ups.8 b/docs/man/netxml-ups.8 index 61957ed..69df2fe 100644 --- a/docs/man/netxml-ups.8 +++ b/docs/man/netxml-ups.8 @@ -2,12 +2,12 @@ .\" Title: netxml-ups .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NETXML\-UPS" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "NETXML\-UPS" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nut-ipmipsu.8 b/docs/man/nut-ipmipsu.8 index 72c0320..9ff396a 100644 --- a/docs/man/nut-ipmipsu.8 +++ b/docs/man/nut-ipmipsu.8 @@ -2,12 +2,12 @@ .\" Title: nut-ipmipsu .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUT\-IPMIPSU" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "NUT\-IPMIPSU" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nut-recorder.8 b/docs/man/nut-recorder.8 new file mode 100644 index 0000000..de8969d --- /dev/null +++ b/docs/man/nut-recorder.8 @@ -0,0 +1,103 @@ +'\" t +.\" Title: nut-recorder +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.75.2 +.\" Date: 05/21/2012 +.\" Manual: NUT Manual +.\" Source: Network UPS Tools +.\" Language: English +.\" +.TH "NUT\-RECORDER" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +nut-recorder \- utility to record device status and values changes +.SH "SYNOPSIS" +.sp +\fBnut\-recorder\fR \fIdevice\-name\fR [output\-file] [interval] +.SH "DESCRIPTION" +.sp +\fBnut\-recorder\fR is an utility to record device running sequence (Ie power failures or any other change) through a NUT data server, and dump it in a \&.seq format\&. +.sp +The \&.seq file can then be used by the \fBdummy-ups\fR(8) driver to replay the sequence\&. +.SH "OPTIONS" +.PP +\fIdevice\-name\fR +.RS 4 +Record the changes of that device\&. The format for this option is +\fIdevname[@hostname[:port]]\fR\&. The default hostname is "localhost"\&. +.RE +.PP +\fIoutput\-file\fR +.RS 4 +Optional\&. Data will be saved to this file\&. The default is +\fIdummy\-device\&.seq\fR\&. +.RE +.PP +\fIinterval\fR +.RS 4 +Optional\&. The status of the device will be checked every +\fIinterval\fR\&. The default is 5 seconds\&. +.RE +.SH "EXAMPLES" +.sp +To record data from \fIups1@host1\fR every 10 seconds: +.sp +.if n \{\ +.RS 4 +.\} +.nf +$ nut\-recorder ups1@host1\*(Aq ups1\-output\&.seq 10 +\&. \&. \&. +battery\&.charge: 100\&.0 +battery\&.voltage: 13\&.9 +battery\&.voltage\&.nominal: 13\&.6 +ups\&.status: OL +\&. \&. \&. +battery\&.charge: 90\&.0 +ups\&.status: OB +\&. \&. \&. +.fi +.if n \{\ +.RE +.\} +.sp +You can then define a dummy device in \fBups.conf\fR(5): +.sp +.if n \{\ +.RS 4 +.\} +.nf +[ups\-test] + driver = dummy\-ups + port = ups1\-output\&.seq +.fi +.if n \{\ +.RE +.\} +.SH "AUTHOR" +.sp +Arnaud Quette +.SH "SEE ALSO" +.sp +\fBdummy-ups\fR(8) +.SH "INTERNET RESOURCES" +.sp +The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/nut-recorder.txt b/docs/man/nut-recorder.txt new file mode 100644 index 0000000..d4a22ed --- /dev/null +++ b/docs/man/nut-recorder.txt @@ -0,0 +1,73 @@ +NUT-RECORDER(8) +=============== + + +NAME +---- +nut-recorder - utility to record device status and values changes + +SYNOPSIS +-------- +*nut-recorder* 'device-name' [output-file] [interval] + +DESCRIPTION +----------- +*nut-recorder* is an utility to record device running sequence (Ie +power failures or any other change) through a NUT data server, and +dump it in a .seq format. + +The .seq file can then be used by the linkman:dummy-ups[8] driver +to replay the sequence. + +OPTIONS +------- +'device-name':: + +Record the changes of that device. The format for this option is +'devname[@hostname[:port]]'. The default hostname is "localhost". + +'output-file':: + +Optional. Data will be saved to this file. The default is +'dummy-device.seq'. + +'interval':: + +Optional. The status of the device will be checked every 'interval'. +The default is 5 seconds. + +EXAMPLES +-------- + +To record data from 'ups1@host1' every 10 seconds: + + $ nut-recorder ups1@host1' ups1-output.seq 10 + . . . + battery.charge: 100.0 + battery.voltage: 13.9 + battery.voltage.nominal: 13.6 + ups.status: OL + . . . + battery.charge: 90.0 + ups.status: OB + . . . + +You can then define a dummy device in linkman:ups.conf[5]: + + [ups-test] + driver = dummy-ups + port = ups1-output.seq + +AUTHOR +------ +Arnaud Quette + +SEE ALSO +-------- + +linkman:dummy-ups[8] + +INTERNET RESOURCES +------------------ + +The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/nut-scanner.8 b/docs/man/nut-scanner.8 index 2b0c1f1..04e926c 100644 --- a/docs/man/nut-scanner.8 +++ b/docs/man/nut-scanner.8 @@ -2,12 +2,12 @@ .\" Title: nut-scanner .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 01/03/2012 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUT\-SCANNER" "8" "01/03/2012" "Network UPS Tools" "NUT Manual" +.TH "NUT\-SCANNER" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -37,6 +37,9 @@ nut-scanner \- scan communication buses for NUT devices .SH "DESCRIPTION" .sp \fBnut\-scanner\fR scans available communication buses and displays any NUT\-compatible devices it has found\&. +.SH "INSTALLATION" +.sp +\fBnut\-scanner\fR is always built by default\&. However, available options (USB, SNMP, IPMI, \&...) will vary according to the available compile time and runtime dependencies\&. For example, if Net\-SNMP is installed, thus providing libsnmp (\&.so or \&.dll) and headers, both during compilation and runtime, then SNMP discovery will be available\&. .SH "OPTIONS" .PP \fB\-h\fR diff --git a/docs/man/nut-scanner.txt b/docs/man/nut-scanner.txt index 90429fc..2f517ee 100644 --- a/docs/man/nut-scanner.txt +++ b/docs/man/nut-scanner.txt @@ -18,6 +18,15 @@ DESCRIPTION *nut-scanner* scans available communication buses and displays any NUT-compatible devices it has found. +INSTALLATION +------------ + +*nut-scanner* is always built by default. However, available options +(USB, SNMP, IPMI, ...) will vary according to the available compile time +and runtime dependencies. For example, if Net-SNMP is installed, thus +providing libsnmp (.so or .dll) and headers, both during compilation +and runtime, then SNMP discovery will be available. + OPTIONS ------- *-h*:: @@ -159,7 +168,6 @@ To scan NUT servers with a timeout of 10 seconds on IP range 192.168.0.0 to 192. *nut-scanner -O -t 10 -m 192.168.0.0/25* - SEE ALSO -------- diff --git a/docs/man/nut.conf.5 b/docs/man/nut.conf.5 index 199ac8f..4231178 100644 --- a/docs/man/nut.conf.5 +++ b/docs/man/nut.conf.5 @@ -2,12 +2,12 @@ .\" Title: nut.conf .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUT\&.CONF" "5" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "NUT\&.CONF" "5" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,6 +36,11 @@ This file attempts to standardize the various files being found in different ins Distribution\(cqs init script should source this file in order to determine which components have to be started\&. .sp Blank lines are ignored\&. Lines with a hash (\fI#\fR) character at the 1st position of the line are ignored, too\&. They can be used to add comments\&. +.SH "IMPORTANT NOTE" +.sp +This file is intended to be sourced by shell scripts\&. You MUST NOT use spaces around the equal sign! +.sp +Refer to the EXAMPLE section for illustrations\&. .SH "DIRECTIVES" .PP \fBMODE\fR @@ -123,7 +128,7 @@ this workaround might be dangerous under some circumstances\&. Please read http: .RS 4 .\} .nf -MODE = none +MODE=none .fi .if n \{\ .RE @@ -133,7 +138,7 @@ MODE = none .RS 4 .\} .nf -UPSD_OPTIONS = "" +UPSD_OPTIONS="" .fi .if n \{\ .RE @@ -143,7 +148,7 @@ UPSD_OPTIONS = "" .RS 4 .\} .nf -UPSMON_OPTIONS = "" +UPSMON_OPTIONS="" .fi .if n \{\ .RE @@ -153,7 +158,7 @@ UPSMON_OPTIONS = "" .RS 4 .\} .nf -# POWEROFF_WAIT = 15m +# POWEROFF_WAIT=15m .fi .if n \{\ .RE diff --git a/docs/man/nut.conf.txt b/docs/man/nut.conf.txt index 26ed896..074ff95 100644 --- a/docs/man/nut.conf.txt +++ b/docs/man/nut.conf.txt @@ -19,6 +19,14 @@ Blank lines are ignored. Lines with a hash ('#') character at the 1st position of the line are ignored, too. They can be used to add comments. +IMPORTANT NOTE +-------------- + +This file is intended to be sourced by shell scripts. +You MUST NOT use spaces around the equal sign! + +Refer to the EXAMPLE section for illustrations. + DIRECTIVES ---------- @@ -76,13 +84,13 @@ EXAMPLE # /etc/nut/nut.conf. See nut.conf(5) - MODE = none + MODE=none - UPSD_OPTIONS = "" + UPSD_OPTIONS="" - UPSMON_OPTIONS = "" + UPSMON_OPTIONS="" - # POWEROFF_WAIT = 15m + # POWEROFF_WAIT=15m INTEGRATION ----------- diff --git a/docs/man/nutscan.3 b/docs/man/nutscan.3 index 68658f8..022ede7 100644 --- a/docs/man/nutscan.3 +++ b/docs/man/nutscan.3 @@ -2,12 +2,12 @@ .\" Title: nutscan .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 11/03/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN" "3" "11/03/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_add_device_to_device.3 b/docs/man/nutscan_add_device_to_device.3 index 47641ee..91c0153 100644 --- a/docs/man/nutscan_add_device_to_device.3 +++ b/docs/man/nutscan_add_device_to_device.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_add_device_to_device .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_ADD_DEVICE_T" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_ADD_DEVICE_T" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_add_option_to_device.3 b/docs/man/nutscan_add_option_to_device.3 index fb8244e..4075e39 100644 --- a/docs/man/nutscan_add_option_to_device.3 +++ b/docs/man/nutscan_add_option_to_device.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_add_option_to_device .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_ADD_OPTION_T" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_ADD_OPTION_T" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_cidr_to_ip.3 b/docs/man/nutscan_cidr_to_ip.3 index 7157550..56a6454 100644 --- a/docs/man/nutscan_cidr_to_ip.3 +++ b/docs/man/nutscan_cidr_to_ip.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_cidr_to_ip .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_CIDR_TO_IP" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_CIDR_TO_IP" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_display_parsable.3 b/docs/man/nutscan_display_parsable.3 index 4dd2820..aee3034 100644 --- a/docs/man/nutscan_display_parsable.3 +++ b/docs/man/nutscan_display_parsable.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_display_parsable .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_DISPLAY_PARS" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_DISPLAY_PARS" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_display_ups_conf.3 b/docs/man/nutscan_display_ups_conf.3 index cc04ade..cc8d242 100644 --- a/docs/man/nutscan_display_ups_conf.3 +++ b/docs/man/nutscan_display_ups_conf.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_display_ups_conf .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_DISPLAY_UPS_" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_DISPLAY_UPS_" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_free_device.3 b/docs/man/nutscan_free_device.3 index 445bc0b..d3d462c 100644 --- a/docs/man/nutscan_free_device.3 +++ b/docs/man/nutscan_free_device.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_free_device .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_FREE_DEVICE" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_FREE_DEVICE" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_init.3 b/docs/man/nutscan_init.3 index bc89e84..24c62ba 100644 --- a/docs/man/nutscan_init.3 +++ b/docs/man/nutscan_init.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_init .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 12/15/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_INIT" "3" "12/15/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_INIT" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_new_device.3 b/docs/man/nutscan_new_device.3 index 511d7e6..028b201 100644 --- a/docs/man/nutscan_new_device.3 +++ b/docs/man/nutscan_new_device.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_new_device .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_NEW_DEVICE" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_NEW_DEVICE" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_scan_avahi.3 b/docs/man/nutscan_scan_avahi.3 index b9eda98..2bf5d71 100644 --- a/docs/man/nutscan_scan_avahi.3 +++ b/docs/man/nutscan_scan_avahi.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_scan_avahi .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 12/15/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_SCAN_AVAHI" "3" "12/15/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_SCAN_AVAHI" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_scan_ipmi.3 b/docs/man/nutscan_scan_ipmi.3 index cfd2041..890c96c 100644 --- a/docs/man/nutscan_scan_ipmi.3 +++ b/docs/man/nutscan_scan_ipmi.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_scan_ipmi .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 12/15/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_SCAN_IPMI" "3" "12/15/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_SCAN_IPMI" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_scan_nut.3 b/docs/man/nutscan_scan_nut.3 index 1ce7578..d40b690 100644 --- a/docs/man/nutscan_scan_nut.3 +++ b/docs/man/nutscan_scan_nut.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_scan_nut .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 12/15/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_SCAN_NUT" "3" "12/15/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_SCAN_NUT" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_scan_snmp.3 b/docs/man/nutscan_scan_snmp.3 index 972e05e..dcdaa04 100644 --- a/docs/man/nutscan_scan_snmp.3 +++ b/docs/man/nutscan_scan_snmp.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_scan_snmp .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 12/15/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_SCAN_SNMP" "3" "12/15/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_SCAN_SNMP" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_scan_usb.3 b/docs/man/nutscan_scan_usb.3 index 7c95d00..40968c0 100644 --- a/docs/man/nutscan_scan_usb.3 +++ b/docs/man/nutscan_scan_usb.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_scan_usb .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 12/15/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_SCAN_USB" "3" "12/15/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_SCAN_USB" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutscan_scan_xml_http.3 b/docs/man/nutscan_scan_xml_http.3 index 5d23cc5..d3c42cd 100644 --- a/docs/man/nutscan_scan_xml_http.3 +++ b/docs/man/nutscan_scan_xml_http.3 @@ -2,12 +2,12 @@ .\" Title: nutscan_scan_xml_http .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 12/15/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTSCAN_SCAN_XML_HTT" "3" "12/15/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTSCAN_SCAN_XML_HTT" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/nutupsdrv.8 b/docs/man/nutupsdrv.8 index e6bc25c..262ddbc 100644 --- a/docs/man/nutupsdrv.8 +++ b/docs/man/nutupsdrv.8 @@ -2,12 +2,12 @@ .\" Title: nutupsdrv .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "NUTUPSDRV" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "NUTUPSDRV" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/oneac.8 b/docs/man/oneac.8 index 064dd60..b468b38 100644 --- a/docs/man/oneac.8 +++ b/docs/man/oneac.8 @@ -2,12 +2,12 @@ .\" Title: oneac .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "ONEAC" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "ONEAC" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,7 +34,53 @@ oneac \- Driver for Oneac UPS equipment This man page only documents the hardware\-specific features of the oneac driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. .SH "SUPPORTED HARDWARE" .sp -This driver supports Oneac EG and ON UPS equipment with the Advanced Interface\&. If your UPS is equipped with the Basic Interface card, use the genericups driver\&. +This driver supports various Oneac UPS families: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +EG (late 80s, early 90s, plug\-in serial interface card) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +ON (early and mid\-90s, plug\-in serial interface card) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +OZ (mid\-90s on, DB\-25 std\&., interface slot) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +OB (early 2000\(cqs on, big cabinet, DB\-25 std\&., interface slot) +.RE +.sp +If your UPS is equipped with the Basic Interface card, use the \fBgenericups\fR(8) driver\&. .SH "EXTRA ARGUMENTS" .sp This driver supports the following optional settings in the \fBups.conf\fR(5) file: @@ -43,18 +89,39 @@ This driver supports the following optional settings in the \fBups.conf\fR(5) fi .RS 4 Change battery test time from the 2 minute default\&. .RE +.PP +\fBoffdelay\fR=\fInum\fR +.RS 4 +Change shutdown delay time from 0 second default\&. +.RE .SH "INSTANT COMMANDS" .sp -This driver supports the following Instant Commands\&. +This driver supports the following Instant Commands\&. (See \fBupscmd\fR(8)) +.SS "All UPS units" .PP -\fBreset\&.input\&.minmax\fR +\fBshutdown\&.return\fR .RS 4 -Reset the minimum and maximum input line voltage values seen since the last reset or power on\&. +Turn off the load possibly after a delay and return when power is back\&. .RE .PP -\fBtest\&.battery\&.start\fR +\fBshutdown\&.stop\fR .RS 4 -Start a battery test\&. The default time is 2 minutes\&. This time can be set in the +Stop a shutdown in progress\&. +.RE +.PP +\fBshutdown\&.reboot\fR +.RS 4 +Shut down the load briefly while rebooting the UPS\&. +.RE +.PP +\fBtest\&.failure\&.start\fR +.RS 4 +Starts a 15 second long simulation of an input power failure\&. +.RE +.PP +\fBtest\&.battery\&.start\&.quick\fR +.RS 4 +Start a "quick" battery test\&. The default time is 2 minutes\&. This time can be set in the \fBups\&.conf\fR file\&. See \fBtestime\fR @@ -65,14 +132,81 @@ above\&. .RS 4 Stops a battery test that is in progress\&. .RE +.SS "All ON UPS units" .PP -\fBtest\&.failure\&.start\fR +\fBreset\&.input\&.minmax\fR .RS 4 -Starts a 15 second long simulation of an input power failure\&. +Reset the minimum and maximum input line voltage values seen since the last reset or power on\&. +.RE +.SS "Newer ON UPS units" +.PP +\fBtest\&.panel\&.start\fR +.RS 4 +Start testing the UPS panel\&. +.RE +.PP +\fBtest\&.battery\&.start\&.deep\fR +.RS 4 +Start a "deep" battery test\&. This test runs the UPS until the low battery point and then returns to the AC line\&. +.RE +.PP +\fBreset\&.input\&.minmax\fR +.RS 4 +Reset the minimum and maximum input line voltage values seen since the last reset or power on\&. +.RE +.PP +\fBbeeper\&.enable\fR +.RS 4 +Enable UPS beeper/buzzer\&. +.RE +.PP +\fBbeeper\&.disable\fR +.RS 4 +Disable UPS beeper/buzzer\&. +.RE +.PP +\fBbeeper\&.mute\fR +.RS 4 +Mutes the UPS beeper/buzzer for the current alarm condition(s)\&. +.RE +.SH "WRITABLE VARIABLES" +.sp +See \fBupsrw\fR(8) to see what variables are writable for the UPS\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +If your UPS supports writing battery\&.runtime\&.low, the new set value is to be entered in minutes (up to 99) but the reported value is reported in seconds (set value * 60)\&. +.sp .5v +.RE +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.sp +If your UPS supports input\&.transfer\&.low and input\&.transfer\&.high, those values are used to create an allowable output range\&. The UPS will do what it can to keep the output voltage value within the defined range (for example: tap change or switch to inverter)\&. +.sp .5v .RE .SH "AUTHOR" .sp -Eric Lawson +Bill Elliot , Eric Lawson .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/oneac.txt b/docs/man/oneac.txt index 88f6aa6..fe6c779 100644 --- a/docs/man/oneac.txt +++ b/docs/man/oneac.txt @@ -15,9 +15,16 @@ linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ -This driver supports Oneac EG and ON UPS equipment with the -Advanced Interface. If your UPS is equipped with the Basic -Interface card, use the genericups driver. + +This driver supports various Oneac UPS families: + + - EG (late 80s, early 90s, plug-in serial interface card) + - ON (early and mid-90s, plug-in serial interface card) + - OZ (mid-90s on, DB-25 std., interface slot) + - OB (early 2000's on, big cabinet, DB-25 std., interface slot) + +If your UPS is equipped with the Basic Interface card, use the +linkman:genericups[8] driver. EXTRA ARGUMENTS --------------- @@ -27,27 +34,83 @@ linkman:ups.conf[5] file: *testtime*='num':: Change battery test time from the 2 minute default. +*offdelay*='num':: +Change shutdown delay time from 0 second default. + INSTANT COMMANDS ---------------- This driver supports the following Instant Commands. +(See linkman:upscmd[8]) -*reset.input.minmax*:: -Reset the minimum and maximum input line voltage values -seen since the last reset or power on. +All UPS units +~~~~~~~~~~~~~ -*test.battery.start*:: -Start a battery test. The default time is 2 minutes. This -time can be set in the *ups.conf* file. See *testime* above. +*shutdown.return*:: +Turn off the load possibly after a delay and return when power is back. -*test.battery.stop*:: -Stops a battery test that is in progress. +*shutdown.stop*:: +Stop a shutdown in progress. + +*shutdown.reboot*:: +Shut down the load briefly while rebooting the UPS. *test.failure.start*:: Starts a 15 second long simulation of an input power failure. +*test.battery.start.quick*:: +Start a "quick" battery test. The default time is 2 minutes. This +time can be set in the *ups.conf* file. See *testime* above. + +*test.battery.stop*:: +Stops a battery test that is in progress. + +All ON UPS units +~~~~~~~~~~~~~~~~ + +*reset.input.minmax*:: +Reset the minimum and maximum input line voltage values +seen since the last reset or power on. + +Newer ON UPS units +~~~~~~~~~~~~~~~~~~ + +*test.panel.start*:: +Start testing the UPS panel. + +*test.battery.start.deep*:: +Start a "deep" battery test. This test runs the UPS until the low +battery point and then returns to the AC line. + +*reset.input.minmax*:: +Reset the minimum and maximum input line voltage values +seen since the last reset or power on. + +*beeper.enable*:: +Enable UPS beeper/buzzer. + +*beeper.disable*:: +Disable UPS beeper/buzzer. + +*beeper.mute*:: +Mutes the UPS beeper/buzzer for the current alarm condition(s). + +Writable Variables +------------------ +See linkman:upsrw[8] to see what variables are writable for the UPS. + +NOTE: If your UPS supports writing battery.runtime.low, the new set value +is to be entered in minutes (up to 99) but the reported value is reported +in seconds (set value * 60). + +NOTE: If your UPS supports input.transfer.low and input.transfer.high, +those values are used to create an allowable output range. The UPS +will do what it can to keep the output voltage value within the +defined range (for example: tap change or switch to inverter). + AUTHOR ------ +Bill Elliot , Eric Lawson SEE ALSO diff --git a/docs/man/optiups.8 b/docs/man/optiups.8 index 08d998e..7e48a29 100644 --- a/docs/man/optiups.8 +++ b/docs/man/optiups.8 @@ -2,12 +2,12 @@ .\" Title: optiups .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "OPTIUPS" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "OPTIUPS" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/powercom.8 b/docs/man/powercom.8 index 43aa95b..24f1c05 100644 --- a/docs/man/powercom.8 +++ b/docs/man/powercom.8 @@ -2,12 +2,12 @@ .\" Title: powercom .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "POWERCOM" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "POWERCOM" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/powerman-pdu.8 b/docs/man/powerman-pdu.8 index 80b55f6..d8f4bc3 100644 --- a/docs/man/powerman-pdu.8 +++ b/docs/man/powerman-pdu.8 @@ -2,12 +2,12 @@ .\" Title: powerman-pdu .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "POWERMAN\-PDU" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "POWERMAN\-PDU" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/powerpanel.8 b/docs/man/powerpanel.8 index b2a706e..53f5d5e 100644 --- a/docs/man/powerpanel.8 +++ b/docs/man/powerpanel.8 @@ -2,12 +2,12 @@ .\" Title: powerpanel .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "POWERPANEL" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "POWERPANEL" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/rhino.8 b/docs/man/rhino.8 index 40f1cb5..c92c25c 100644 --- a/docs/man/rhino.8 +++ b/docs/man/rhino.8 @@ -2,12 +2,12 @@ .\" Title: rhino .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "RHINO" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "RHINO" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/richcomm_usb.8 b/docs/man/richcomm_usb.8 index ad09d82..ab5f191 100644 --- a/docs/man/richcomm_usb.8 +++ b/docs/man/richcomm_usb.8 @@ -2,12 +2,12 @@ .\" Title: richcomm_usb .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "RICHCOMM_USB" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "RICHCOMM_USB" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/safenet.8 b/docs/man/safenet.8 index 32a17ba..c21a244 100644 --- a/docs/man/safenet.8 +++ b/docs/man/safenet.8 @@ -2,12 +2,12 @@ .\" Title: safenet .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "SAFENET" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "SAFENET" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/snmp-ups.8 b/docs/man/snmp-ups.8 index ee25930..d431961 100644 --- a/docs/man/snmp-ups.8 +++ b/docs/man/snmp-ups.8 @@ -2,12 +2,12 @@ .\" Title: snmp-ups .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 12/05/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "SNMP\-UPS" "8" "12/05/2011" "Network UPS Tools" "NUT Manual" +.TH "SNMP\-UPS" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -43,7 +43,7 @@ MGE UPS SYSTEMS and MGE Office Protection Systems devices with SNMP cards (ref 6 .PP \fBapcc\fR .RS 4 -APC AP9606 APC Web/SNMP management card, perhaps others +APC AP9605, AP9606, AP9617, and AP9618 APC network management cards, as well as any others supporting the APC POWERNET MIB .RE .PP \fBnetvision\fR diff --git a/docs/man/snmp-ups.txt b/docs/man/snmp-ups.txt index 58ee71e..00fa083 100644 --- a/docs/man/snmp-ups.txt +++ b/docs/man/snmp-ups.txt @@ -23,7 +23,7 @@ UPS that is RFC 1628 (UPS MIB) compliant, e.g. MGE UPS SYSTEMS, Liebert, perhaps MGE UPS SYSTEMS and MGE Office Protection Systems devices with SNMP cards (ref 66062, 66045, 66074 and 66244) *apcc*:: -APC AP9606 APC Web/SNMP management card, perhaps others +APC AP9605, AP9606, AP9617, and AP9618 APC network management cards, as well as any others supporting the APC POWERNET MIB *netvision*:: Socomec Sicon UPS with Netvision Web/SNMP management card/external box diff --git a/docs/man/solis.8 b/docs/man/solis.8 index 2551f0e..da4d0e9 100644 --- a/docs/man/solis.8 +++ b/docs/man/solis.8 @@ -2,12 +2,12 @@ .\" Title: solis .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "SOLIS" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "SOLIS" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/tripplite.8 b/docs/man/tripplite.8 index a25ad60..a74c0cf 100644 --- a/docs/man/tripplite.8 +++ b/docs/man/tripplite.8 @@ -2,12 +2,12 @@ .\" Title: tripplite .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "TRIPPLITE" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "TRIPPLITE" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/tripplite_usb.8 b/docs/man/tripplite_usb.8 index dbaa6cb..5a71c35 100644 --- a/docs/man/tripplite_usb.8 +++ b/docs/man/tripplite_usb.8 @@ -2,12 +2,12 @@ .\" Title: tripplite_usb .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "TRIPPLITE_USB" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "TRIPPLITE_USB" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/tripplitesu.8 b/docs/man/tripplitesu.8 index a6f6b8d..366af7c 100644 --- a/docs/man/tripplitesu.8 +++ b/docs/man/tripplitesu.8 @@ -2,12 +2,12 @@ .\" Title: tripplitesu .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "TRIPPLITESU" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "TRIPPLITESU" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/ups.conf.5 b/docs/man/ups.conf.5 index fe04f4b..0abc9a1 100644 --- a/docs/man/ups.conf.5 +++ b/docs/man/ups.conf.5 @@ -2,12 +2,12 @@ .\" Title: ups.conf .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPS\&.CONF" "5" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPS\&.CONF" "5" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsc.8 b/docs/man/upsc.8 index 24f0121..115da0e 100644 --- a/docs/man/upsc.8 +++ b/docs/man/upsc.8 @@ -2,12 +2,12 @@ .\" Title: upsc .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSC" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSC" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,6 +34,8 @@ upsc \- example lightweight UPS client \fBupsc\fR \-l | \-L [\fIhost\fR] .sp \fBupsc\fR \fIups\fR [\fIvariable\fR] +.sp +\fBupsc\fR \-c \fIups\fR .SH "DESCRIPTION" .sp \fBupsc\fR 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\(cqt want to include the full interface\&. @@ -51,6 +53,12 @@ As above, list all UPS names configured at \fIhost\fR, including their description provided by the remote upsd(8) from ups\&.conf(5)\&. The hostname defaults to "localhost"\&. You may optionally add a colon and a port number to override the default port\&. .RE .PP +\fB\-c\fR \fIups\fR +.RS 4 +Lists each client connected on +\fIups\fR, one name per line\&. +.RE +.PP \fIups\fR .RS 4 Display the status of that UPS\&. The format for this option is @@ -106,6 +114,21 @@ done .if n \{\ .RE .\} +.sp +To list clients connected on "myups": +.sp +.if n \{\ +.RS 4 +.\} +.nf +$ upsc \-c myups +127\&.0\&.0\&.1 +::1 +192\&.168\&.1\&.2 +.fi +.if n \{\ +.RE +.\} .SH "DIAGNOSTICS" .sp 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\&. diff --git a/docs/man/upsc.txt b/docs/man/upsc.txt index 74c96a9..a32afc7 100644 --- a/docs/man/upsc.txt +++ b/docs/man/upsc.txt @@ -12,6 +12,8 @@ SYNOPSIS *upsc* 'ups' ['variable'] +*upsc* -c 'ups' + DESCRIPTION ----------- @@ -33,6 +35,10 @@ OPTIONS "localhost". You may optionally add a colon and a port number to override the default port. +*-c* 'ups':: + + Lists each client connected on 'ups', one name per line. + 'ups':: Display the status of that UPS. The format for this option is @@ -69,6 +75,15 @@ syntax: upsc $UPS ups.status done +To list clients connected on "myups": + + $ upsc -c myups + 127.0.0.1 + ::1 + 192.168.1.2 + + + DIAGNOSTICS ----------- diff --git a/docs/man/upscli_connect.3 b/docs/man/upscli_connect.3 index 6500ac5..f696834 100644 --- a/docs/man/upscli_connect.3 +++ b/docs/man/upscli_connect.3 @@ -2,12 +2,12 @@ .\" Title: upscli_connect .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLI_CONNECT" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLI_CONNECT" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_disconnect.3 b/docs/man/upscli_disconnect.3 index 0d64bdd..b51af56 100644 --- a/docs/man/upscli_disconnect.3 +++ b/docs/man/upscli_disconnect.3 @@ -2,12 +2,12 @@ .\" Title: upscli_disconnect .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLI_DISCONNECT" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLI_DISCONNECT" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_fd.3 b/docs/man/upscli_fd.3 index 59da63e..4c22874 100644 --- a/docs/man/upscli_fd.3 +++ b/docs/man/upscli_fd.3 @@ -2,12 +2,12 @@ .\" Title: upscli_fd .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLI_FD" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLI_FD" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_get.3 b/docs/man/upscli_get.3 index f9fe2b6..5fa3550 100644 --- a/docs/man/upscli_get.3 +++ b/docs/man/upscli_get.3 @@ -2,12 +2,12 @@ .\" Title: upscli_get .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLI_GET" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLI_GET" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_list_next.3 b/docs/man/upscli_list_next.3 index 40d36d6..028df71 100644 --- a/docs/man/upscli_list_next.3 +++ b/docs/man/upscli_list_next.3 @@ -2,12 +2,12 @@ .\" Title: upscli_list_next .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLI_LIST_NEXT" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLI_LIST_NEXT" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_list_start.3 b/docs/man/upscli_list_start.3 index fcf87a7..9f7134b 100644 --- a/docs/man/upscli_list_start.3 +++ b/docs/man/upscli_list_start.3 @@ -2,12 +2,12 @@ .\" Title: upscli_list_start .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/31/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLI_LIST_START" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLI_LIST_START" "3" "05/31/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -98,6 +98,17 @@ LIST CMD .\} LIST ENUM .RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +LIST RANGE +.RE .SH "QUERY FORMATTING" .sp To see the list of variables on a UPS called \fIsu700\fR, the protocol command would be LIST VAR su700\&. To start that list with this function, you would populate query and numq as follows: diff --git a/docs/man/upscli_list_start.txt b/docs/man/upscli_list_start.txt index a017d9c..e041934 100644 --- a/docs/man/upscli_list_start.txt +++ b/docs/man/upscli_list_start.txt @@ -37,6 +37,7 @@ Some examples are: - LIST RW - LIST CMD - LIST ENUM + - LIST RANGE QUERY FORMATTING ---------------- diff --git a/docs/man/upscli_readline.3 b/docs/man/upscli_readline.3 index 6c619be..6f5be4a 100644 --- a/docs/man/upscli_readline.3 +++ b/docs/man/upscli_readline.3 @@ -2,12 +2,12 @@ .\" Title: upscli_readline .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLI_READLINE" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLI_READLINE" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_sendline.3 b/docs/man/upscli_sendline.3 index 4f0559d..29d31db 100644 --- a/docs/man/upscli_sendline.3 +++ b/docs/man/upscli_sendline.3 @@ -2,12 +2,12 @@ .\" Title: upscli_sendline .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLI_SENDLINE" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLI_SENDLINE" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_splitaddr.3 b/docs/man/upscli_splitaddr.3 index 940700b..17ed111 100644 --- a/docs/man/upscli_splitaddr.3 +++ b/docs/man/upscli_splitaddr.3 @@ -2,12 +2,12 @@ .\" Title: upscli_splitaddr .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLI_SPLITADDR" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLI_SPLITADDR" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_splitname.3 b/docs/man/upscli_splitname.3 index 45c544d..166dd0f 100644 --- a/docs/man/upscli_splitname.3 +++ b/docs/man/upscli_splitname.3 @@ -2,12 +2,12 @@ .\" Title: upscli_splitname .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLI_SPLITNAME" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLI_SPLITNAME" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_ssl.3 b/docs/man/upscli_ssl.3 index 76371e6..87da86c 100644 --- a/docs/man/upscli_ssl.3 +++ b/docs/man/upscli_ssl.3 @@ -2,12 +2,12 @@ .\" Title: upscli_ssl .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLI_SSL" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLI_SSL" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_strerror.3 b/docs/man/upscli_strerror.3 index e6762c0..a5549ff 100644 --- a/docs/man/upscli_strerror.3 +++ b/docs/man/upscli_strerror.3 @@ -2,12 +2,12 @@ .\" Title: upscli_strerror .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLI_STRERROR" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLI_STRERROR" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_upserror.3 b/docs/man/upscli_upserror.3 index 68eb5b3..4aebd4f 100644 --- a/docs/man/upscli_upserror.3 +++ b/docs/man/upscli_upserror.3 @@ -2,12 +2,12 @@ .\" Title: upscli_upserror .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLI_UPSERROR" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLI_UPSERROR" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsclient.3 b/docs/man/upsclient.3 index 63c694c..00f57f3 100644 --- a/docs/man/upsclient.3 +++ b/docs/man/upsclient.3 @@ -2,12 +2,12 @@ .\" Title: upsclient .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCLIENT" "3" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCLIENT" "3" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscmd.8 b/docs/man/upscmd.8 index e6ba464..1bcdded 100644 --- a/docs/man/upscmd.8 +++ b/docs/man/upscmd.8 @@ -2,12 +2,12 @@ .\" Title: upscmd .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCMD" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCMD" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscode2.8 b/docs/man/upscode2.8 index ca3559f..3cf38d9 100644 --- a/docs/man/upscode2.8 +++ b/docs/man/upscode2.8 @@ -2,12 +2,12 @@ .\" Title: upscode2 .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSCODE2" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSCODE2" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsd.8 b/docs/man/upsd.8 index 5b505ef..746253e 100644 --- a/docs/man/upsd.8 +++ b/docs/man/upsd.8 @@ -2,12 +2,12 @@ .\" Title: upsd .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSD" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSD" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsd.conf.5 b/docs/man/upsd.conf.5 index 4f2d407..c3f95cb 100644 --- a/docs/man/upsd.conf.5 +++ b/docs/man/upsd.conf.5 @@ -2,12 +2,12 @@ .\" Title: upsd.conf .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSD\&.CONF" "5" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSD\&.CONF" "5" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsd.users.5 b/docs/man/upsd.users.5 index e2f9473..73fe1b5 100644 --- a/docs/man/upsd.users.5 +++ b/docs/man/upsd.users.5 @@ -2,12 +2,12 @@ .\" Title: upsd.users .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/25/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSD\&.USERS" "5" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSD\&.USERS" "5" "05/25/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -44,6 +44,7 @@ Here are some examples to get you started: [admin] password = mypass actions = set + actions = fsd instcmds = all .fi .if n \{\ @@ -95,7 +96,9 @@ Set the password for this user\&. .PP \fBactions\fR .RS 4 -Allow the user to do certain things with upsd\&. Valid actions are: +Allow the user to do certain things with upsd\&. To specify multiple actions, use multiple instances of the +\fBactions\fR +field\&. Valid actions are: .PP SET .RS 4 @@ -105,14 +108,16 @@ change the value of certain variables in the UPS FSD .RS 4 set the forced shutdown flag in the UPS\&. This is equivalent to an "on battery + low battery" situation for the purposes of monitoring\&. +.RE +.RE .sp The list of actions is expected to grow in the future\&. -.RE -.RE .PP \fBinstcmds\fR .RS 4 -Let a user initiate specific instant commands\&. Use "ALL" to grant all commands automatically\&. To specify multiple commands, use multiple instances of the instcmds field\&. For the full list of what your UPS supports, use "upscmd \-l"\&. +Let a user initiate specific instant commands\&. Use "ALL" to grant all commands automatically\&. To specify multiple commands, use multiple instances of the +\fBinstcmds\fR +field\&. For the full list of what your UPS supports, use "upscmd \-l"\&. .sp The cmdvartab diff --git a/docs/man/upsd.users.txt b/docs/man/upsd.users.txt index 457bc33..4f73ceb 100644 --- a/docs/man/upsd.users.txt +++ b/docs/man/upsd.users.txt @@ -22,6 +22,7 @@ Here are some examples to get you started: [admin] password = mypass actions = set + actions = fsd instcmds = all [pfy] @@ -46,22 +47,23 @@ Set the password for this user. *actions*:: -Allow the user to do certain things with upsd. -Valid actions are: +Allow the user to do certain things with upsd. To specify multiple +actions, use multiple instances of the *actions* field. Valid +actions are: SET;; change the value of certain variables in the UPS FSD;; set the forced shutdown flag in the UPS. This is equivalent to an "on battery + low battery" situation for the purposes of monitoring. -+ + The list of actions is expected to grow in the future. *instcmds*:: Let a user initiate specific instant commands. Use "ALL" to grant all commands automatically. To specify multiple commands, use multiple -instances of the instcmds field. For the full list of what your UPS +instances of the *instcmds* field. For the full list of what your UPS supports, use "upscmd -l". + The +cmdvartab+ file supplied with the distribution contains a list diff --git a/docs/man/upsdrvctl.8 b/docs/man/upsdrvctl.8 index 1cf796a..909d855 100644 --- a/docs/man/upsdrvctl.8 +++ b/docs/man/upsdrvctl.8 @@ -2,12 +2,12 @@ .\" Title: upsdrvctl .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSDRVCTL" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSDRVCTL" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsimage.cgi.8 b/docs/man/upsimage.cgi.8 index f12a8e1..ab3f1ee 100644 --- a/docs/man/upsimage.cgi.8 +++ b/docs/man/upsimage.cgi.8 @@ -2,12 +2,12 @@ .\" Title: upsimage.cgi .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSIMAGE\&.CGI" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSIMAGE\&.CGI" "8" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upslog.8 b/docs/man/upslog.8 index 0907c79..2eb6121 100644 --- a/docs/man/upslog.8 +++ b/docs/man/upslog.8 @@ -2,12 +2,12 @@ .\" Title: upslog .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSLOG" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSLOG" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsmon.8 b/docs/man/upsmon.8 index 422f81e..08bf7aa 100644 --- a/docs/man/upsmon.8 +++ b/docs/man/upsmon.8 @@ -2,12 +2,12 @@ .\" Title: upsmon .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSMON" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSMON" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -35,12 +35,12 @@ upsmon \- UPS monitor and shutdown controller .sp \fBupsmon\fR \-c \fIcommand\fR .sp -\fBupsmon\fR [\-D] [\-p] [\-u \fIuser\fR] +\fBupsmon\fR [\-D] [\-K] [\-p] [\-u \fIuser\fR] .SH "DESCRIPTION" .sp \fBupsmon\fR is the client process that is responsible for the most important part of UPS monitoring\(emshutting down the system when the power goes out\&. It can call out to other helper programs for notification purposes during power events\&. .sp -upsmon can monitor multiple systems using a single process\&. Every UPS that is defined in the \fBupsmon.conf\fR(5) configuration file is assigned a power value and a type (slave or master)\&. +upsmon can monitor multiple systems using a single process\&. Every UPS that is defined in the \fBupsmon.conf\fR(5) configuration file is assigned a power value and a type (\fBslave\fR or \fBmaster\fR)\&. .SH "OPTIONS" .PP \fB\-h\fR diff --git a/docs/man/upsmon.conf.5 b/docs/man/upsmon.conf.5 index 0400f8a..f2079f3 100644 --- a/docs/man/upsmon.conf.5 +++ b/docs/man/upsmon.conf.5 @@ -2,12 +2,12 @@ .\" Title: upsmon.conf .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSMON\&.CONF" "5" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSMON\&.CONF" "5" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsmon.txt b/docs/man/upsmon.txt index 025c6e4..077144d 100644 --- a/docs/man/upsmon.txt +++ b/docs/man/upsmon.txt @@ -13,7 +13,7 @@ SYNOPSIS *upsmon* -c 'command' -*upsmon* [-D] [-p] [-u 'user'] +*upsmon* [-D] [-K] [-p] [-u 'user'] DESCRIPTION ----------- @@ -25,7 +25,7 @@ power events. upsmon can monitor multiple systems using a single process. Every UPS that is defined in the linkman:upsmon.conf[5] configuration file is assigned -a power value and a type (slave or master). +a power value and a type (*slave* or *master*). OPTIONS ------- diff --git a/docs/man/upsrw.8 b/docs/man/upsrw.8 index e6739ec..6a885bc 100644 --- a/docs/man/upsrw.8 +++ b/docs/man/upsrw.8 @@ -2,12 +2,12 @@ .\" Title: upsrw .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/24/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSRW" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSRW" "8" "05/24/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -64,7 +64,7 @@ Specify the variable to be changed inside the UPS\&. For unattended mode such as .sp Without this argument, upsrw will just display the list of the variables and their possible values\&. .sp -Some variables are strings, and can be set to any value within the length limit\&. Others are enumerated types and can only be set to one of those values\&. Refer to the list to know what\(cqs available in your hardware\&. +Some variables are strings, and can be set to any value within the length limit\&. Others are enumerated types and can only be set to one of those values\&. Others may be within an allowed range of values\&. Refer to the list to know what\(cqs available in your hardware\&. .RE .PP \fB\-u\fR \fIusername\fR diff --git a/docs/man/upsrw.txt b/docs/man/upsrw.txt index c58b040..fd4b49c 100644 --- a/docs/man/upsrw.txt +++ b/docs/man/upsrw.txt @@ -45,8 +45,8 @@ and their possible values. + Some variables are strings, and can be set to any value within the length limit. Others are enumerated types and can only be set to one of -those values. Refer to the list to know what's available in your -hardware. +those values. Others may be within an allowed range of values. Refer to +the list to know what's available in your hardware. *-u* 'username':: Set the NUT username for the connection to the server. This is optional, diff --git a/docs/man/upssched.8 b/docs/man/upssched.8 index 6f2102b..0695d66 100644 --- a/docs/man/upssched.8 +++ b/docs/man/upssched.8 @@ -2,12 +2,12 @@ .\" Title: upssched .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSSCHED" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSSCHED" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upssched.conf.5 b/docs/man/upssched.conf.5 index 48b74ba..7ed2fb5 100644 --- a/docs/man/upssched.conf.5 +++ b/docs/man/upssched.conf.5 @@ -2,12 +2,12 @@ .\" Title: upssched.conf .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSSCHED\&.CONF" "5" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSSCHED\&.CONF" "5" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsset.cgi.8 b/docs/man/upsset.cgi.8 index 3c6b568..d89ece6 100644 --- a/docs/man/upsset.cgi.8 +++ b/docs/man/upsset.cgi.8 @@ -2,12 +2,12 @@ .\" Title: upsset.cgi .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSSET\&.CGI" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSSET\&.CGI" "8" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsset.conf.5 b/docs/man/upsset.conf.5 index 1f1994e..931c821 100644 --- a/docs/man/upsset.conf.5 +++ b/docs/man/upsset.conf.5 @@ -2,12 +2,12 @@ .\" Title: upsset.conf .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSSET\&.CONF" "5" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSSET\&.CONF" "5" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsstats.cgi.8 b/docs/man/upsstats.cgi.8 index 3c6f637..7ffbc0e 100644 --- a/docs/man/upsstats.cgi.8 +++ b/docs/man/upsstats.cgi.8 @@ -2,12 +2,12 @@ .\" Title: upsstats.cgi .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSSTATS\&.CGI" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSSTATS\&.CGI" "8" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsstats.html.5 b/docs/man/upsstats.html.5 index bd23dd9..b305592 100644 --- a/docs/man/upsstats.html.5 +++ b/docs/man/upsstats.html.5 @@ -2,12 +2,12 @@ .\" Title: upsstats.html .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/22/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "UPSSTATS\&.HTML" "5" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "UPSSTATS\&.HTML" "5" "05/22/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/usbhid-ups.8 b/docs/man/usbhid-ups.8 index 9dc441d..207bfb1 100644 --- a/docs/man/usbhid-ups.8 +++ b/docs/man/usbhid-ups.8 @@ -2,12 +2,12 @@ .\" Title: usbhid-ups .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "USBHID\-UPS" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "USBHID\-UPS" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/victronups.8 b/docs/man/victronups.8 index a1210e5..412f19a 100644 --- a/docs/man/victronups.8 +++ b/docs/man/victronups.8 @@ -2,12 +2,12 @@ .\" Title: victronups .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 10/09/2011 +.\" Date: 05/21/2012 .\" Manual: NUT Manual .\" Source: Network UPS Tools .\" Language: English .\" -.TH "VICTRONUPS" "8" "10/09/2011" "Network UPS Tools" "NUT Manual" +.TH "VICTRONUPS" "8" "05/21/2012" "Network UPS Tools" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/net-protocol.txt b/docs/net-protocol.txt index 1c52d62..650effa 100644 --- a/docs/net-protocol.txt +++ b/docs/net-protocol.txt @@ -28,6 +28,24 @@ Embedded quotes are escaped with backslashes. Embedded backslashes are also escaped by representing them as \\. This protocol is intended to be interpreted with parseconf (NUT parser) or something similar. +Revision history +---------------- + +Here's a table to present the various changes that happened to the +NUT network protocol, over the time: + +[options="header",style="asciidoc",cols="^.^,^.^,<"] +|=============================================================================== +|Protocol version |NUT version |Description +|1.0 |< 1.5.0 |Original protocol (legacy version) +|1.1 |>= 1.5.0 |Original protocol (without old commands) +.2+|1.2 .2+|>= 2.6.4 |Add "LIST CLIENTS" and "NETVER" commands + |Add ranges of values for writable variables +|=============================================================================== + +NOTE: any new version of the protocol implies an update of NUT_NETVERSION +in *configure.in*. + GET --- @@ -106,8 +124,10 @@ Response: - 'RW': this variable may be set to another value with SET - 'ENUM': an enumerated type, which supports a few specific values - 'STRING:n': this is a string of maximum length n +- 'RANGE': this is an integer, comprised in the range (see LIST RANGE) -ENUM and STRING are usually associated with RW, but not always. +ENUM, STRING and RANGE are usually associated with RW, but not always. +The default , when omitted, is integer. This replaces the old "VARTYPE" command. @@ -286,6 +306,47 @@ This replaces the old "ENUM" command. NOTE: this does not support the old "SELECTED" notation. You must request the current value separately. +RANGE +~~~~~ + +Form: + + LIST RANGE + LIST RANGE su700 input.transfer.low + +Response: + + BEGIN LIST RANGE + RANGE "" "" + ... + END LIST RANGE + + BEGIN LIST RANGE su700 input.transfer.low + RANGE su700 input.transfer.low "90" "100" + RANGE su700 input.transfer.low "102" "105" + ... + END LIST RANGE su700 input.transfer.low + +CLIENT +~~~~~~ + +Form: + + LIST CLIENT + LIST CLIENT ups1 + +Response: + + BEGIN LIST CLIENT + CLIENT + ... + END LIST CLIENT + + BEGIN LIST CLIENT ups1 + CLIENT ups1 ::1 + CLIENT ups1 192.168.1.2 + END LIST CLIENT ups1 + SET --- @@ -426,15 +487,16 @@ Response: This tells upsd to switch to TLS mode internally, so all future communications will be encrypted. You must also change to TLS mode in -the client after receiving the OK, or the connection will be useless. +the client after receiving the OK, or the connection will be useless. Other commands -------------- - HELP: lists the commands supported by this server - VER: shows the version of the server currently in use +- NETVER: shows the version of the network protocol currently in use -These two are not intended to be used directly by programs. Humans can +These three are not intended to be used directly by programs. Humans can make use of this program by using telnet or netcat. If you use telnet, make sure you don't have it set to negotiate extra options. upsd doesn't speak telnet and will probably misunderstand your first diff --git a/docs/new-drivers.txt b/docs/new-drivers.txt index 2ebc5de..40a887f 100644 --- a/docs/new-drivers.txt +++ b/docs/new-drivers.txt @@ -208,15 +208,25 @@ Possible values for status_set: OVER - UPS is overloaded TRIM - UPS is trimming incoming voltage (called "buck" in some hardware) BOOST - UPS is boosting incoming voltage + FSD - Forced Shutdown (restricted use, see the note below) Anything else will not be recognized by the usual clients. Coordinate with the nut-upsdev list before creating something new, since there will be duplication and ugliness otherwise. -NOTE: upsd injects "FSD" by itself following that command by a master -upsmon process. Drivers must not set that value. +[NOTE] +================================================================================ -NOTE: the OL and OB flags are an indication of the input line status only. +- upsd injects "FSD" by itself following that command by a master upsmon +process. Drivers must not set that value, apart from specific cases (see +below). + +- As an exception, drivers may set "FSD" when an imminent shutdown has been +detected. In this case, the "on battery + low battery" condition should not be +met. Otherwise, setting status to "OB LB" should be prefered. + +- the OL and OB flags are an indication of the input line status only. +================================================================================ UPS alarms ---------- @@ -602,6 +612,15 @@ enumerated. You should add each one to make it available to the client: dstate_addenum("input.transfer.low", "99"); dstate_addenum("input.transfer.low", "105"); +Range values +------------ + +If you have a variable that support values comprised in one or more ranges, +you should add each one to make it available to the client: + + dstate_addrange("input.transfer.low", 90, 95); + dstate_addrange("input.transfer.low", 100, 105); + Writable strings ---------------- diff --git a/docs/nut-names.txt b/docs/nut-names.txt index 147e78c..e2563ab 100644 --- a/docs/nut-names.txt +++ b/docs/nut-names.txt @@ -23,17 +23,22 @@ Variables device: General unit information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -NOTE: these data will be redundant with some ups.* information +NOTE: some of these data will be redundant with ups.* information during a transition period. The ups.* data will then be removed. [options="header"] -|======================================================================== -| Name | Description | Example value -| device.model | Device model | BladeUPS -| device.mfr | Device manufacturer | Eaton -| device.serial | Device serial number (opaque string) | WS9643050926 -| device.type | Device type (ups, pdu, scd) | ups -|======================================================================== +|==================================================================================== +| Name | Description | Example value +| device.model | Device model | BladeUPS +| device.mfr | Device manufacturer | Eaton +| device.serial | Device serial number (opaque string) | WS9643050926 +| device.type | Device type (ups, pdu, scd, psu) | ups +| device.description | Device description (opaque string) | Some ups +| device.contact | Device administrator name (opaque string) | John Doe +| device.location | Device physical location (opaque string) | 1rst floor +| device.part | Device part number (opaque string) | 123456789 +| device.macaddr | Physical network address of the device | 68:b5:99:f5:89:27 +|===================================================================================== ups: General unit information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -110,6 +115,10 @@ ups: General unit information (enabled or disabled) | yes |=============================================================================== +NOTE: When present, the value of *ups.start.auto* has an impact on shutdown.* +commands. For the sake of coherence, shutdown commands will set *ups.start.auto* +to the right value before issuing the command. Ie, shutdown.stayoff will first +set *ups.start.auto* to *no*, while shutdown.return will set it to *yes*. input: Incoming line/power information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -240,7 +249,7 @@ Valid with/without context (ie. per phase or aggregated/averaged) | current | Current (A) | current.maximum | Maximum seen current (A) | current.minimum | Minimum seen current (A) -| peakcurrent | Peak current +| current.peak | Peak current | voltage | Voltage (V) | voltage.nominal | Nominal voltage (V) | voltage.maximum | Maximum seen voltage (V) @@ -295,36 +304,40 @@ battery: Any battery details [options="header"] |=============================================================================== -| Name | Description | Example value -| battery.charge | Battery charge (percent) | 100.0 +| Name | Description | Example value +| battery.charge | Battery charge (percent) | 100.0 | battery.charge.low | Remaining battery level when - UPS switches to LB (percent) | 20 + UPS switches to LB (percent) | 20 | battery.charge.restart | Minimum battery level for - UPS restart after power-off | 20 + UPS restart after power-off | 20 | battery.charge.warning | Battery level when UPS switches - to "Warning" state (percent) | 50 -| battery.voltage | Battery voltage (V) | 24.84 -| battery.capacity | Battery capacity (Ah) | 7.2 -| battery.current | Battery current (A) | 1.19 -| battery.temperature | Battery temperature (degrees C) | 050.7 -| battery.voltage.nominal | Nominal battery voltage (V) | 024 -| battery.runtime | Battery runtime (seconds) - Remaining battery runtime | 1080 -| battery.runtime.low | when UPS switches to LB - (seconds) | 180 -| battery.alarm.threshold | Battery alarm threshold | 0 (immediate) -| battery.date | Battery change date (opaque - string) | 11/14/00 + to "Warning" state (percent) | 50 +| battery.voltage | Battery voltage (V) | 24.84 +| battery.voltage.nominal | Nominal battery voltage (V) | 024 +| battery.voltage.low | Minimum battery voltage, that + triggers FSD status | 21,52 +| battery.voltage.high | Maximum battery voltage + (Ie battery.charge = 100) | 26,9 +| battery.capacity | Battery capacity (Ah) | 7.2 +| battery.current | Battery current (A) | 1.19 +| battery.temperature | Battery temperature (degrees C) | 050.7 +| battery.runtime | Battery runtime (seconds) | 1080 +| battery.runtime.low | Remaining battery runtime when + UPS switches to LB (seconds) | 180 +| battery.runtime.restart | Minimum battery runtime for UPS + restart after power-off (seconds) | 120 +| battery.alarm.threshold | Battery alarm threshold | 0 (immediate) +| battery.date | Battery change date (opaque string) | 11/14/00 | battery.mfr.date | Battery manufacturing date - (opaque string) | 2005/04/02 -| battery.packs | Number of battery packs | 001 -| battery.packs.bad | Number of bad battery packs | 000 + (opaque string) | 2005/04/02 +| battery.packs | Number of battery packs | 001 +| battery.packs.bad | Number of bad battery packs | 000 | battery.type | Battery chemistry (opaque - string) | PbAc + string) | PbAc | battery.protection | Prevent deep discharge of - battery | yes + battery | yes | battery.energysave | Switch off when running on - battery and no/low load | no + battery and no/low load | no |=============================================================================== @@ -385,13 +398,19 @@ represent the whole set of outlets of the device. | outlet.n.autoswitch.charge.low | Remaining battery level to power off this outlet (percent) | 80 +| outlet.n.battery.charge.low | Remaining battery level to + power off this outlet + (percent) | 80 | outlet.n.delay.shutdown | Interval to wait before shutting down this outlet (seconds) | 180 - | outlet.n.delay.start | Interval to wait before restarting this outlet - (seconds) | 120 + (seconds) | 120 +| outlet.n.timer.shutdown | Time before the outlet load + will be shutdown (seconds) | 20 +| outlet.n.timer.start | Time before the outlet load + will be started (seconds) | 30 | outlet.n.current | Current (A) | 0.19 | outlet.n.current.maximum | Maximum seen current (A) | 0.56 | outlet.n.realpower | Current value of real @@ -406,7 +425,6 @@ represent the whole set of outlets of the device. | outlet.n.power | Apparent power (VA) | 46 |=============================================================================== - driver: Internal driver information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -442,6 +460,8 @@ Instant commands | Name | Description | load.off | Turn off the load immediately | load.on | Turn on the load immediately +| load.off.delay | Turn off the load possibly after a delay +| load.on.delay | Turn on the load possibly after a delay | shutdown.return | Turn off the load possibly after a delay and return when power is back | shutdown.stayoff | Turn off the load possibly after a delay @@ -468,4 +488,9 @@ Instant commands | beeper.disable | Disable UPS beeper/buzzer | beeper.mute | Temporarily mute UPS beeper/buzzer | beeper.toggle | Toggle UPS beeper/buzzer +| outlet.n.shutdown.return | Turn off the outlet possibly after a delay + and return when power is back +| outlet.n.load.off | Turn off the outlet immediately +| outlet.n.load.on | Turn on the outlet immediately +| outlet.n.load.cycle | Power cycle the outlet immediately |======================================================================== diff --git a/docs/security.txt b/docs/security.txt index 1a83c09..04e795f 100644 --- a/docs/security.txt +++ b/docs/security.txt @@ -126,12 +126,15 @@ Firewall NUT has its own official IANA port: 3493/tcp. -The `upsmon` process on slave systems (as well as `upsc`) connects to the -`upsd` process on the master system via this TCP port. The `upsd` process does -not connect out. +The `upsmon` process on slave systems, as well as any other NUT client (such +as `upsc`, `upscmd`, `upsrw`, NUT-Monitor, ...) connects to the `upsd` process +on the master system via this TCP port. The `upsd` process does not connect out. You should use this to restrict network access. +[[UFW]] + +include::../scripts/ufw/README[] [[TCP_Wrappers]] TCP Wrappers diff --git a/docs/sock-protocol.txt b/docs/sock-protocol.txt index 7f25d9d..944d3ef 100644 --- a/docs/sock-protocol.txt +++ b/docs/sock-protocol.txt @@ -54,6 +54,20 @@ DELENUM DELENUM input.transfer.low "98" +ADDRANGE +~~~~~~~~ + + ADDRANGE + + ADDRANGE input.transfer.low 95 100 + +DELRANGE +~~~~~~~~ + + DELRANGE + + DELRANGE input.transfer.low 95 100 + SETAUX ~~~~~~ diff --git a/docs/stable-hcl.txt b/docs/stable-hcl.txt index 0599d3c..f23827c 100644 --- a/docs/stable-hcl.txt +++ b/docs/stable-hcl.txt @@ -150,20 +150,21 @@ The form of the URL is the following: http://www.networkupstools.org/stable-hcl.html?= -.Possible values for and -[cols="^,^",options="header"] -|========================================================================== -| | -| support-level | a number from '1' to '5' -.3+^.^| device-type | - 'ups' for uninterruptible power supply - | - 'pdu' for power distribution unit - | - 'scd' for solar controller device -| manufacturer | a manufacturer name from the selection list -| model | a model name from the selection list -.3+^.^| connection | 'USB' - | 'Serial' - | 'Network' -|========================================================================== +.Possible values +[options="header,autowidth",style="asciidoc",cols="<,<"] +|=================================================================== +| | +|support-level |a number from '1' to '5' +|device-type |- 'ups' for uninterruptible power supply + - 'pdu' for power distribution unit + - 'psu' for power supply unit + - 'scd' for solar controller device +|manufacturer |a manufacturer name from the selection list +|model |a model name from the selection list +|connection |- 'USB' + - 'Serial' + - 'Network' +|=================================================================== You can finally combine multiple filters, using ampersand (*&*). diff --git a/docs/website/Makefile.in b/docs/website/Makefile.in index 46688c9..fc22885 100644 --- a/docs/website/Makefile.in +++ b/docs/website/Makefile.in @@ -148,6 +148,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -161,6 +162,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -168,6 +170,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ diff --git a/docs/website/news.txt b/docs/website/news.txt index a505f08..e8f4f9e 100644 --- a/docs/website/news.txt +++ b/docs/website/news.txt @@ -1,3 +1,8 @@ +- May 31, 2012: 2.6.4 released, including link:http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-2944[CVE-2012-2944] fix +- May 10, 2012: link:http://wmnut.mgeops.org[WMNut] 0.63 released +- May 9, 2012: Official publication of Riello communication protocols +- May 2, 2012: link:download.html#_binary_packages[Beta NUT 2.6.3-3 package for Windows released] +- April 26, 2012: link:download.html#_binary_packages[Beta NUT 2.6.3-1 package for Windows released] - January 4, 2012: 2.6.3 released - October 31, 2011: link:download.html#_java_packages[jNUT and jNutWebAPI 0.2-SNAPSHOT released] - September 15, 2011: 2.6.2 released diff --git a/docs/website/projects.txt b/docs/website/projects.txt index 2032098..5968036 100644 --- a/docs/website/projects.txt +++ b/docs/website/projects.txt @@ -192,6 +192,12 @@ link:http://www.readynas.com/?page_id=92[Netgear ReadyNAS] The RAIDiator firmware for the ReadyNAS product line includes NUT to either monitor a local USB UPS, or to connect as a slave to a NUT server. +link:http://www.thecus.com[Thecus NAS] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Thecus NAS firmware includes NUT for UPS support. The +link:http://www.thecus.com/Downloads/Compatible_List/UPS_List_v1.0_ALL.pdf[following list of devices] is known to be supported. + link:http://www.webbastards.com/projects/[lcd-nut] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/website/ups-protocols.txt b/docs/website/ups-protocols.txt index 8067418..fd20cc6 100644 --- a/docs/website/ups-protocols.txt +++ b/docs/website/ups-protocols.txt @@ -71,6 +71,15 @@ PowerKinetics - PowerKinetics MiniCOL protocol - courtesy of PowerKinetics technical support +Riello +~~~~~~ + +All these document are officially provided by Riello + +- link:ups-protocols/riello/PSGPSER-0104.pdf[GPSER protocol] +- link:ups-protocols/riello/PSSENTR-0100.pdf[Sentry HPS / HTS protocol] +- link:ups-protocols/riello/Riello_UPS_protocol_list.pdf[UPS protocol list] + Standard protocols ~~~~~~~~~~~~~~~~~~ diff --git a/drivers/Makefile.in b/drivers/Makefile.in index 20f18c3..8b2c02e 100644 --- a/drivers/Makefile.in +++ b/drivers/Makefile.in @@ -512,6 +512,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -525,6 +526,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -532,6 +534,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ diff --git a/drivers/apc-mib.c b/drivers/apc-mib.c index 6b44fd6..368504c 100644 --- a/drivers/apc-mib.c +++ b/drivers/apc-mib.c @@ -31,8 +31,15 @@ * * examples found on the Net and other sources: * 'enterprises.apc.products.system.smartUPS.smartUPS700' + * - from fence agents * '.1.3.6.1.4.1.318.1.3.4.5': ApcRPDU, * '.1.3.6.1.4.1.318.1.3.4.4': ApcMSP + * - from Bill Seligman + * .1.3.6.1.4.1.318.1.3.2.11 + * .1.3.6.1.4.1.318.1.3.2.12 + * .1.3.6.1.4.1.318.1.3.27 + * .1.3.6.1.4.1.318.1.3.2.7 + * .1.3.6.1.4.1.318.1.3.2.8 */ /* TODO: find the right sysOID for this MIB diff --git a/drivers/apcsmart.c b/drivers/apcsmart.c index 93d46ff..1f5ab12 100644 --- a/drivers/apcsmart.c +++ b/drivers/apcsmart.c @@ -45,6 +45,81 @@ upsdrv_info_t upsdrv_info = { static int ups_status = 0; +/* + * Aix compatible names + */ +#if defined(VWERSE) && !defined(VWERASE) +#define VWERASE VWERSE +#endif /* VWERSE && !VWERASE */ + +#if defined(VDISCRD) && !defined(VDISCARD) +#define VDISCARD VDISCRD +#endif /* VDISCRD && !VDISCARD */ + + +#ifndef CTRL +#define CONTROL(x) (x&037) +#else +#define CONTROL CTRL +#endif + +/* + * Allow use of system default characters if defined and reasonable. + * These are based on the BSD ttydefaults.h + */ +#ifndef CDISCARD +#define CDISCARD CONTROL('O') +#endif +#ifndef CDSUSP +#define CDSUSP CONTROL('Y') +#endif +#ifndef CEOF +#define CEOF CONTROL('D') +#endif +#ifndef CEOL +#define CEOL 0xff /* was 0 */ +#endif +#ifndef CERASE +#define CERASE 0177 +#endif +#ifndef CINTR +#define CINTR CONTROL('C') +#endif +#ifndef CKILL +#define CKILL CONTROL('U') /* was '@' */ +#endif +#ifndef CLNEXT +#define CLNEXT CONTROL('V') +#endif +#ifndef CMIN +#define CMIN CEOF +#endif +#ifndef CQUIT +#define CQUIT CONTROL('\\') +#endif +#ifndef CRPRNT +#define CRPRNT CONTROL('R') +#endif +#ifndef CREPRINT +#define CREPRINT CRPRNT +#endif +#ifndef CSTART +#define CSTART CONTROL('Q') +#endif +#ifndef CSTOP +#define CSTOP CONTROL('S') +#endif +#ifndef CSUSP +#define CSUSP CONTROL('Z') +#endif +#ifndef CTIME +#define CTIME CEOL +#endif +#ifndef CWERASE +#define CWERASE CONTROL('W') +#endif + + /* some forwards */ static int sdcmd_S(const void *); @@ -188,7 +263,10 @@ static void apc_ser_set(void) tio.c_cflag |= (CS8 | CLOCAL | CREAD); tio.c_lflag |= ICANON; - tio.c_lflag &= ~ISIG; +#ifdef NOKERNINFO + tio.c_lflag |= NOKERNINFO; +#endif + tio.c_lflag &= ~(ISIG | IEXTEN); tio.c_iflag |= (IGNCR | IGNPAR); tio.c_iflag &= ~(IXON | IXOFF); @@ -220,11 +298,92 @@ static void apc_ser_set(void) if (tcsetattr(upsfd, TCSANOW, &tio)) fatal_with_errno(EXIT_FAILURE, "tcsetattr(%s)", device_path); + /* clear status flags so that they don't affect our binary compare */ +#ifdef PENDIN + tio.c_lflag &= ~PENDIN; +#endif +#ifdef FLUSHO + tio.c_lflag &= ~FLUSHO; +#endif + memset(&tio_chk, 0, sizeof(tio_chk)); if (tcgetattr(upsfd, &tio_chk)) fatal_with_errno(EXIT_FAILURE, "tcgetattr(%s)", device_path); - if (memcmp(&tio_chk, &tio, sizeof(tio))) - fatalx(EXIT_FAILURE, "unable to set the required attributes (%s)", device_path); + + /* clear status flags so that they don't affect our binary compare */ +#ifdef PENDIN + tio_chk.c_lflag &= ~PENDIN; +#endif +#ifdef FLUSHO + tio_chk.c_lflag &= ~FLUSHO; +#endif + + if (memcmp(&tio_chk, &tio, sizeof(tio))) { + struct cchar { + const char *name; + int sub; + u_char def; + }; + const struct cchar cchars1[] = { +#ifdef VDISCARD + { "discard", VDISCARD, CDISCARD }, +#endif +#ifdef VDSUSP + { "dsusp", VDSUSP, CDSUSP }, +#endif + { "eof", VEOF, CEOF }, + { "eol", VEOL, CEOL }, + { "eol2", VEOL2, CEOL }, + { "erase", VERASE, CERASE }, +#ifdef VINTR + { "intr", VINTR, CINTR }, +#endif + { "kill", VKILL, CKILL }, + { "lnext", VLNEXT, CLNEXT }, + { "min", VMIN, CMIN }, + { "quit", VQUIT, CQUIT }, +#ifdef VREPRINT + { "reprint", VREPRINT, CREPRINT }, +#endif + { "start", VSTART, CSTART }, +#ifdef VSTATUS + { "status", VSTATUS, CSTATUS }, +#endif + { "stop", VSTOP, CSTOP }, + { "susp", VSUSP, CSUSP }, + { "time", VTIME, CTIME }, + { "werase", VWERASE, CWERASE }, + { .name = NULL }, + }; + const struct cchar *cp; + struct termios *tp; + + upslogx(LOG_NOTICE, "%s: device reports different attributes than what were set", device_path); + + /* + * According to the manual the most common problem is + * mis-matched combinations of input and output baud rates. If + * the combination is not supported then neither are changed. + * This should not be a problem here since we set them both to + * the same extremely common rate of 2400. + */ + + tp = &tio; + upsdebugx(1, "tcsetattr(): gfmt1:cflag=%x:iflag=%x:lflag=%x:oflag=%x:", + (unsigned int) tp->c_cflag, (unsigned int) tp->c_iflag, + (unsigned int) tp->c_lflag, (unsigned int) tp->c_oflag); + for (cp = cchars1; cp->name; ++cp) + upsdebugx(1, "\t%s=%x:", cp->name, tp->c_cc[cp->sub]); + upsdebugx(1, "\tispeed=%d:ospeed=%d", (int) cfgetispeed(tp), (int) cfgetospeed(tp)); + + tp = &tio_chk; + upsdebugx(1, "tcgetattr(): gfmt1:cflag=%x:iflag=%x:lflag=%x:oflag=%x:", + (unsigned int) tp->c_cflag, (unsigned int) tp->c_iflag, + (unsigned int) tp->c_lflag, (unsigned int) tp->c_oflag); + for (cp = cchars1; cp->name; ++cp) + upsdebugx(1, "\t%s=%x:", cp->name, tp->c_cc[cp->sub]); + upsdebugx(1, "\tispeed=%d:ospeed=%d", (int) cfgetispeed(tp), (int) cfgetospeed(tp)); + } cable = getval("cable"); if (cable && !strcasecmp(cable, ALT_CABLE_1)) { @@ -464,7 +623,8 @@ static int apc_write_long(const char *code) return -1; } - return ser_send_pace(upsfd, 50000, "%s", code + 1); + ret = ser_send_pace(upsfd, 50000, "%s", code + 1); + return ret < 0 ? ret : ret + 1; } static int apc_write_rep(unsigned char code) @@ -1747,9 +1907,9 @@ static int setvar_string(apc_vartab_t *vt, const char *val) *ptr++ = '\015'; /* pad with CRs */ *ptr = 0; - ret = apc_write_long(ptr); + ret = apc_write_long(temp); - if ((size_t)ret != strlen(ptr)) { + if (ret != APC_STRLEN + 1) { upslog_with_errno(LOG_ERR, "setvar_string: apc_write_long failed"); return STAT_SET_FAILED; } diff --git a/drivers/apcsmart.h b/drivers/apcsmart.h index e10c5fe..012634d 100644 --- a/drivers/apcsmart.h +++ b/drivers/apcsmart.h @@ -24,7 +24,7 @@ #define __apcsmart_h__ #define DRIVER_NAME "APC Smart protocol driver" -#define DRIVER_VERSION "3.0" +#define DRIVER_VERSION "3.04" #define ALT_CABLE_1 "940-0095B" @@ -115,14 +115,14 @@ /* status bits */ -#define APC_STAT_CAL 0x01 /* calibration */ -#define APC_STAT_TRIM 0x02 /* SmartTrim */ -#define APC_STAT_BOOST 0x04 /* SmartBoost */ -#define APC_STAT_OL 0x08 /* on line */ -#define APC_STAT_OB 0x10 /* on battery */ -#define APC_STAT_OVER 0x20 /* overload */ -#define APC_STAT_LB 0x40 /* low battery */ -#define APC_STAT_RB 0x80 /* replace battery */ +#define APC_STAT_CAL (1 << 0) /* calibration */ +#define APC_STAT_TRIM (1 << 1) /* SmartTrim */ +#define APC_STAT_BOOST (1 << 2) /* SmartBoost */ +#define APC_STAT_OL (1 << 3) /* on line */ +#define APC_STAT_OB (1 << 4) /* on battery */ +#define APC_STAT_OVER (1 << 5) /* overload */ +#define APC_STAT_LB (1 << 6) /* low battery */ +#define APC_STAT_RB (1 << 7) /* replace battery */ /* * serial protocol: special commands - initialization and such diff --git a/drivers/bcmxcp.c b/drivers/bcmxcp.c index 1bc8b78..2e5f18f 100644 --- a/drivers/bcmxcp.c +++ b/drivers/bcmxcp.c @@ -6,8 +6,10 @@ * emes -at- geomer.de * * All rights reserved.* - Copyright (C) 2004 Kjell Claesson - and Tore Ørpetveit + Copyright (C) + 2004 Kjell Claesson + 2004 Tore Ørpetveit + 2011 - 2012 Arnaud Quette Thanks to Tore Ørpetveit that sent me the manuals for bcm/xcp. @@ -124,7 +126,7 @@ TODO List: #include "bcmxcp.h" #define DRIVER_NAME "BCMXCP UPS driver" -#define DRIVER_VERSION "0.25" +#define DRIVER_VERSION "0.26" #define MAX_NUT_NAME_LENGTH 128 #define NUT_OUTLET_POSITION 7 @@ -157,6 +159,7 @@ static int init_outlet(unsigned char len); static int instcmd(const char *cmdname, const char *extra); static int setvar (const char *varname, const char *val); +static const char *nut_find_infoval(info_lkp_t *xcp2info, const double value); const char *FreqTol[3] = {"+/-2%", "+/-5%", "+/-7"}; const char *ABMStatus[4] = {"Charging", "Discharging", "Floating", "Resting"}; @@ -166,6 +169,32 @@ int nphases = 0; int outlet_block_len = 0; const char *cpu_name[5] = {"Cont:", "Inve:", "Rect:", "Netw:", "Disp:"}; + + +/* Battery test results */ +info_lkp_t batt_test_info[] = { + { 0, "No test initiated", NULL }, + { 1, "In progress", NULL }, + { 2, "Done and passed", NULL }, + { 3, "Aborted", NULL }, + { 4, "Done and error", NULL }, + { 5, "Test scheduled", NULL }, + /* Not sure about the meaning of the below ones! */ + { 6, NULL, NULL }, /* The string was present but it has now been removed */ + { 7, NULL, NULL }, /* The string was not installed at the last power up */ + { 0, NULL, NULL } +}; + + +/* allocate storage for shared variables (extern in bcmxcp.h) */ +BCMXCP_METER_MAP_ENTRY_t + bcmxcp_meter_map[BCMXCP_METER_MAP_MAX]; +BCMXCP_ALARM_MAP_ENTRY_t + bcmxcp_alarm_map[BCMXCP_ALARM_MAP_MAX]; +BCMXCP_STATUS_t + bcmxcp_status; + + /* 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 */ { @@ -583,7 +612,12 @@ void init_alarm_map() bcmxcp_alarm_map[BCMXCP_ALARM_CHARGER_ON_COMMAND].alarm_desc = "CHARGER_ON_COMMAND"; bcmxcp_alarm_map[BCMXCP_ALARM_CHARGER_OFF_COMMAND].alarm_desc = "CHARGER_OFF_COMMAND"; bcmxcp_alarm_map[BCMXCP_ALARM_UPS_NORMAL].alarm_desc = "UPS_NORMAL"; + bcmxcp_alarm_map[BCMXCP_ALARM_INVERTER_PHASE_ROTATION].alarm_desc = "INVERTER_PHASE_ROTATION"; + bcmxcp_alarm_map[BCMXCP_ALARM_UPS_OFF].alarm_desc = "UPS_OFF"; bcmxcp_alarm_map[BCMXCP_ALARM_EXTERNAL_COMMUNICATION_FAILURE].alarm_desc = "EXTERNAL_COMMUNICATION_FAILURE"; + bcmxcp_alarm_map[BCMXCP_ALARM_BATTERY_TEST_INPROGRESS].alarm_desc = "BATTERY_TEST_INPROGRESS"; + bcmxcp_alarm_map[BCMXCP_ALARM_SYSTEM_TEST_INPROGRESS].alarm_desc = "SYSTEM_TEST_INPROGRESS"; + bcmxcp_alarm_map[BCMXCP_ALARM_BATTERY_TEST_ABORTED].alarm_desc = "BATTERY_TEST_ABORTED"; } @@ -936,7 +970,7 @@ void init_config(void) int voltage = 0, res, len; char sValue[17]; - res = command_read_sequence(PW_CONFIG_BLOC_REQ, answer); + res = command_read_sequence(PW_CONFIG_BLOCK_REQ, answer); if (res <= 0) fatal_with_errno(EXIT_FAILURE, "Could not communicate with the ups"); @@ -1104,12 +1138,12 @@ void upsdrv_initinfo(void) dstate_setinfo("ups.firmware", "%s", pTmp); - free(pTmp); - /* Increment index to point at end of CPU bytes. */ iIndex += len * 2; } + free(pTmp); + /* Get rating in kVA, if present */ if ((iRating = answer[iIndex++]) > 0) iRating *= 1000; @@ -1244,6 +1278,8 @@ void upsdrv_updateinfo(void) char sValue[128]; int iIndex, res; float output, max_output, fValue = 0.0f; + int batt_status = 0; + const char *nutvalue; /* Get info from UPS */ res = command_read_sequence(PW_METER_BLOCK_REQ, answer); @@ -1332,6 +1368,14 @@ void upsdrv_updateinfo(void) if (iIndex == BCMXCP_ALARM_BATTERY_LOW) { bcmxcp_status.alarm_low_battery = 1; } + + if (iIndex == BCMXCP_ALARM_BATTERY_TEST_FAILED) { + bcmxcp_status.alarm_replace_battery = 1; + } + + if (iIndex == BCMXCP_ALARM_BATTERY_NEEDS_SERVICE) { + bcmxcp_status.alarm_replace_battery = 1; + } } } } @@ -1404,10 +1448,38 @@ void upsdrv_updateinfo(void) status_set("OB"); if (bcmxcp_status.alarm_low_battery) status_set("LB"); + if (bcmxcp_status.alarm_replace_battery) + status_set("RB"); status_commit(); } + /* Get battery info from UPS, if exist */ + res = command_read_sequence(PW_BATTERY_REQ, answer); + if (res <= 0) + { + upsdebugx(1, "Failed to read Battery Status from UPS"); + } + else + { + /* Only parse the status (first byte) + * Powerware 5115 RM output: + * 02 00 78 1d 42 00 e0 17 42 1e 00 00 00 00 00 00 00 00 00 01 03 + * Powerware 9130 output: + * 03 0a d7 25 42 0a d7 25 42 00 9a 19 6d 43 cd cc 4c 3e 01 00 01 03 + */ + upsdebug_hex(2, "Battery Status", answer, res); + batt_status = answer[0]; + + if ((nutvalue = nut_find_infoval(batt_test_info, batt_status)) != NULL) { + dstate_setinfo("ups.test.result", "%s", nutvalue); + upsdebugx(2, "Battery Status = %s (%i)", nutvalue, batt_status); + } + else { + upsdebugx(1, "Failed to extract Battery Status from answer"); + } + } + dstate_dataok(); } @@ -1428,7 +1500,7 @@ void upsdrv_shutdown(void) it doesn't respond at first if possible */ send_write_command(AUTHOR, 4); - sleep(1); /* Need to. Have to wait at least 0,25 sec max 16 sec */ + sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ cbuf[0] = PW_LOAD_OFF_RESTART; cbuf[1] = (unsigned char)(bcmxcp_status.shutdowndelay & 0x00ff); /* "delay" sec delay for shutdown, */ @@ -1493,12 +1565,12 @@ static int instcmd(const char *cmdname, const char *extra) ) { send_write_command(AUTHOR, 4); - sleep(1); /* Need to. Have to wait at least 0,25 sec max 16 sec */ + sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ /* Get the shutdown delay, if any */ snprintf(varname, sizeof(varname)-1, "outlet.%c.delay.shutdown", cmdname[7]); if ((varvalue = dstate_getinfo(varname)) != NULL) { - sddelay = atoi(dstate_getinfo(varname)); + sddelay = atoi(varvalue); } cbuf[0] = PW_LOAD_OFF_RESTART; @@ -1546,7 +1618,7 @@ static int instcmd(const char *cmdname, const char *extra) if (!strcasecmp(cmdname, "shutdown.return")) { send_write_command(AUTHOR, 4); - sleep(1); /* Need to. Have to wait at least 0,25 sec max 16 sec */ + sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ cbuf[0] = PW_LOAD_OFF_RESTART; cbuf[1] = (unsigned char)(bcmxcp_status.shutdowndelay & 0x00ff); /* "delay" sec delay for shutdown, */ @@ -1590,7 +1662,7 @@ static int instcmd(const char *cmdname, const char *extra) if (!strcasecmp(cmdname, "shutdown.stayoff")) { send_write_command(AUTHOR, 4); - sleep(1); /* Need to. Have to wait at least 0,25 sec max 16 sec */ + sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ res = command_read_sequence(PW_UPS_OFF, answer); if (res <= 0) { @@ -1626,10 +1698,13 @@ static int instcmd(const char *cmdname, const char *extra) } + /* Note: test result will be parsed from Battery status block, + * part of the update loop, and published into ups.test.result + */ if (!strcasecmp(cmdname, "test.battery.start")) { send_write_command(AUTHOR, 4); - sleep(1); /* Need to. Have to wait at least 0,25 sec max 16 sec */ + sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ cbuf[0] = PW_INIT_BAT_TEST; cbuf[1] = 0x0A; /* 10 sec start delay for test.*/ @@ -1665,12 +1740,6 @@ static int instcmd(const char *cmdname, const char *extra) break; } } - /* Get test info from UPS ? - Should we wait for 50 sec and get the - answer from the test. - Or return, as we may lose line power - and need to do a shutdown.*/ - } upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); @@ -1715,8 +1784,7 @@ int setvar (const char *varname, const char *val) } send_write_command(AUTHOR, 4); - /* Need to. Have to wait at least 0.25 sec max 16 sec */ - sleep (1); + sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ outlet_num = varname[NUT_OUTLET_POSITION] - '0'; if (outlet_num < 1 || outlet_num > 9) { @@ -1781,4 +1849,28 @@ int setvar (const char *varname, const char *val) return STAT_SET_INVALID; } +/******************************* + * Extracted from usbhid-ups.c * + *******************************/ +/* find the NUT value matching that XCP Item value */ +static const char *nut_find_infoval(info_lkp_t *xcp2info, const double value) +{ + info_lkp_t *info_lkp; + + /* if a conversion function is defined, use 'value' as argument for it */ + if (xcp2info->fun != NULL) { + return xcp2info->fun(value); + } + + /* use 'value' as an index for a lookup in an array */ + for (info_lkp = xcp2info; info_lkp->nut_value != NULL; info_lkp++) { + if (info_lkp->xcp_value == (long)value) { + upsdebugx(5, "nut_find_infoval: found %s (value: %ld)", info_lkp->nut_value, (long)value); + return info_lkp->nut_value; + } + } + + upsdebugx(3, "hu_find_infoval: no matching INFO_* value for this XCP value (%g)", value); + return NULL; +} diff --git a/drivers/bcmxcp.h b/drivers/bcmxcp.h index beb19fe..7174953 100644 --- a/drivers/bcmxcp.h +++ b/drivers/bcmxcp.h @@ -7,6 +7,11 @@ #include "timehead.h" +/* Have to wait at least 0,25 sec max 16 sec */ +/* 1 second is too short for PW9120 (leads to communication errors). + So we set it to 2 seconds */ +#define PW_SLEEP 2 + #define PW_MAX_TRY 3 /* How many times we try to send data. */ #define PW_COMMAND_START_BYTE (unsigned char)0xAB @@ -20,8 +25,8 @@ #define PW_STATUS_REQ (unsigned char)0x33 /* On Line, On Bypass, ... length 1-2 */ #define PW_METER_BLOCK_REQ (unsigned char)0x34 /* Current UPS status (Load, utility,...) length 1 */ #define PW_CUR_ALARM_REQ (unsigned char)0x35 /* Current alarm and event request. length 1 */ -#define PW_CONFIG_BLOC_REQ (unsigned char)0x36 /* Model serial#, ... length 1 */ -#define PW_BAT_TEST_REQ (unsigned char)0x3B /* Charging, floating, ... length 1 */ +#define PW_CONFIG_BLOCK_REQ (unsigned char)0x36 /* Model serial#, ... length 1 */ +#define PW_BATTERY_REQ (unsigned char)0x3B /* Charging, floating, ... length 1 */ #define PW_LIMIT_BLOCK_REQ (unsigned char)0x3C /* Configuration (Bypass thresholds,...). length 1 */ #define PW_TEST_RESULT_REQ (unsigned char)0x3F /* ??. length 1 */ #define PW_COMMAND_LIST_REQ (unsigned char)0x40 /* Available commands. length 1 */ @@ -342,10 +347,15 @@ #define BCMXCP_ALARM_CHARGER_ON_COMMAND 235 #define BCMXCP_ALARM_CHARGER_OFF_COMMAND 236 #define BCMXCP_ALARM_UPS_NORMAL 237 -#define BCMXCP_ALARM_EXTERNAL_COMMUNICATION_FAILURE 238 +#define BCMXCP_ALARM_INVERTER_PHASE_ROTATION 238 +#define BCMXCP_ALARM_UPS_OFF 239 +#define BCMXCP_ALARM_EXTERNAL_COMMUNICATION_FAILURE 240 +#define BCMXCP_ALARM_BATTERY_TEST_INPROGRESS 256 +#define BCMXCP_ALARM_SYSTEM_TEST_INPROGRESS 257 +#define BCMXCP_ALARM_BATTERY_TEST_ABORTED 258 #define BCMXCP_METER_MAP_MAX 91 /* Max no of entries in BCM/XCP meter map */ -#define BCMXCP_ALARM_MAP_MAX 240 /* Max no of entries in BCM/XCP alarm map (adjusted upwards to nearest multi of 8 */ +#define BCMXCP_ALARM_MAP_MAX 260 /* 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 */ const char *nut_entity; /* The NUT variable name */ @@ -353,7 +363,7 @@ typedef struct { /* Entry in BCM/XCP - UPS - NUT mapping table */ unsigned int meter_block_index; /* The position of this meter in the UPS meter block */ } BCMXCP_METER_MAP_ENTRY_t; -BCMXCP_METER_MAP_ENTRY_t +extern BCMXCP_METER_MAP_ENTRY_t bcmxcp_meter_map[BCMXCP_METER_MAP_MAX]; typedef struct { /* Entry in BCM/XCP - UPS mapping table */ @@ -361,7 +371,7 @@ typedef struct { /* Entry in BCM/XCP - UPS mapping table */ const char *alarm_desc; /* Description of this alarm */ } BCMXCP_ALARM_MAP_ENTRY_t; -BCMXCP_ALARM_MAP_ENTRY_t +extern BCMXCP_ALARM_MAP_ENTRY_t bcmxcp_alarm_map[BCMXCP_ALARM_MAP_MAX]; typedef struct { /* A place to store status info and other data not for NUT */ @@ -370,13 +380,22 @@ typedef struct { /* A place to store status info and other data not for NUT * unsigned int shutdowndelay; /* Shutdown delay in seconds, from ups.conf */ int alarm_on_battery; /* On Battery alarm active? */ int alarm_low_battery; /* Battery Low alarm active? */ + int alarm_replace_battery; /* Battery needs replacement! */ } BCMXCP_STATUS_t; -BCMXCP_STATUS_t +extern BCMXCP_STATUS_t bcmxcp_status; int checksum_test(const unsigned char*); unsigned char calc_checksum(const unsigned char *buf); - + +/* from usbhid-ups.h */ +typedef struct { + const long xcp_value; /* XCP value */ + const char *nut_value; /* NUT value */ + const char *(*fun)(double xcp_value); /* optional XCP to NUT mapping */ + double (*nuf)(const char *nut_value); /* optional NUT to HID mapping */ +} info_lkp_t; + #endif /*_POWERWARE_H */ diff --git a/drivers/bcmxcp_ser.c b/drivers/bcmxcp_ser.c index 0c7e6b3..2568eba 100644 --- a/drivers/bcmxcp_ser.c +++ b/drivers/bcmxcp_ser.c @@ -6,7 +6,7 @@ #define PW_MAX_BAUD 5 #define SUBDRIVER_NAME "RS-232 communication subdriver" -#define SUBDRIVER_VERSION "0.18" +#define SUBDRIVER_VERSION "0.19" /* communication driver description structure */ upsdrv_info_t comm_upsdrv_info = { @@ -45,6 +45,8 @@ static void send_command(unsigned char *command, int command_length) sbuf[command_length] = calc_checksum(sbuf); command_length += 1; + upsdebug_hex (3, "send_command", sbuf, command_length); + while (retry++ < PW_MAX_TRY) { if (retry == PW_MAX_TRY) { @@ -189,6 +191,7 @@ int get_answer(unsigned char *data, unsigned char command) } + upsdebug_hex (5, "get_answer", data, end_length); ser_comm_good(); return end_length; diff --git a/drivers/bcmxcp_usb.c b/drivers/bcmxcp_usb.c index 8c30a4d..6b9bcc5 100644 --- a/drivers/bcmxcp_usb.c +++ b/drivers/bcmxcp_usb.c @@ -12,7 +12,7 @@ #include #define SUBDRIVER_NAME "USB communication subdriver" -#define SUBDRIVER_VERSION "0.19" +#define SUBDRIVER_VERSION "0.21" /* communication driver description structure */ upsdrv_info_t comm_upsdrv_info = { @@ -104,6 +104,7 @@ void send_read_command(unsigned char command) buf[1] = 0x01; /* data length */ buf[2] = command; /* command to send */ buf[3] = calc_checksum(buf); /* checksum */ + upsdebug_hex (3, "send_read_command", buf, 4); usb_set_descriptor(upsdev, USB_DT_STRING, 4, buf, 4); /* FIXME: Ignore error */ } } @@ -122,6 +123,7 @@ void send_write_command(unsigned char *command, int command_length) /* Add checksum */ sbuf[command_length] = calc_checksum(sbuf); command_length += 1; + upsdebug_hex (3, "send_write_command", sbuf, command_length); usb_set_descriptor(upsdev, USB_DT_STRING, 4, sbuf, command_length); /* FIXME: Ignore error */ } } @@ -266,7 +268,8 @@ int get_answer(unsigned char *data, unsigned char command) end_length += length; my_buf += length + 5; } - upsdebugx(4, "get_answer: exiting (len=%d)", end_length); + + upsdebug_hex (5, "get_answer", data, end_length); return end_length; } @@ -299,6 +302,7 @@ int command_write_sequence(unsigned char *command, int command_length, unsigned while ((bytes_read < 1) && (retry < 5)) { send_write_command(command, command_length); + sleep(PW_SLEEP); bytes_read = get_answer(answer, command[0]); retry ++; } @@ -388,7 +392,7 @@ usb_dev_handle *nutusb_open(const char *port) usb_find_busses(); usb_find_devices(); - for (retry = 0; retry <= MAX_TRY ; retry++) + for (retry = 0; retry < MAX_TRY ; retry++) { dev_h = open_powerware_usb(); if (!dev_h) { diff --git a/drivers/belkin-hid.c b/drivers/belkin-hid.c index d3b294b..ce665e8 100644 --- a/drivers/belkin-hid.c +++ b/drivers/belkin-hid.c @@ -1,8 +1,9 @@ -/* belkin-hid.h - data to monitor Belkin UPS Systems USB/HID devices with NUT +/* belkin-hid.c - data to monitor Belkin UPS Systems USB/HID devices with NUT * * Copyright (C) * 2003 - 2008 Arnaud Quette * 2005 Peter Selinger + * 2011 Charles Lepple * * Sponsored by MGE UPS SYSTEMS * @@ -28,13 +29,18 @@ #include "belkin-hid.h" #include "usb-common.h" -#define BELKIN_HID_VERSION "Belkin HID 0.12" +#define BELKIN_HID_VERSION "Belkin HID 0.15" /* Belkin */ #define BELKIN_VENDORID 0x050d /* Liebert */ #define LIEBERT_VENDORID 0x10af +/* Note that there are at least two Liebert firmware types which both report + * a VID:PID of 10af:0001. The newer ones tend not to have the Belkin broken + * Usage Pages (and therefore use standard HID PDC paths) but they have + * incorrect exponents for some fields. + */ /* USB IDs device table */ static usb_device_id_t belkin_usb_device_table[] = { @@ -64,6 +70,123 @@ static usb_device_id_t belkin_usb_device_table[] = { { -1, -1, NULL } }; +static const char *liebert_online_fun(double value); +static const char *liebert_discharging_fun(double value); +static const char *liebert_charging_fun(double value); +static const char *liebert_lowbatt_fun(double value); +static const char *liebert_replacebatt_fun(double value); +static const char *liebert_shutdownimm_fun(double value); +static const char *liebert_config_voltage_fun(double value); +static const char *liebert_line_voltage_fun(double value); + +static info_lkp_t liebert_online_info[] = { + { 0, NULL, liebert_online_fun } +}; + +static info_lkp_t liebert_discharging_info[] = { + { 0, NULL, liebert_discharging_fun } +}; + +static info_lkp_t liebert_charging_info[] = { + { 0, NULL, liebert_charging_fun } +}; + +static info_lkp_t liebert_lowbatt_info[] = { + { 0, NULL, liebert_lowbatt_fun } +}; + +static info_lkp_t liebert_replacebatt_info[] = { + { 0, NULL, liebert_replacebatt_fun } +}; + +static info_lkp_t liebert_shutdownimm_info[] = { + { 0, NULL, liebert_shutdownimm_fun } +}; + +static info_lkp_t liebert_config_voltage_info[] = { + { 0, NULL, liebert_config_voltage_fun }, +}; + +static info_lkp_t liebert_line_voltage_info[] = { + { 0, NULL, liebert_line_voltage_fun }, +}; + +static double liebert_config_voltage_mult = 1.0; +static double liebert_line_voltage_mult = 1.0; +static char liebert_conversion_buf[10]; + +/* These lookup functions also cover the 1e-7 factor which seems to be due to a + * broken report descriptor in certain Liebert units. + */ +static const char *liebert_online_fun(double value) +{ + return value ? "online" : "!online"; +} + +static const char *liebert_discharging_fun(double value) +{ + return value ? "dischrg" : "!dischrg"; +} + +static const char *liebert_charging_fun(double value) +{ + return value ? "chrg" : "!chrg"; +} + +static const char *liebert_lowbatt_fun(double value) +{ + return value ? "lowbatt" : "!lowbatt"; +} + +static const char *liebert_replacebatt_fun(double value) +{ + return value ? "replacebatt" : "!replacebatt"; +} + +static const char *liebert_shutdownimm_fun(double value) +{ + return value ? "shutdownimm" : "!shutdownimm"; +} + +/*! Apply heuristics to Liebert ConfigVoltage for correction of other values. + * Logic is weird since the ConfigVoltage item comes after InputVoltage and + * OutputVoltage. + */ +static const char *liebert_config_voltage_fun(double value) +{ + if( value < 1 ) { + if( abs(value - 1e-7) < 1e-9 ) { + liebert_config_voltage_mult = 1e8; + liebert_line_voltage_mult = 1e7; /* stomp this in case input voltage was low */ + upsdebugx(2, "ConfigVoltage = %g -> assuming correction factor = %g", + value, liebert_config_voltage_mult); + } else { + upslogx(LOG_NOTICE, "ConfigVoltage exponent looks wrong, but not correcting."); + } + } + + snprintf(liebert_conversion_buf, sizeof(liebert_conversion_buf), "%.1f", + value * liebert_config_voltage_mult); + return liebert_conversion_buf; +} + +static const char *liebert_line_voltage_fun(double value) +{ + if( value < 1 ) { + if( abs(value - 1e-7) < 1e-9 ) { + liebert_line_voltage_mult = 1e7; + upsdebugx(2, "Input/OutputVoltage = %g -> assuming correction factor = %g", + value, liebert_line_voltage_mult); + } else { + upslogx(LOG_NOTICE, "LineVoltage exponent looks wrong, but not correcting."); + } + } + + snprintf(liebert_conversion_buf, sizeof(liebert_conversion_buf), "%.1f", + value * liebert_line_voltage_mult); + return liebert_conversion_buf; +} + /* some conversion functions specific to Belkin */ /* returns statically allocated string - must not use it again before @@ -338,12 +461,27 @@ static hid_info_t belkin_hid2nut[] = { { "ups.serial", 0, 0, "UPS.PowerSummary.iSerialNumber", NULL, "%s", 0, stringid_conversion }, { "ups.test.result", 0, 0, "UPS.BELKINControls.BELKINTest", NULL, "%s", 0, belkin_test_info }, { "ups.type", 0, 0, "UPS.BELKINDevice.BELKINUPSType", NULL, "%s", 0, belkin_upstype_conversion }, - + /* Liebert PSA: */ + { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL }, /* why .broken above? */ + { "input.frequency", 0, 0, "UPS.Input.Frequency", NULL, "%s", 0, divide_by_10_conversion }, + { "input.voltage", 0, 0, "UPS.Input.Voltage", NULL, "%s", 0, liebert_line_voltage_info }, + { "output.voltage", 0, 0, "UPS.Output.Voltage", NULL, "%s", 0, liebert_line_voltage_info }, + /* You would think these next two would be off by the same factor. You'd be wrong. */ + { "battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%s", 0, liebert_line_voltage_info }, + { "battery.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", NULL, "%s", HU_FLAG_STATIC, liebert_config_voltage_info }, + { "ups.load", 0, 0, "UPS.Output.PercentLoad", NULL, "%.0f", 0, NULL }, /* status */ - { "BOOL", 0, 0, "UPS.PowerSummary.Discharging", NULL, NULL, HU_FLAG_QUICK_POLL, discharging_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.Charging", NULL, NULL, HU_FLAG_QUICK_POLL, charging_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.ShutdownImminent", NULL, NULL, 0, shutdownimm_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.ACPresent", NULL, NULL, HU_FLAG_QUICK_POLL, online_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.Discharging", NULL, NULL, HU_FLAG_QUICK_POLL, liebert_discharging_info }, /* might not need to be liebert_* version */ + { "BOOL", 0, 0, "UPS.PowerSummary.Charging", NULL, NULL, HU_FLAG_QUICK_POLL, liebert_charging_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.ShutdownImminent", NULL, NULL, 0, liebert_shutdownimm_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.ACPresent", NULL, NULL, HU_FLAG_QUICK_POLL, liebert_online_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Discharging", NULL, NULL, HU_FLAG_QUICK_POLL, liebert_discharging_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Charging", NULL, NULL, HU_FLAG_QUICK_POLL, liebert_charging_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ShutdownImminent", NULL, NULL, 0, liebert_shutdownimm_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, NULL, HU_FLAG_QUICK_POLL, liebert_online_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.NeedReplacement", NULL, NULL, HU_FLAG_QUICK_POLL, liebert_replacebatt_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit", NULL, NULL, HU_FLAG_QUICK_POLL, liebert_lowbatt_info }, + /* { "BOOL", 0, 0, "UPS.PowerSummary.BelowRemainingCapacityLimit", NULL, "%s", 0, lowbatt_info }, broken! */ { "BOOL", 0, 0, "UPS.BELKINStatus.BELKINPowerStatus", NULL, NULL, 0, belkin_overload_conversion }, { "BOOL", 0, 0, "UPS.BELKINStatus.BELKINPowerStatus", NULL, NULL, 0, belkin_overheat_conversion }, diff --git a/drivers/bestfortress.c b/drivers/bestfortress.c index c3d60c4..b12dd15 100644 --- a/drivers/bestfortress.c +++ b/drivers/bestfortress.c @@ -33,8 +33,8 @@ #define inline __inline #endif -#define DRIVER_NAME "Best Fortress UPS driver" -#define DRIVER_VERSION "0.02" +#define DRIVER_NAME "Best Fortress UPS driver" +#define DRIVER_VERSION "0.05" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -116,7 +116,7 @@ static int checksum (char * s) int sum; for (i = 40, sum = 0; s[0] && s[1] && i > 0; i--, s += 2) { sum += (fromhex (s[0]) << 4) + fromhex (s[1]); - } + } return sum; } @@ -201,22 +201,30 @@ void upsdrv_updateinfo(void) char temp[256]; char *p; int loadva; - int len; + int len, recv; int retry; - + char ch; int checksum_ok, is_online=1, is_off, low_batt, trimming, boosting; + upsdebugx(1, "upsdrv_updateinfo"); + for (retry = 0; retry < 5; ++retry) { upsflushin (0, 0, "\r "); upssend ("f\r"); + while (ser_get_char(upsfd, &ch, 0, UPSDELAY) > 0 && ch != '\n'); /* response starts with \r\n */ + temp[2] = 0; do { - if (upsrecv (temp+2, sizeof temp - 2, ENDCHAR, IGNCHARS) <= 0) { + if ((recv = upsrecv (temp+2, sizeof temp - 2, ENDCHAR, IGNCHARS)) <= 0) { upsflushin (0, 0, "\r "); upssend ("f\r"); + while (ser_get_char(upsfd, &ch, 0, UPSDELAY) > 0 && ch != '\n'); /* response starts with \r\n */ } } while (temp[2] == 0); - /*syslog (LOG_DAEMON | LOG_NOTICE,"ups: got '%s'\n", p);*/ + upsdebugx(1, "upsdrv_updateinfo: received %i bytes (try %i)", recv, retry); + upsdebug_hex(5, "buffer", temp, recv); + + /* syslog (LOG_DAEMON | LOG_NOTICE,"ups: got %d chars '%s'\n", recv, temp + 2); */ /* status example: 000000000001000000000000012201210000001200014500000280600000990025000000000301BE 000000000001000000000000012401230000001200014800000280600000990025000000000301B7 @@ -248,6 +256,8 @@ void upsdrv_updateinfo(void) } if (!checksum_ok) { + upsdebugx(2, "checksum corruption"); + upsdebug_hex(3, "buffer", temp, len); dstate_datastale(); return; } diff --git a/drivers/bestups.c b/drivers/bestups.c index aa142da..854bddf 100644 --- a/drivers/bestups.c +++ b/drivers/bestups.c @@ -23,7 +23,7 @@ #include "serial.h" #define DRIVER_NAME "Best UPS driver" -#define DRIVER_VERSION "1.05" +#define DRIVER_VERSION "1.06" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -422,6 +422,7 @@ void upsdrv_help(void) void upsdrv_makevartable(void) { addvar(VAR_VALUE, "nombattvolt", "Override nominal battery voltage"); + addvar(VAR_VALUE, "battvoltmult", "Battery voltage multiplier"); addvar(VAR_VALUE, "ID", "Force UPS ID response string"); } diff --git a/drivers/blazer.c b/drivers/blazer.c index 0b3cc8f..d3792fc 100644 --- a/drivers/blazer.c +++ b/drivers/blazer.c @@ -2,9 +2,11 @@ * blazer.c: driver core for Megatec/Q1 protocol based UPSes * * A document describing the protocol implemented by this driver can be - * found online at "http://www.networkupstools.org/protocols/megatec.html". + * found online at http://www.networkupstools.org/ups-protocols/megatec.html * - * Copyright (C) 2008,2009 - Arjen de Korte + * Copyright (C) + * 2008,2009 - Arjen de Korte + * 2012 - Arnaud Quette * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -223,9 +225,9 @@ static int blazer_status(const char *cmd) } if (val[7] == '1') { /* Beeper On */ - dstate_setinfo("beeper.status", "enabled"); + dstate_setinfo("ups.beeper.status", "enabled"); } else { - dstate_setinfo("beeper.status", "disabled"); + dstate_setinfo("ups.beeper.status", "disabled"); } if (val[4] == '1') { /* UPS Type is Standby (0 is On_line) */ @@ -280,6 +282,7 @@ static int blazer_status(const char *cmd) if (val[6] == '1') { /* Shutdown Active */ alarm_set("Shutdown imminent!"); + status_set("FSD"); } alarm_commit(); @@ -425,6 +428,13 @@ static int blazer_instcmd(const char *cmdname, const char *extra) } if (!strcasecmp(cmdname, "shutdown.return")) { + /* + * Note: "S01R0001" and "S01R0002" may not work on early (GE) + * firmware versions. The failure mode is that the UPS turns + * off and never returns. The fix is to push the return value + * up by 2, i.e. S01R0003, and it will return online properly. + * (thus the default of ondelay=3 mins) + */ if (offdelay < 60) { snprintf(buf, sizeof(buf), "S.%dR%04d\r", offdelay / 6, ondelay); } else { @@ -450,11 +460,14 @@ static int blazer_instcmd(const char *cmdname, const char *extra) } /* - * If a command is invalid, it will be echoed back + * If a command is invalid, it will be echoed back. + * As an exception, Best UPS units will report "ACK" in case of success! */ if (blazer_command(buf, buf, sizeof(buf)) > 0) { - upslogx(LOG_ERR, "instcmd: command [%s] failed", cmdname); - return STAT_INSTCMD_FAILED; + if (strncmp(buf, "ACK", 3)) { + upslogx(LOG_ERR, "instcmd: command [%s] failed", cmdname); + return STAT_INSTCMD_FAILED; + } } upslogx(LOG_INFO, "instcmd: command [%s] handled", cmdname); @@ -523,6 +536,22 @@ static void blazer_initbattery(void) { const char *val; + /* If no values were provided by the user in ups.conf, try to guesstimate + * battery.charge, but announce it! */ + if ((batt.volt.nom != 1) && (batt.volt.high == -1) && (batt.volt.high == -1)) { + upslogx(LOG_INFO, "No values provided for battery high/low voltages in ups.conf\n"); + + /* Basic formula, which should cover most cases */ + batt.volt.low = 104 * batt.volt.nom / 120; + batt.volt.high = 130 * batt.volt.nom / 120; + + /* Publish these data too */ + dstate_setinfo("battery.voltage.low", "%.2f", batt.volt.low); + dstate_setinfo("battery.voltage.high", "%.2f", batt.volt.high); + + upslogx(LOG_INFO, "Using 'guestimation' (low: %f, high: %f)!", batt.volt.low, batt.volt.high); + } + val = getval("runtimecal"); if (val) { double rh, lh, rl, ll; diff --git a/drivers/blazer_ser.c b/drivers/blazer_ser.c index fbc7e35..6351c62 100644 --- a/drivers/blazer_ser.c +++ b/drivers/blazer_ser.c @@ -26,7 +26,7 @@ #include "blazer.h" #define DRIVER_NAME "Megatec/Q1 protocol serial driver" -#define DRIVER_VERSION "1.51" +#define DRIVER_VERSION "1.55" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -37,7 +37,7 @@ upsdrv_info_t upsdrv_info = { { NULL } }; -#define SER_WAIT_SEC 1 +#define SER_WAIT_SEC 1 /* 3 seconds for Best UPS */ /* * Generic command processing function. Send a command and read a reply. @@ -58,7 +58,7 @@ int blazer_command(const char *cmd, char *buf, size_t buflen) return ret; } - upsdebugx(3, "send: %.*s", (int)strcspn(cmd, "\r"), cmd); + upsdebugx(3, "send: '%.*s'", (int)strcspn(cmd, "\r"), cmd); ret = ser_get_buf(upsfd, buf, buflen, SER_WAIT_SEC, 0); @@ -67,7 +67,7 @@ int blazer_command(const char *cmd, char *buf, size_t buflen) return ret; } - upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); + upsdebugx(3, "read: '%.*s'", (int)strcspn(buf, "\r"), buf); return ret; #else const struct { diff --git a/drivers/blazer_usb.c b/drivers/blazer_usb.c index b303596..1104071 100644 --- a/drivers/blazer_usb.c +++ b/drivers/blazer_usb.c @@ -5,7 +5,7 @@ * found online at "http://www.networkupstools.org/protocols/megatec.html". * * Copyright (C) 2003-2009 Arjen de Korte - * Copyright (C) 2011 Arnaud Quette + * Copyright (C) 2011-2012 Arnaud Quette * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ #include "blazer.h" #define DRIVER_NAME "Megatec/Q1 protocol USB driver" -#define DRIVER_VERSION "0.04" +#define DRIVER_VERSION "0.08" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -64,7 +64,7 @@ static int cypress_command(const char *cmd, char *buf, size_t buflen) /* Write data in 8-byte chunks */ /* ret = usb->set_report(udev, 0, (unsigned char *)&tmp[i], 8); */ ret = usb_control_msg(udev, USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, - 0x09, 0x200, 0, &tmp[i], 8, 1000); + 0x09, 0x200, 0, &tmp[i], 8, 5000); if (ret <= 0) { upsdebugx(3, "send: %s", ret ? usb_strerror() : "timeout"); @@ -346,7 +346,11 @@ static usb_device_id_t blazer_usb_id[] = { { USB_DEVICE(0x0001, 0x0000), &krauler_subdriver }, /* Krauler UP-M500VA */ { USB_DEVICE(0xffff, 0x0000), &krauler_subdriver }, /* Ablerex 625L USB */ { USB_DEVICE(0x0665, 0x5161), &cypress_subdriver }, /* Belkin F6C1200-UNV */ + { USB_DEVICE(0x06da, 0x0002), &cypress_subdriver }, /* Online Yunto YQ450 */ { USB_DEVICE(0x06da, 0x0003), &ippon_subdriver }, /* Mustek Powermust */ + { USB_DEVICE(0x06da, 0x0004), &cypress_subdriver }, /* Phoenixtec Innova 3/1 T */ + { USB_DEVICE(0x06da, 0x0005), &cypress_subdriver }, /* Phoenixtec Innova RT */ + { USB_DEVICE(0x06da, 0x0201), &cypress_subdriver }, /* Phoenixtec Innova T */ { USB_DEVICE(0x0f03, 0x0001), &cypress_subdriver }, /* Unitek Alpha 1200Sx */ { USB_DEVICE(0x14f0, 0x00c9), &phoenix_subdriver }, /* GE EP series */ /* end of list */ diff --git a/drivers/compaq-mib.c b/drivers/compaq-mib.c index 206b04b..febb9c0 100644 --- a/drivers/compaq-mib.c +++ b/drivers/compaq-mib.c @@ -1,14 +1,15 @@ /* compaq-mib.c - data to monitor SNMP UPS with NUT * - * Copyright (C) 2002-2006 - * Arnaud Quette - * Niels Baggesen - * Philip Ward + * Copyright (C) + * 2002-2012 Arnaud Quette + * 2002-2006 Niels Baggesen + * 2002-2006 Philip Ward * - * Sponsored by MGE UPS SYSTEMS + * This program was sponsored by MGE UPS SYSTEMS, and now Eaton * - * This version has been tested using an HP R5500XR UPS with AF401A - * management card and a single phase input. + * This version has been tested using: + * HP R5500XR UPS with management card AF401A and a single phase input + * HP R/T3000 UPS with management card AF465A and a single phase input * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,48 +30,58 @@ #include "compaq-mib.h" -#define CPQPOWER_MIB_VERSION "1.0" +#define CPQPOWER_MIB_VERSION "1.5" + +#define DEFAULT_ONDELAY 30 +#define DEFAULT_OFFDELAY 20 +#define STR_DEFAULT_ONDELAY "30" +#define STR_DEFAULT_OFFDELAY "20" + +/* Note: RFC-1628 (UPS MIB) is also supported on these devices! */ /* SNMP OIDs set */ -#define CPQPOWER_OID_UPS_MIB "1.3.6.1.4.1.232.165.3" +#define CPQPOWER_OID_UPS_MIB ".1.3.6.1.4.1.232.165.3" +/* FIXME: to be verified */ +#define CPQPOWER_SYSOID CPQPOWER_OID_UPS_MIB -#define CPQPOWER_OID_MFR_NAME CPQPOWER_OID_UPS_MIB ".1.1.0" /* UPS-MIB::upsIdentManufacturer */ -#define CPQPOWER_OID_MODEL_NAME CPQPOWER_OID_UPS_MIB ".1.2.0" /* UPS-MIB::upsIdentModel */ -#define CPQPOWER_OID_FIRMREV CPQPOWER_OID_UPS_MIB ".1.3.0" /* UPS-MIB::upsIdentUPSSoftwareVersion */ -#define CPQPOWER_OID_OEMCODE CPQPOWER_OID_UPS_MIB ".1.4.0" /* UPS-MIB::upsIdentAgentSoftwareVersion */ +#define CPQPOWER_OID_MFR_NAME ".1.3.6.1.4.1.232.165.3.1.1.0" /* UPS-MIB::upsIdentManufacturer */ +#define CPQPOWER_OID_MODEL_NAME ".1.3.6.1.4.1.232.165.3.1.2.0" /* UPS-MIB::upsIdentModel */ +#define CPQPOWER_OID_FIRMREV ".1.3.6.1.4.1.232.165.3.1.3.0" /* UPS-MIB::upsIdentUPSSoftwareVersion */ +#define CPQPOWER_OID_OEMCODE ".1.3.6.1.4.1.232.165.3.1.4.0" /* UPS-MIB::upsIdentAgentSoftwareVersion */ -#define CPQPOWER_OID_BATT_RUNTIME CPQPOWER_OID_UPS_MIB ".2.1.0" /* UPS-MIB::upsEstimatedMinutesRemaining */ -#define CPQPOWER_OID_BATT_VOLTAGE CPQPOWER_OID_UPS_MIB ".2.2.0" /* UPS-MIB::upsBatteryVoltage */ -#define CPQPOWER_OID_BATT_CURRENT CPQPOWER_OID_UPS_MIB ".2.3.0" /* UPS-MIB::upsBatteryCurrent */ -#define CPQPOWER_OID_BATT_CHARGE CPQPOWER_OID_UPS_MIB ".2.4.0" /* UPS-MIB::upsBattCapacity */ -#define CPQPOWER_OID_BATT_STATUS CPQPOWER_OID_UPS_MIB ".2.5.0" /* UPS-MIB::upsBatteryAbmStatus */ +#define CPQPOWER_OID_BATT_RUNTIME ".1.3.6.1.4.1.232.165.3.2.1.0" /* UPS-MIB::upsEstimatedMinutesRemaining */ +#define CPQPOWER_OID_BATT_VOLTAGE ".1.3.6.1.4.1.232.165.3.2.2.0" /* UPS-MIB::upsBatteryVoltage */ +#define CPQPOWER_OID_BATT_CURRENT ".1.3.6.1.4.1.232.165.3.2.3.0" /* UPS-MIB::upsBatteryCurrent */ +#define CPQPOWER_OID_BATT_CHARGE ".1.3.6.1.4.1.232.165.3.2.4.0" /* UPS-MIB::upsBattCapacity */ +#define CPQPOWER_OID_BATT_STATUS ".1.3.6.1.4.1.232.165.3.2.5.0" /* UPS-MIB::upsBatteryAbmStatus */ -#define CPQPOWER_OID_IN_FREQ CPQPOWER_OID_UPS_MIB ".3.1.0" /* UPS-MIB::upsInputFrequency */ -#define CPQPOWER_OID_IN_LINEBADS CPQPOWER_OID_UPS_MIB ".3.2.0" /* UPS-MIB::upsInputLineBads */ -#define CPQPOWER_OID_IN_LINES CPQPOWER_OID_UPS_MIB ".3.3.0" /* UPS-MIB::upsInputNumPhases */ +#define CPQPOWER_OID_IN_FREQ ".1.3.6.1.4.1.232.165.3.3.1.0" /* UPS-MIB::upsInputFrequency */ +#define CPQPOWER_OID_IN_LINEBADS ".1.3.6.1.4.1.232.165.3.3.2.0" /* UPS-MIB::upsInputLineBads */ +#define CPQPOWER_OID_IN_LINES ".1.3.6.1.4.1.232.165.3.3.3.0" /* UPS-MIB::upsInputNumPhases */ -#define CPQPOWER_OID_IN_PHASE CPQPOWER_OID_UPS_MIB ".3.4.1.1" /* UPS-MIB::upsInputPhase */ -#define CPQPOWER_OID_IN_VOLTAGE CPQPOWER_OID_UPS_MIB ".3.4.1.2" /* UPS-MIB::upsInputVoltage */ -#define CPQPOWER_OID_IN_CURRENT CPQPOWER_OID_UPS_MIB ".3.4.1.3" /* UPS-MIB::upsInputCurrent */ -#define CPQPOWER_OID_IN_POWER CPQPOWER_OID_UPS_MIB ".3.4.1.4" /* UPS-MIB::upsInputWatts */ +#define CPQPOWER_OID_IN_PHASE ".1.3.6.1.4.1.232.165.3.3.4.1.1" /* UPS-MIB::upsInputPhase */ +#define CPQPOWER_OID_IN_VOLTAGE ".1.3.6.1.4.1.232.165.3.3.4.1.2" /* UPS-MIB::upsInputVoltage */ +#define CPQPOWER_OID_IN_CURRENT ".1.3.6.1.4.1.232.165.3.3.4.1.3" /* UPS-MIB::upsInputCurrent */ +#define CPQPOWER_OID_IN_POWER ".1.3.6.1.4.1.232.165.3.3.4.1.4" /* UPS-MIB::upsInputWatts */ -#define CPQPOWER_OID_LOAD_LEVEL CPQPOWER_OID_UPS_MIB ".4.1.0" /* UPS-MIB::upsOutputLoad */ -#define CPQPOWER_OID_OUT_FREQUENCY CPQPOWER_OID_UPS_MIB ".4.2.0" /* UPS-MIB::upsOutputFrequency */ -#define CPQPOWER_OID_OUT_LINES CPQPOWER_OID_UPS_MIB ".4.3.0" /* UPS-MIB::upsOutputNumPhases */ +#define CPQPOWER_OID_LOAD_LEVEL ".1.3.6.1.4.1.232.165.3.4.1.0" /* UPS-MIB::upsOutputLoad */ +#define CPQPOWER_OID_OUT_FREQUENCY ".1.3.6.1.4.1.232.165.3.4.2.0" /* UPS-MIB::upsOutputFrequency */ +#define CPQPOWER_OID_OUT_LINES ".1.3.6.1.4.1.232.165.3.4.3.0" /* UPS-MIB::upsOutputNumPhases */ -#define CPQPOWER_OID_OUT_PHASE CPQPOWER_OID_UPS_MIB ".4.4.1.1" /* UPS-MIB::upsOutputPhase */ -#define CPQPOWER_OID_OUT_VOLTAGE CPQPOWER_OID_UPS_MIB ".4.4.1.2" /* UPS-MIB::upsOutputVoltage */ -#define CPQPOWER_OID_OUT_CURRENT CPQPOWER_OID_UPS_MIB ".4.4.1.3" /* UPS-MIB::upsOutputCurrent */ -#define CPQPOWER_OID_OUT_POWER CPQPOWER_OID_UPS_MIB ".4.4.1.4" /* UPS-MIB::upsOutputWatts */ +#define CPQPOWER_OID_OUT_PHASE ".1.3.6.1.4.1.232.165.3.4.4.1.1" /* UPS-MIB::upsOutputPhase */ +#define CPQPOWER_OID_OUT_VOLTAGE ".1.3.6.1.4.1.232.165.3.4.4.1.2" /* UPS-MIB::upsOutputVoltage */ +#define CPQPOWER_OID_OUT_CURRENT ".1.3.6.1.4.1.232.165.3.4.4.1.3" /* UPS-MIB::upsOutputCurrent */ +#define CPQPOWER_OID_OUT_POWER ".1.3.6.1.4.1.232.165.3.4.4.1.4" /* UPS-MIB::upsOutputWatts */ -#define CPQPOWER_OID_POWER_STATUS CPQPOWER_OID_UPS_MIB ".4.5.0" /* UPS-MIB::upsOutputSource */ +#define CPQPOWER_OID_POWER_STATUS ".1.3.6.1.4.1.232.165.3.4.5.0" /* UPS-MIB::upsOutputSource */ -#define CPQPOWER_OID_AMBIENT_TEMP CPQPOWER_OID_UPS_MIB ".6.1.0" /* UPS-MIB::upsEnvAmbientTemp */ +#define CPQPOWER_OID_AMBIENT_TEMP ".1.3.6.1.4.1.232.165.3.6.1.0" /* UPS-MIB::upsEnvAmbientTemp */ + +#define CPQPOWER_OID_UPS_TEST_BATT ".1.3.6.1.4.1.232.165.3.7.1.0" /* UPS-MIB::upsTestBattery */ +#define CPQPOWER_OID_UPS_TEST_RES ".1.3.6.1.4.1.232.165.3.7.2.0" /* UPS-MIB::upsTestBatteryStatus */ +#define CPQPOWER_OID_ALARM_OB ".1.3.6.1.4.1.232.165.3.7.3.0" /* UPS-MIB::upsOnBattery */ +#define CPQPOWER_OID_ALARM_LB ".1.3.6.1.4.1.232.165.3.7.4.0" /* UPS-MIB::upsLowBattery */ -#define CPQPOWER_OID_UPS_TEST_BATT CPQPOWER_OID_UPS_MIB ".7.1.0" /* UPS-MIB::upsTestBattery */ -#define CPQPOWER_OID_UPS_TEST_RES CPQPOWER_OID_UPS_MIB ".7.2.0" /* UPS-MIB::upsTestBatteryStatus */ -#define CPQPOWER_OID_ALARM_OB CPQPOWER_OID_UPS_MIB ".7.3.0" /* UPS-MIB::upsOnBattery */ -#define CPQPOWER_OID_ALARM_LB CPQPOWER_OID_UPS_MIB ".7.4.0" /* UPS-MIB::upsLowBattery */ static info_lkp_t cpqpower_alarm_ob[] = { { 1, "OB" }, @@ -132,7 +143,28 @@ static info_lkp_t cpqpower_test_res_info[] = { { 0, "NULL" } } ; -#define CPQPOWER_OID_SD_AFTER_DELAY CPQPOWER_OID_UPS_MIB ".8.1.0" /* UPS-MIB::upsShutdownAfterDelay */ +#define CPQPOWER_START_TEST 1 + +static info_lkp_t cpqpower_outlet_status_info[] = { + { 1, "on" }, + { 2, "off" }, + { 3, "pendingOff" }, /* transitional status */ + { 4, "pendingOn" }, /* transitional status */ + { 5, "unknown" }, + { 0, NULL } +}; + +/* Ugly hack: having the matching OID present means that the outlet is + * switchable. So, it should not require this value lookup */ +static info_lkp_t cpqpower_outlet_switchability_info[] = { + { 1, "yes" }, + { 2, "yes" }, + { 3, "yes" }, + { 4, "yes" }, + { 0, NULL } +}; + +#define CPQPOWER_OID_SD_AFTER_DELAY ".1.3.6.1.4.1.232.165.3.8.1.0" /* UPS-MIB::upsControlOutputOffDelay */ #define CPQPOWER_OFF_DO 0 /* Snmp2NUT lookup table */ @@ -142,10 +174,15 @@ static snmp_info_t cpqpower_mib[] = { /* info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar */ { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_MFR_NAME, "HP/Compaq", SU_FLAG_STATIC, NULL }, { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_MODEL_NAME, "SNMP UPS", SU_FLAG_STATIC, NULL }, - { "ups.model.aux", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_OEMCODE, "", SU_FLAG_STATIC, NULL }, + /* { "ups.model.aux", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_OEMCODE, "", SU_FLAG_STATIC, NULL },*/ + { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.232.165.1.2.7.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + /* FIXME: split between firmware and firmware.aux ("00.01.0019;00.01.0004") + * UPS Firmware Revision : 00.01.0004 + * Communication Board Firmware Revision : 00.01.0019 */ { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_FIRMREV, "", SU_FLAG_STATIC, NULL }, { "ups.load", 0, 1.0, CPQPOWER_OID_LOAD_LEVEL, "", 0, NULL }, { "ups.realpower", 0, 1.0, CPQPOWER_OID_OUT_POWER, "", SU_OUTPUT_1, NULL }, + { "ups.realpower", 0, 1.0, ".1.3.6.1.4.1.232.165.3.9.3.0", "", SU_OUTPUT_1, NULL }, { "ups.L1.realpower", 0, 0.1, CPQPOWER_OID_OUT_POWER ".1", "", SU_OUTPUT_3, NULL }, { "ups.L2.realpower", 0, 0.1, CPQPOWER_OID_OUT_POWER ".2", "", SU_OUTPUT_3, NULL }, { "ups.L3.realpower", 0, 0.1, CPQPOWER_OID_OUT_POWER ".3", "", SU_OUTPUT_3, NULL }, @@ -154,27 +191,54 @@ static snmp_info_t cpqpower_mib[] = { { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_ALARM_OB, "", SU_STATUS_BATT, cpqpower_alarm_ob }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_ALARM_LB, "", SU_STATUS_BATT, cpqpower_alarm_lb }, /* { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_BATT_STATUS, "", SU_STATUS_BATT, ietf_batt_info }, */ + /* FIXME: this should use either .1.3.6.1.4.1.232.165.3.11.1.0 (upsTopologyType) + * or .1.3.6.1.4.1.232.165.3.11.2.0 (upsTopoMachineCode) */ { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_POWER_STATUS, "", SU_STATUS_PWR, cpqpower_mode_info }, { "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_UPS_TEST_RES, "", 0, cpqpower_test_res_info }, + /* FIXME: handle ups.date and ups.time + * - OID: .1.3.6.1.4.1.232.165.3.9.5.0 + * - format MM/DD/YYYY HH:MM:SS */ + /* FIXME: handle upsInputSource.0 (".1.3.6.1.4.1.232.165.3.3.5.0") + * other(1) + * none(2) + * primaryUtility(3) + * bypassFeed(4) + * secondaryUtility(5) + * generator(6) + * flywheel(7) + * fuelcell(8) */ + + { "ups.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW, 6, ".1.3.6.1.4.1.232.165.3.8.1.0", STR_DEFAULT_OFFDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "ups.delay.start", ST_FLAG_STRING | ST_FLAG_RW, 6, ".1.3.6.1.4.1.232.165.3.8.2.0", STR_DEFAULT_ONDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "ups.timer.shutdown", 0, 1, ".1.3.6.1.4.1.232.165.3.8.1.0", "", SU_FLAG_OK, NULL }, + { "ups.timer.start", 0, 1, ".1.3.6.1.4.1.232.165.3.8.2.0", "", SU_FLAG_OK, NULL }, /* Ambient page */ { "ambient.temperature", 0, 1.0, CPQPOWER_OID_AMBIENT_TEMP, "", 0, NULL }, + { "ambient.temperature.low", 0, 1.0, ".1.3.6.1.4.1.232.165.3.6.2.0", "", 0, NULL }, + { "ambient.temperature.high", 0, 1.0, ".1.3.6.1.4.1.232.165.3.6.3.0", "", 0, NULL }, /* Battery page */ { "battery.charge", 0, 1.0, CPQPOWER_OID_BATT_CHARGE, "", 0, NULL }, - { "battery.runtime", 0, 60.0, CPQPOWER_OID_BATT_RUNTIME, "", 0, NULL }, + { "battery.runtime", 0, 1.0, CPQPOWER_OID_BATT_RUNTIME, "", 0, NULL }, { "battery.voltage", 0, 0.1, CPQPOWER_OID_BATT_VOLTAGE, "", 0, NULL }, { "battery.current", 0, 0.1, CPQPOWER_OID_BATT_CURRENT, "", 0, NULL }, + /* FIXME: need the new variable (for ABM) + { "battery.status", 0, 0.1, ".1.3.6.1.4.1.232.165.3.2.5.0", "", 0, NULL }, */ /* Input page */ { "input.phases", 0, 1.0, CPQPOWER_OID_IN_LINES, "", SU_FLAG_SETINT, NULL, &input_phases }, /* { "input.phase", 0, 1.0, CPQPOWER_OID_IN_PHASE, "", SU_OUTPUT_1, NULL }, */ { "input.frequency", 0, 0.1, CPQPOWER_OID_IN_FREQ , "", 0, NULL }, { "input.voltage", 0, 1.0, CPQPOWER_OID_IN_VOLTAGE, "", SU_OUTPUT_1, NULL }, + { "input.voltage", 0, 1.0, ".1.3.6.1.4.1.232.165.3.3.4.1.2.1", "", SU_OUTPUT_1, NULL }, + { "input.voltage.nominal", ST_FLAG_RW | ST_FLAG_STRING, 3, ".1.3.6.1.4.1.232.165.3.9.2.0", "", SU_OUTPUT_1, NULL }, { "input.L1-N.voltage", 0, 1.0, CPQPOWER_OID_IN_VOLTAGE ".1", "", SU_INPUT_3, NULL }, { "input.L2-N.voltage", 0, 1.0, CPQPOWER_OID_IN_VOLTAGE ".2", "", SU_INPUT_3, NULL }, { "input.L3-N.voltage", 0, 1.0, CPQPOWER_OID_IN_VOLTAGE ".3", "", SU_INPUT_3, NULL }, { "input.current", 0, 0.1, CPQPOWER_OID_IN_CURRENT, "", SU_OUTPUT_1, NULL }, + { "input.current", 0, 0.1, ".1.3.6.1.4.1.232.165.3.3.4.1.3.1", "", SU_OUTPUT_1, NULL }, + { "input.L1.current", 0, 0.1, CPQPOWER_OID_IN_CURRENT ".1", "", SU_INPUT_3, NULL }, { "input.L2.current", 0, 0.1, CPQPOWER_OID_IN_CURRENT ".2", "", SU_INPUT_3, NULL }, { "input.L3.current", 0, 0.1, CPQPOWER_OID_IN_CURRENT ".3", "", SU_INPUT_3, NULL }, @@ -188,21 +252,76 @@ static snmp_info_t cpqpower_mib[] = { { "output.phases", 0, 1.0, CPQPOWER_OID_OUT_LINES, "", SU_FLAG_SETINT, NULL, &output_phases }, /* { "output.phase", 0, 1.0, CPQPOWER_OID_OUT_PHASE, "", SU_OUTPUT_1, NULL }, */ { "output.frequency", 0, 0.1, CPQPOWER_OID_OUT_FREQUENCY, "", 0, NULL }, + /* FIXME: handle multiplier (0.1 there) */ + { "output.frequency.nominal", ST_FLAG_RW | ST_FLAG_STRING, 3, ".1.3.6.1.4.1.232.165.3.9.4.0", "", SU_OUTPUT_1, NULL }, { "output.voltage", 0, 1.0, CPQPOWER_OID_OUT_VOLTAGE, "", SU_OUTPUT_1, NULL }, + { "output.voltage", 0, 1.0, ".1.3.6.1.4.1.232.165.3.4.4.1.2.1", "", SU_OUTPUT_1, NULL }, + { "output.voltage.nominal", ST_FLAG_RW | ST_FLAG_STRING, 3, ".1.3.6.1.4.1.232.165.3.9.1.0", "", SU_OUTPUT_1, NULL }, { "output.L1-N.voltage", 0, 1.0, CPQPOWER_OID_OUT_VOLTAGE ".1", "", SU_OUTPUT_3, NULL }, { "output.L2-N.voltage", 0, 1.0, CPQPOWER_OID_OUT_VOLTAGE ".2", "", SU_OUTPUT_3, NULL }, { "output.L3-N.voltage", 0, 1.0, CPQPOWER_OID_OUT_VOLTAGE ".3", "", SU_OUTPUT_3, NULL }, { "output.current", 0, 0.1, CPQPOWER_OID_OUT_CURRENT, "", SU_OUTPUT_1, NULL }, + { "output.current", 0, 0.1, ".1.3.6.1.4.1.232.165.3.4.4.1.3.1", "", SU_OUTPUT_1, NULL }, + /* { "output.realpower", 0, 1.0, ".1.3.6.1.4.1.232.165.3.4.4.1.4", "", SU_OUTPUT_1, NULL }, */ { "output.L1.current", 0, 0.1, CPQPOWER_OID_OUT_CURRENT ".1", "", SU_OUTPUT_3, NULL }, { "output.L2.current", 0, 0.1, CPQPOWER_OID_OUT_CURRENT ".2", "", SU_OUTPUT_3, NULL }, { "output.L3.current", 0, 0.1, CPQPOWER_OID_OUT_CURRENT ".3", "", SU_OUTPUT_3, NULL }, + /* FIXME: what to map with these? + * Name/OID: upsConfigLowOutputVoltageLimit.0; Value (Integer): 160 + * => input.transfer.low? + * Name/OID: upsConfigHighOutputVoltageLimit.0; Value (Integer): 288 + * => input.transfer.high? */ + + /* Outlet page */ + { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "outlet.count", 0, 1, ".1.3.6.1.4.1.232.165.3.10.1.0", "0", 0, NULL }, /* upsNumReceptacles */ + +/* { "outlet.current", 0, 0.001, AR_OID_UNIT_CURRENT ".0", NULL, 0, NULL, NULL }, + { "outlet.voltage", 0, 0.001, AR_OID_UNIT_VOLTAGE ".0", NULL, 0, NULL, NULL }, + { "outlet.realpower", 0, 1.0, AR_OID_UNIT_ACTIVEPOWER ".0", NULL, 0, NULL, NULL }, + { "outlet.power", 0, 1.0, AR_OID_UNIT_APPARENTPOWER ".0", NULL, 0, NULL, NULL }, */ + + /* outlet template definition */ + /* FIXME always true? */ + { "outlet.%i.switchable", ST_FLAG_STRING, 3, ".1.3.6.1.4.1.232.165.3.10.2.1.1.%i", "yes", SU_FLAG_STATIC | SU_OUTLET, &cpqpower_outlet_switchability_info[0], NULL }, + { "outlet.%i.id", 0, 1, ".1.3.6.1.4.1.232.165.3.10.2.1.1.%i", "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET, NULL, NULL }, + /* { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, AR_OID_OUTLET_NAME ".%i", NULL, SU_OUTLET, NULL, NULL }, */ + { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.232.165.3.10.2.1.2.%i", NULL, SU_FLAG_OK | SU_OUTLET, &cpqpower_outlet_status_info[0], NULL }, + /* FIXME: come up with a suitable varname! + * - The delay after going On Battery until the Receptacle is automatically turned Off. + * A value of -1 means that this Output should never be turned Off automatically, but must be turned Off only by command. + * { "outlet.%i.autoswitch.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW, 6, ".1.3.6.1.4.1.232.165.3.10.2.1.5.%i", STR_DEFAULT_OFFDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, // upsRecepAutoOffDelay + * - Seconds delay after the Outlet is signaled to turn On before the Output is Automatically turned ON. + * A value of -1 means that this Output should never be turned On automatically, but only when specifically commanded to do so. + * { "outlet.%i.autoswitch.delay.start", ST_FLAG_STRING | ST_FLAG_RW, 6, ".1.3.6.1.4.1.232.165.3.10.2.1.5.%i", STR_DEFAULT_OFFDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, // upsRecepAutoOnDelay + */ + /* FIXME: also define .stop (as for 'shutdown.reboot') + * and .delay */ + { "outlet.%i.load.off", 0, 0, ".1.3.6.1.4.1.232.165.3.10.2.1.3.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, + { "outlet.%i.load.on", 0, 0, ".1.3.6.1.4.1.232.165.3.10.2.1.4.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, + /* FIXME: also define a .delay or map to "outlet.%i.delay.shutdown" */ + { "outlet.%i.load.cycle", 0, 0, ".1.3.6.1.4.1.232.165.3.10.2.1.7.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, + /* instant commands. */ - { "load.off", 0, CPQPOWER_OFF_DO, CPQPOWER_OID_SD_AFTER_DELAY, "", SU_TYPE_CMD, NULL }, -/* { CMD_SHUTDOWN, 0, CPQPOWER_OFF_GRACEFUL, CPQPOWER_OID_OFF, "", 0, NULL }, */ + /* We need to duplicate load.{on,off} Vs load.{on,off}.delay, since + * "0" cancels the shutdown, so we put "1" (second) for immediate off! */ + { "load.off", 0, 1, ".1.3.6.1.4.1.232.165.3.8.1.0", "", SU_TYPE_CMD, NULL }, + { "load.on", 0, 1, ".1.3.6.1.4.1.232.165.3.8.2.0", "", SU_TYPE_CMD, NULL }, + { "shutdown.stop", 0, 0, ".1.3.6.1.4.1.232.165.3.8.1.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + /* FIXME: need ups.{timer,delay}.{start,shutdown} param counterparts! */ + + { "load.off.delay", 0, DEFAULT_OFFDELAY, ".1.3.6.1.4.1.232.165.3.8.1.0", "", SU_TYPE_CMD, NULL }, + { "load.on.delay", 0, DEFAULT_ONDELAY, ".1.3.6.1.4.1.232.165.3.8.2.0", "", SU_TYPE_CMD, NULL }, + /* { CMD_SHUTDOWN, 0, CPQPOWER_OFF_GRACEFUL, CPQPOWER_OID_OFF, "", 0, NULL }, */ + { "shutdown.reboot", 0, 0, ".1.3.6.1.4.1.232.165.3.8.6.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "test.battery.start", 0, CPQPOWER_START_TEST, ".1.3.6.1.4.1.232.165.3.7.1.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, /* end of structure. */ { NULL, 0, 0, NULL, NULL, 0, NULL } }; -mib2nut_info_t compaq = { "cpqpower", CPQPOWER_MIB_VERSION, "", CPQPOWER_OID_MFR_NAME, cpqpower_mib }; +mib2nut_info_t compaq = { "cpqpower", CPQPOWER_MIB_VERSION, "", CPQPOWER_OID_MFR_NAME, cpqpower_mib, CPQPOWER_SYSOID }; + diff --git a/drivers/cps-hid.c b/drivers/cps-hid.c index b098df3..44824ff 100644 --- a/drivers/cps-hid.c +++ b/drivers/cps-hid.c @@ -52,7 +52,7 @@ static usb_device_id_t cps_usb_device_table[] = { { USB_DEVICE(CPS_VENDORID, 0x0005), NULL }, /* Dynex DX-800U? */ { USB_DEVICE(CPS_VENDORID, 0x0501), &cps_battery_scale }, - /* OR2200LCDRM2U */ + /* OR2200LCDRM2U, OR700LCDRM1U, PR6000LCDRTXL5U */ { USB_DEVICE(CPS_VENDORID, 0x0601), NULL }, /* Terminating entry */ diff --git a/drivers/dstate.c b/drivers/dstate.c index 316c54f..2e5bd7e 100644 --- a/drivers/dstate.c +++ b/drivers/dstate.c @@ -3,6 +3,7 @@ Copyright (C) 2003 Russell Kroll 2008 Arjen de Korte + 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -273,6 +274,7 @@ static int st_tree_dump_conn(st_tree_t *node, conn_t *conn) { int ret; enum_t *etmp; + range_t *rtmp; if (!node) { return 1; /* not an error */ @@ -297,6 +299,13 @@ static int st_tree_dump_conn(st_tree_t *node, conn_t *conn) } } + /* send any ranges */ + for (rtmp = node->range_list; rtmp; rtmp = rtmp->next) { + if (!send_to_one(conn, "ADDRANGE %s %i %i\n", node->var, rtmp->min, rtmp->max)) { + return 0; + } + } + /* provide any auxiliary data */ if (node->aux) { if (!send_to_one(conn, "SETAUX %s %d\n", node->var, node->aux)) { @@ -318,7 +327,9 @@ static int st_tree_dump_conn(st_tree_t *node, conn_t *conn) snprintfcat(flist, sizeof(flist), " STRING"); } - send_to_one(conn, "SETFLAGS %s\n", flist); + if (!send_to_one(conn, "SETFLAGS %s\n", flist)) { + return 0; + } } if (node->right) { @@ -633,6 +644,19 @@ int dstate_addenum(const char *var, const char *fmt, ...) return ret; } +int dstate_addrange(const char *var, const int min, const int max) +{ + int ret; + + ret = state_addrange(dtree_root, var, min, max); + + if (ret == 1) { + send_to_all("ADDRANGE %s %i %i\n", var, min, max); + } + + return ret; +} + void dstate_setflags(const char *var, int flags) { st_tree_t *sttmp; @@ -739,6 +763,20 @@ int dstate_delenum(const char *var, const char *val) return ret; } +int dstate_delrange(const char *var, const int min, const int max) +{ + int ret; + + ret = state_delrange(dtree_root, var, min, max); + + /* update listeners */ + if (ret == 1) { + send_to_all("DELRANGE %s \"%i %i\"\n", var, min, max); + } + + return ret; +} + int dstate_delcmd(const char *cmd) { int ret; diff --git a/drivers/dstate.h b/drivers/dstate.h index 7ffe899..b4a5aa9 100644 --- a/drivers/dstate.h +++ b/drivers/dstate.h @@ -1,6 +1,8 @@ /* dstate.h - Network UPS Tools driver-side state management - Copyright (C) 2003 Russell Kroll + Copyright (C) + 2003 Russell Kroll + 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,12 +47,14 @@ int dstate_setinfo(const char *var, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); int dstate_addenum(const char *var, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); +int dstate_addrange(const char *var, const int min, const int max); void dstate_setflags(const char *var, int flags); void dstate_setaux(const char *var, int aux); const char *dstate_getinfo(const char *var); void dstate_addcmd(const char *cmdname); int dstate_delinfo(const char *var); int dstate_delenum(const char *var, const char *val); +int dstate_delrange(const char *var, const int min, const int max); int dstate_delcmd(const char *cmd); void dstate_free(void); const st_tree_t *dstate_getroot(void); diff --git a/drivers/dummy-ups.c b/drivers/dummy-ups.c index c2e9957..7dbb991 100644 --- a/drivers/dummy-ups.c +++ b/drivers/dummy-ups.c @@ -40,7 +40,7 @@ #include "dummy-ups.h" #define DRIVER_NAME "Device simulation and repeater driver" -#define DRIVER_VERSION "0.12" +#define DRIVER_VERSION "0.13" /* driver description structure */ upsdrv_info_t upsdrv_info = diff --git a/drivers/dummy-ups.h b/drivers/dummy-ups.h index b086a52..49294ca 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 - 2010 Arnaud Quette + 2005 - 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,11 +18,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* This file list all valid data with their type and info. - * this are then enable through a definition file, specified +/* This file lists all valid data with their type and info. + * + * These are then enabled through a definition file, specified * as the "port" parameter (only the file name, not the path). + * * The format of this file is the same as an upsc dump: + * * : + * * FIXME: use cmdvartab for conformance checking * ... * Once the driver is loaded: @@ -36,24 +40,31 @@ /* Struct & data for ups.status processing */ /* --------------------------------------------------------------- */ +#if 0 /* XXX status lookup table not currently used???? */ +/* + * Status lookup table type definition + */ typedef struct { - const char *status_str; /* ups.status string */ - int status_value; /* ups.status value */ + const char *status_str; /* ups.status string */ + int status_value; /* ups.status flag bit */ } status_lkp_t; -#define STATUS_CAL 1 /* calibration */ -#define STATUS_TRIM 2 /* SmartTrim */ -#define STATUS_BOOST 4 /* SmartBoost */ -#define STATUS_OL 8 /* on line */ -#define STATUS_OB 16 /* on battery */ -#define STATUS_OVER 32 /* overload */ -#define STATUS_LB 64 /* low battery */ -#define STATUS_RB 128 /* replace battery */ -#define STATUS_BYPASS 256 /* on bypass */ -#define STATUS_OFF 512 /* ups is off */ -#define STATUS_CHRG 1024 /* charging */ -#define STATUS_DISCHRG 2048 /* discharging */ +#define STATUS_CAL (1 << 0) /* calibration */ +#define STATUS_TRIM (1 << 1) /* SmartTrim */ +#define STATUS_BOOST (1 << 2) /* SmartBoost */ +#define STATUS_OL (1 << 3) /* on line */ +#define STATUS_OB (1 << 4) /* on battery */ +#define STATUS_OVER (1 << 5) /* overload */ +#define STATUS_LB (1 << 6) /* low battery */ +#define STATUS_RB (1 << 7) /* replace battery */ +#define STATUS_BYPASS (1 << 8) /* on bypass */ +#define STATUS_OFF (1 << 9) /* ups is off */ +#define STATUS_CHRG (1 << 10) /* charging */ +#define STATUS_DISCHRG (1 << 11) /* discharging */ +/* + * Status lookup table + */ status_lkp_t status_info[] = { { "CAL", STATUS_CAL }, { "TRIM", STATUS_TRIM }, @@ -69,7 +80,7 @@ status_lkp_t status_info[] = { { "DISCHRG", STATUS_DISCHRG }, { "NULL", 0 }, }; -/* from usbhid-ups.h */ +#endif /* 0 -- not currently used??? */ typedef struct { char hid_value; /* HID value */ @@ -96,7 +107,6 @@ typedef struct { /* data flags */ #define DU_FLAG_NONE 0 #define DU_FLAG_INIT 1 /* intialy show element to upsd */ -#define DU_TYPE_CMD 2 /* --------------------------------------------------------------- */ /* Data table (all possible info from NUT, then enable upon cong */ @@ -166,16 +176,16 @@ battery.alarm.threshold battery.date battery.packs battery.packs.bad - -ambient.temperature -ambient.temperature.alarm -ambient.temperature.high -ambient.temperature.low -ambient.humidity -ambient.humidity.alarm -ambient.humidity.high -ambient.humidity.low - +*/ + { "ambient.temperature", ST_FLAG_RW, 1, NULL, DU_FLAG_NONE, NULL }, + { "ambient.temperature.alarm", ST_FLAG_RW, 1, NULL, DU_FLAG_NONE, NULL }, + { "ambient.temperature.high", ST_FLAG_RW, 1, NULL, DU_FLAG_NONE, NULL }, + { "ambient.temperature.low", ST_FLAG_RW, 1, NULL, DU_FLAG_NONE, NULL }, + { "ambient.humidity", ST_FLAG_RW, 1, NULL, DU_FLAG_NONE, NULL }, + { "ambient.humidity.alarm", ST_FLAG_RW, 1, NULL, DU_FLAG_NONE, NULL }, + { "ambient.humidity.high", ST_FLAG_RW, 1, NULL, DU_FLAG_NONE, NULL }, + { "ambient.humidity.low", ST_FLAG_RW, 1, NULL, DU_FLAG_NONE, NULL }, +/* FIXME: how to manage these? outlet.n.id outlet.n.desc diff --git a/drivers/ietf-mib.c b/drivers/ietf-mib.c index 0cc3192..6cae43d 100644 --- a/drivers/ietf-mib.c +++ b/drivers/ietf-mib.c @@ -1,9 +1,9 @@ /* ietf-mib.c - data to monitor SNMP UPS (RFC 1628 compliant) with NUT * * Copyright (C) 2002-2006 - * Arnaud Quette - * Niels Baggesen - * Arjen de Korte + * 2002-2012 Arnaud Quette + * 2002-2006 Niels Baggesen + * 2002-2006 Arjen de Korte * * Sponsored by MGE UPS SYSTEMS * @@ -26,7 +26,7 @@ #include "ietf-mib.h" -#define IETF_MIB_VERSION "1.3" +#define IETF_MIB_VERSION "1.4" /* SNMP OIDs set */ #define IETF_OID_UPS_MIB "1.3.6.1.2.1.33.1." @@ -263,7 +263,7 @@ static snmp_info_t ietf_mib[] = { { "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 */ + { "ups.beeper.status", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "9.8.0", "", 0, ietf_beeper_status_info }, /* upsConfigAudibleStatus */ { "beeper.disable", 0, 1, IETF_OID_UPS_MIB "9.8.0", "", 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 }, diff --git a/drivers/libshut.c b/drivers/libshut.c index 2028648..3c33668 100644 --- a/drivers/libshut.c +++ b/drivers/libshut.c @@ -41,7 +41,7 @@ #include "common.h" /* for xmalloc, upsdebugx prototypes */ #define SHUT_DRIVER_NAME "SHUT communication driver" -#define SHUT_DRIVER_VERSION "0.82" +#define SHUT_DRIVER_VERSION "0.83" /* communication driver description structure */ upsdrv_info_t comm_upsdrv_info = { @@ -610,7 +610,7 @@ void setline(int upsfd, int set) int shut_synchronise(int upsfd) { int retCode = 0; - u_char c = SHUT_SYNC, reply; + u_char c = SHUT_SYNC_OFF, reply; int try; upsdebugx (2, "entering shut_synchronise()"); @@ -695,6 +695,12 @@ int shut_packet_recv(int upsfd, u_char *Buf, int datalen) memcpy(Buf, Start, 1); return 1; } + else if(Start[0]==SHUT_SYNC_OFF) + { + upsdebugx (4, "received SYNC_OFF token"); + memcpy(Buf, Start, 1); + return 1; + } else { /* if((serial_read (SHUT_TIMEOUT, &Start[1]) > 0) && */ @@ -703,6 +709,12 @@ int shut_packet_recv(int upsfd, u_char *Buf, int datalen) { upsdebug_hex(4, "Receive", Start, 2); Size=Start[1]&0x0F; + if( Size > 8 ) { + upsdebugx (4, "shut_packet_recv: invalid frame size = %d", Size); + ser_send_char(upsfd, SHUT_NOK); + Retry++; + break; + } /* sdata.shut_pkt.bLength = Size; */ for(recv=0;recv notification"); @@ -736,7 +750,7 @@ int shut_packet_recv(int upsfd, u_char *Buf, int datalen) Pos=0; } else - return Pos; + return Pos; } else upsdebugx (4, "need more data (%i)!", datalen); @@ -876,8 +890,10 @@ int shut_control_msg(int upsfd, int requesttype, int request, upsdebug_hex(4, "data", bytes, data_size); } } - else - data_size = (size >= 8) ? 8 : remaining_size; + else { + /* Always 8 bytes payload for GET_REPORT with SHUT */ + data_size = 8; + } /* Forge the SHUT Frame */ shut_pkt[0] = SHUT_TYPE_REQUEST + ( ((requesttype == REQUEST_TYPE_SET_REPORT) && (remaining_size>8))? 0 : SHUT_PKT_LAST); @@ -970,7 +986,7 @@ int shut_wait_ack(int upsfd) upsdebugx (2, "shut_wait_ack(): NACK received"); retCode = -2; } - else if ((c & SHUT_PKT_LAST) == SHUT_TYPE_NOTIFY) + else if ((c & 0x0f) == SHUT_TYPE_NOTIFY) { upsdebugx (2, "shut_wait_ack(): NOTIFY received"); retCode = -3; diff --git a/drivers/liebert-hid.c b/drivers/liebert-hid.c index 2cce0ee..2ef293f 100644 --- a/drivers/liebert-hid.c +++ b/drivers/liebert-hid.c @@ -29,7 +29,7 @@ #define LIEBERT_HID_VERSION "Liebert HID 0.3" /* FIXME: experimental flag to be put in upsdrv_info */ -/* Phoenixtec */ +/* Phoenixtec Power Co., Ltd */ #define LIEBERT_VENDORID 0x06da /* USB IDs device table */ diff --git a/drivers/metasys.c b/drivers/metasys.c index e80217f..d05e5ef 100644 --- a/drivers/metasys.c +++ b/drivers/metasys.c @@ -108,7 +108,7 @@ void dump_buffer(unsigned char *buffer, int buf_len) { int i; for (i = 0; i < buf_len; i++) { printf("byte %d: %x\n", i, buffer[i]); - } + } return; } @@ -127,7 +127,7 @@ void send_read_command(char command) { if (retry == 4) send_zeros(); /* last retry is preceded by a serial reset...*/ sent = ser_send_buf(upsfd, buf, 4); retry += 1; - } + } } /* send a write command to the UPS, the write command and the value to be written are passed @@ -136,20 +136,20 @@ void send_read_command(char command) { void send_write_command(unsigned char *command, int command_length) { int i, retry, sent, checksum; unsigned char raw_buf[255]; - + /* prepares the raw data */ raw_buf[0] = 0x02; /* STX byte */ raw_buf[1] = (unsigned char)(command_length + 1); /* data length + checksum */ memcpy(raw_buf+2, command, command_length); command_length += 2; - + /* calculate checksum */ checksum = 0; for (i = 1; i < command_length; i++) checksum += raw_buf[i]; checksum = checksum % 256; raw_buf[command_length] = (unsigned char)checksum; command_length +=1; - + retry = 0; sent = 0; while ((sent != (command_length)) && (retry < 5)) { @@ -157,7 +157,7 @@ void send_write_command(unsigned char *command, int command_length) { sent = ser_send_buf(upsfd, raw_buf, (command_length)); if (sent != (command_length)) printf("Error sending command %d\n", raw_buf[2]); retry += 1; - } + } } @@ -192,7 +192,7 @@ int get_answer(unsigned char *data) { ser_comm_fail("Receive error (data): got %d bytes instead of %d!!!\n", res, packet_length); return -1; } - + /* now we have the whole answer from the ups, we can checksum it checksum byte is equal to the sum modulus 256 of all the data bytes + packet_length (no STX no checksum byte itself) */ @@ -215,7 +215,7 @@ int get_answer(unsigned char *data) { int command_read_sequence(unsigned char command, unsigned char *data) { int bytes_read = 0; int retry = 0; - + while ((bytes_read < 1) && (retry < 5)) { send_read_command(command); bytes_read = get_answer(data); @@ -806,7 +806,7 @@ void upsdrv_updateinfo(void) printf("status unknown \n"); break; } - status_commit(); + status_commit(); dstate_dataok(); } return; @@ -815,8 +815,7 @@ void upsdrv_updateinfo(void) void upsdrv_shutdown(void) { unsigned char command[10], answer[10]; - - + /* Ensure that the ups is configured for automatically restart after a complete battery discharge and when the power comes back after a shutdown */ @@ -831,14 +830,14 @@ void upsdrv_shutdown(void) command[5]=0x01; /* autorestart after battery depleted enabled */ command_write_sequence(command, 6, answer); } - + /* shedule a shutdown in 120 seconds */ command[0]=UPS_SET_SCHEDULING; command[1]=0x96; /* remaining */ command[2]=0x00; /* time */ command[3]=0x00; /* to */ command[4]=0x00; /* shutdown 150 secs */ - + /* restart time has been set to 1 instead of 0 for avoiding a bug in some ups firmware */ command[5]=0x01; /* programmed */ @@ -860,7 +859,7 @@ static int instcmd(const char *cmdname, const char *extra) { unsigned char command[10], answer[10]; int res; - + if (!strcasecmp(cmdname, "beeper.off")) { /* compatibility mode for old command */ upslogx(LOG_WARNING, @@ -892,7 +891,7 @@ static int instcmd(const char *cmdname, const char *extra) command[2]=0x00; /* time */ command[3]=0x00; /* to */ command[4]=0x00; /* shutdown 30 secs */ - + command[5]=0x01; /* programmed */ command[6]=0x00; /* time */ command[7]=0x00; /* to */ @@ -900,7 +899,7 @@ static int instcmd(const char *cmdname, const char *extra) command_write_sequence(command, 9, answer); return STAT_INSTCMD_HANDLED; } - + if (!strcasecmp(cmdname, "shutdown.stayoff")) { /* shedule a shutdown in 30 seconds with no restart (-1) */ command[0]=UPS_SET_SCHEDULING; @@ -916,7 +915,7 @@ static int instcmd(const char *cmdname, const char *extra) command_write_sequence(command, 9, answer); return STAT_INSTCMD_HANDLED; } - + if (!strcasecmp(cmdname, "shutdown.stop")) { /* set shutdown and restart time to -1 (no shutdown, no restart) */ command[0]=UPS_SET_SCHEDULING; @@ -943,7 +942,7 @@ static int instcmd(const char *cmdname, const char *extra) command_write_sequence(command, 2, answer); return STAT_INSTCMD_HANDLED; } - + if (!strcasecmp(cmdname, "test.failure.stop")) { /* restore standard mode (mains power) */ command[0]=UPS_SET_BATTERY_TEST; @@ -954,7 +953,7 @@ static int instcmd(const char *cmdname, const char *extra) command_write_sequence(command, 2, answer); return STAT_INSTCMD_HANDLED; } - + if (!strcasecmp(cmdname, "test.battery.start")) { /* launch battery test */ command[0]=UPS_SET_BATTERY_TEST; @@ -996,7 +995,7 @@ static int instcmd(const char *cmdname, const char *extra) upslogx(LOG_NOTICE, "test battery byte 1 = %x", answer[1]); return STAT_INSTCMD_HANDLED; } - + if (!strcasecmp(cmdname, "beeper.enable")) { /* set buzzer to not muted */ command[0]=UPS_SET_BUZZER_MUTE; @@ -1007,7 +1006,7 @@ static int instcmd(const char *cmdname, const char *extra) command_write_sequence(command, 2, answer); return STAT_INSTCMD_HANDLED; } - + if (!strcasecmp(cmdname, "beeper.mute")) { /* set buzzer to muted */ command[0]=UPS_SET_BUZZER_MUTE; diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c index 7c07703..628152d 100644 --- a/drivers/mge-hid.c +++ b/drivers/mge-hid.c @@ -1,6 +1,6 @@ -/* mge-hid.c - data to monitor MGE UPS SYSTEMS HID (USB and serial) devices +/* mge-hid.c - data to monitor Eaton / MGE HID (USB and serial) devices * - * Copyright (C) 2003 - 2009 + * Copyright (C) 2003 - 2012 * Arnaud Quette * * Sponsored by MGE UPS SYSTEMS @@ -22,11 +22,21 @@ * */ +/* TODO list: + * - better processing of FW info: + * * some models (HP R5000) include firmware.aux (00.01.0021;00.01.00) + * * other (9130) need more processing (0128 => 1.28) + * ... + * - better handling of input.transfer.* (need dstate_addrange) + * - outlet management logic (Ie, for outlet.X.load.{on,off}.delay + * => use outlet.X.delay.{start,stop} + */ + #include "main.h" /* for getval() */ #include "usbhid-ups.h" #include "mge-hid.h" -#define MGE_HID_VERSION "MGE HID 1.27" +#define MGE_HID_VERSION "MGE HID 1.31" /* (prev. MGE Office Protection Systems, prev. MGE UPS SYSTEMS) */ /* Eaton */ @@ -38,6 +48,9 @@ /* Powerware */ #define POWERWARE_VENDORID 0x0592 +/* Hewlett Packard */ +#define HP_VENDORID 0x03f0 + #ifndef SHUT_MODE #include "usb-common.h" @@ -53,6 +66,14 @@ static usb_device_id_t mge_usb_device_table[] = { /* PW 9140 */ { USB_DEVICE(POWERWARE_VENDORID, 0x0004), NULL }, + /* R/T3000 */ + { USB_DEVICE(HP_VENDORID, 0x1fe5), NULL }, + /* R/T3000 */ + { USB_DEVICE(HP_VENDORID, 0x1fe6), NULL }, + /* various models */ + { USB_DEVICE(HP_VENDORID, 0x1fe7), NULL }, + { USB_DEVICE(HP_VENDORID, 0x1fe8), NULL }, + /* Terminating entry */ { -1, -1, NULL } }; @@ -326,6 +347,53 @@ static info_lkp_t pegasus_threshold_info[] = { { 0, NULL, NULL } }; +/* allow limiting standard yes/no info (here, to enable ECO mode) to + * ups.model = Protection Station, Ellipse Eco and 3S (US 750 and AUS 700 only!) + * this allows to enable special flags used in hid_info_t entries (Ie RW) */ +static const char *pegasus_yes_no_info_fun(double value) +{ + switch (mge_type & 0xFF00) /* Ignore model byte */ + { + case MGE_PEGASUS: + break; + case MGE_3S: + /* Only consider non European models */ + if (country_code != COUNTRY_EUROPE) + break; + default: + return NULL; + } + + return (value == 0) ? "no" : "yes"; +} + +/* Conversion back of yes/no info */ +static double pegasus_yes_no_info_nuf(const char *value) +{ + switch (mge_type & 0xFF00) /* Ignore model byte */ + { + case MGE_PEGASUS: + break; + case MGE_3S: + /* Only consider non European models */ + if (country_code != COUNTRY_EUROPE) + break; + default: + return 0; + } + + if (!strncmp(value, "yes", 3)) + return 1; + else + return 0; +} + +info_lkp_t pegasus_yes_no_info[] = { + { 0, "no", pegasus_yes_no_info_fun, pegasus_yes_no_info_nuf }, + { 1, "yes", pegasus_yes_no_info_fun, pegasus_yes_no_info_nuf }, + { 0, NULL, NULL } +}; + /* Determine country using UPS.PowerSummary.Country. * If not present: * if PowerConverter.Output.Voltage >= 200 => "Europe" @@ -448,7 +516,7 @@ static info_lkp_t nominal_output_voltage_info[] = { /* Vendor-specific usage table */ /* --------------------------------------------------------------- */ -/* MGE UPS SYSTEMS usage table */ +/* Eaton / MGE HID usage table */ static usage_lkp_t mge_usage_lkp[] = { { "Undefined", 0xffff0000 }, { "STS", 0xffff0001 }, @@ -474,7 +542,7 @@ static usage_lkp_t mge_usage_lkp[] = { { "EventID", 0xffff001f }, { "CircuitBreaker", 0xffff0020 }, { "TransferForbidden", 0xffff0021 }, - { "OverallAlarm", 0xffff0022 }, + { "OverallAlarm", 0xffff0022 }, /* renamed to Alarm in Eaton SW! */ { "Dephasing", 0xffff0023 }, { "BypassBreaker", 0xffff0024 }, { "PowerModule", 0xffff0025 }, @@ -486,8 +554,9 @@ static usage_lkp_t mge_usage_lkp[] = { { "NotificationStatus", 0xffff002b }, { "ProtectionLost", 0xffff002c }, { "ConfigurationFailure", 0xffff002d }, + { "CompatibilityFailure", 0xffff002e }, /* 0xffff002e-0xffff003f => Reserved */ - { "SwitchType", 0xffff0040 }, + { "SwitchType", 0xffff0040 }, /* renamed to Type in Eaton SW! */ { "ConverterType", 0xffff0041 }, { "FrequencyConverterMode", 0xffff0042 }, { "AutomaticRestart", 0xffff0043 }, @@ -556,8 +625,12 @@ static usage_lkp_t mge_usage_lkp[] = { { "HighHumidity", 0xffff0082 }, { "LowTemperature", 0xffff0083 }, { "HighTemperature", 0xffff0084 }, - /* 0xffff0085-0xffff008f (minus 0xffff0086) => Reserved */ + { "ECOControl", 0xffff0085 }, { "Efficiency", 0xffff0086 }, + { "ABMEnable", 0xffff0087 }, + { "NegativeCurrent", 0xffff0088 }, + { "AutomaticStart", 0xffff0089 }, + /* 0xffff008a-0xffff008f => Reserved */ { "Count", 0xffff0090 }, { "Timer", 0xffff0091 }, { "Interval", 0xffff0092 }, @@ -569,16 +642,26 @@ static usage_lkp_t mge_usage_lkp[] = { { "Code", 0xffff0098 }, { "DataValid", 0xffff0099 }, { "ToggleTimer", 0xffff009a }, - /* 0xffff009b-0xffff009f => Reserved */ - { "PDU", 0xffff00a0 }, + { "BypassTransferDelay", 0xffff009b }, + { "HysteresysVoltageTransfer", 0xffff009c }, + { "SlewRate", 0xffff009d }, + /* 0xffff009e-0xffff009f => Reserved */ + { "PDU", 0xffff00a0 }, { "Breaker", 0xffff00a1 }, { "BreakerID", 0xffff00a2 }, - { "OverVoltage", 0xffff00a3 }, + { "OverVoltage", 0xffff00a3 }, { "Tripped", 0xffff00a4 }, { "OverEnergy", 0xffff00a5 }, - { "OverHumidity", 0xffff00a6 }, - { "LCDControl", 0xffff00a6 }, - /* 0xffff00a8-0xffff00df => Reserved */ + { "OverHumidity", 0xffff00a6 }, + { "ConfigurationReset", 0xffff00a7 }, /* renamed from LCDControl in Eaton SW! */ + { "Level", 0xffff00a8 }, + { "PDUType", 0xffff00a9 }, + { "ReactivePower", 0xffff00aa }, + { "Pole", 0xffff00ab }, + { "PoleID", 0xffff00ac }, + { "Reset", 0xffff00ad }, + { "WatchdogReset", 0xffff00ae }, + /* 0xffff00af-0xffff00df => Reserved */ { "COPIBridge", 0xffff00e0 }, /* 0xffff00e1-0xffff00ef => Reserved */ { "iModel", 0xffff00f0 }, @@ -586,7 +669,8 @@ static usage_lkp_t mge_usage_lkp[] = { { "iTechnicalLevel", 0xffff00f2 }, { "iPartNumber", 0xffff00f3 }, { "iReferenceNumber", 0xffff00f4 }, - /* 0xffff00f5-0xffff00ff => Reserved */ + { "iGang", 0xffff00f5 }, + /* 0xffff00f6-0xffff00ff => Reserved */ /* end of table */ { NULL, 0 } @@ -941,7 +1025,7 @@ static hid_info_t mge_hid2nut[] = { "outlet.power", 0, 0, "UPS.OutletSystem.Outlet.[1].ApparentPower", NULL, "%.0f", 0, NULL }, { "outlet.realpower", 0, 0, "UPS.OutletSystem.Outlet.[1].ActivePower", NULL, "%.0f", 0, NULL }, { "outlet.current", 0, 0, "UPS.OutletSystem.Outlet.[1].Current", NULL, "%.2f", 0, NULL }, - { "outlet.powerfactor", 0, 0, "UPS.OutletSystem.Outlet.[1].PowerFactor", NULL, "%.2f", 0, NULL }, // "%s", 0, mge_powerfactor_conversion }, + { "outlet.powerfactor", 0, 0, "UPS.OutletSystem.Outlet.[1].PowerFactor", NULL, "%.2f", 0, NULL }, /* "%s", 0, mge_powerfactor_conversion }, */ /* First outlet */ { "outlet.1.id", 0, 0, "UPS.OutletSystem.Outlet.[2].OutletID", NULL, "%.0f", HU_FLAG_STATIC, NULL }, @@ -950,18 +1034,22 @@ static hid_info_t mge_hid2nut[] = { "outlet.1.status", 0, 0, "UPS.OutletSystem.Outlet.[2].PresentStatus.SwitchOn/Off", NULL, "%s", 0, on_off_info }, /* For low end models, with 1 non backup'ed outlet */ { "outlet.1.status", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, "%s", 0, on_off_info }, + /* FIXME: change to outlet.1.battery.charge.low, as in mge-xml.c?! */ { "outlet.1.autoswitch.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 3, "UPS.OutletSystem.Outlet.[2].RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "outlet.1.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.OutletSystem.Outlet.[2].ShutdownTimer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "outlet.1.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.OutletSystem.Outlet.[2].StartupTimer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "outlet.1.power", 0, 0, "UPS.OutletSystem.Outlet.[2].ApparentPower", NULL, "%.0f", 0, NULL }, { "outlet.1.realpower", 0, 0, "UPS.OutletSystem.Outlet.[2].ActivePower", NULL, "%.0f", 0, NULL }, { "outlet.1.current", 0, 0, "UPS.OutletSystem.Outlet.[2].Current", NULL, "%.2f", 0, NULL }, - { "outlet.1.powerfactor", 0, 0, "UPS.OutletSystem.Outlet.[2].PowerFactor", NULL, "%.2f", 0, NULL }, // "%s", 0, mge_powerfactor_conversion }, + { "outlet.1.powerfactor", 0, 0, "UPS.OutletSystem.Outlet.[2].PowerFactor", NULL, "%.2f", 0, NULL }, /* "%s", 0, mge_powerfactor_conversion }, */ /* Second outlet */ { "outlet.2.id", 0, 0, "UPS.OutletSystem.Outlet.[3].OutletID", NULL, "%.0f", HU_FLAG_STATIC, NULL }, { "outlet.2.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[3].OutletID", NULL, "PowerShare Outlet 2", HU_FLAG_ABSENT, NULL }, - /* needed for Pegasus to enable master/slave mode */ - { "outlet.2.switchable", ST_FLAG_RW | ST_FLAG_STRING, 3, "UPS.OutletSystem.Outlet.[3].PresentStatus.Switchable", NULL, "%s", HU_FLAG_SEMI_STATIC, yes_no_info }, + /* needed for Pegasus to enable master/slave mode: + * FIXME: rename to something more suitable (outlet.?) */ + { "outlet.2.switchable", ST_FLAG_RW | ST_FLAG_STRING, 3, "UPS.OutletSystem.Outlet.[3].PresentStatus.Switchable", NULL, "%s", HU_FLAG_SEMI_STATIC, pegasus_yes_no_info }, + /* Generic version (RO) for other models */ + { "outlet.2.switchable", 0, 0, "UPS.OutletSystem.Outlet.[3].PresentStatus.Switchable", NULL, "%s", 0, yes_no_info }, { "outlet.2.status", 0, 0, "UPS.OutletSystem.Outlet.[3].PresentStatus.SwitchOn/Off", NULL, "%s", 0, on_off_info }, { "outlet.2.autoswitch.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 3, "UPS.OutletSystem.Outlet.[3].RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "outlet.2.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.OutletSystem.Outlet.[3].ShutdownTimer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, @@ -969,7 +1057,7 @@ static hid_info_t mge_hid2nut[] = { "outlet.2.power", 0, 0, "UPS.OutletSystem.Outlet.[3].ApparentPower", NULL, "%.0f", 0, NULL }, { "outlet.2.realpower", 0, 0, "UPS.OutletSystem.Outlet.[3].ActivePower", NULL, "%.0f", 0, NULL }, { "outlet.2.current", 0, 0, "UPS.OutletSystem.Outlet.[3].Current", NULL, "%.2f", 0, NULL }, - { "outlet.2.powerfactor", 0, 0, "UPS.OutletSystem.Outlet.[3].PowerFactor", NULL, "%.2f", 0, NULL }, // "%s", 0, mge_powerfactor_conversion }, + { "outlet.2.powerfactor", 0, 0, "UPS.OutletSystem.Outlet.[3].PowerFactor", NULL, "%.2f", 0, NULL }, /* "%s", 0, mge_powerfactor_conversion }, */ /* instant commands. */ /* splited into subset while waiting for extradata support @@ -1084,20 +1172,37 @@ static int mge_claim(HIDDevice_t *hd) { switch (status) { - case POSSIBLY_SUPPORTED: - /* by default, reject, unless the productid option is given */ - if (getval("productid")) { - return 1; - } - possibly_supported("Eaton / MGE", hd); - return 0; + case POSSIBLY_SUPPORTED: - case SUPPORTED: - return 1; + switch (hd->VendorID) + { + case HP_VENDORID: + case DELL_VENDORID: + /* by default, reject, unless the productid option is given */ + if (getval("productid")) { + return 1; + } - case NOT_SUPPORTED: - default: - return 0; + /* + * this vendor makes lots of USB devices that are + * not a UPS, so don't use possibly_supported here + */ + return 0; + default: /* Valid for Eaton */ + /* by default, reject, unless the productid option is given */ + if (getval("productid")) { + return 1; + } + possibly_supported("Eaton / MGE", hd); + return 0; + } + + case SUPPORTED: + return 1; + + case NOT_SUPPORTED: + default: + return 0; } #else return 1; diff --git a/drivers/mge-mib.c b/drivers/mge-mib.c index 8c8c59f..e19816b 100644 --- a/drivers/mge-mib.c +++ b/drivers/mge-mib.c @@ -1,11 +1,12 @@ /* mge-mib.c - data to monitor MGE UPS SYSTEMS SNMP devices with NUT * - * Copyright (C) 2002-2003 - * Arnaud Quette - * J.W. Hoogervorst + * Copyright (C) + * 2002-2012 Arnaud Quette + * 2002-2003 J.W. Hoogervorst * * Sponsored by MGE UPS SYSTEMS - * and MGE Office Protection Systems + * MGE Office Protection Systems + * Eaton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,7 +27,7 @@ #include "mge-mib.h" -#define MGE_MIB_VERSION "0.4" +#define MGE_MIB_VERSION "0.5" /* TODO: * - MGE PDU MIB and sysOID (".1.3.6.1.4.1.705.2") */ @@ -72,6 +73,73 @@ static info_lkp_t mge_overload_info[] = { { 0, "NULL" } }; + +static info_lkp_t mge_replacebatt_info[] = { + { 1, "RB" }, + { 2, "" }, + { 0, "NULL" } +}; + +static info_lkp_t mge_output_util_off_info[] = { + { 1, "OFF" }, + { 2, "" }, + { 0, "NULL" } +}; + +static info_lkp_t mge_transfer_reason_info[] = { + { 1, "" }, + { 2, "input voltage out of range" }, + { 3, "input frequency out of range" }, + { 4, "utility off" }, + { 0, "NULL" } +}; + +static info_lkp_t ietf_test_result_info[] = { + { 1, "done and passed" }, + { 2, "done and warning" }, + { 3, "done and error" }, + { 4, "aborted" }, + { 5, "in progress" }, + { 6, "no test initiated" }, + { 0, "NULL" } +}; + +static info_lkp_t ietf_beeper_status_info[] = { + { 1, "disabled" }, + { 2, "enabled" }, + { 3, "muted" }, + { 0, "NULL" } +}; + +static info_lkp_t ietf_yes_no_info[] = { + { 1, "yes" }, + { 2, "no" }, + { 0, "NULL" } +}; + +/* FIXME: the below may introduce status redundancy, that needs to be + * adressed by the driver, as for usbhid-ups! */ +static info_lkp_t ietf_power_source_info[] = { + { 1, "" /* other */ }, + { 2, "OFF" /* none */ }, +#if 0 + { 3, "OL" /* normal */ }, +#endif + { 4, "BYPASS" /* bypass */ }, + { 5, "OB" /* battery */ }, + { 6, "BOOST" /* booster */ }, + { 7, "TRIM" /* reducer */ }, + { 0, "NULL" } +}; + +/* Parameters default values */ +#define STR_DEFAULT_ONDELAY "30" /* Delay between return of utility power */ + /* and powering up of load, in seconds */ + /* CAUTION: ondelay > offdelay */ +#define DEFAULT_ONDELAY 30 +#define STR_DEFAULT_OFFDELAY "20" /* Delay before power off, in seconds */ +#define DEFAULT_OFFDELAY 20 + #define MGE_NOTHING_VALUE 1 #define MGE_START_VALUE 2 #define MGE_STOP_VALUE 3 @@ -82,80 +150,122 @@ static info_lkp_t mge_overload_info[] = { static snmp_info_t mge_mib[] = { /* UPS page */ - { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "MGE UPS SYSTEMS", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, MGE_BASE_OID ".1.1.0", "Generic SNMP UPS", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, MGE_BASE_OID ".1.7.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.firmware.aux", ST_FLAG_STRING, SU_INFOSIZE, MGE_BASE_OID ".12.12.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, MGE_BASE_OID ".5.14.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_lowbatt_info }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, MGE_BASE_OID ".5.16.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_lowbatt_info }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, MGE_BASE_OID ".7.3.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_onbatt_info }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, MGE_BASE_OID ".7.4.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_bypass_info }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, MGE_BASE_OID ".7.8.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_boost_info }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, MGE_BASE_OID ".7.10.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_overload_info }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, MGE_BASE_OID ".7.12.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_trim_info }, - { "ups.load", 0, 1, MGE_BASE_OID ".7.2.1.4.1", "", SU_OUTPUT_1, NULL }, - { "ups.L1.load", 0, 1, MGE_BASE_OID ".7.2.1.4.1", "", SU_OUTPUT_3, NULL }, - { "ups.L2.load", 0, 1, MGE_BASE_OID ".7.2.1.4.2", "", SU_OUTPUT_3, NULL }, - { "ups.L3.load", 0, 1, MGE_BASE_OID ".7.2.1.4.3", "", SU_OUTPUT_3, NULL }, -/* { "ups.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW, 3, MGE_OID_GRACEDELAY, "", SU_FLAG_OK, NULL }, */ + { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Eaton", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.1.1.0", "Generic SNMP UPS", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.1.7.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.1.4.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + { "ups.firmware.aux", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.12.12.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + { "ups.load", 0, 1, ".1.3.6.1.4.1.705.1.7.2.1.4.1", "", SU_OUTPUT_1, NULL }, + { "ups.beeper.status", ST_FLAG_STRING, SU_INFOSIZE, "1.3.6.1.2.1.33.1.9.8.0", "", 0, ietf_beeper_status_info }, + { "ups.L1.load", 0, 1, ".1.3.6.1.4.1.705.1.7.2.1.4.1", "", SU_OUTPUT_3, NULL }, + { "ups.L2.load", 0, 1, ".1.3.6.1.4.1.705.1.7.2.1.4.2", "", SU_OUTPUT_3, NULL }, + { "ups.L3.load", 0, 1, ".1.3.6.1.4.1.705.1.7.2.1.4.3", "", SU_OUTPUT_3, NULL }, + { "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.33.1.7.3.0", "", 0, ietf_test_result_info }, + { "ups.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW, 6, "1.3.6.1.2.1.33.1.8.2.0", STR_DEFAULT_OFFDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "ups.delay.start", ST_FLAG_STRING | ST_FLAG_RW, 6, "1.3.6.1.2.1.33.1.8.3.0", STR_DEFAULT_ONDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "ups.timer.shutdown", 0, 1, "1.3.6.1.2.1.33.1.8.2.0", "", SU_FLAG_OK, NULL }, + { "ups.timer.start", 0, 1, "1.3.6.1.2.1.33.1.8.3.0", "", SU_FLAG_OK, NULL }, + { "ups.timer.reboot", 0, 1, "1.3.6.1.2.1.33.1.8.4.0", "", SU_FLAG_OK, NULL }, + { "ups.start.auto", ST_FLAG_RW, 1, "1.3.6.1.2.1.33.1.8.5.0", "", SU_FLAG_OK, ietf_yes_no_info }, + /* status data */ + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.5.11.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_replacebatt_info }, + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.5.14.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_lowbatt_info }, + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.5.16.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_lowbatt_info }, + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.3.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_onbatt_info }, + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.4.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_bypass_info }, + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.7.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_output_util_off_info }, + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.8.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_boost_info }, + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.10.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_overload_info }, + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.12.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_trim_info }, + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.33.1.4.1.0", "", SU_STATUS_PWR | SU_FLAG_OK, ietf_power_source_info }, + + /* FIXME: Alarms + * - upsmgBatteryChargerFault (.1.3.6.1.4.1.705.1.5.15.0), yes (1), no (2) + * => Battery charger fail! + * - upsmgBatteryFaultBattery (.1.3.6.1.4.1.705.1.5.9.0), yes (1), no (2) + * => "Battery fault!" or? + * - upsmgOutputOverTemp (.1.3.6.1.4.1.705.1.7.11.0), yes (1), no (2) + * => "Temperature too high!" + * - upsmgOutputInverterOff (.1.3.6.1.4.1.705.1.7.9.0), yes (1), no (2) + * => "??" + * - upsmgInputBadStatus (.1.3.6.1.4.1.705.1.6.3.0), yes (1), no (2) + * => "bad volt or bad freq" + */ /* Input page */ - { "input.phases", 0, 1.0, MGE_BASE_OID ".6.1.0", "", SU_FLAG_SETINT, NULL, &input_phases }, - { "input.voltage", 0, 0.1, MGE_BASE_OID ".6.2.1.2.1", "", SU_INPUT_1, NULL }, - { "input.L1-N.voltage", 0, 0.1, MGE_BASE_OID ".6.2.1.2.1", "", SU_INPUT_3, NULL }, - { "input.L2-N.voltage", 0, 0.1, MGE_BASE_OID ".6.2.1.2.2", "", SU_INPUT_3, NULL }, - { "input.L3-N.voltage", 0, 0.1, MGE_BASE_OID ".6.2.1.2.3", "", SU_INPUT_3, NULL }, - { "input.frequency", 0, 0.1, MGE_BASE_OID ".6.2.1.3.1", "", SU_INPUT_1, NULL }, - { "input.L1.frequency", 0, 0.1, MGE_BASE_OID ".6.2.1.3.1", "", SU_INPUT_3, NULL }, - { "input.L2.frequency", 0, 0.1, MGE_BASE_OID ".6.2.1.3.2", "", SU_INPUT_3, NULL }, - { "input.L3.frequency", 0, 0.1, MGE_BASE_OID ".6.2.1.3.3", "", SU_INPUT_3, NULL }, - { "input.voltage.minimum", 0, 0.1, MGE_BASE_OID ".6.2.1.4.1", "", SU_INPUT_1, NULL }, - { "input.L1-N.voltage.minimum", 0, 0.1, MGE_BASE_OID ".6.2.1.4.1", "", SU_INPUT_3, NULL }, - { "input.L2-N.voltage.minimum", 0, 0.1, MGE_BASE_OID ".6.2.1.4.2", "", SU_INPUT_3, NULL }, - { "input.L3-N.voltage.minimum", 0, 0.1, MGE_BASE_OID ".6.2.1.4.3", "", SU_INPUT_3, NULL }, - { "input.voltage.maximum", 0, 0.1, MGE_BASE_OID ".6.2.1.5.1", "", SU_INPUT_1, NULL }, - { "input.L1-N.voltage.maximum", 0, 0.1, MGE_BASE_OID ".6.2.1.5.1", "", SU_INPUT_3, NULL }, - { "input.L2-N.voltage.maximum", 0, 0.1, MGE_BASE_OID ".6.2.1.5.2", "", SU_INPUT_3, NULL }, - { "input.L3-N.voltage.maximum", 0, 0.1, MGE_BASE_OID ".6.2.1.5.3", "", SU_INPUT_3, NULL }, - { "input.current", 0, 0.1, MGE_BASE_OID ".6.2.1.6.1", "", SU_INPUT_1, NULL }, - { "input.L1.current", 0, 0.1, MGE_BASE_OID ".6.2.1.6.1", "", SU_INPUT_3, NULL }, - { "input.L2.current", 0, 0.1, MGE_BASE_OID ".6.2.1.6.2", "", SU_INPUT_3, NULL }, - { "input.L3.current", 0, 0.1, MGE_BASE_OID ".6.2.1.6.3", "", SU_INPUT_3, NULL }, + { "input.phases", 0, 1.0, ".1.3.6.1.4.1.705.1.6.1.0", "", SU_FLAG_SETINT, NULL, &input_phases }, + { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.1", "", SU_INPUT_1, NULL }, + { "input.L1-N.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.1", "", SU_INPUT_3, NULL }, + { "input.L2-N.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.2", "", SU_INPUT_3, NULL }, + { "input.L3-N.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.3", "", SU_INPUT_3, NULL }, + { "input.frequency", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.3.1", "", SU_INPUT_1, NULL }, + { "input.L1.frequency", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.3.1", "", SU_INPUT_3, NULL }, + { "input.L2.frequency", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.3.2", "", SU_INPUT_3, NULL }, + { "input.L3.frequency", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.3.3", "", SU_INPUT_3, NULL }, + { "input.voltage.minimum", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.4.1", "", SU_INPUT_1, NULL }, + { "input.L1-N.voltage.minimum", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.4.1", "", SU_INPUT_3, NULL }, + { "input.L2-N.voltage.minimum", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.4.2", "", SU_INPUT_3, NULL }, + { "input.L3-N.voltage.minimum", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.4.3", "", SU_INPUT_3, NULL }, + { "input.voltage.maximum", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.5.1", "", SU_INPUT_1, NULL }, + { "input.L1-N.voltage.maximum", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.5.1", "", SU_INPUT_3, NULL }, + { "input.L2-N.voltage.maximum", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.5.2", "", SU_INPUT_3, NULL }, + { "input.L3-N.voltage.maximum", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.5.3", "", SU_INPUT_3, NULL }, + { "input.current", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.6.1", "", SU_INPUT_1, NULL }, + { "input.L1.current", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.6.1", "", SU_INPUT_3, NULL }, + { "input.L2.current", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.6.2", "", SU_INPUT_3, NULL }, + { "input.L3.current", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.6.3", "", SU_INPUT_3, NULL }, + { "input.transfer.reason", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.6.4.0", "", SU_FLAG_OK, mge_transfer_reason_info }, /* Output page */ - { "output.phases", 0, 1.0, MGE_BASE_OID ".7.1.0", "", SU_FLAG_SETINT, NULL, &output_phases }, - { "output.voltage", 0, 0.1, MGE_BASE_OID ".7.2.1.2.1", "", SU_OUTPUT_1, NULL }, - { "output.L1-N.voltage", 0, 0.1, MGE_BASE_OID ".7.2.1.2.1", "", SU_OUTPUT_3, NULL }, - { "output.L2-N.voltage", 0, 0.1, MGE_BASE_OID ".7.2.1.2.2", "", SU_OUTPUT_3, NULL }, - { "output.L3-N.voltage", 0, 0.1, MGE_BASE_OID ".7.2.1.2.3", "", SU_OUTPUT_3, NULL }, - { "output.frequency", 0, 0.1, MGE_BASE_OID ".7.2.1.3.1", "", SU_OUTPUT_1, NULL }, - { "output.L1.frequency", 0, 0.1, MGE_BASE_OID ".7.2.1.3.1", "", SU_OUTPUT_3, NULL }, - { "output.L2.frequency", 0, 0.1, MGE_BASE_OID ".7.2.1.3.2", "", SU_OUTPUT_3, NULL }, - { "output.L3.frequency", 0, 0.1, MGE_BASE_OID ".7.2.1.3.3", "", SU_OUTPUT_3, NULL }, - { "output.current", 0, 0.1, MGE_BASE_OID ".7.2.1.5.1", "", SU_OUTPUT_1, NULL }, - { "output.L1.current", 0, 0.1, MGE_BASE_OID ".7.2.1.5.1", "", SU_OUTPUT_3, NULL }, - { "output.L2.current", 0, 0.1, MGE_BASE_OID ".7.2.1.5.2", "", SU_OUTPUT_3, NULL }, - { "output.L3.current", 0, 0.1, MGE_BASE_OID ".7.2.1.5.3", "", SU_OUTPUT_3, NULL }, + { "output.phases", 0, 1.0, ".1.3.6.1.4.1.705.1.7.1.0", "", SU_FLAG_SETINT, NULL, &output_phases }, + { "output.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.2.1", "", SU_OUTPUT_1, NULL }, + { "output.L1-N.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.2.1", "", SU_OUTPUT_3, NULL }, + { "output.L2-N.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.2.2", "", SU_OUTPUT_3, NULL }, + { "output.L3-N.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.2.3", "", SU_OUTPUT_3, NULL }, + { "output.frequency", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.3.1", "", SU_OUTPUT_1, NULL }, + { "output.L1.frequency", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.3.1", "", SU_OUTPUT_3, NULL }, + { "output.L2.frequency", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.3.2", "", SU_OUTPUT_3, NULL }, + { "output.L3.frequency", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.3.3", "", SU_OUTPUT_3, NULL }, + { "output.current", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.5.1", "", SU_OUTPUT_1, NULL }, + { "output.L1.current", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.5.1", "", SU_OUTPUT_3, NULL }, + { "output.L2.current", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.5.2", "", SU_OUTPUT_3, NULL }, + { "output.L3.current", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.5.3", "", SU_OUTPUT_3, NULL }, /* Battery page */ - { "battery.charge", 0, 1, MGE_BASE_OID ".5.2.0", "", SU_FLAG_OK, NULL }, - { "battery.runtime", 0, 1, MGE_BASE_OID ".5.1.0", "", SU_FLAG_OK, NULL }, - { "battery.charge.low", ST_FLAG_STRING | ST_FLAG_RW, 2, MGE_BASE_OID ".4.8.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL }, - { "battery.voltage", 0, 0.1, MGE_BASE_OID ".5.5.0", "", SU_FLAG_OK, NULL }, + { "battery.charge", 0, 1, ".1.3.6.1.4.1.705.1.5.2.0", "", SU_FLAG_OK, NULL }, + { "battery.runtime", 0, 1, ".1.3.6.1.4.1.705.1.5.1.0", "", SU_FLAG_OK, NULL }, + { "battery.runtime.low", 0, 1, ".1.3.6.1.4.1.705.1.4.7.0", "", SU_FLAG_OK, NULL }, + { "battery.charge.low", ST_FLAG_STRING | ST_FLAG_RW, 2, ".1.3.6.1.4.1.705.1.4.8.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL }, + { "battery.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.5.5.0", "", SU_FLAG_OK, NULL }, /* Ambient page: Environment Sensor (ref 66 846) */ - { "ambient.temperature", 0, 0.1, MGE_BASE_OID ".8.1.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL }, - { "ambient.humidity", 0, 0.1, MGE_BASE_OID ".8.2.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL }, + { "ambient.temperature", 0, 0.1, ".1.3.6.1.4.1.705.1.8.1.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL }, + { "ambient.humidity", 0, 0.1, ".1.3.6.1.4.1.705.1.8.2.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL }, /* Outlet page */ { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "Main Outlet", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, /* instant commands. */ - { "test.battery.start", 0, MGE_START_VALUE, MGE_BASE_OID ".10.4.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, -/* { "load.off", 0, MGE_START_VALUE, MGE_BASE_OID ".9.1.1.6.1", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, */ -/* { "load.on", 0, MGE_START_VALUE, MGE_BASE_OID ".9.1.1.3.1", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, */ -/* { "shutdown.return", 0, MGE_START_VALUE, MGE_BASE_OID ".9.1.1.9.1", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, */ + { "test.battery.start", 0, MGE_START_VALUE, ".1.3.6.1.4.1.705.1.10.4.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + /* Also use IETF OIDs + * { "test.battery.stop", 0, 0, "1.3.6.1.2.1.33.1.7.1.0", "1.3.6.1.2.1.33.1.7.7.2", SU_TYPE_CMD, NULL }, + * { "test.battery.start", 0, 0, "1.3.6.1.2.1.33.1.7.1.0", "1.3.6.1.2.1.33.1.7.7.3", SU_TYPE_CMD, NULL }, + * { "test.battery.start.quick", 0, 0, "1.3.6.1.2.1.33.1.7.1.0", "1.3.6.1.2.1.33.1.7.7.4", SU_TYPE_CMD, NULL }, + * { "test.battery.start.deep", 0, 0, "1.3.6.1.2.1.33.1.7.1.0", "1.3.6.1.2.1.33.1.7.7.5", SU_TYPE_CMD, NULL }, + */ + + /* { "load.off", 0, MGE_START_VALUE, ".1.3.6.1.4.1.705.1.9.1.1.6.1", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + * { "load.on", 0, MGE_START_VALUE, ".1.3.6.1.4.1.705.1.9.1.1.3.1", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + * { "shutdown.return", 0, MGE_START_VALUE, ".1.3.6.1.4.1.705.1.9.1.1.9.1", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + */ + /* IETF MIB fallback */ + { "beeper.disable", 0, 1, "1.3.6.1.2.1.33.1.9.8.0", "", SU_TYPE_CMD, NULL }, + { "beeper.enable", 0, 2, "1.3.6.1.2.1.33.1.9.8.0", "", SU_TYPE_CMD, NULL }, + { "beeper.mute", 0, 3, "1.3.6.1.2.1.33.1.9.8.0", "", SU_TYPE_CMD, NULL }, + /* Use ST_FLAG_STRING to get default value from ->dfl instead of info_len */ + { "load.off.delay", 0, DEFAULT_OFFDELAY, "1.3.6.1.2.1.33.1.8.2.0", "", SU_TYPE_CMD, NULL }, + { "load.on.delay", 0, DEFAULT_ONDELAY, "1.3.6.1.2.1.33.1.8.3.0", "", SU_TYPE_CMD, NULL }, /* end of structure. */ { NULL, 0, 0, NULL, NULL, 0, NULL } diff --git a/drivers/mge-shut.c b/drivers/mge-shut.c index 1f9e519..06398ed 100644 --- a/drivers/mge-shut.c +++ b/drivers/mge-shut.c @@ -1,6 +1,6 @@ /* mge-shut.c - monitor MGE UPS for NUT with SHUT protocol * - * Copyright (C) 2002 - 2008 + * Copyright (C) 2002 - 2012 * Arnaud Quette * * Sponsored by MGE UPS SYSTEMS @@ -37,7 +37,7 @@ /* --------------------------------------------------------------- */ #define DRIVER_NAME "Eaton / SHUT driver" -#define DRIVER_VERSION "0.69" +#define DRIVER_VERSION "0.70" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -524,7 +524,7 @@ int shut_wait_ack (void) upsdebugx (2, "shut_wait_ack(): NACK received"); return -2; } - else if ((c[0] & SHUT_PKT_LAST) == SHUT_TYPE_NOTIFY) { + else if ((c[0] & 0x0f) == SHUT_TYPE_NOTIFY) { upsdebugx (2, "shut_wait_ack(): NOTIFY received"); return -3; } @@ -835,8 +835,11 @@ int shut_packet_recv (u_char *Buf, int datalen) shut_token_send(SHUT_OK); - if(Start[0]&SHUT_PKT_LAST) { - if ((Start[0]&SHUT_PKT_LAST) == SHUT_TYPE_NOTIFY) { + + /* Check if there are more data to receive */ + if((Start[0] & 0xf0) == SHUT_PKT_LAST) { + /* Check if it's a notification */ + if ((Start[0] & 0x0f) == SHUT_TYPE_NOTIFY) { /* TODO: process notification (dropped for now) */ upsdebugx (4, "=> notification"); datalen+=Pos; diff --git a/drivers/mge-utalk.c b/drivers/mge-utalk.c index 616e2ad..3139065 100644 --- a/drivers/mge-utalk.c +++ b/drivers/mge-utalk.c @@ -287,10 +287,9 @@ void upsdrv_initinfo(void) *p = '\0'; si_data1 = atoi(buf); v = p+1; + p = strchr(v, ' '); } - p = strchr(v, ' '); - if ( p != NULL ) { *p = '\0'; si_data2 = atoi(v); diff --git a/drivers/netvision-mib.c b/drivers/netvision-mib.c index 91e4d35..3b31e32 100644 --- a/drivers/netvision-mib.c +++ b/drivers/netvision-mib.c @@ -1,8 +1,9 @@ /* netvision-mib.c - data to monitor Socomec Sicon UPS equipped * with Netvision WEB/SNMP card/external box with NUT * - * Copyright (C) 2004 - * Thanos Chatziathanassiou + * Copyright (C) + * 2004 Thanos Chatziathanassiou + * 2012 Manuel Bouyer * * 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,7 +24,7 @@ #include "netvision-mib.h" -#define NETVISION_MIB_VERSION "0.1" +#define NETVISION_MIB_VERSION "0.3" #define NETVISION_SYSOID ".1.3.6.1.4.1.4555.1.1.1" @@ -37,11 +38,11 @@ /* UPS Battery */ #define NETVISION_OID_BATTERYSTATUS ".1.3.6.1.4.1.4555.1.1.1.1.2.1.0" static info_lkp_t netvision_batt_info[] = { - { 2, "" }, /* battery normal */ - { 3, "LB" }, /* battery low */ - { 4, "LB" }, /* battery depleted */ + { 2, "" }, /* battery normal */ + { 3, "LB" }, /* battery low */ + { 4, "LB" }, /* battery depleted */ { 5, "DISCHRG" }, /* battery discharging */ - { 6, "RB" }, /* battery failure */ + { 6, "RB" }, /* battery failure */ { 0, "NULL" } }; @@ -51,8 +52,12 @@ static info_lkp_t netvision_batt_info[] = { #define NETVISION_OID_BATT_VOLTS ".1.3.6.1.4.1.4555.1.1.1.1.2.5.0" #define NETVISION_OID_INPUT_NUM_LINES ".1.3.6.1.4.1.4555.1.1.1.1.3.1.0" /* 1phase or 3phase UPS input */ +#define NETVISION_OID_INPUT_FREQ ".1.3.6.1.4.1.4555.1.1.1.1.3.2.0" #define NETVISION_OID_OUTPUT_NUM_LINES ".1.3.6.1.4.1.4555.1.1.1.1.4.3.0" /* 1phase or 3phase UPS output */ +#define NETVISION_OID_OUTPUT_FREQ ".1.3.6.1.4.1.4555.1.1.1.1.4.2.0" +#define NETVISION_OID_BYPASS_FREQ ".1.3.6.1.4.1.4555.1.1.1.1.5.1.0" +#define NETVISION_OID_BYPASS_NUM_LINES ".1.3.6.1.4.1.4555.1.1.1.1.5.2.0" /* 1phase or 3phase UPS input */ /* three phase ups provide input/output/load for each phase in case of one-phase output, only _P1 should be used @@ -62,29 +67,41 @@ static info_lkp_t netvision_batt_info[] = { #define NETVISION_OID_OUT_CURRENT_P1 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.3.1" #define NETVISION_OID_OUT_LOAD_PCT_P1 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.4.1" #define NETVISION_OID_IN_VOLTAGE_P1 ".1.3.6.1.4.1.4555.1.1.1.1.3.3.1.5.1" +#define NETVISION_OID_IN_CURRENT_P1 ".1.3.6.1.4.1.4555.1.1.1.1.3.3.1.3.1" +#define NETVISION_OID_BY_VOLTAGE_P1 ".1.3.6.1.4.1.4555.1.1.1.1.5.3.1.2.1" +#define NETVISION_OID_BY_CURRENT_P1 ".1.3.6.1.4.1.4555.1.1.1.1.5.3.1.3.1" #define NETVISION_OID_OUT_VOLTAGE_P2 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.2.2" #define NETVISION_OID_OUT_CURRENT_P2 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.3.2" #define NETVISION_OID_OUT_LOAD_PCT_P2 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.4.2" #define NETVISION_OID_IN_VOLTAGE_P2 ".1.3.6.1.4.1.4555.1.1.1.1.3.3.1.5.2" +#define NETVISION_OID_IN_CURRENT_P2 ".1.3.6.1.4.1.4555.1.1.1.1.3.3.1.3.2" +#define NETVISION_OID_BY_VOLTAGE_P2 ".1.3.6.1.4.1.4555.1.1.1.1.5.3.1.2.2" +#define NETVISION_OID_BY_CURRENT_P2 ".1.3.6.1.4.1.4555.1.1.1.1.5.3.1.3.2" #define NETVISION_OID_OUT_VOLTAGE_P3 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.2.3" #define NETVISION_OID_OUT_CURRENT_P3 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.3.3" #define NETVISION_OID_OUT_LOAD_PCT_P3 ".1.3.6.1.4.1.4555.1.1.1.1.4.4.1.4.3" #define NETVISION_OID_IN_VOLTAGE_P3 ".1.3.6.1.4.1.4555.1.1.1.1.3.3.1.5.3" +#define NETVISION_OID_IN_CURRENT_P3 ".1.3.6.1.4.1.4555.1.1.1.1.3.3.1.3.3" +#define NETVISION_OID_BY_VOLTAGE_P3 ".1.3.6.1.4.1.4555.1.1.1.1.5.3.1.2.3" +#define NETVISION_OID_BY_CURRENT_P3 ".1.3.6.1.4.1.4555.1.1.1.1.5.3.1.3.3" #define NETVISION_OID_OUTPUT_SOURCE ".1.3.6.1.4.1.4555.1.1.1.1.4.1.0" +#define NETVISION_OID_CONTROL_STATUS ".1.3.6.1.4.1.4555.1.1.1.1.8.1" +#define NETVISION_OID_CONTROL_SHUTDOWN_DELAY ".1.3.6.1.4.1.4555.1.1.1.1.8.2" + static info_lkp_t netvision_output_info[] = { - { 1, "" }, /* output source other */ - { 2, "" }, /* output source none */ - { 3, "OL" }, /* output source normal */ + { 1, "" }, /* output source other */ + { 2, "" }, /* output source none */ + { 3, "OL" }, /* output source normal */ { 4, "OL BYPASS" }, /* output source bypass */ - { 5, "OB" }, /* output source battery */ + { 5, "OB" }, /* output source battery */ { 6, "OL BOOST" }, /* output source booster */ { 7, "OL TRIM" }, /* output source reducer */ - { 8, "" }, /* output source standby */ - { 9, "" }, /* output source ecomode */ + { 8, "OL" }, /* output source standby */ + { 9, "" }, /* output source ecomode */ { 0, "NULL" } }; @@ -104,12 +121,45 @@ static snmp_info_t netvision_mib[] = { SU_FLAG_OK | SU_STATUS_PWR, &netvision_output_info[0] }, /* ups load */ - { "ups.load", 0, 1, NETVISION_OID_OUT_LOAD_PCT_P1, 0, SU_FLAG_OK, NULL }, + { "ups.load", 0, 1, NETVISION_OID_OUT_LOAD_PCT_P1, 0, SU_INPUT_1, NULL }, /*ups input,output voltage, output frquency phase 1 */ - { "input.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P1, 0, SU_FLAG_OK, NULL }, - { "output.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P1, 0, SU_FLAG_OK, NULL }, - { "output.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P1, 0, SU_FLAG_OK, NULL }, + { "input.phases", 0, 1.0, NETVISION_OID_INPUT_NUM_LINES, 0, SU_FLAG_SETINT, NULL, &input_phases }, + { "input.frequency", 0, 0.1, NETVISION_OID_INPUT_FREQ, 0, SU_FLAG_OK, NULL }, + { "input.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P1, 0, SU_INPUT_1, NULL }, + { "input.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P1, 0, SU_INPUT_1, NULL }, + { "input.L1-N.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P1, 0, SU_INPUT_3, NULL }, + { "input.L1.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P1, 0, SU_INPUT_3, NULL }, + { "input.L2-N.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P2, 0, SU_INPUT_3, NULL }, + { "input.L2.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P2, 0, SU_INPUT_3, NULL }, + { "input.L3-N.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P3, 0, SU_INPUT_3, NULL }, + { "input.L3.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P3, 0, SU_INPUT_3, NULL }, + + { "output.phases", 0, 1.0, NETVISION_OID_OUTPUT_NUM_LINES, 0, SU_FLAG_SETINT, NULL, &output_phases }, + { "output.frequency", 0, 0.1, NETVISION_OID_OUTPUT_FREQ, 0, SU_FLAG_OK, NULL }, + { "output.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P1, 0, SU_OUTPUT_1, NULL }, + { "output.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P1, 0, SU_OUTPUT_1, NULL }, + { "output.load", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P1, 0, SU_OUTPUT_1, NULL }, + { "output.L1-N.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P1, 0, SU_OUTPUT_3, NULL }, + { "output.L1.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P1, 0, SU_OUTPUT_3, NULL }, + { "output.L1.power.percent", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P1, 0, SU_OUTPUT_3, NULL }, + { "output.L2-N.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P2, 0, SU_OUTPUT_3, NULL }, + { "output.L2.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P2, 0, SU_OUTPUT_3, NULL }, + { "output.L2.power.percent", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P2, 0, SU_OUTPUT_3, NULL }, + { "output.L3-N.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P3, 0, SU_OUTPUT_3, NULL }, + { "output.L3.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P3, 0, SU_OUTPUT_3, NULL }, + { "output.L3.power.percent", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P3, 0, SU_OUTPUT_3, NULL }, + + { "input.bypass.phases", 0, 1.0, NETVISION_OID_BYPASS_NUM_LINES, 0, SU_FLAG_SETINT, NULL, &bypass_phases }, + { "input.bypass.frequency", 0, 0.1, NETVISION_OID_BYPASS_FREQ, 0, SU_FLAG_OK, NULL }, + { "input.bypass.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P1, 0, SU_BYPASS_1, NULL }, + { "input.bypass.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P1, 0, SU_BYPASS_1, NULL }, + { "input.bypass.L1-N.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P1, 0, SU_BYPASS_3, NULL }, + { "input.bypass.L1.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P1, 0, SU_BYPASS_3, NULL }, + { "input.bypass.L2-N.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P2, 0, SU_BYPASS_3, NULL }, + { "input.bypass.L2.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P2, 0, SU_BYPASS_3, NULL }, + { "input.bypass.L3-N.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P3, 0, SU_BYPASS_3, NULL }, + { "input.bypass.L3.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P3, 0, SU_BYPASS_3, NULL }, /* battery info */ { "battery.charge", 0, 1, NETVISION_OID_BATT_CHARGE, "", SU_FLAG_OK, NULL }, diff --git a/drivers/oneac.c b/drivers/oneac.c index 22a73ab..55035f7 100644 --- a/drivers/oneac.c +++ b/drivers/oneac.c @@ -1,57 +1,118 @@ /*vim ts=4*/ - -/* - * NUT Oneac EG and ON model specific drivers for UPS units using - * the Oneac Advanced Interface. If your UPS is equipped with the - * Oneac Basic Interface, use the genericups driver -*/ - -/* - Copyright (C) 2003 by Eric Lawson - - 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 -*/ - -/* 28 November 2003. Eric Lawson +/* oneac.c - Driver for Oneac UPS using the Advanced Interface. + * + * Supported Oneac UPS families in this driver: + * EG (late 80s, early 90s, plug-in serial interface card) + * ON (early and mid-90s, plug-in serial interface card) + * OZ (mid-90s on, DB-25 std., interface slot) + * OB (early 2000's on, big cabinet, DB-25 std., interface slot) + * + * Copyright (C) + * 2003 by Eric Lawson + * 2012 by Bill Elliot + * + * This program was sponsored by MGE UPS SYSTEMS, and now Eaton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * History: + * - 7 February 2012. Bill Elliot + * Enhancing the driver for additional capabilities and later units. + * + * - 28 November 2003. Eric Lawson * More or less complete re-write for NUT 1.5.9 * This was somewhat easier than trying to beat the old driver code * into submission -*/ + * + */ #include "main.h" #include "serial.h" #include "oneac.h" -#define DRIVER_NAME "Oneac EG/ON UPS driver" -#define DRIVER_VERSION "0.51" +/* Prototypes to allow setting pointer before function is defined */ +int setcmd(const char* varname, const char* setvalue); +int instcmd(const char *cmdname, const char *extra); + +#define DRIVER_NAME "Oneac EG/ON/OZ/OB UPS driver" +#define DRIVER_VERSION "0.80" /* driver description structure */ upsdrv_info_t upsdrv_info = { DRIVER_NAME, DRIVER_VERSION, + "Bill Elliot \n" "Eric Lawson ", - DRV_EXPERIMENTAL, + DRV_STABLE, { NULL } }; -#define SECS 2 /*wait time*/ -#define USEC 0 /*rest of wait time*/ +#define SECS 0 /* Serial function wait time*/ +#define USEC 500000 /* Rest of serial function wait time*/ + +#define COMM_TRIES 3 /* Serial retries before "stale" */ + +static char UpsFamily [3]; + +/**************************************************************** + * Below are functions used only in this oneac driver * + ***************************************************************/ + +/* Since an installed network card may delay responses from the UPS + * allow for a repeat of the get request. Also confirm that + * the correct number of characters are returned. + */ + +int OneacGetResponse (char* chBuff, const int BuffSize, int ExpectedCount) +{ + int Retries = 10; /* x/2 seconds max with 500000 USEC */ + int return_val; + + do + { + return_val = ser_get_line(upsfd, chBuff, BuffSize, ENDCHAR, IGNCHARS, + SECS, USEC); + + if (return_val == ExpectedCount) + break; + + upsdebugx (3,"!OneacGetResponse retry (%d, %d)...", return_val,Retries); + + } while (--Retries > 0); + + upsdebugx (4,"OneacGetResponse buffer: %s",chBuff); + + if (Retries == 0) + { + upsdebugx (2,"!!OneacGetResponse timeout..."); + return_val = 1; /* Comms error */ + } + else + { + if (Retries < 10) + upsdebugx (2,"OneacGetResponse recovered (%d)...", Retries); + + return_val = 0; /* Good comms */ + } + + return return_val; +} void do_battery_test(void) { - char buffer[256]; + char buffer[32]; if (getval("testtime") == NULL) snprintf(buffer, 3, "%s", DEFAULT_BAT_TEST_TIME); @@ -69,180 +130,420 @@ void do_battery_test(void) ser_send(upsfd,"%s%s%s",BAT_TEST_PREFIX,buffer,COMMAND_END); } - -/**************************************************************** - *below are the commands that are called by main (part of the * - *Above, are functions used only in this oneac driver * - ***************************************************************/ - -int instcmd(const char *cmdname, const char *extra) +int SetOutputAllow(const char* lowval, const char* highval) { - if (!strcasecmp(cmdname, "test.failure.start")) { - ser_send(upsfd,"%s%s",SIM_PWR_FAIL,COMMAND_END); - return STAT_INSTCMD_HANDLED; - } + char buffer[32]; - if (!strcasecmp(cmdname, "test.battery.start")) { - do_battery_test(); - return STAT_INSTCMD_HANDLED; - } + snprintf(buffer, 4, "%.3s", lowval); - if (!strcasecmp(cmdname, "test.battery.stop")) { - ser_send(upsfd,"%s00%s",BAT_TEST_PREFIX,COMMAND_END); - return STAT_INSTCMD_HANDLED; - } + /*the UPS wants this value to always be three characters long*/ + /*so put a zero in front of the string, if needed.... */ - if (!strcasecmp(cmdname, "reset.input.minmax")) { - ser_send(upsfd,"%c%s",RESET_MIN_MAX, COMMAND_END); - return STAT_INSTCMD_HANDLED; + if (strlen(buffer) < 3) + { + buffer[3] = '\0'; + buffer[2] = buffer[1]; + buffer[1] = buffer[0]; + buffer[0] = '0'; } + + upsdebugx (2,"SetOutputAllow sending %s%.3s,%.3s...", + SETX_OUT_ALLOW, buffer, highval); + + ser_send(upsfd,"%s%.3s,%.3s%s", SETX_OUT_ALLOW, buffer, highval, + COMMAND_END); + ser_get_line(upsfd,buffer,sizeof(buffer), ENDCHAR, IGNCHARS,SECS,USEC); + + if(buffer[0] == DONT_UNDERSTAND) + { + upsdebugx (2,"SetOutputAllow got asterisk back..."); - upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); - return STAT_INSTCMD_UNKNOWN; + return 1; /* Invalid command */ + } + + return 0; /* Valid command */ +} + +void EliminateLeadingZeroes (const char* buff1, int StringSize, char* buff2, + const int buff2size) +{ + int i = 0; + int j = 0; + + memset(buff2, '\0', buff2size); /* Fill with nulls */ + + /* Find first non-'0' */ + while ((buff1[i] == '0') && (i < (StringSize - 1))) + { + i++; + } + + while (i < StringSize) /* Move rest of string */ + { + buff2[j++] = buff1[i++]; + } } +/**************************************************************** + * Below are the commands that are called by main * + ***************************************************************/ + +void upsdrv_initups(void) +{ + upsfd = ser_open(device_path); + ser_set_speed(upsfd, device_path, B9600); + + /*get the UPS in the right frame of mind*/ + ser_send_pace(upsfd, 100, "%s", COMMAND_END); + ser_send_pace(upsfd, 100, "%s", COMMAND_END); + sleep (1); +} + void upsdrv_initinfo(void) { - int i; + int i,j, k; + int VRange=0; + int timevalue; + int RetValue; char buffer[256], buffer2[32]; + + /* All families should reply to this request so we can confirm that it is + * an ONEAC UPS + */ + ser_flush_in(upsfd,"",0); - ser_send(upsfd,"%c%s",GET_MFR,COMMAND_END); - ser_get_line(upsfd, buffer, sizeof(buffer),ENDCHAR,IGNCHARS,SECS,USEC); - if(strncmp(buffer,MFGR, sizeof(MFGR))) - fatalx(EXIT_FAILURE, "Unable to connect to ONEAC UPS on %s\n",device_path); - - dstate_setinfo("ups.mfr", "%s", buffer); - dstate_addcmd("test.battery.start"); - dstate_addcmd("test.battery.stop"); - dstate_addcmd("test.failure.start"); - dstate_addcmd("reset.input.minmax"); + ser_send(upsfd,"%c%s",GET_FAMILY,COMMAND_END); - - upsh.instcmd = instcmd; - - /*set some stuff that shouldn't change after initialization*/ - /*this stuff is common to both the EG and ON family of UPS */ - - /*firmware revision*/ - ser_send(upsfd,"%c%s", GET_VERSION, COMMAND_END); - ser_get_line(upsfd, buffer, sizeof(buffer),ENDCHAR,IGNCHARS,SECS,USEC); - dstate_setinfo("ups.firmware", "%.3s",buffer); - - /*nominal AC frequency setting --either 50 or 60*/ - ser_send(upsfd,"%c%s", GET_NOM_FREQ, COMMAND_END); - ser_get_line(upsfd,buffer,sizeof(buffer),ENDCHAR,IGNCHARS,SECS,USEC); - dstate_setinfo("input.frequency", "%.2s", buffer); - - - /*UPS Model (either ON, or EG series of UPS)*/ - - ser_send(upsfd,"%c%s", GET_FAMILY,COMMAND_END); - ser_get_line(upsfd,buffer,sizeof(buffer),ENDCHAR,IGNCHARS,SECS,USEC); - dstate_setinfo("ups.model", "%.2s",buffer); - printf("Found %.2s family of Oneac UPS\n", buffer); - - if ((strncmp(buffer,FAMILY_ON,2) != 0 && - strncmp(buffer,FAMILY_ON_EXT,2) != 0) || - strncmp(buffer,FAMILY_EG,2) == 0) - printf("Unknown family of UPS. Assuming EG capabilities.\n"); - - /*Get the actual model string for ON UPS reported as OZ family*/ - if (strncmp (dstate_getinfo("ups.model"), FAMILY_ON_EXT, 2) == 0) { - ser_flush_in(upsfd,"",0); - ser_send(upsfd,"%c%s",GET_ALL_EXT_2,COMMAND_END); - ser_get_line(upsfd, buffer, sizeof(buffer),ENDCHAR,IGNCHARS,SECS,USEC); - - /*UPS Model (full string)*/ - memset(buffer2, '\0', 32); - strncpy(buffer2,&buffer[5], 10); - for (i = 9; i >= 0 && buffer2[i] == ' '; --i) { - buffer2[i] = '\0'; + if(OneacGetResponse (buffer, sizeof(buffer), 2)) + { + fatalx(EXIT_FAILURE, "Serial timeout with ONEAC UPS on %s\n", + device_path); + } + else + { + if (strncmp(buffer,FAMILY_ON,FAMILY_SIZE) != 0 && + strncmp(buffer,FAMILY_OZ,FAMILY_SIZE) != 0 && + strncmp(buffer,FAMILY_OB,FAMILY_SIZE) != 0 && + strncmp(buffer,FAMILY_EG,FAMILY_SIZE) != 0) + { + fatalx(EXIT_FAILURE, "Did not find an ONEAC UPS on %s\n", + device_path); } - - dstate_setinfo("ups.model", "%s", buffer2); - printf("Found %.10s UPS\n", buffer2); } - /*The ON (OZ) series of UPS supports more stuff than does the EG. - *Take care of the ON (OZ) only stuff here - */ - if(strncmp (dstate_getinfo("ups.model"), FAMILY_ON, 2) == 0 || - strncmp (dstate_getinfo("ups.model"), FAMILY_ON_EXT, 2) == 0) { - /*now set the ON specific "static" parameters*/ + /* UPS Model (either EG, ON, OZ or OB series of UPS) */ + strncpy(UpsFamily, buffer, FAMILY_SIZE); + UpsFamily[2] = '\0'; + dstate_setinfo("device.model", "%s",UpsFamily); + printf("Found %s family of Oneac UPS\n", UpsFamily); - /*nominal input voltage*/ + dstate_setinfo("ups.type", "%s", "Line Interactive"); + + dstate_addcmd("test.battery.start.quick"); + dstate_addcmd("test.battery.stop"); + dstate_addcmd("test.failure.start"); + dstate_addcmd("shutdown.return"); + dstate_addcmd("shutdown.stop"); + dstate_addcmd("shutdown.reboot"); - ser_send(upsfd,"%c%s",GET_NOM_VOLTAGE,COMMAND_END); - ser_get_line(upsfd,buffer,sizeof(buffer),ENDCHAR,IGNCHARS,SECS,USEC); + upsh.setvar = setcmd; + upsh.instcmd = instcmd; - switch (buffer[0]) { + /* set some stuff that shouldn't change after initialization */ + /* this stuff is common to all families of UPS */ + + ser_send(upsfd,"%c%s",GET_ALL,COMMAND_END); + + if (strncmp(UpsFamily, FAMILY_EG, FAMILY_SIZE) == 0) + { + RetValue = OneacGetResponse (buffer, sizeof(buffer), + GETALL_EG_RESP_SIZE); + } + else + { + RetValue = OneacGetResponse (buffer, sizeof(buffer), GETALL_RESP_SIZE); + } + + if(RetValue) + { + fatalx(EXIT_FAILURE, "Serial timeout(2) with ONEAC UPS on %s\n", + device_path); + } + + /* Manufacturer */ + dstate_setinfo("device.mfr", "%.5s", buffer); + + /*firmware revision*/ + dstate_setinfo("ups.firmware", "%.3s",buffer+7); + + /*nominal AC frequency setting --either 50 or 60*/ + dstate_setinfo("input.frequency.nominal", "%.2s", buffer+20); + dstate_setinfo("output.frequency.nominal", "%.2s", buffer+20); + + /* Shutdown delay in seconds...can be changed by user */ + if (getval("offdelay") == NULL) + dstate_setinfo("ups.delay.shutdown", "0"); + else + dstate_setinfo("ups.delay.shutdown", "%s", getval("offdelay")); + + dstate_setflags("ups.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW); + dstate_setaux("ups.delay.shutdown", GET_SHUTDOWN_RESP_SIZE); + + /* Setup some ON/OZ/OB only stuff ... i.e. not EG */ + + if (strncmp(UpsFamily, FAMILY_EG, FAMILY_SIZE) != 0) + { + dstate_addcmd("reset.input.minmax"); + + /*nominal input voltage*/ + + VRange = buffer[26]; /* Keep for later use also */ + + switch (VRange) /* Will be '1' or '2' */ + { case V120AC: - dstate_setinfo("output.voltage.nominal", - "120"); + dstate_setinfo("input.voltage.nominal", "120"); + dstate_setinfo("output.voltage.nominal", "120"); break; case V230AC: - dstate_setinfo("output.voltage.nominal", - "240"); + dstate_setinfo("input.voltage.nominal", "230"); + dstate_setinfo("output.voltage.nominal", "230"); break; default: upslogx(LOG_INFO,"Oneac: " - "Invalid voltage parameter from UPS"); + "Invalid nom voltage parameter from UPS [%c]", VRange); + } + } + + /* Setup some OZ/OB only stuff */ + + if ((strncmp (UpsFamily, FAMILY_OZ, FAMILY_SIZE) == 0) || + (strncmp (UpsFamily, FAMILY_OB, FAMILY_SIZE) == 0)) + { + dstate_addcmd("test.panel.start"); + dstate_addcmd("test.battery.start.deep"); + dstate_addcmd("beeper.enable"); + dstate_addcmd("beeper.disable"); + dstate_addcmd("beeper.mute"); + + dstate_setaux("ups.delay.shutdown", GETX_SHUTDOWN_RESP_SIZE); + + ser_flush_in(upsfd,"",0); + ser_send(upsfd,"%c%s",GETX_ALL_2,COMMAND_END); + if(OneacGetResponse (buffer, sizeof(buffer), GETX_ALL2_RESP_SIZE)) + { + fatalx(EXIT_FAILURE, "Serial timeout(3) with ONEAC UPS on %s\n", + device_path); + } + + /* Low and high output trip points */ + EliminateLeadingZeroes (buffer+73, 3, buffer2, sizeof(buffer2)); + dstate_setinfo("input.transfer.low", "%s", buffer2); + dstate_setflags("input.transfer.low", ST_FLAG_STRING | ST_FLAG_RW ); + dstate_setaux("input.transfer.low", 3); + + EliminateLeadingZeroes (buffer+76, 3, buffer2, sizeof(buffer2)); + dstate_setinfo("input.transfer.high", "%s", buffer2); + dstate_setflags("input.transfer.high", ST_FLAG_STRING | ST_FLAG_RW); + dstate_setaux("input.transfer.high", 3); + + /* Restart delay */ + EliminateLeadingZeroes (buffer+84, 4, buffer2, sizeof(buffer2)); + dstate_setinfo("ups.delay.start", "%s", buffer2); + dstate_setflags("ups.delay.start", ST_FLAG_STRING | ST_FLAG_RW); + dstate_setaux("ups.delay.start", 4); + + /* Low Batt at time */ + strncpy(buffer2, buffer+82, 2); + buffer2[2]='\0'; + timevalue = atoi(buffer2) * 60; /* Change minutes to seconds */ + dstate_setinfo("battery.runtime.low", "%d",timevalue); + dstate_setflags("battery.runtime.low", ST_FLAG_STRING | ST_FLAG_RW); + dstate_setaux("battery.runtime.low", 2); + + /*Get the actual model string for ON UPS reported as OZ/OB family*/ + + /*UPS Model (full string)*/ + memset(buffer2, '\0', 32); + strncpy(buffer2, buffer+5, 10); + for (i = 9; i >= 0 && buffer2[i] == ' '; --i) + { + buffer2[i] = '\0'; + } + + dstate_setinfo("device.model", "%s", buffer2); + + /* Serial number */ + dstate_setinfo("device.serial", "%.4s-%.4s", buffer+18, buffer+22); + printf("Found %.10s UPS with serial number %.4s-%.4s\n", + buffer2, buffer+18, buffer+22); + + /* Manufacture Date */ + dstate_setinfo("ups.mfr.date", "%.6s (yymmdd)", buffer+38); + + /* Battery Replace Date */ + dstate_setinfo("battery.date", "%.6s (yymmdd)", buffer+44); + dstate_setflags("battery.date", ST_FLAG_STRING | ST_FLAG_RW); + dstate_setaux("battery.date", 6); + + /* Real power nominal */ + EliminateLeadingZeroes (buffer+55, 5, buffer2, sizeof(buffer2)); + dstate_setinfo("ups.realpower.nominal", "%s", buffer2); + + /* Set up ups.start.auto to be writable */ + dstate_setinfo("ups.start.auto", "yes"); + dstate_setflags("ups.start.auto", ST_FLAG_STRING | ST_FLAG_RW); + dstate_setaux("ups.start.auto", 3); + + /* Get output window min/max points from OB or OZ v1.9 or later */ + if ((strncmp (UpsFamily, FAMILY_OB, FAMILY_SIZE) == 0) || + (strcmp (dstate_getinfo("ups.firmware"), MIN_ALLOW_FW) >= 0 )) + { + upsdebugx (2,"Can get output window min/max! (%s)", + dstate_getinfo("ups.firmware")); + + ser_send(upsfd,"%s%s",GETX_ALLOW_RANGE,COMMAND_END); + if(OneacGetResponse (buffer, sizeof(buffer), GETX_RANGE_RESP_SIZE)) + { + fatalx(EXIT_FAILURE, + "Serial timeout(4) with ONEAC UPS on %s\n",device_path); + } + + strncpy(buffer2, buffer, 3); + buffer2[3]='\0'; + i = atoi(buffer2); /* Minimum voltage */ + + strncpy(buffer2, buffer+4, 3); + j = atoi(buffer2); /* Maximum voltage */ + + strncpy(buffer2, buffer+8, 2); + buffer2[2]='\0'; + k = atoi(buffer2); /* Spread between */ + + dstate_setinfo("input.transfer.low.min", "%3d", i); + dstate_setinfo("input.transfer.low.max", "%3d", j-k); + dstate_setinfo("input.transfer.high.min", "%3d", i+k); + dstate_setinfo("input.transfer.high.max", "%3d", j); + + } + else + { + /* Use default values from firmware */ + upsdebugx (2,"Using trip defaults (%s)...", + dstate_getinfo("ups.firmware")); + + switch (VRange) /* Held from initial use */ + { + case V120AC: + dstate_setinfo("input.transfer.low.min", "90"); + dstate_setinfo("input.transfer.low.max", "120"); + dstate_setinfo("input.transfer.high.min", "110"); + dstate_setinfo("input.transfer.high.max", "140"); + break; + + case V230AC: + dstate_setinfo("input.transfer.low.min", "172"); + dstate_setinfo("input.transfer.low.max", "228"); + dstate_setinfo("input.transfer.high.min", "212"); + dstate_setinfo("input.transfer.high.max", "268"); + break; + + default: + ; + + } } } } void upsdrv_updateinfo(void) { - char buffer[256]; - int ret_value; - + static int CommTry = COMM_TRIES; /* Comm loss counter */ + char buffer[256]; /* Main response buffer */ + char buffer2[32]; /* Conversion buffer */ + char s; + int RetValue; + int timevalue; + /* Start with EG/ON information */ ser_flush_in(upsfd,"",0); /*just in case*/ - ser_send (upsfd,"%c%s",GET_ALL,COMMAND_END); - ret_value = ser_get_line(upsfd,buffer,sizeof(buffer),ENDCHAR, - IGNCHARS,SECS,USEC); - - upsdebugx (2,"upsrecv_updateinfo: upsrecv returned: %s\n",buffer); - if (ret_value < 1) + ser_send (upsfd,"%c%s", GET_ALL, COMMAND_END); + + if (strncmp(UpsFamily, FAMILY_EG, FAMILY_SIZE) == 0) { - ser_comm_fail("Oneac UPS Comm failure on port %s",device_path); - dstate_datastale(); + RetValue = OneacGetResponse (buffer,sizeof(buffer),GETALL_EG_RESP_SIZE); } else { + RetValue = OneacGetResponse (buffer, sizeof(buffer), GETALL_RESP_SIZE); + } + + if ((RetValue != 0) && (CommTry == 0)) + { + ser_comm_fail("Oneac UPS Comm failure continues on port %s", + device_path); + } + else if (RetValue != 0) + { + if (--CommTry == 0) + { + ser_comm_fail("Oneac UPS Comm failure on port %s",device_path); + dstate_datastale(); + } + upsdebugx(2,"Oneac: Update serial comm retry value: %d", CommTry); + + return; + } + else + { + CommTry = COMM_TRIES; /* Reset serial retries */ + + s = buffer[12]; + status_init(); + alarm_init(); + /*take care of the UPS status information*/ - switch (buffer[12]) { - case NORMAL : - status_set("OL"); - break; - case ON_BAT_LOW_LINE : - case ON_BAT_HI_LINE : + if (s == '@') + { + status_set("OL"); + } + else + { + if (s & 0x01) /* On Battery */ + { status_set("OB"); - break; - case LO_BAT_LOW_LINE : - case LO_BAT_HI_LINE : - status_set("OB LB"); - break; - case TOO_HOT : - status_set("OVER OB LB"); - break; - case FIX_ME : - dstate_setinfo("ups.test.result","UPS Internal Failure"); - break; - case BAD_BAT : - status_set("RB"); - break; - default : /*cry for attention, fake a status*/ - /*Would another status be better?*/ - upslogx (LOG_ERR, "Oneac: Unknown UPS status"); + } + else + { status_set("OL"); + } + + if (s & 0x02) /* Low Battery */ + status_set("LB"); + + if (s & 0x04) /* General fault */ + { + dstate_setinfo("ups.test.result","UPS Internal Failure"); + } + else + { + dstate_setinfo("ups.test.result","Normal"); + } + + if (s & 0x08) /* Replace Battery */ + status_set("RB"); + +/* if (s & 0x10) */ /* High Line */ + + if (s & 0x20) /* Unit is hot */ + alarm_set("OVERHEAT"); } - /*take care of the reason why the UPS last transfered to battery*/ + /*take care of the reason why the UPS last transferred to battery*/ switch (buffer[13]) { case XFER_BLACKOUT : dstate_setinfo("input.transfer.reason", "Blackout"); @@ -261,61 +562,465 @@ void upsdrv_updateinfo(void) break; default : upslogx(LOG_INFO,"Oneac: Unknown reason for UPS battery" - " transfer"); + " transfer [%c]", buffer[13]); } - /* now update info for only the ON family of UPS*/ - if (strncmp(dstate_getinfo("ups.model"), FAMILY_ON, 2) == 0) { + /* now update info for only the non-EG families of UPS*/ + + if (strncmp(UpsFamily, FAMILY_EG, FAMILY_SIZE) != 0) + { dstate_setinfo("ups.load", "0%.2s",buffer+31); + /* Output ON or OFF? */ + if(buffer[27] == NO_VALUE_YET) + status_set("OFF"); + /*battery charge*/ if(buffer[10] == YES) dstate_setinfo("battery.charge", "0%.2s",buffer+33); - else dstate_setinfo("battery.charge", "100"); + else + dstate_setinfo("battery.charge", "100"); - dstate_setinfo("input.voltage", "%.3s",buffer+35); - dstate_setinfo("input.voltage.minimum", "%.3s",buffer+38); - dstate_setinfo("input.voltage.maximum", "%.3s",buffer+41); - dstate_setinfo("output.voltage", "%.3s",buffer+44); - if (buffer[47] == YES) status_set("BOOST"); + EliminateLeadingZeroes (buffer+35, 3, buffer2, sizeof(buffer2)); + dstate_setinfo("input.voltage", "%s",buffer2); + + EliminateLeadingZeroes (buffer+38, 3, buffer2, sizeof(buffer2)); + dstate_setinfo("input.voltage.minimum", "%s",buffer2); + + EliminateLeadingZeroes (buffer+41, 3, buffer2, sizeof(buffer2)); + dstate_setinfo("input.voltage.maximum", "%s",buffer2); + + EliminateLeadingZeroes (buffer+44, 3, buffer2, sizeof(buffer2)); + dstate_setinfo("output.voltage", "%s",buffer2); + + if (buffer[15] == NO_VALUE_YET) + { + dstate_delinfo("ups.timer.shutdown"); + } + else + { + /* A shutdown is underway! */ + status_set("FSD"); + + if(buffer[15] != HIGH_COUNT) + { + EliminateLeadingZeroes (buffer+15, 3, buffer2, + sizeof(buffer2)); + dstate_setinfo("ups.timer.shutdown", "%s", buffer2); + } + else + { + dstate_setinfo("ups.timer.shutdown", "999"); + } + } + + if (buffer[47] == YES) + status_set("BOOST"); } + + /* Now update info for only the OZ/OB families of UPS */ + + if ((strncmp(UpsFamily, FAMILY_OZ, FAMILY_SIZE) == 0) || + (strncmp(UpsFamily, FAMILY_OB, FAMILY_SIZE) == 0)) + { + ser_flush_in(upsfd,"",0); /*just in case*/ + ser_send (upsfd,"%c%s",GETX_ALL_1,COMMAND_END); + RetValue = OneacGetResponse (buffer, sizeof(buffer), + GETX_ALL1_RESP_SIZE); + + if(RetValue) + { + if (--CommTry == 0) + { + ser_comm_fail("Oneac (OZ) UPS Comm failure on port %s", + device_path); + dstate_datastale(); + } + + upsdebugx(2,"Oneac: " + "Update (OZ) serial comm retry value: %d", CommTry); + } + else + { + CommTry = COMM_TRIES; /* Reset count */ + + EliminateLeadingZeroes (buffer+57, 5, buffer2, sizeof(buffer2)); + dstate_setinfo("ups.realpower", "%s",buffer2); + + dstate_setinfo("input.frequency", "%.2s.%c", + buffer+42,buffer[44]); + dstate_setinfo("output.frequency", "%.2s.%c", + buffer+76, buffer[78]); + + EliminateLeadingZeroes (buffer+29, 3, buffer2, sizeof(buffer2)); + dstate_setinfo("battery.voltage", "%s.%c",buffer2, buffer[32]); + + dstate_setinfo("ups.temperature", "%.2s",buffer+13); + dstate_setinfo("ups.load", "%.3s",buffer+73); + + strncpy(buffer2, buffer+19, 4); + buffer2[4]='\0'; + timevalue = atoi(buffer2) * 60; /* Change mins to secs */ + dstate_setinfo("battery.runtime", "%d",timevalue); + + /* Now some individual requests... */ + + /* Battery replace date */ + ser_send (upsfd,"%c%s",GETX_BATT_REPLACED,COMMAND_END); + if(!OneacGetResponse (buffer, sizeof(buffer), + GETX_DATE_RESP_SIZE)) + dstate_setinfo("battery.date", "%.6s (yymmdd)", buffer); + + /* Low and high output trip points */ + ser_send (upsfd,"%c%s",GETX_LOW_OUT_ALLOW,COMMAND_END); + if(!OneacGetResponse (buffer, sizeof(buffer), + GETX_ALLOW_RESP_SIZE)) + { + EliminateLeadingZeroes (buffer, 3, buffer2,sizeof(buffer2)); + dstate_setinfo("input.transfer.low", "%s", buffer2); + } + + ser_send (upsfd,"%c%s",GETX_HI_OUT_ALLOW,COMMAND_END); + if(!OneacGetResponse (buffer, sizeof(buffer), + GETX_ALLOW_RESP_SIZE)) + dstate_setinfo("input.transfer.high", "%s", buffer); + + /* Restart delay */ + ser_send (upsfd,"%c%s",GETX_RESTART_DLY,COMMAND_END); + if(!OneacGetResponse (buffer, sizeof(buffer), + GETX_RSTRT_RESP_SIZE)) + { + EliminateLeadingZeroes (buffer, 4, buffer2, + sizeof(buffer2)); + dstate_setinfo("ups.delay.start", "%s", buffer2); + } + + /* Buzzer state */ + ser_send (upsfd,"%s%s",GETX_BUZZER_WHAT,COMMAND_END); + if(!OneacGetResponse (buffer, sizeof(buffer), 1)) + { + switch (buffer[0]) + { + case BUZZER_ENABLED : + dstate_setinfo("ups.beeper.status", "enabled"); + break; + case BUZZER_DISABLED : + dstate_setinfo("ups.beeper.status", "disabled"); + break; + case BUZZER_MUTED : + dstate_setinfo("ups.beeper.status", "muted"); + break; + default : + dstate_setinfo("ups.beeper.status", "enabled"); + } + } + + /* Auto start setting */ + ser_send (upsfd,"%s%s",GETX_AUTO_START,COMMAND_END); + if(!OneacGetResponse (buffer, sizeof(buffer), 1)) + { + if (buffer[0] == '0') + dstate_setinfo("ups.start.auto", "yes"); + else + dstate_setinfo("ups.start.auto", "no"); + } + + /* Low Batt at time */ + ser_send (upsfd,"%c%s",GETX_LOW_BATT_TIME,COMMAND_END); + if(!OneacGetResponse (buffer, sizeof(buffer), 2)) + { + strncpy(buffer2, buffer, 2); + buffer2[2]='\0'; + timevalue = atoi(buffer2) * 60; /* Mins to secs */ + dstate_setinfo("battery.runtime.low", "%d",timevalue); + } + + /* Shutdown timer */ + ser_send (upsfd,"%c%s",GETX_SHUTDOWN,COMMAND_END); + if(!OneacGetResponse (buffer, sizeof(buffer), + GETX_SHUTDOWN_RESP_SIZE)) + { + /* ON would have handled NO_VALUE_YET and setting FSD + * above so only deal with counter value here. + */ + if (buffer[0] != NO_VALUE_YET) + { + EliminateLeadingZeroes (buffer, 5, buffer2, + sizeof(buffer2)); + dstate_setinfo("ups.timer.shutdown", "%s", buffer2); + } + } + + /* Restart timer */ + ser_send (upsfd,"%s%s",GETX_RESTART_COUNT,COMMAND_END); + if(!OneacGetResponse (buffer, sizeof(buffer), + GETX_RSTRT_RESP_SIZE)) + { + if (atoi(buffer) == 0) + { + dstate_delinfo("ups.timer.start"); + } + else + { + EliminateLeadingZeroes (buffer, 4, buffer2, + sizeof(buffer2)); + dstate_setinfo("ups.timer.start", "%s", buffer2); + } + } + } + } + + alarm_commit(); status_commit(); - dstate_dataok(); - ser_comm_good(); + + /* If the comm retry counter is zero then datastale has been set. + * We don't want to set dataok or ser_comm_good if that is the case. + */ + + if (CommTry != 0) + { + dstate_dataok(); + ser_comm_good(); + } } } + void upsdrv_shutdown(void) { ser_send(upsfd,"%s",SHUTDOWN); } - void upsdrv_help(void) { printf("\n---------\nNOTE:\n"); - printf("You must set the UPS interface card DIP switch to 9600BPS\n"); -} - -void upsdrv_makevartable(void) -{ - addvar(VAR_VALUE,"testtime", - "Change battery test time from 2 minute default."); -} - -void upsdrv_initups(void) -{ - upsfd = ser_open(device_path); - ser_set_speed(upsfd, device_path, B9600); - -/*get the UPS in the right frame of mind*/ - - ser_send(upsfd,"%s", COMMAND_END); - sleep (1); - ser_send(upsfd,"%s", COMMAND_END); - sleep (1); + printf("You must set the UPS interface card DIP switch to 9600 BPS\n"); } void upsdrv_cleanup(void) { ser_close(upsfd, device_path); } + +void upsdrv_makevartable(void) +{ + addvar(VAR_VALUE,"testtime", + "Change battery test time from the 2 minute default."); + + addvar(VAR_VALUE,"offdelay", + "Change shutdown delay time from 0 second default."); +} + +int instcmd(const char *cmdname, const char *extra) +{ + int i; + + upsdebugx(2, "In instcmd with %s and extra %s.", cmdname, extra); + + if (!strcasecmp(cmdname, "test.failure.start")) { + ser_send(upsfd,"%s%s",SIM_PWR_FAIL,COMMAND_END); + return STAT_INSTCMD_HANDLED; + } + + if (!strcasecmp(cmdname, "shutdown.return")) { + + i = atoi(dstate_getinfo("ups.delay.shutdown")); + + if ((strncmp (UpsFamily, FAMILY_OZ, FAMILY_SIZE) == 0) || + (strncmp (UpsFamily, FAMILY_OB, FAMILY_SIZE) == 0)) + { + upsdebugx(3, "Shutdown using %c%d...", DELAYED_SHUTDOWN_PREFIX, i); + ser_send(upsfd,"%c%d%s",DELAYED_SHUTDOWN_PREFIX, i, COMMAND_END); + } + else + { + upsdebugx(3, "Shutdown using %c%03d...",DELAYED_SHUTDOWN_PREFIX, i); + ser_send(upsfd,"%c%03d%s",DELAYED_SHUTDOWN_PREFIX, i, COMMAND_END); + } + + return STAT_INSTCMD_HANDLED; + } + + if(!strcasecmp(cmdname, "shutdown.reboot")) { + ser_send(upsfd, "%s", SHUTDOWN); + return STAT_INSTCMD_HANDLED; + } + + if (!strcasecmp(cmdname, "shutdown.stop")) { + ser_send(upsfd,"%c%s",DELAYED_SHUTDOWN_PREFIX,COMMAND_END); + return STAT_INSTCMD_HANDLED; + } + + if (!strcasecmp(cmdname, "test.battery.start.quick")) { + do_battery_test(); + return STAT_INSTCMD_HANDLED; + } + + if (!strcasecmp(cmdname, "test.battery.start.deep")) { + ser_send(upsfd, "%s%s", TEST_BATT_DEEP, COMMAND_END); + return STAT_INSTCMD_HANDLED; + } + + if (!strcasecmp(cmdname, "test.battery.stop")) + { + if ((strncmp (UpsFamily, FAMILY_EG, FAMILY_SIZE) == 0) || + (strncmp (UpsFamily, FAMILY_ON, FAMILY_SIZE) == 0)) + { + ser_send(upsfd,"%s00%s",BAT_TEST_PREFIX,COMMAND_END); + } + else + { + ser_send(upsfd,"%c%s",TEST_ABORT,COMMAND_END); + } + return STAT_INSTCMD_HANDLED; + } + + if (!strcasecmp(cmdname, "reset.input.minmax")) { + ser_send(upsfd,"%c%s",RESET_MIN_MAX, COMMAND_END); + return STAT_INSTCMD_HANDLED; + } + + if (!strcasecmp(cmdname, "beeper.enable")) { + ser_send(upsfd,"%c%c%s",SETX_BUZZER_PREFIX, BUZZER_ENABLED,COMMAND_END); + return STAT_INSTCMD_HANDLED; + } + + if (!strcasecmp(cmdname, "beeper.disable")) { + ser_send(upsfd,"%c%c%s",SETX_BUZZER_PREFIX,BUZZER_DISABLED,COMMAND_END); + return STAT_INSTCMD_HANDLED; + } + + if (!strcasecmp(cmdname, "beeper.mute")) { + ser_send(upsfd,"%c%c%s",SETX_BUZZER_PREFIX, BUZZER_MUTED, COMMAND_END); + return STAT_INSTCMD_HANDLED; + } + + if (!strcasecmp(cmdname, "test.panel.start")) { + ser_send(upsfd,"%s%s",TEST_INDICATORS, COMMAND_END); + return STAT_INSTCMD_HANDLED; + } + + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); + return STAT_INSTCMD_UNKNOWN; +} + + +int setcmd(const char* varname, const char* setvalue) +{ + upsdebugx(2, "In setcmd for %s with %s...", varname, setvalue); + + if (!strcasecmp(varname, "ups.delay.shutdown")) + { + if ((strncmp (UpsFamily, FAMILY_OZ, FAMILY_SIZE) == 0) || + (strncmp (UpsFamily, FAMILY_OB, FAMILY_SIZE) == 0)) + { + if (atoi(setvalue) > 65535) + { + upsdebugx(2, "Too big for OZ/OB (>65535)...(%s)", setvalue); + return STAT_SET_UNKNOWN; + } + } + else + { + if (atoi(setvalue) > 999) + { + upsdebugx(2, "Too big for EG/ON (>999)...(%s)", setvalue); + return STAT_SET_UNKNOWN; + } + } + + dstate_setinfo("ups.delay.shutdown", "%s", setvalue); + return STAT_SET_HANDLED; + } + + if (!strcasecmp(varname, "input.transfer.low")) + { + if (SetOutputAllow(setvalue, dstate_getinfo("input.transfer.high"))) + { + return STAT_SET_UNKNOWN; + } + else + { + dstate_setinfo("input.transfer.low" , "%s", setvalue); + return STAT_SET_HANDLED; + } + } + + if (!strcasecmp(varname, "input.transfer.high")) + { + if (SetOutputAllow(dstate_getinfo("input.transfer.low"), setvalue)) + { + return STAT_SET_UNKNOWN; + } + else + { + dstate_setinfo("input.transfer.high" , "%s", setvalue); + return STAT_SET_HANDLED; + } + } + + if (!strcasecmp(varname, "battery.date")) + { + if(strlen(setvalue) == GETX_DATE_RESP_SIZE) /* yymmdd (6 chars) */ + { + ser_send(upsfd, "%s%s%s", SETX_BATTERY_DATE, setvalue, COMMAND_END); + dstate_setinfo("battery.date", "%s (yymmdd)", setvalue); + return STAT_SET_HANDLED; + } + else + { + return STAT_SET_UNKNOWN; + } + } + + if (!strcasecmp(varname, "ups.delay.start")) + { + if (atoi(setvalue) <= 9999) + { + ser_send(upsfd,"%s%s%s",SETX_RESTART_DELAY, setvalue, COMMAND_END); + + dstate_setinfo("ups.delay.start", "%s", setvalue); + return STAT_SET_HANDLED; + } + else + { + return STAT_SET_UNKNOWN; + } + } + + if (!strcasecmp(varname, "battery.runtime.low")) + { + if (atoi(setvalue) <= 99) + { + ser_send(upsfd,"%s%s%s",SETX_LOWBATT_AT, setvalue, COMMAND_END); + + dstate_setinfo("battery.runtime.low", "%s", setvalue); + return STAT_SET_HANDLED; + } + else + { + return STAT_SET_UNKNOWN; + } + } + + if (!strcasecmp(varname, "ups.start.auto")) + { + if (!strcasecmp(setvalue, "yes")) + { + ser_send(upsfd,"%c0%s",SETX_AUTO_START, COMMAND_END); + dstate_setinfo("ups.start.auto", "yes"); + return STAT_SET_HANDLED; + } + else if (!strcasecmp(setvalue, "no")) + { + ser_send(upsfd,"%c1%s",SETX_AUTO_START, COMMAND_END); + dstate_setinfo("ups.start.auto", "no"); + return STAT_SET_HANDLED; + } + + return STAT_SET_UNKNOWN; + } + + upslogx(LOG_NOTICE, "setcmd: unknown command [%s]", varname); + + return STAT_SET_UNKNOWN; +} diff --git a/drivers/oneac.h b/drivers/oneac.h index c90d74b..9f1bae8 100644 --- a/drivers/oneac.h +++ b/drivers/oneac.h @@ -1,19 +1,25 @@ -/* -Copyright (C) 2002 Eric Lawson - - 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 +/* oneac.h - Driver for Oneac UPS using the Advanced Interface. + * + * Copyright (C) + * 2003 by Eric Lawson + * 2012 by Bill Elliot + * + * This program was sponsored by MGE UPS SYSTEMS, and now Eaton + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * */ /*misc stuff*/ @@ -22,22 +28,27 @@ Copyright (C) 2002 Eric Lawson #define COMMAND_END "\r\n" #define DEFAULT_BAT_TEST_TIME "02" -/*Information requests*/ +/*Information requests -- EG level */ -#define GET_ALL '%' -#define GET_ALL_EXT_2 '^' -#define GET_ALL_EXT_1 '&' -#define GET_MFR 'M' -#define GET_FAMILY 'F' -#define GET_VERSION 'N' -#define GET_ON_INVERTER 'G' -#define GET_BATLOW 'K' -#define GET_STATUS 'X' -#define GET_LAST_XFER 'W' +#define GET_ALL '%' +#define GETALL_EG_RESP_SIZE 22 +#define GETALL_RESP_SIZE 48 + +#define GET_MFR 'M' +#define GET_FAMILY 'F' +#define GET_VERSION 'N' +#define GET_ON_INVERTER 'G' +#define GET_BATLOW 'K' +#define GET_STATUS 'X' +#define GET_LAST_XFER 'W' #define GET_INVERTER_RDY 'I' -#define GET_TEST_TIME 'Q' -#define GET_NOM_FREQ 'H' -#define GET_NOM_VOLTAGE 'V' +#define GET_SHUTDOWN 'O' +#define GET_TEST_TIME 'Q' +#define GET_NOM_FREQ 'H' + +/*Information requests -- ON level (EG plus these) */ + +#define GET_NOM_VOLTAGE 'V' #define GET_DISPLAY_CODE 'D' #define GET_CONDITION_CODE 'C' #define GET_PERCENT_LOAD 'P' @@ -45,48 +56,124 @@ Copyright (C) 2002 Eric Lawson #define GET_INPUT_LINE_VOLT 'L' #define GET_MIN_INPUT_VOLT 'A' #define GET_MAX_INPUT_VOLT 'E' -#define GET_OUTPUT_VOLT 'S' -#define GET_BOOSTING 'B' +#define GET_OUTPUT_VOLT 'S' +#define GET_BOOSTING 'B' -/*Control functions*/ -#define SIM_PWR_FAIL "\x02\x15" /*^B^U 15 second battery test*/ -#define SHUTDOWN "\x0f\x06" /*^O^F (a letter O)*/ +#define GET_SHUTDOWN_RESP_SIZE 3 + +/*Information requests -- OZ/OB level (ON plus these) */ + +#define GETX_ALL_1 '&' +#define GETX_ALL1_RESP_SIZE 79 + +#define GETX_OUTSOURCE 'a' +#define GETX_FRONTDISP 'b' +#define GETX_INT_TEMP 'g' /* Degrees C */ +#define GETX_BATT_STAT 'h' /* Unknown(1), Normal, Low, Depleted */ +#define GETX_BATT_CHG_PERC 'i' /* 0 - 100 */ +#define GETX_EST_MIN_REM 'j' +#define GETX_ONBATT_TIME 'k' /* In seconds */ +#define GETX_BATT_VOLTS 'l' /* Read as xxx.x */ +#define GETX_INP_FREQ 'p' +#define GETX_MIN_IN_VOLTS 'q' +#define GETX_MAX_IN_VOLTS 'r' +#define GETX_IN_VOLTS 's' +#define GETX_IN_WATTS 'u' +#define GETX_OUT_VOLTS 'v' +#define GETX_OUT_WATTS 'x' +#define GETX_OUT_LOAD_PERC 'y' +#define GETX_OUT_FREQ 'z' + +#define GETX_ALL_2 '^' +#define GETX_ALL2_RESP_SIZE 92 + +#define GETX_MODEL 'J' +#define GETX_FW_REV 'U' /* Read as xx.x */ +#define GETX_SERIAL_NUM 'Y' + +#define GETX_MAN_DATE '$' /* yymmdd */ +#define GETX_BATT_REPLACED '+' /* yymmdd */ +#define GETX_DATE_RESP_SIZE 6 + +#define GETX_UNIT_KVA '''' /* Read as xxx.xx */ +#define GETX_UNIT_WATTS "''" /* 2-character string request */ +#define GETX_LOW_OUT_ALLOW '[' /* Tap up or inverter at this point */ +#define GETX_HI_OUT_ALLOW ']' /* Tap down or inverter at this point */ +#define GETX_NOTIFY_DELAY ',' /* Secs of delay for power fail alert */ +#define GETX_ALLOW_RESP_SIZE 3 + +#define GETX_LOW_BATT_TIME '"' /* Low batt alarm at xx minutes */ + +#define GETX_RESTART_DLY '_' /* Restart delay */ +#define GETX_RESTART_COUNT "_?" /* Returns actual counter value */ +#define GETX_RSTRT_RESP_SIZE 4 + +/*Other requests */ +#define GETX_SHUTDOWN '}' /* Shutdown counter (..... for none) */ +#define GETX_SHUTDOWN_RESP_SIZE 5 + +#define GETX_BATT_TEST_DAYS "\x02\x1A" /* Days between battery tests */ +#define GETX_BUZZER_WHAT "\x07?" /* What is buzzer state */ +#define GETX_AUTO_START " 999 on OZ */ +#define MIN_ALLOW_FW "1.9" /* At or above provides output allow range */ /*responses*/ -#define MFGR "ONEAC" -#define FAMILY_ON "ON" -#define FAMILY_ON_EXT "OZ" -#define FAMILY_EG "EG" -#define YES 'Y' -#define NO 'N' -#define NORMAL '@' -#define ON_BAT_LOW_LINE 'A' -#define ON_BAT_HI_LINE 'Q' -#define LO_BAT_LOW_LINE 'C' -#define LO_BAT_HI_LINE 'S' -#define TOO_HOT '`' -#define FIX_ME 'D' -#define BAD_BAT 'H' -#define V230AC '2' -#define V120AC '1' -#define XFER_BLACKOUT 'B' -#define XFER_LOW_VOLT 'L' -#define XFER_HI_VOLT 'H' +#define FAMILY_EG "EG" /* 3 tri-color LEDs and big ON/OFF on front */ +#define FAMILY_ON "ON" /* Serial port avail only on interface card */ +#define FAMILY_OZ "OZ" /* DB-25 std., plus interface slot */ +#define FAMILY_OB "OB" /* Lg. cab with removable modules */ +#define FAMILY_SIZE 2 +#define YES 'Y' +#define NO 'N' +#define V230AC '2' +#define V120AC '1' +#define XFER_BLACKOUT 'B' +#define XFER_LOW_VOLT 'L' +#define XFER_HI_VOLT 'H' +#define BUZZER_ENABLED '1' +#define BUZZER_DISABLED '0' +#define BUZZER_MUTED '2' /*front panel alarm codes*/ -#define CODE_BREAKER_OPEN "c1" /*input circuit breaker open*/ -#define CODE_BAT_FUSE_OPEN "c2" /*battery not connected. Open fuse?*/ -#define CODE_TOO_HOT "c3" /*UPS too hot*/ -#define CODE_CHARGING "c4" /*recharging battery pack*/ -#define CODE_LOW_BAT_CAP "c5" /*batteries getting too old*/ -#define CODE_OVERLOAD "c8" /*"slight" overload*/ -#define CODE_GROSS_OVLE "c9" /*gross overload 1 minute to power off*/ +#define CODE_BREAKER_OPEN "c1" /*input circuit breaker open*/ +#define CODE_BAT_FUSE_OPEN "c2" /*battery not connected. Open fuse?*/ +#define CODE_TOO_HOT "c3" /*UPS too hot*/ +#define CODE_CHARGING "c4" /*recharging battery pack*/ +#define CODE_LOW_BAT_CAP "c5" /*batteries getting too old*/ +#define CODE_OVERLOAD "c8" /*"slight" overload*/ +#define CODE_GROSS_OVLE "c9" /*gross overload 1 minute to power off*/ #define CODE_CHRGR_FUSE_OPEN "u1" /*battery charger fuse probably open*/ diff --git a/drivers/rhino.c b/drivers/rhino.c index 707432b..c43c411 100644 --- a/drivers/rhino.c +++ b/drivers/rhino.c @@ -540,13 +540,12 @@ static void getbaseinfo(void) unsigned char temp[256]; unsigned char Pacote[37]; int tam, i, j=0; - time_t *tmt; + time_t tmt; struct tm *now; const char *Model; - tmt = ( time_t * ) malloc( sizeof( time_t ) ); - time( tmt ); - now = localtime( tmt ); + time( &tmt ); + now = localtime( &tmt ); dian = now->tm_mday; mesn = now->tm_mon+1; anon = now->tm_year+1900; diff --git a/drivers/snmp-ups.c b/drivers/snmp-ups.c index 8e17c06..36fdfb8 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 - 2011 Arnaud Quette + * 2002 - 2012 Arnaud Quette * 2002 - 2006 Dmitry Frolov * J.W. Hoogervorst * Niels Baggesen @@ -47,6 +47,11 @@ #include "cyberpower-mib.h" #include "ietf-mib.h" +/* Address API change */ +#ifndef usmAESPrivProtocol +#define usmAESPrivProtocol usmAES128PrivProtocol +#endif + static mib2nut_info_t *mib2nut[] = { &apc, &mge, @@ -70,6 +75,10 @@ static mib2nut_info_t *mib2nut[] = { NULL }; +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, bypass_phases; /* pointer to the Snmp2Nut lookup table */ @@ -82,7 +91,7 @@ const char *mibvers; static void disable_transfer_oids(void); #define DRIVER_NAME "Generic SNMP UPS driver" -#define DRIVER_VERSION "0.58" +#define DRIVER_VERSION "0.66" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -122,13 +131,18 @@ void upsdrv_initinfo(void) dstate_setinfo("driver.version.internal", "%s", version); /* add instant commands to the info database. - * outlet commands are processed during initial walk */ + * outlet commands are processed later, during initial walk */ for (su_info_p = &snmp_info[0]; su_info_p->info_type != NULL ; su_info_p++) { su_info_p->flags |= SU_FLAG_OK; if ((SU_TYPE(su_info_p) == SU_TYPE_CMD) - && !(su_info_p->flags & SU_OUTLET)) - dstate_addcmd(su_info_p->info_type); + && !(su_info_p->flags & SU_OUTLET)) { + /* first check that this OID actually exists */ + if (nut_snmp_get(su_info_p->OID) != NULL) { + dstate_addcmd(su_info_p->info_type); + upsdebugx(1, "upsdrv_initinfo(): adding command '%s'", su_info_p->info_type); + } + } } if (testvar("notransferoids")) @@ -150,7 +164,7 @@ void upsdrv_updateinfo(void) upsdebugx(1,"SNMP UPS driver : entering upsdrv_updateinfo()"); /* only update every pollfreq */ - /* FIXME: update status (SU_STATUS_*), à la usbhid-ups, in between */ + /* FIXME: only update status (SU_STATUS_*), à la usbhid-ups, in between */ if (time(NULL) > (lastpoll + pollfreq)) { status_init(); @@ -178,7 +192,28 @@ void upsdrv_shutdown(void) never send this command to the UPS. This is not an error, but a limitation of the interface used. */ - fatalx(EXIT_SUCCESS, "SNMP doesn't support shutdown in system halt script"); + + upsdebugx(1, "upsdrv_shutdown..."); + + /* Try to shutdown with delay */ + if (su_instcmd("shutdown.return", NULL) == STAT_INSTCMD_HANDLED) { + /* Shutdown successful */ + return; + } + + /* If the above doesn't work, try shutdown.reboot */ + if (su_instcmd("shutdown.reboot", NULL) == STAT_INSTCMD_HANDLED) { + /* Shutdown successful */ + return; + } + + /* If the above doesn't work, try load.off.delay */ + if (su_instcmd("load.off.delay", NULL) == STAT_INSTCMD_HANDLED) { + /* Shutdown successful */ + return; + } + + fatalx(EXIT_FAILURE, "Shutdown failed!"); } void upsdrv_help(void) @@ -251,6 +286,22 @@ void upsdrv_initups(void) else fatalx(EXIT_FAILURE, "%s MIB wasn't found on %s", mibs, g_snmp_sess.peername); /* FIXME: "No supported device detected" */ + + if (su_find_info("load.off.delay")) { + /* Adds default with a delay value of '0' (= immediate) */ + dstate_addcmd("load.off"); + } + + if (su_find_info("load.on.delay")) { + /* Adds default with a delay value of '0' (= immediate) */ + dstate_addcmd("load.on"); + } + + if (su_find_info("load.off.delay") && su_find_info("load.on.delay")) { + /* Add composite instcmds (require setting multiple OID values) */ + dstate_addcmd("shutdown.return"); + dstate_addcmd("shutdown.stayoff"); + } } void upsdrv_cleanup(void) @@ -811,8 +862,9 @@ mib2nut_info_t *match_sysoid() } } /* Yell all to call for user report */ - upslogx(LOG_ERR, "No matching MIB found for sysOID '%s'! " \ - "Please report it to NUT developers, with the 'mib' paramater for your devices", + upslogx(LOG_ERR, "No matching MIB found for sysOID '%s'!\n" \ + "Please report it to NUT developers, with an 'upsc' output for your device.\n" \ + "Going back to the classic MIB detection method.", sysOID_buf); } else @@ -879,7 +931,7 @@ bool_t load_mib2nut(const char *mib) } /* find the OID value matching that INFO_* value */ -long su_find_valinfo(info_lkp_t *oid2info, char* value) +long su_find_valinfo(info_lkp_t *oid2info, const char* value) { info_lkp_t *info_lkp; @@ -1334,6 +1386,7 @@ int su_setvar(const char *varname, const char *val) snmp_info_t *su_info_p = NULL; bool_t status; int retval = STAT_SET_FAILED; + int value = -1; upsdebugx(2, "entering su_setvar(%s, %s)", varname, val); @@ -1410,7 +1463,15 @@ int su_setvar(const char *varname, const char *val) if (su_info_p->info_flags & ST_FLAG_STRING) { status = nut_snmp_set_str(su_info_p->OID, val); } else { - status = nut_snmp_set_int(su_info_p->OID, strtol(val, NULL, 0)); + /* non string data may imply a value lookup */ + if (su_info_p->oid2info) { + value = su_find_valinfo(su_info_p->oid2info, val); + } + else { + value = strtol(val, NULL, 0); + } + /* Actually apply the new value */ + status = nut_snmp_set_int(su_info_p->OID, value); } if (status == FALSE) @@ -1486,7 +1547,50 @@ int su_instcmd(const char *cmdname, const char *extradata) } } + /* Sanity check */ if (!su_info_p || !su_info_p->info_type || !(su_info_p->flags & SU_FLAG_OK)) { + + /* Check for composite commands */ + if (!strcasecmp(cmdname, "load.on")) { + return su_instcmd("load.on.delay", "0"); + } + + if (!strcasecmp(cmdname, "load.off")) { + return su_instcmd("load.off.delay", "0"); + } + + if (!strcasecmp(cmdname, "shutdown.return")) { + int ret; + + /* Ensure "ups.start.auto" is set to "yes", if supported */ + if (dstate_getinfo("ups.start.auto")) { + su_setvar("ups.start.auto", "yes"); + } + + ret = su_instcmd("load.on.delay", dstate_getinfo("ups.delay.start")); + if (ret != STAT_INSTCMD_HANDLED) { + return ret; + } + + return su_instcmd("load.off.delay", dstate_getinfo("ups.delay.shutdown")); + } + + if (!strcasecmp(cmdname, "shutdown.stayoff")) { + int ret; + + /* Ensure "ups.start.auto" is set to "no", if supported */ + if (dstate_getinfo("ups.start.auto")) { + su_setvar("ups.start.auto", "no"); + } + + ret = su_instcmd("load.on.delay", "-1"); + if (ret != STAT_INSTCMD_HANDLED) { + return ret; + } + + return su_instcmd("load.off.delay", dstate_getinfo("ups.delay.shutdown")); + } + upsdebugx(2, "su_instcmd: %s unavailable", cmdname); if (!strncmp(cmdname, "outlet", 6)) @@ -1495,7 +1599,7 @@ int su_instcmd(const char *cmdname, const char *extradata) return STAT_INSTCMD_UNKNOWN; } - /* set value. */ + /* set value, using the provided one, or the default one otherwise */ if (su_info_p->info_flags & ST_FLAG_STRING) { status = nut_snmp_set_str(su_info_p->OID, extradata ? extradata : su_info_p->dfl); } else { @@ -1515,54 +1619,6 @@ int su_instcmd(const char *cmdname, const char *extradata) return retval; } -/* TODO: complete rewrite */ -void su_shutdown_ups(void) -{ - int sdtype = 0; - long pwr_status; - - if (nut_snmp_get_int(OID_pwr_status, &pwr_status) == FALSE) - fatalx(EXIT_FAILURE, "cannot determine UPS status"); - - if (testvar(SU_VAR_SDTYPE)) - sdtype = atoi(getval(SU_VAR_SDTYPE)); - - /* logic from newapc.c */ - switch (sdtype) { - case 3: /* shutdown with grace period */ - upslogx(LOG_INFO, "sending delayed power off command to UPS"); - su_instcmd("shutdown.stayoff", "0"); - break; - case 2: /* instant shutdown */ - upslogx(LOG_INFO, "sending power off command to UPS"); - su_instcmd("load.off", "0"); - break; - case 1: - /* Send a combined set of shutdown commands which can work better */ - /* if the UPS gets power during shutdown process */ - /* Specifically it sends both the soft shutdown 'S' */ - /* and the powerdown after grace period - '@000' commands */ -/* upslogx(LOG_INFO, "UPS - sending shutdown/powerdown"); - if (pwr_status == g_pwr_battery) - su_ups_instcmd(CMD_SOFTDOWN, 0, 0); - su_ups_instcmd(CMD_SDRET, 0, 0); - break; -*/ - default: - /* if on battery... */ -/* if (pwr_status == su_find_valinfo(info_lkp_t *oid2info, "OB")) { - upslogx(LOG_INFO, - "UPS is on battery, sending shutdown command..."); - su_ups_instcmd(CMD_SOFTDOWN, 0, 0); - } else { - upslogx(LOG_INFO, "UPS is online, sending shutdown+return command..."); - su_ups_instcmd(CMD_SDRET, 0, 0); - } -*/ - break; - } -} - /* FIXME: the below functions can be removed since these were for loading * the mib2nut information from a file instead of the .h definitions... */ /* return 1 if usable, 0 if not */ diff --git a/drivers/snmp-ups.h b/drivers/snmp-ups.h index d130428..72f93ce 100644 --- a/drivers/snmp-ups.h +++ b/drivers/snmp-ups.h @@ -78,7 +78,7 @@ for each OID request we made), instead of sending many small packets /* Force numeric OIDs by disabling MIB loading */ #define DISABLE_MIB_LOADING 1 - +/* Parameters default values */ #define DEFAULT_POLLFREQ 30 /* in seconds */ /* use explicit booleans */ @@ -171,7 +171,6 @@ typedef struct { #define SU_VAR_VERSION "snmp_version" #define SU_VAR_MIBS "mibs" #define SU_VAR_POLLFREQ "pollfreq" -#define SU_VAR_SDTYPE "sdtype" /* SNMP v3 related parameters */ #define SU_VAR_SECLEVEL "secLevel" #define SU_VAR_SECNAME "secName" @@ -234,7 +233,7 @@ bool_t su_ups_get(snmp_info_t *su_info_p); bool_t load_mib2nut(const char *mib); const char *su_find_infoval(info_lkp_t *oid2info, long value); -long su_find_valinfo(info_lkp_t *oid2info, char* value); +long su_find_valinfo(info_lkp_t *oid2info, const char* value); int su_setvar(const char *varname, const char *val); int su_instcmd(const char *cmdname, const char *extradata); @@ -242,10 +241,10 @@ void su_shutdown_ups(void); void read_mibconf(char *mib); -struct snmp_session g_snmp_sess, *g_snmp_sess_p; -const char *OID_pwr_status; -int g_pwr_battery; -int pollfreq; /* polling frequency */ +extern struct snmp_session g_snmp_sess, *g_snmp_sess_p; +extern const char *OID_pwr_status; +extern int g_pwr_battery; +extern int pollfreq; /* polling frequency */ extern int input_phases, output_phases, bypass_phases; #endif /* SNMP_UPS_H */ diff --git a/drivers/solis.c b/drivers/solis.c index 4cc2c88..78e83e0 100644 --- a/drivers/solis.c +++ b/drivers/solis.c @@ -792,11 +792,10 @@ static void getbaseinfo(void) unsigned char Pacote[25]; int i, i1=0, i2=0, j=0, tam, tpac=25; - time_t *tmt; + time_t tmt; struct tm *now; - tmt = ( time_t * ) malloc( sizeof( time_t ) ); - time( tmt ); - now = localtime( tmt ); + time( &tmt ); + now = localtime( &tmt ); dian = now->tm_mday; mesn = now->tm_mon+1; anon = now->tm_year+1900; @@ -956,11 +955,10 @@ static void getupdateinfo(void) int tam, isday, hourn, minn; /* time update and programable shutdown block */ - time_t *tmt; + time_t tmt; struct tm *now; - tmt = ( time_t * ) malloc( sizeof( time_t ) ); - time( tmt ); - now = localtime( tmt ); + time( &tmt ); + now = localtime( &tmt ); hourn = now->tm_hour; minn = now->tm_min; weekn = now->tm_wday; diff --git a/drivers/tripplite-hid.c b/drivers/tripplite-hid.c index 5fc88cd..5069164 100644 --- a/drivers/tripplite-hid.c +++ b/drivers/tripplite-hid.c @@ -1,7 +1,7 @@ /* tripplite-hid.c - data to monitor Tripp Lite USB/HID devices with NUT * * Copyright (C) - * 2003 - 2005 Arnaud Quette + * 2003 - 2012 Arnaud Quette * 2005 - 2006 Peter Selinger * 2008 - 2009 Arjen de Korte * @@ -29,7 +29,7 @@ #include "tripplite-hid.h" #include "usb-common.h" -#define TRIPPLITE_HID_VERSION "TrippLite HID 0.6" +#define TRIPPLITE_HID_VERSION "TrippLite HID 0.8" /* FIXME: experimental flag to be put in upsdrv_info */ @@ -109,6 +109,16 @@ static usb_device_id_t tripplite_usb_device_table[] = { { USB_DEVICE(TRIPPLITE_VENDORID, 0x4007), battery_scale_1dot0 }, { USB_DEVICE(TRIPPLITE_VENDORID, 0x4008), battery_scale_1dot0 }, + /* e.g. ? */ + { USB_DEVICE(HP_VENDORID, 0x0001), battery_scale_1dot0 }, + /* HP R1500 G2 and G3 INTL */ + { USB_DEVICE(HP_VENDORID, 0x1fe0), battery_scale_1dot0 }, + /* HP T750 G2 */ + { USB_DEVICE(HP_VENDORID, 0x1fe1), battery_scale_1dot0 }, + /* e.g. ? */ + { USB_DEVICE(HP_VENDORID, 0x1fe2), battery_scale_1dot0 }, + /* HP T1500 G3 */ + { USB_DEVICE(HP_VENDORID, 0x1fe3), battery_scale_1dot0 }, /* HP T750 INTL */ { USB_DEVICE(HP_VENDORID, 0x1f06), battery_scale_1dot0 }, /* HP T1000 INTL */ @@ -117,10 +127,6 @@ static usb_device_id_t tripplite_usb_device_table[] = { { 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 } @@ -174,19 +180,41 @@ static info_lkp_t tripplite_battvolt[] = { /* TRIPPLITE usage table */ static usage_lkp_t tripplite_usage_lkp[] = { /* currently unknown: - ffff0010, 00ff0001, ffff007d, ffff00c0, ffff00c1, ffff00c2, + 00ff0001, ffff007d, ffff00c0, ffff00c1, ffff00c2, ffff00c3, ffff00c4, ffff00c5, ffff00d2, ffff0091, ffff00c7 */ + { "TLCustom", 0xffff0010 }, + { "TLDelayBeforeStartup", 0xffff0056 }, /* in minutes */ { "TLLowVoltageTransferMax", 0xffff0057 }, { "TLLowVoltageTransferMin", 0xffff0058 }, { "TLHighVoltageTransferMax", 0xffff0059 }, { "TLHighVoltageTransferMin", 0xffff005a }, + /* Outlet state: + * 1- On/Closed + * 2- Off/Open + * 3- On with pending off + * 4- Off with pending on + * 5- Unknown + * 6- Resolved/Unknown + * 7- Failed and Closed + * 8- Failed and Open */ + { "OutletState", 0xffff007a }, + { "OutletCount", 0xffff007b }, /* Number of load segments */ + { "UPSFirmwareVersion", 0xffff007c }, + { "CommunicationProtocolVersion", 0xffff007d }, /* HID protocol version */ + { "CommunicationVersion", 0xffff007e }, /* USB firmware version */ + { "iUPSPartNumber", 0xffff007f }, /* String index to Part Number */ + { "AutoOnDelay", 0xffff0080 }, /* '0' (no delay) to 'n' (delay in seconds) */ { "TLWatchdog", 0xffff0092 }, + { "TLOutletsAvailableMask", 0xffff0095 }, + { "TLOutletsStatusMask", 0xffff0096 }, /* it looks like Tripp Lite confused pages 0x84 and 0x85 for the following 4 items, on some OMNI1000LCD devices. */ { "TLCharging", 0x00840044 }, /* conflicts with HID spec! */ - { "TLDischarging", 0x00840045 }, /* conflicts with HID spec! */ + /* conflicts with HID spec (and HP implementation) for TrippLite! + * Refer to tripplite_discharging_info */ + { "TLDischarging", 0x00840045 }, { "TLNeedReplacement", 0x0084004b }, { "TLACPresent", 0x008400d0 }, { NULL, 0 } @@ -209,19 +237,19 @@ static hid_info_t tripplite_hid2nut[] = { /* unmapped variables - meaning unknown */ { "UPS.Flow.0xffff0097", 0, 0, "UPS.Flow.0xffff0097", NULL, "%.0f", 0, NULL }, - { "UPS.0xffff0010.[1].0xffff0075", 0, 0, "UPS.0xffff0010.[1].0xffff0075", NULL, "%.0f", 0, NULL }, - { "UPS.0xffff0010.[1].0xffff0076", 0, 0, "UPS.0xffff0010.[1].0xffff0076", NULL, "%.0f", 0, NULL }, - { "UPS.0xffff0010.[1].0xffff007c", 0, 0, "UPS.0xffff0010.[1].0xffff007c", NULL, "%.0f", 0, NULL }, - { "UPS.0xffff0010.[1].0xffff007d", 0, 0, "UPS.0xffff0010.[1].0xffff007d", NULL, "%.0f", 0, NULL }, - { "UPS.0xffff0010.[1].0xffff00e0", 0, 0, "UPS.0xffff0010.[1].0xffff00e0", NULL, "%.0f", 0, NULL }, - { "UPS.0xffff0010.[1].0xffff00e1", 0, 0, "UPS.0xffff0010.[1].0xffff00e1", NULL, "%.0f", 0, NULL }, - { "UPS.0xffff0010.[1].0xffff00e2", 0, 0, "UPS.0xffff0010.[1].0xffff00e2", NULL, "%.0f", 0, NULL }, - { "UPS.0xffff0010.[1].0xffff00e3", 0, 0, "UPS.0xffff0010.[1].0xffff00e3", NULL, "%.0f", 0, NULL }, - { "UPS.0xffff0010.[1].0xffff00e4", 0, 0, "UPS.0xffff0010.[1].0xffff00e4", NULL, "%.0f", 0, NULL }, - { "UPS.0xffff0010.[1].0xffff00e5", 0, 0, "UPS.0xffff0010.[1].0xffff00e5", NULL, "%.0f", 0, NULL }, - { "UPS.0xffff0010.[1].0xffff00e6", 0, 0, "UPS.0xffff0010.[1].0xffff00e6", NULL, "%.0f", 0, NULL }, - { "UPS.0xffff0010.[1].0xffff00e7", 0, 0, "UPS.0xffff0010.[1].0xffff00e7", NULL, "%.0f", 0, NULL }, - { "UPS.0xffff0010.[1].0xffff00e8", 0, 0, "UPS.0xffff0010.[1].0xffff00e8", NULL, "%.0f", 0, NULL }, + { "UPS.TLCustom.[1].0xffff0075", 0, 0, "UPS.TLCustom.[1].0xffff0075", NULL, "%.0f", 0, NULL }, + { "UPS.TLCustom.[1].0xffff0076", 0, 0, "UPS.TLCustom.[1].0xffff0076", NULL, "%.0f", 0, NULL }, + { "UPS.TLCustom.[1].0xffff007c", 0, 0, "UPS.TLCustom.[1].0xffff007c", NULL, "%.0f", 0, NULL }, + { "UPS.TLCustom.[1].0xffff007d", 0, 0, "UPS.TLCustom.[1].0xffff007d", NULL, "%.0f", 0, NULL }, + { "UPS.TLCustom.[1].0xffff00e0", 0, 0, "UPS.TLCustom.[1].0xffff00e0", NULL, "%.0f", 0, NULL }, + { "UPS.TLCustom.[1].0xffff00e1", 0, 0, "UPS.TLCustom.[1].0xffff00e1", NULL, "%.0f", 0, NULL }, + { "UPS.TLCustom.[1].0xffff00e2", 0, 0, "UPS.TLCustom.[1].0xffff00e2", NULL, "%.0f", 0, NULL }, + { "UPS.TLCustom.[1].0xffff00e3", 0, 0, "UPS.TLCustom.[1].0xffff00e3", NULL, "%.0f", 0, NULL }, + { "UPS.TLCustom.[1].0xffff00e4", 0, 0, "UPS.TLCustom.[1].0xffff00e4", NULL, "%.0f", 0, NULL }, + { "UPS.TLCustom.[1].0xffff00e5", 0, 0, "UPS.TLCustom.[1].0xffff00e5", NULL, "%.0f", 0, NULL }, + { "UPS.TLCustom.[1].0xffff00e6", 0, 0, "UPS.TLCustom.[1].0xffff00e6", NULL, "%.0f", 0, NULL }, + { "UPS.TLCustom.[1].0xffff00e7", 0, 0, "UPS.TLCustom.[1].0xffff00e7", NULL, "%.0f", 0, NULL }, + { "UPS.TLCustom.[1].0xffff00e8", 0, 0, "UPS.TLCustom.[1].0xffff00e8", NULL, "%.0f", 0, NULL }, { "UPS.0xffff0015.[1].0xffff00c0", 0, 0, "UPS.0xffff0015.[1].0xffff00c0", NULL, "%.0f", 0, NULL }, { "UPS.0xffff0015.[1].0xffff00c1", 0, 0, "UPS.0xffff0015.[1].0xffff00c1", NULL, "%.0f", 0, NULL }, { "UPS.0xffff0015.[1].0xffff00c2", 0, 0, "UPS.0xffff0015.[1].0xffff00c2", NULL, "%.0f", 0, NULL }, @@ -231,7 +259,6 @@ static hid_info_t tripplite_hid2nut[] = { { "UPS.0xffff0015.[1].0xffff00d2", 0, 0, "UPS.0xffff0015.[1].0xffff00d2", NULL, "%.0f", 0, NULL }, { "UPS.0xffff0015.[1].0xffff00d3", 0, 0, "UPS.0xffff0015.[1].0xffff00d3", NULL, "%.0f", 0, NULL }, { "UPS.0xffff0015.[1].0xffff00d6", 0, 0, "UPS.0xffff0015.[1].0xffff00d6", NULL, "%.0f", 0, NULL }, - { "UPS.OutletSystem.Outlet.0xffff0056", 0, 0, "UPS.OutletSystem.Outlet.0xffff0056", NULL, "%.0f", 0, NULL }, { "UPS.OutletSystem.Outlet.0xffff0081", 0, 0, "UPS.OutletSystem.Outlet.0xffff0081", NULL, "%.0f", 0, NULL }, { "UPS.OutletSystem.Outlet.0xffff0091", 0, 0, "UPS.OutletSystem.Outlet.0xffff0091", NULL, "%.0f", 0, NULL }, { "UPS.OutletSystem.Outlet.0xffff0093", 0, 0, "UPS.OutletSystem.Outlet.0xffff0093", NULL, "%.0f", 0, NULL }, @@ -249,6 +276,9 @@ static hid_info_t tripplite_hid2nut[] = { #endif /* USBHID_UPS_TRIPPLITE_DEBUG */ + /* Device page */ + { "device.part", 0, 0, "UPS.TLCustom.[1].iUPSPartNumber", NULL, "%.0f", 0, stringid_conversion }, + /* Battery page */ { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, { "battery.charge", 0, 0, "UPS.BatterySystem.Battery.RemainingCapacity", NULL, "%.0f", 0, NULL }, @@ -262,8 +292,16 @@ static hid_info_t tripplite_hid2nut[] = { /* UPS page */ { "ups.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.OutletSystem.Outlet.DelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_FLAG_ABSENT, NULL}, + { "ups.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.OutletSystem.Outlet.TLDelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_FLAG_ABSENT, NULL}, + /* FIXME + { "ups.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 6, "UPS.TLCustom.[1].TLDelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_FLAG_ABSENT, NULL}, + { "ups.timer.start", 0, 0, "UPS.TLCustom.[1].DelayBeforeStartup", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, + - what's the right notion behind this one? + { "ups.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 6, "UPS.TLCustom.[1].AutoOnDelay", NULL, DEFAULT_ONDELAY, 0, NULL}, + */ { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.OutletSystem.Outlet.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_FLAG_ABSENT, NULL}, { "ups.timer.start", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeStartup", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, + { "ups.timer.start", 0, 0, "UPS.OutletSystem.Outlet.TLDelayBeforeStartup", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, { "ups.timer.shutdown", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeShutdown", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, { "ups.timer.reboot", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeReboot", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL }, { "ups.test.result", 0, 0, "UPS.BatterySystem.Test", NULL, "%s", 0, test_read_info }, @@ -272,6 +310,10 @@ static hid_info_t tripplite_hid2nut[] = { { "ups.power", 0, 0, "UPS.OutletSystem.Outlet.ActivePower", NULL, "%.1f", 0, NULL }, { "ups.power", 0, 0, "UPS.PowerConverter.Output.ActivePower", NULL, "%.1f", 0, NULL }, { "ups.load", 0, 0, "UPS.OutletSystem.Outlet.PercentLoad", NULL, "%.0f", 0, NULL }, + /* FIXME: what is the conversion format for this one? + * Example on HP T1500 G3 + * UPS.TLCustom.[1].UPSFirmwareVersion, Type: Feature, ReportID: 0x0f, Offset: 0, Size: 16, Value: 262 */ + { "ups.firmware", 0, 0, "UPS.TLCustom.[1].UPSFirmwareVersion", NULL, "%.0f", HU_FLAG_STATIC, NULL }, /* Number of seconds left before the watchdog reboots the UPS (0 = disabled) */ { "ups.watchdog.status", 0, 0, "UPS.OutletSystem.Outlet.TLWatchdog", NULL, "%.0f", 0, NULL }, @@ -288,10 +330,16 @@ static hid_info_t tripplite_hid2nut[] = { { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.NeedReplacement", NULL, NULL, 0, replacebatt_info }, /* repeat some of the above for faulty usage codes (seen on OMNI1000LCD, untested) */ { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.TLACPresent", NULL, NULL, HU_FLAG_QUICK_POLL, online_info }, + /* "Redundant" definition to deal with the conflict between + * TrippLite units, wrongly defining 0x00840045 as "TLDischarging" + * and HP which uses the standard 0x00840045 (as ConfigPercentLoad). + * Note that this path should not exist on HP devices. */ { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.TLDischarging", NULL, NULL, HU_FLAG_QUICK_POLL, discharging_info }, + /* Otherwise, define the version for HP devices */ + { "ups.load.nominal", 0, 0, "UPS.Flow.ConfigPercentLoad", NULL, "%.0f", 0, NULL }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.TLCharging", NULL, NULL, HU_FLAG_QUICK_POLL, charging_info }, { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.TLNeedReplacement", NULL, NULL, 0, replacebatt_info }, - { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.VoltageOutOfRange", NULL, NULL, 0, vrange_info }, { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.Buck", NULL, NULL, 0, trim_info }, { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.Boost", NULL, NULL, 0, boost_info }, @@ -338,6 +386,7 @@ static hid_info_t tripplite_hid2nut[] = { { "load.off.delay", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_TYPE_CMD, NULL }, { "load.on.delay", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_TYPE_CMD, NULL }, + { "load.on.delay", 0, 0, "UPS.OutletSystem.Outlet.TLDelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_TYPE_CMD, NULL }, { "shutdown.stop", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeShutdown", NULL, "-1", HU_TYPE_CMD, NULL }, { "shutdown.reboot", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeReboot", NULL, "10", HU_TYPE_CMD, NULL }, @@ -354,6 +403,18 @@ static hid_info_t tripplite_hid2nut[] = { { "beeper.enable", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL }, { "beeper.mute", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "3", HU_TYPE_CMD, NULL }, + /* FIXME (to be tested): HP specific (may conflict or differ from TL implementation!) + * { "outlet.count", 0, 0, "UPS.TLCustom.[1].OutletCount", NULL, "%.0f", HU_FLAG_STATIC, NULL }, + * { "outlet.status", 0, 0, "UPS.TLCustom.[1].OutletState", NULL, "%.0f", HU_FLAG_STATIC, NULL }, + 0.284486 Path: UPS.TLCustom.[1].ffff00ff, Type: Feature, ReportID: 0xff, Offset: 0, Size: 8, Value: 255 + 0.285276 Path: UPS.TLCustom.[1].OutletCount, Type: Feature, ReportID: 0x6d, Offset: 0, Size: 8, Value: 1 + 0.286260 Path: UPS.TLCustom.[1].OutletState, Type: Feature, ReportID: 0x70, Offset: 0, Size: 8, Value: 1 + 0.287248 Path: UPS.TLCustom.[1].CommunicationVersion, Type: Feature, ReportID: 0x0e, Offset: 0, Size: 16, Value: 262 + 0.288901 Path: UPS.TLCustom.[1].CommunicationProtocolVersion, Type: Feature, ReportID: 0x6c, Offset: 0, Size: 16, Value: 2560 + 0.289903 Path: UPS.TLCustom.[1].TLDelayBeforeStartup, Type: Feature, ReportID: 0x71, Offset: 0, Size: 16, Value: 65535 + 0.290854 Path: UPS.TLCustom.[1].AutoOnDelay, Type: Feature, ReportID: 0x72, Offset: 0, Size: 16, Value: 65535 + */ + /* end of structure. */ { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } }; diff --git a/drivers/tripplite_usb.c b/drivers/tripplite_usb.c index 56061a7..1a4765f 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: 2598 $' --center='Network UPS Tools (NUT)' tripplite_usb.c +pod2man --name='TRIPPLITE_USB' --section=8 --release='$Rev: 3555 $' --center='Network UPS Tools (NUT)' tripplite_usb.c =head1 NAME @@ -504,24 +504,30 @@ static int hex2d(const unsigned char *start, unsigned int len) static const char *hexascdump(unsigned char *msg, size_t len) { size_t i; - static unsigned char buf[256], *bufp; + static unsigned char buf[256]; + unsigned char *bufp, *end; bufp = buf; + end = bufp + sizeof(buf); buf[0] = 0; /* Dump each byte in hex: */ - for(i=0; i=3; i++) { bufp += sprintf((char *)bufp, "%02x ", msg[i]); } /* Dump single-quoted string with printable version of each byte: */ - *bufp++ = '\''; - for(i=0; i 0) *bufp++ = '\''; + + for(i=0; i0; i++) { *bufp++ = toprint(msg[i]); } - *bufp++ = '\''; + if (end-bufp > 0) *bufp++ = '\''; - *bufp++ = '\0'; + if (end-bufp > 0) + *bufp = '\0'; + else + *--end='\0'; return (char *)buf; } diff --git a/drivers/upscode2.c b/drivers/upscode2.c index 5f2e0b4..78a4718 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 2391 2010-03-04 15:35:09Z adkorte-guest $ + $Id: upscode2.c 3597 2012-05-15 11:22:06Z aquette $ */ /* @@ -45,7 +45,7 @@ #include #define DRIVER_NAME "UPScode II UPS driver" -#define DRIVER_VERSION "0.87" +#define DRIVER_VERSION "0.88" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -309,9 +309,9 @@ static simple_t simple[] = { { "MOIL1", t_value, "output.current" }, { "MOIL2", t_value, "output.L2.current" }, { "MOIL3", t_value, "output.L3.current" }, - { "MOIP1", t_value, "output.peakcurrent" }, - { "MOIP2", t_value, "output.L2.peakcurrent" }, - { "MOIP3", t_value, "output.L3.peakcurrent" }, + { "MOIP1", t_value, "output.current.peak" }, + { "MOIP2", t_value, "output.L2.current.peak" }, + { "MOIP3", t_value, "output.L3.current.peak" }, { "MOPL1", t_value, "output.realpower", 0, &kilo_to_unity }, { "MOPL2", t_value, "output.L2.realpower", 0, &kilo_to_unity }, { "MOPL3", t_value, "output.L3.realpower", 0, &kilo_to_unity }, @@ -780,7 +780,7 @@ void upsdrv_updateinfo(void) change_name(simple, "output.current", "output.L1.current"); change_name(simple, - "output.peakcurrent", "output.L1.peakcurrent"); + "output.current.peak", "output.L1.current.peak"); change_name(simple, "output.realpower", "output.L1.realpower"); change_name(simple, diff --git a/drivers/upshandler.h b/drivers/upshandler.h index b7539a0..ca9a349 100644 --- a/drivers/upshandler.h +++ b/drivers/upshandler.h @@ -25,12 +25,12 @@ enum { STAT_INSTCMD_HANDLED = 0, /* completed successfully */ STAT_INSTCMD_UNKNOWN, /* unspecified error */ STAT_INSTCMD_INVALID, /* invalid command */ - STAT_INSTCMD_FAILED /* command failed */ + STAT_INSTCMD_FAILED /* command failed */ }; /* return values for setvar */ enum { - STAT_SET_HANDLED = 0, /* completed successfully */ + STAT_SET_HANDLED = 0, /* completed successfully */ STAT_SET_UNKNOWN, /* unspecified error */ STAT_SET_INVALID, /* not writeable */ STAT_SET_FAILED /* writing failed */ diff --git a/drivers/usbhid-ups.c b/drivers/usbhid-ups.c index c925a81..6899d2f 100644 --- a/drivers/usbhid-ups.c +++ b/drivers/usbhid-ups.c @@ -1,7 +1,7 @@ /* usbhid-ups.c - Driver for USB and serial (MGE SHUT) HID UPS units * * Copyright (C) - * 2003-2009 Arnaud Quette + * 2003-2012 Arnaud Quette * 2005 John Stamp * 2005-2006 Peter Selinger * 2007-2009 Arjen de Korte @@ -27,7 +27,7 @@ */ #define DRIVER_NAME "Generic HID driver" -#define DRIVER_VERSION "0.35" +#define DRIVER_VERSION "0.37" #include "main.h" #include "libhid.h" @@ -480,7 +480,17 @@ static const char *kelvin_celsius_conversion_fun(double value) { static char buf[20]; - snprintf(buf, sizeof(buf), "%.1f", value - 273.15); + /* check if the value is in the Kelvin range, to + * detect buggy value (already expressed in °C), as found + * on some HP implementation */ + if ((value >= 273) && (value <= 373)) { + /* the value is indeed in °K */ + snprintf(buf, sizeof(buf), "%.1f", value - 273.15); + } + else { + /* else, this is actually °C, not °K! */ + snprintf(buf, sizeof(buf), "%.1f", value); + } return buf; } @@ -556,6 +566,11 @@ int instcmd(const char *cmdname, const char *extradata) if (!strcasecmp(cmdname, "shutdown.return")) { int ret; + /* Ensure "ups.start.auto" is set to "yes", if supported */ + if (dstate_getinfo("ups.start.auto")) { + setvar("ups.start.auto", "yes"); + } + ret = instcmd("load.on.delay", dstate_getinfo("ups.delay.start")); if (ret != STAT_INSTCMD_HANDLED) { return ret; @@ -567,6 +582,11 @@ int instcmd(const char *cmdname, const char *extradata) if (!strcasecmp(cmdname, "shutdown.stayoff")) { int ret; + /* Ensure "ups.start.auto" is set to "no", if supported */ + if (dstate_getinfo("ups.start.auto")) { + setvar("ups.start.auto", "no"); + } + ret = instcmd("load.on.delay", "-1"); if (ret != STAT_INSTCMD_HANDLED) { return ret; diff --git a/include/Makefile.am b/include/Makefile.am index d599ac0..5ed42d9 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -26,3 +26,9 @@ nut_version.h: FORCE -rm -f _nut_version.h FORCE: + +# counter part of BUILT_SOURCES: since nut_version is not a direct +# deps of a local target, we must clean it by ourself before the +# distribution +dist-hook: + rm -f $(distdir)/nut_version.h diff --git a/include/Makefile.in b/include/Makefile.in index 678a6e2..324c600 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -149,6 +149,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -162,6 +163,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -169,6 +171,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ @@ -343,6 +346,9 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am @@ -445,9 +451,9 @@ uninstall-am: .MAKE: all check install install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-hdr distclean-libtool \ - distdir dvi dvi-am html html-am info info-am install \ - install-am install-data install-data-am install-dvi \ + dist-hook distclean distclean-generic distclean-hdr \ + 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 \ @@ -479,6 +485,12 @@ nut_version.h: FORCE FORCE: +# counter part of BUILT_SOURCES: since nut_version is not a direct +# deps of a local target, we must clean it by ourself before the +# distribution +dist-hook: + rm -f $(distdir)/nut_version.h + # 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/include/common.h b/include/common.h index 431751c..d044d52 100644 --- a/include/common.h +++ b/include/common.h @@ -112,6 +112,7 @@ void *xrealloc(void *ptr, size_t size); char *xstrdup(const char *string); char *rtrim(char *in, const char sep); +char* ltrim(char *in, const char sep); int select_read(const int fd, void *buf, const size_t buflen, const long d_sec, const long d_usec); int select_write(const int fd, const void *buf, const size_t buflen, const long d_sec, const long d_usec); diff --git a/include/config.h.in b/include/config.h.in index ad12ff1..2d9c06d 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -291,6 +291,9 @@ /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O +/* NUT network protocol version */ +#undef NUT_NETVERSION + /* Name of package */ #undef PACKAGE @@ -324,6 +327,9 @@ /* User to switch to if started as root */ #undef RUN_AS_USER +/* Default path for system executables */ +#undef SBINDIR + /* Path for UPS driver state files */ #undef STATEPATH diff --git a/include/extstate.h b/include/extstate.h index cb178c3..e54e8e9 100644 --- a/include/extstate.h +++ b/include/extstate.h @@ -17,6 +17,13 @@ typedef struct enum_s { struct enum_s *next; } enum_t; +/* RANGE boundaries */ +typedef struct range_s { + int min; + int max; + struct range_s *next; +} range_t; + /* list of instant commands */ typedef struct cmdlist_s { char *name; diff --git a/include/nut_version.h b/include/nut_version.h deleted file mode 100644 index 9db8b19..0000000 --- a/include/nut_version.h +++ /dev/null @@ -1,3 +0,0 @@ -/* Autogenerated file. Do not change. */ -/* This file was generated by "make". */ -#define NUT_VERSION_MACRO "2.6.3-3369:3371" diff --git a/include/state.h b/include/state.h index cb1814e..5b1e713 100644 --- a/include/state.h +++ b/include/state.h @@ -1,6 +1,8 @@ /* state.h - Network UPS Tools common state management functions - Copyright (C) 2003 Russell Kroll + Copyright (C) + 2003 Russell Kroll + 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,6 +40,7 @@ typedef struct st_tree_s { int aux; struct enum_s *enum_list; + struct range_s *range_list; struct st_tree_s *left; struct st_tree_s *right; @@ -45,11 +48,13 @@ typedef struct st_tree_s { 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_addrange(st_tree_t *root, const char *var, const int min, const int max); 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); +const range_t *state_getrangelist(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); @@ -57,6 +62,7 @@ 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); +int state_delrange(st_tree_t *root, const char *var, const int min, const int max); st_tree_t *state_tree_find(st_tree_t *node, const char *var); #endif /* STATE_H_SEEN */ diff --git a/lib/Makefile.in b/lib/Makefile.in index fb06b28..36945ba 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -178,6 +178,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -191,6 +192,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -198,6 +200,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 2e0ed23..f38649c 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -7,6 +7,7 @@ HP-UX/nut-upsd \ HP-UX/nut-upsd.sh \ HP-UX/nut-upsmon \ HP-UX/nut-upsmon.sh \ +logrotate/nutlogd \ misc/nut.bash_completion \ misc/osd-notify \ perl/Nut.pm \ @@ -19,6 +20,7 @@ RedHat/upsmon \ RedHat/upsmon.in \ Solaris8/S99upsmon \ subdriver/path-to-subdriver.sh \ +ufw/README \ upower/95-upower-hid.rules \ Windows/halt.c \ Windows/Makefile diff --git a/scripts/Makefile.in b/scripts/Makefile.in index 35ef1f9..156e00a 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -188,6 +188,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -201,6 +202,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -208,6 +210,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ @@ -290,6 +293,7 @@ HP-UX/nut-upsd \ HP-UX/nut-upsd.sh \ HP-UX/nut-upsmon \ HP-UX/nut-upsmon.sh \ +logrotate/nutlogd \ misc/nut.bash_completion \ misc/osd-notify \ perl/Nut.pm \ @@ -302,6 +306,7 @@ RedHat/upsmon \ RedHat/upsmon.in \ Solaris8/S99upsmon \ subdriver/path-to-subdriver.sh \ +ufw/README \ upower/95-upower-hid.rules \ Windows/halt.c \ Windows/Makefile diff --git a/scripts/augeas/Makefile.am b/scripts/augeas/Makefile.am index c387541..5ef4c1e 100644 --- a/scripts/augeas/Makefile.am +++ b/scripts/augeas/Makefile.am @@ -5,7 +5,7 @@ EXTRA_DIST = gen-nutupsconf-aug.py nutupsconf.aug.tpl \ # only call the script to generate Augeas ups.conf lens upon "make dist", # and if Python is present dist-hook: - @if python -c pass; then \ + @if python -c "import re,glob,codecs"; then \ echo "Regenerating Augeas ups.conf lens."; \ $(distdir)/gen-nutupsconf-aug.py $(distdir)/; \ else \ diff --git a/scripts/augeas/Makefile.in b/scripts/augeas/Makefile.in index 6cb69c7..22d5f63 100644 --- a/scripts/augeas/Makefile.in +++ b/scripts/augeas/Makefile.in @@ -155,6 +155,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -168,6 +169,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -175,6 +177,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ @@ -459,7 +462,7 @@ uninstall-am: # only call the script to generate Augeas ups.conf lens upon "make dist", # and if Python is present dist-hook: - @if python -c pass; then \ + @if python -c "import re,glob,codecs"; then \ echo "Regenerating Augeas ups.conf lens."; \ $(distdir)/gen-nutupsconf-aug.py $(distdir)/; \ else \ diff --git a/scripts/augeas/nutupsconf.aug.in b/scripts/augeas/nutupsconf.aug.in index d3199bc..5e53fc0 100644 --- a/scripts/augeas/nutupsconf.aug.in +++ b/scripts/augeas/nutupsconf.aug.in @@ -58,6 +58,7 @@ let ups_fields = "driver" | "awd" | "batteryPercentage" | "battext" + | "battvoltmult" | "baud_rate" | "baudrate" | "bus" diff --git a/scripts/hal/Makefile.in b/scripts/hal/Makefile.in index e8125fd..4f9f7cd 100644 --- a/scripts/hal/Makefile.in +++ b/scripts/hal/Makefile.in @@ -173,6 +173,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -186,6 +187,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -193,6 +195,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ diff --git a/scripts/hal/ups-nut-device.fdi.in b/scripts/hal/ups-nut-device.fdi.in index 45294b0..d35c5d4 100644 --- a/scripts/hal/ups-nut-device.fdi.in +++ b/scripts/hal/ups-nut-device.fdi.in @@ -14,6 +14,13 @@ + + + battery + battery + hald-addon-usbhid-ups + ups + battery @@ -56,7 +63,7 @@ hald-addon-usbhid-ups ups - + battery battery @@ -70,6 +77,48 @@ 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 + @@ -222,13 +271,13 @@ - + - + battery battery - hald-addon-bcmxcp_usb + hald-addon-blazer_usb ups @@ -238,6 +287,27 @@ hald-addon-blazer_usb ups + + + battery + battery + hald-addon-blazer_usb + ups + + + + battery + battery + hald-addon-blazer_usb + ups + + + + battery + battery + hald-addon-blazer_usb + ups + battery @@ -274,7 +344,7 @@ hald-addon-usbhid-ups ups - + battery battery diff --git a/scripts/hotplug/Makefile.in b/scripts/hotplug/Makefile.in index 62bc680..8aeb214 100644 --- a/scripts/hotplug/Makefile.in +++ b/scripts/hotplug/Makefile.in @@ -178,6 +178,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -191,6 +192,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -198,6 +200,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ diff --git a/scripts/hotplug/libhid.usermap b/scripts/hotplug/libhid.usermap index 53c1519..40c07e2 100644 --- a/scripts/hotplug/libhid.usermap +++ b/scripts/hotplug/libhid.usermap @@ -8,6 +8,8 @@ libhidups 0x0003 0x0001 0x0000 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # Hewlett Packard +# e.g. ? +libhidups 0x0003 0x03f0 0x0001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # T500 libhidups 0x0003 0x03f0 0x1f01 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # T750 @@ -20,10 +22,22 @@ libhidups 0x0003 0x03f0 0x1f08 0x0000 0x0000 0x00 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 +# HP R1500 G2 and G3 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 +# e.g. ? +libhidups 0x0003 0x03f0 0x1fe2 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# HP T1500 G3 +libhidups 0x0003 0x03f0 0x1fe3 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# R/T3000 +libhidups 0x0003 0x03f0 0x1fe5 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# R/T3000 +libhidups 0x0003 0x03f0 0x1fe6 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# various models +libhidups 0x0003 0x03f0 0x1fe7 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# various models +libhidups 0x0003 0x03f0 0x1fe8 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # Eaton # various models @@ -71,11 +85,17 @@ libhidups 0x0003 0x05b8 0x0000 0x0000 0x0000 0x00 # Belkin F6C1200-UNV libhidups 0x0003 0x0665 0x5161 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Phoenixtec -# various models +# Phoenixtec Power Co., Ltd +# Online Yunto YQ450 libhidups 0x0003 0x06da 0x0002 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # Mustek Powermust libhidups 0x0003 0x06da 0x0003 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# Phoenixtec Innova 3/1 T +libhidups 0x0003 0x06da 0x0004 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# Phoenixtec Innova RT +libhidups 0x0003 0x06da 0x0005 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 +# Phoenixtec Innova T +libhidups 0x0003 0x06da 0x0201 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # various models libhidups 0x0003 0x06da 0xffff 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 @@ -88,7 +108,7 @@ libhidups 0x0003 0x075d 0x0300 0x0000 0x0000 0x00 libhidups 0x0003 0x0764 0x0005 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # Dynex DX-800U? libhidups 0x0003 0x0764 0x0501 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# OR2200LCDRM2U +# OR2200LCDRM2U, OR700LCDRM1U, PR6000LCDRTXL5U libhidups 0x0003 0x0764 0x0601 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # Sweex 1000VA libhidups 0x0003 0x0925 0x1234 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 diff --git a/scripts/java/Makefile.in b/scripts/java/Makefile.in index a10e01e..7afd226 100644 --- a/scripts/java/Makefile.in +++ b/scripts/java/Makefile.in @@ -150,6 +150,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -163,6 +164,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -170,6 +172,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ diff --git a/scripts/java/jNut/src/main/java/org/networkupstools/jnut/Variable.java b/scripts/java/jNut/src/main/java/org/networkupstools/jnut/Variable.java index 07c7c37..fce6b0b 100644 --- a/scripts/java/jNut/src/main/java/org/networkupstools/jnut/Variable.java +++ b/scripts/java/jNut/src/main/java/org/networkupstools/jnut/Variable.java @@ -116,5 +116,5 @@ public class Variable { } } - // TODO Add query for type and enum values + // TODO Add query for type, enum and range values } diff --git a/scripts/logrotate/nutlogd b/scripts/logrotate/nutlogd new file mode 100644 index 0000000..b230e3b --- /dev/null +++ b/scripts/logrotate/nutlogd @@ -0,0 +1,24 @@ +# Log rotation configuration for NUT: +# Rotate NUT log file(s) either monthly or when exceeding 5 Mb +# +# For more information, refer to logrotate(8) manual page: +# http://linuxcommand.org/man_pages/logrotate8.html +# +# To install this file, use: +# $ cp nutlogd /etc/logrotate.d/ +# $ chmod 644 /etc/logrotate.d/nutlogd +# $ chown root.root /etc/logrotate.d/nutlogd +# +# Log files must have "nut-" prefix and ".log" suffix + +/var/log/nut-*.log { + missingok + notifempty + size=5M + rotate 12 + monthly + postrotate + /usr/bin/killall -HUP upslog + endscript +} + diff --git a/scripts/python/Makefile.in b/scripts/python/Makefile.in index 4f89ab1..1f354b0 100644 --- a/scripts/python/Makefile.in +++ b/scripts/python/Makefile.in @@ -150,6 +150,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -163,6 +164,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -170,6 +172,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ diff --git a/scripts/python/module/PyNUT.py b/scripts/python/module/PyNUT.py index af09fac..98c9114 100644 --- a/scripts/python/module/PyNUT.py +++ b/scripts/python/module/PyNUT.py @@ -28,6 +28,13 @@ # 2010-07-23 David Goncalves - Version 1.2 # Changed GetRWVars function that fails is the UPS is not # providing such vars. +# +# 2011-07-05 René Martín Rodríguez - Version 1.2.1 +# Added support for FSD, HELP and VER commands +# +# 2012-02-07 René Martín Rodríguez - Version 1.2.2 +# Added support for LIST CLIENTS command +# import telnetlib @@ -42,8 +49,8 @@ class PyNUTClient : __timeout = None __srv_handler = None - __version = "1.2" - __release = "2010-07-23" + __version = "1.2.2" + __release = "2012-02-07" def __init__( self, host="127.0.0.1", port=3493, login=None, password=None, debug=False, timeout=5 ) : @@ -247,3 +254,78 @@ Returns OK on success or raises an error return( "OK" ) else : raise Exception, result.replace( "\n", "" ) + + def FSD( self, ups="") : + """ Send FSD command + +Returns OK on success or raises an error + """ + + if self.__debug : + print( "[DEBUG] MASTER called..." ) + + self.__srv_handler.write( "MASTER %s\n" % ups ) + result = self.__srv_handler.read_until( "\n" ) + if ( result != "OK MASTER-GRANTED\n" ) : + raise Exception, ( "Master level function are not available", "" ) + + if self.__debug : + print( "[DEBUG] FSD called..." ) + self.__srv_handler.write( "FSD %s\n" % ups ) + result = self.__srv_handler.read_until( "\n" ) + if ( result == "OK FSD-SET\n" ) : + return( "OK" ) + else : + raise Exception, result.replace( "\n", "" ) + + def help(self) : + """ Send HELP command + """ + + if self.__debug : + print( "[DEBUG] HELP called..." ) + + self.__srv_handler.write( "HELP\n") + return self.__srv_handler.read_until( "\n" ) + + def ver(self) : + """ Send VER command + """ + + if self.__debug : + print( "[DEBUG] VER called..." ) + + self.__srv_handler.write( "VER\n") + return self.__srv_handler.read_until( "\n" ) + + def ListClients( self, ups = None ) : + """ Returns the list of connected clients from the NUT server + +The result is a dictionary containing 'key->val' pairs of 'UPSName' and a list of clients + """ + if self.__debug : + print( "[DEBUG] ListClients from server" ) + + if ups and (ups not in self.GetUPSList()): + raise Exception, "%s is not a valid UPS" % ups + + if ups: + self.__srv_handler.write( "LIST CLIENTS %s\n" % ups) + else: + self.__srv_handler.write( "LIST CLIENTS\n" ) + result = self.__srv_handler.read_until( "\n" ) + if result != "BEGIN LIST CLIENTS\n" : + raise Exception, result.replace( "\n", "" ) + + result = self.__srv_handler.read_until( "END LIST CLIENTS\n" ) + ups_list = {} + + for line in result.split( "\n" ): + if line[:6] == "CLIENT" : + host, ups = line[7:].split(' ') + ups.replace(' ', '') + if not ups in ups_list: + ups_list[ups] = [] + ups_list[ups].append(host) + + return( ups_list ) diff --git a/scripts/systemd/Makefile.am b/scripts/systemd/Makefile.am index bc88503..b62796d 100644 --- a/scripts/systemd/Makefile.am +++ b/scripts/systemd/Makefile.am @@ -1,11 +1,6 @@ EXTRA_DIST = README if HAVE_SYSTEMD -%.service: %.service.in - sed -e 's,@sbindir\@,$(sbindir),g' $< > $@ - -nutshutdown: nutshutdown.in - sed -e 's,@sbindir\@,$(sbindir),g' $< > $@ systemdsystemunit_DATA = \ nut-driver.service \ diff --git a/scripts/systemd/Makefile.in b/scripts/systemd/Makefile.in index 28dc04a..8c2bc3d 100644 --- a/scripts/systemd/Makefile.in +++ b/scripts/systemd/Makefile.in @@ -40,7 +40,10 @@ target_triplet = @target@ @HAVE_SYSTEMD_FALSE@ nut-server.service.in nutshutdown.in subdir = scripts/systemd -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/nut-driver.service.in \ + $(srcdir)/nut-monitor.service.in \ + $(srcdir)/nut-server.service.in $(srcdir)/nutshutdown.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -68,7 +71,8 @@ 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 = nut-driver.service nut-monitor.service \ + nut-server.service nutshutdown CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -178,6 +182,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -191,6 +196,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -198,6 +204,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ @@ -311,6 +318,14 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +nut-driver.service: $(top_builddir)/config.status $(srcdir)/nut-driver.service.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +nut-monitor.service: $(top_builddir)/config.status $(srcdir)/nut-monitor.service.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +nut-server.service: $(top_builddir)/config.status $(srcdir)/nut-server.service.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +nutshutdown: $(top_builddir)/config.status $(srcdir)/nutshutdown.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-systemdsystemshutdownSCRIPTS: $(systemdsystemshutdown_SCRIPTS) @$(NORMAL_INSTALL) test -z "$(systemdsystemshutdowndir)" || $(MKDIR_P) "$(DESTDIR)$(systemdsystemshutdowndir)" @@ -526,12 +541,6 @@ uninstall-am: uninstall-systemdsystemshutdownSCRIPTS \ uninstall-systemdsystemunitDATA -@HAVE_SYSTEMD_TRUE@%.service: %.service.in -@HAVE_SYSTEMD_TRUE@ sed -e 's,@sbindir\@,$(sbindir),g' $< > $@ - -@HAVE_SYSTEMD_TRUE@nutshutdown: nutshutdown.in -@HAVE_SYSTEMD_TRUE@ sed -e 's,@sbindir\@,$(sbindir),g' $< > $@ - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/scripts/systemd/nut-driver.service.in b/scripts/systemd/nut-driver.service.in index eef3480..f81ac69 100644 --- a/scripts/systemd/nut-driver.service.in +++ b/scripts/systemd/nut-driver.service.in @@ -4,7 +4,7 @@ After=local-fs.target network.target StopWhenUnneeded=yes [Service] -ExecStart=/sbin/upsdrvctl start -ExecStop=/sbin/upsdrvctl stop +ExecStart=@SBINDIR@/upsdrvctl start +ExecStop=@SBINDIR@/upsdrvctl stop Type=forking diff --git a/scripts/systemd/nut-monitor.service.in b/scripts/systemd/nut-monitor.service.in index 8a7f3b2..8429bf2 100644 --- a/scripts/systemd/nut-monitor.service.in +++ b/scripts/systemd/nut-monitor.service.in @@ -3,8 +3,8 @@ Description=Network UPS Tools - power device monitor and shutdown controller After=local-fs.target network.target nut-server.service [Service] -ExecStart=/usr/sbin/upsmon -PIDFile=/var/run/nut/upsmon.pid +ExecStart=@SBINDIR@/upsmon +PIDFile=@PIDPATH@/upsmon.pid Type=forking [Install] diff --git a/scripts/systemd/nut-server.service.in b/scripts/systemd/nut-server.service.in index 38b1322..edcaf10 100644 --- a/scripts/systemd/nut-server.service.in +++ b/scripts/systemd/nut-server.service.in @@ -5,7 +5,7 @@ Requires=nut-driver.service Before=nut-monitor.service [Service] -ExecStart=/usr/sbin/upsd +ExecStart=@SBINDIR@/upsd Type=forking [Install] diff --git a/scripts/systemd/nutshutdown.in b/scripts/systemd/nutshutdown.in index 3406592..1b97fa2 100644 --- a/scripts/systemd/nutshutdown.in +++ b/scripts/systemd/nutshutdown.in @@ -1,2 +1,2 @@ #!/bin/sh -upsmon -K >/dev/null 2>&1 && upsdrvctl shutdown +@SBINDIR@/upsmon -K >/dev/null 2>&1 && @SBINDIR@/upsdrvctl shutdown diff --git a/scripts/udev/Makefile.in b/scripts/udev/Makefile.in index be711f3..00d19d5 100644 --- a/scripts/udev/Makefile.in +++ b/scripts/udev/Makefile.in @@ -175,6 +175,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -188,6 +189,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -195,6 +197,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ diff --git a/scripts/udev/nut-usbups.rules.in b/scripts/udev/nut-usbups.rules.in index 2faf9a2..6aa3166 100644 --- a/scripts/udev/nut-usbups.rules.in +++ b/scripts/udev/nut-usbups.rules.in @@ -10,6 +10,8 @@ LABEL="nut-usbups_rules_real" ATTR{idVendor}=="0001", ATTR{idProduct}=="0000", MODE="664", GROUP="@RUN_AS_GROUP@" # Hewlett Packard +# e.g. ? - usbhid-ups +ATTR{idVendor}=="03f0", ATTR{idProduct}=="0001", MODE="664", GROUP="@RUN_AS_GROUP@" # T500 - bcmxcp_usb ATTR{idVendor}=="03f0", ATTR{idProduct}=="1f01", MODE="664", GROUP="@RUN_AS_GROUP@" # T750 - bcmxcp_usb @@ -22,10 +24,22 @@ ATTR{idVendor}=="03f0", ATTR{idProduct}=="1f08", MODE="664", GROUP="@RUN_AS_GROU 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 +# HP R1500 G2 and G3 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@" +# e.g. ? - usbhid-ups +ATTR{idVendor}=="03f0", ATTR{idProduct}=="1fe2", MODE="664", GROUP="@RUN_AS_GROUP@" +# HP T1500 G3 - usbhid-ups +ATTR{idVendor}=="03f0", ATTR{idProduct}=="1fe3", MODE="664", GROUP="@RUN_AS_GROUP@" +# R/T3000 - usbhid-ups +ATTR{idVendor}=="03f0", ATTR{idProduct}=="1fe5", MODE="664", GROUP="@RUN_AS_GROUP@" +# R/T3000 - usbhid-ups +ATTR{idVendor}=="03f0", ATTR{idProduct}=="1fe6", MODE="664", GROUP="@RUN_AS_GROUP@" +# various models - usbhid-ups +ATTR{idVendor}=="03f0", ATTR{idProduct}=="1fe7", MODE="664", GROUP="@RUN_AS_GROUP@" +# various models - usbhid-ups +ATTR{idVendor}=="03f0", ATTR{idProduct}=="1fe8", MODE="664", GROUP="@RUN_AS_GROUP@" # Eaton # various models - usbhid-ups @@ -73,11 +87,17 @@ ATTR{idVendor}=="05b8", ATTR{idProduct}=="0000", MODE="664", GROUP="@RUN_AS_GROU # Belkin F6C1200-UNV - blazer_usb ATTR{idVendor}=="0665", ATTR{idProduct}=="5161", MODE="664", GROUP="@RUN_AS_GROUP@" -# Phoenixtec -# various models - bcmxcp_usb +# Phoenixtec Power Co., Ltd +# Online Yunto YQ450 - blazer_usb ATTR{idVendor}=="06da", ATTR{idProduct}=="0002", MODE="664", GROUP="@RUN_AS_GROUP@" # Mustek Powermust - blazer_usb ATTR{idVendor}=="06da", ATTR{idProduct}=="0003", MODE="664", GROUP="@RUN_AS_GROUP@" +# Phoenixtec Innova 3/1 T - blazer_usb +ATTR{idVendor}=="06da", ATTR{idProduct}=="0004", MODE="664", GROUP="@RUN_AS_GROUP@" +# Phoenixtec Innova RT - blazer_usb +ATTR{idVendor}=="06da", ATTR{idProduct}=="0005", MODE="664", GROUP="@RUN_AS_GROUP@" +# Phoenixtec Innova T - blazer_usb +ATTR{idVendor}=="06da", ATTR{idProduct}=="0201", MODE="664", GROUP="@RUN_AS_GROUP@" # various models - usbhid-ups ATTR{idVendor}=="06da", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROUP@" @@ -90,7 +110,7 @@ ATTR{idVendor}=="075d", ATTR{idProduct}=="0300", MODE="664", GROUP="@RUN_AS_GROU ATTR{idVendor}=="0764", ATTR{idProduct}=="0005", MODE="664", GROUP="@RUN_AS_GROUP@" # Dynex DX-800U? - usbhid-ups ATTR{idVendor}=="0764", ATTR{idProduct}=="0501", MODE="664", GROUP="@RUN_AS_GROUP@" -# OR2200LCDRM2U - usbhid-ups +# OR2200LCDRM2U, OR700LCDRM1U, PR6000LCDRTXL5U - usbhid-ups ATTR{idVendor}=="0764", ATTR{idProduct}=="0601", MODE="664", GROUP="@RUN_AS_GROUP@" # Sweex 1000VA - richcomm_usb ATTR{idVendor}=="0925", ATTR{idProduct}=="1234", MODE="664", GROUP="@RUN_AS_GROUP@" diff --git a/scripts/ufw/README b/scripts/ufw/README new file mode 100644 index 0000000..701f323 --- /dev/null +++ b/scripts/ufw/README @@ -0,0 +1,30 @@ +Uncomplicated Firewall (UFW) support +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +NUT can tightly integrate with +link:http://en.wikipedia.org/wiki/Uncomplicated_Firewall[Uncomplicated Firewall] +using the provided profile (nut.ufw.profile). + +You must first install the profile on your system: + + $ cp nut.ufw.profile /etc/ufw/applications.d/ + +To enable outside access to your local upsd, use: + + $ ufw allow NUT + +To restrict access to the network '192.168.X.Y', use: + + $ ufw allow from 192.168.0.0/16 to any app NUT + +You can also use graphical frontends, such as gui-ufw (gufw), ufw-kde +or ufw-frontends. + +For more information, refer to: + + - link:http://gufw.tuxfamily.org/[UFW homepage], + - link:https://launchpad.net/ufw[UFW project page], + - link:https://wiki.ubuntu.com/UncomplicatedFirewall[UFW wiki], + - UFW manual page, section APPLICATION INTEGRATION + + diff --git a/scripts/ufw/nut.ufw.profile.in b/scripts/ufw/nut.ufw.profile.in new file mode 100644 index 0000000..df9202d --- /dev/null +++ b/scripts/ufw/nut.ufw.profile.in @@ -0,0 +1,4 @@ +[NUT] +title=NUT - Network UPS Tools server +description=NUT is a client - server system with support for UPS, PDU and PSU. +ports=@PORT@/tcp diff --git a/scripts/upower/95-upower-hid.rules b/scripts/upower/95-upower-hid.rules index dd9d899..a9e18fe 100644 --- a/scripts/upower/95-upower-hid.rules +++ b/scripts/upower/95-upower-hid.rules @@ -18,7 +18,7 @@ ATTRS{idVendor}=="047c", ENV{UPOWER_VENDOR}="Dell" ATTRS{idVendor}=="050d", ENV{UPOWER_VENDOR}="Belkin" ATTRS{idVendor}=="051d", ENV{UPOWER_VENDOR}="APC" ATTRS{idVendor}=="0592", ENV{UPOWER_VENDOR}="Powerware" -ATTRS{idVendor}=="06da", ENV{UPOWER_VENDOR}="Phoenixtec" +ATTRS{idVendor}=="06da", ENV{UPOWER_VENDOR}="Phoenixtec Power Co., Ltd" ATTRS{idVendor}=="075d", ENV{UPOWER_VENDOR}="iDowell" ATTRS{idVendor}=="0764", ENV{UPOWER_VENDOR}="Cyber Power Systems" ATTRS{idVendor}=="09ae", ENV{UPOWER_VENDOR}="TrippLite" @@ -26,12 +26,19 @@ ATTRS{idVendor}=="0d9f", ENV{UPOWER_VENDOR}="PowerCOM" ATTRS{idVendor}=="10af", ENV{UPOWER_VENDOR}="Liebert" # Hewlett Packard +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="0001", ENV{UPOWER_BATTERY_TYPE}="ups" ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f06", ENV{UPOWER_BATTERY_TYPE}="ups" ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f08", ENV{UPOWER_BATTERY_TYPE}="ups" ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f09", ENV{UPOWER_BATTERY_TYPE}="ups" ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f0a", ENV{UPOWER_BATTERY_TYPE}="ups" ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe0", ENV{UPOWER_BATTERY_TYPE}="ups" ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe1", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe2", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe3", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe5", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe6", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe7", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe8", ENV{UPOWER_BATTERY_TYPE}="ups" # Eaton ATTRS{idVendor}=="0463", ATTRS{idProduct}=="0001", ENV{UPOWER_BATTERY_TYPE}="ups" @@ -58,7 +65,7 @@ ATTRS{idVendor}=="051d", ATTRS{idProduct}=="0003", ENV{UPOWER_BATTERY_TYPE}="ups # Powerware ATTRS{idVendor}=="0592", ATTRS{idProduct}=="0004", ENV{UPOWER_BATTERY_TYPE}="ups" -# Phoenixtec +# Phoenixtec Power Co., Ltd ATTRS{idVendor}=="06da", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups" # iDowell diff --git a/server/Makefile.in b/server/Makefile.in index 0c32dea..dd63712 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -192,6 +192,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -205,6 +206,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -212,6 +214,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ diff --git a/server/netcmds.h b/server/netcmds.h index 30f5124..c0b5225 100644 --- a/server/netcmds.h +++ b/server/netcmds.h @@ -35,6 +35,7 @@ struct { int flags; } netcmds[] = { { "VER", net_ver, 0 }, + { "NETVER", net_netver, 0 }, { "HELP", net_help, 0 }, { "STARTTLS", net_starttls, 0 }, diff --git a/server/netget.c b/server/netget.c index 43e7370..9d6cf08 100644 --- a/server/netget.c +++ b/server/netget.c @@ -56,9 +56,6 @@ static void get_upsdesc(nut_ctype_t *client, const char *upsname) return; } - if (!ups_available(ups, client)) - return; - if (ups->desc) { pconf_encode(ups->desc, esc, sizeof(esc)); sendback(client, "UPSDESC %s \"%s\"\n", upsname, esc); @@ -149,6 +146,11 @@ static void get_type(nut_ctype_t *client, const char *upsname, const char *var) return; } + if (node->range_list) { + sendback(client, "%s RANGE\n", buf); + return; + } + if (node->flags & ST_FLAG_STRING) { sendback(client, "%s STRING:%d\n", buf, node->aux); return; diff --git a/server/netlist.c b/server/netlist.c index ea6ee4c..91f7831 100644 --- a/server/netlist.c +++ b/server/netlist.c @@ -1,6 +1,8 @@ /* netlist.c - LIST handlers for upsd - Copyright (C) 2003 Russell Kroll + Copyright (C) + 2003 Russell Kroll + 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,7 +28,8 @@ #include "netlist.h" - extern upstype_t *firstups; /* for list_ups */ +extern upstype_t *firstups; /* for list_ups */ +extern nut_ctype_t *firstclient; /* for list_clients */ static int tree_dump(st_tree_t *node, nut_ctype_t *client, const char *ups, int rw, int fsd) @@ -185,6 +188,41 @@ static void list_enum(nut_ctype_t *client, const char *upsname, const char *var) sendback(client, "END LIST ENUM %s %s\n", upsname, var); } +static void list_range(nut_ctype_t *client, const char *upsname, const char *var) +{ + const upstype_t *ups; + const st_tree_t *node; + const range_t *rtmp; + + ups = get_ups_ptr(upsname); + + if (!ups) { + send_err(client, NUT_ERR_UNKNOWN_UPS); + return; + } + + if (!ups_available(ups, client)) + return; + + node = sstate_getnode(ups, var); + + if (!node) { + send_err(client, NUT_ERR_VAR_NOT_SUPPORTED); + return; + } + + if (!sendback(client, "BEGIN LIST RANGE %s %s\n", upsname, var)) + return; + + for (rtmp = node->range_list; rtmp != NULL; rtmp = rtmp->next) { + if (!sendback(client, "RANGE %s %s \"%i\" \"%i\"\n", + upsname, var, rtmp->min, rtmp->max)) + return; + } + + sendback(client, "END LIST ENUM %s %s\n", upsname, var); +} + static void list_ups(nut_ctype_t *client) { upstype_t *utmp; @@ -217,6 +255,36 @@ static void list_ups(nut_ctype_t *client) sendback(client, "END LIST UPS\n"); } +static void list_clients(nut_ctype_t *client, const char *upsname) +{ + const upstype_t *ups; + nut_ctype_t *c, *cnext; + + ups = get_ups_ptr(upsname); + + if (!ups) { + send_err(client, NUT_ERR_UNKNOWN_UPS); + return; + } + + if (!sendback(client, "BEGIN LIST CLIENT %s\n", upsname)) + return; + + if (firstclient) { + int ret; + /* show connected clients */ + for (c = firstclient; c; c = cnext) { + if (c->loginups && (!ups || !strcasecmp(c->loginups, ups->name))) { + ret = sendback(client, "CLIENT %s %s\n", c->loginups, c->addr); + if (!ret) + return; + } + cnext = c->next; + } + } + sendback(client, "END LIST CLIENT %s\n", upsname); +} + void net_list(nut_ctype_t *client, int numarg, const char **arg) { if (numarg < 1) { @@ -253,6 +321,12 @@ void net_list(nut_ctype_t *client, int numarg, const char **arg) return; } + /* LIST CLIENT UPS */ + if (!strcasecmp(arg[0], "CLIENT")) { + list_clients(client, arg[1]); + return; + } + if (numarg < 3) { send_err(client, NUT_ERR_INVALID_ARGUMENT); return; @@ -264,5 +338,11 @@ void net_list(nut_ctype_t *client, int numarg, const char **arg) return; } + /* LIST RANGE UPS VARNAME */ + if (!strcasecmp(arg[0], "RANGE")) { + list_range(client, arg[1], arg[2]); + return; + } + send_err(client, NUT_ERR_INVALID_ARGUMENT); } diff --git a/server/netmisc.c b/server/netmisc.c index cbfb1ca..3863ae5 100644 --- a/server/netmisc.c +++ b/server/netmisc.c @@ -1,6 +1,8 @@ /* netmisc.c - miscellaneous network handlers for upsd (VER, HELP, FSD) - Copyright (C) 2003 Russell Kroll + Copyright (C) + 2003 Russell Kroll + 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,6 +40,16 @@ void net_ver(nut_ctype_t *client, int numarg, const char **arg) UPS_VERSION); } +void net_netver(nut_ctype_t *client, int numarg, const char **arg) +{ + if (numarg != 0) { + send_err(client, NUT_ERR_INVALID_ARGUMENT); + return; + } + + sendback(client, "%s\n", NUT_NETVERSION); +} + void net_help(nut_ctype_t *client, int numarg, const char **arg) { if (numarg != 0) { diff --git a/server/netmisc.h b/server/netmisc.h index e1899df..e48f6f4 100644 --- a/server/netmisc.h +++ b/server/netmisc.h @@ -1,3 +1,4 @@ void net_ver(nut_ctype_t *client, int numarg, const char **arg); +void net_netver(nut_ctype_t *client, int numarg, const char **arg); void net_help(nut_ctype_t *client, int numarg, const char **arg); void net_fsd(nut_ctype_t *client, int numarg, const char **arg); diff --git a/server/netset.c b/server/netset.c index 145bd2f..b88bb40 100644 --- a/server/netset.c +++ b/server/netset.c @@ -33,6 +33,7 @@ static void set_var(nut_ctype_t *client, const char *upsname, const char *var, upstype_t *ups; const char *val; const enum_t *etmp; + const range_t *rtmp; char cmd[SMALLBUF], esc[SMALLBUF]; ups = get_ups_ptr(upsname); @@ -108,6 +109,29 @@ static void set_var(nut_ctype_t *client, const char *upsname, const char *var, } } + /* or if it's within a range */ + + rtmp = sstate_getrangelist(ups, var); + + if (rtmp) { + int found = 0; + int inewval = atoi(newval); + + while (rtmp) { + if ((inewval >= rtmp->min) && (inewval <= rtmp->max)) { + found = 1; + break; + } + + rtmp = rtmp->next; + } + + if (!found) { + send_err(client, NUT_ERR_INVALID_VALUE); + return; + } + } + /* must be OK now */ upslogx(LOG_INFO, "Set variable: %s@%s set %s on %s to %s", diff --git a/server/sstate.c b/server/sstate.c index dfbc2b6..15d2c14 100644 --- a/server/sstate.c +++ b/server/sstate.c @@ -3,6 +3,7 @@ Copyright (C) 2003 Russell Kroll 2008 Arjen de Korte + 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,6 +64,7 @@ static int parse_args(upstype_t *ups, int numargs, char **arg) if (numargs < 2) return 0; + /* FIXME: all these should return their state_...() value! */ /* ADDCMD */ if (!strcasecmp(arg[0], "ADDCMD")) { state_addcmd(&ups->cmdlist, arg[1]); @@ -88,7 +90,7 @@ static int parse_args(upstype_t *ups, int numargs, char **arg) if (!strcasecmp(arg[0], "SETFLAGS")) { state_setflags(ups->inforoot, arg[1], numargs - 2, &arg[2]); return 1; - } + } /* SETINFO */ if (!strcasecmp(arg[0], "SETINFO")) { @@ -102,12 +104,24 @@ static int parse_args(upstype_t *ups, int numargs, char **arg) return 1; } + /* ADDRANGE */ + if (!strcasecmp(arg[0], "ADDRANGE")) { + state_addrange(ups->inforoot, arg[1], atoi(arg[2]), atoi(arg[3])); + return 1; + } + /* DELENUM */ if (!strcasecmp(arg[0], "DELENUM")) { state_delenum(ups->inforoot, arg[1], arg[2]); return 1; } + /* DELRANGE */ + if (!strcasecmp(arg[0], "DELRANGE")) { + state_delrange(ups->inforoot, arg[1], atoi(arg[2]), atoi(arg[3])); + return 1; + } + /* SETAUX */ if (!strcasecmp(arg[0], "SETAUX")) { state_setaux(ups->inforoot, arg[1], arg[2]); @@ -301,6 +315,11 @@ const enum_t *sstate_getenumlist(const upstype_t *ups, const char *var) return state_getenumlist(ups->inforoot, var); } +const range_t *sstate_getrangelist(const upstype_t *ups, const char *var) +{ + return state_getrangelist(ups->inforoot, var); +} + const cmdlist_t *sstate_getcmdlist(const upstype_t *ups) { return ups->cmdlist; diff --git a/server/sstate.h b/server/sstate.h index 622b848..bfb5ae6 100644 --- a/server/sstate.h +++ b/server/sstate.h @@ -3,6 +3,7 @@ Copyright (C) 2003 Russell Kroll 2008 Arjen de Korte + 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,6 +36,7 @@ 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 enum_t *sstate_getenumlist(const upstype_t *ups, const char *var); +const range_t *sstate_getrangelist(const upstype_t *ups, const char *var); const cmdlist_t *sstate_getcmdlist(const upstype_t *ups); void sstate_makeinfolist(const upstype_t *ups, char *buf, size_t bufsize); void sstate_makerwlist(const upstype_t *ups, char *buf, size_t bufsize); diff --git a/server/upsd.c b/server/upsd.c index db200aa..1bb6c27 100644 --- a/server/upsd.c +++ b/server/upsd.c @@ -1,9 +1,9 @@ /* upsd.c - watches ups state files and answers queries Copyright (C) - 1999 Russell Kroll - 2008 Arjen de Korte - 2011 Arnaud Quette + 1999 Russell Kroll + 2008 Arjen de Korte + 2011 - 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -65,7 +65,7 @@ int deny_severity = LOG_WARNING; /* everything else */ const char *progname; -static nut_ctype_t *firstclient = NULL; +nut_ctype_t *firstclient = NULL; /* static nut_ctype_t *lastclient = NULL; */ /* default is to listen on all local interfaces */ @@ -955,6 +955,15 @@ int main(int argc, char **argv) exit(EXIT_SUCCESS); } + /* otherwise, we are being asked to start. + * so check if a previous instance is running by sending signal '0' + * (Ie 'kill 0') */ + if (sendsignalfn(pidfn, 0) == 0) { + printf("Fatal error: A previous upsd instance is already running!\n"); + printf("Either stop the previous instance first, or use the 'reload' command.\n"); + exit(EXIT_FAILURE); + } + argc -= optind; argv += optind; diff --git a/server/upsd.h b/server/upsd.h index 85985fe..2df9fc0 100644 --- a/server/upsd.h +++ b/server/upsd.h @@ -67,6 +67,7 @@ void check_perms(const char *fn); extern int maxage, maxconn; extern char *statepath, *datapath; extern upstype_t *firstups; +extern nut_ctype_t *firstclient; /* map commands onto signals */ diff --git a/server/user.c b/server/user.c index e443eee..8eff8a0 100644 --- a/server/user.c +++ b/server/user.c @@ -111,6 +111,9 @@ static void user_add_instcmd(const char *cmd) } } + upsdebugx(2, "user_add_instcmd: adding '%s' for %s", + cmd, curr_user->username); + tmp = xcalloc(1, sizeof(*tmp)); tmp->cmd = xstrdup(cmd); @@ -155,6 +158,9 @@ static void user_add_action(const char *act) return; } + upsdebugx(2, "user_add_action: adding '%s' for %s", + act, curr_user->username); + curr_user->firstaction = addaction(curr_user->firstaction, act); } diff --git a/tools/Makefile.am b/tools/Makefile.am index 0d9828b..ed280a9 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,13 +1,29 @@ # TODO: remove redundancies! -# Force build in ./ before nut-scanner, to have nutscan-{usb,snmp}.h -# built before going into the nut-scanner sub-directory +# XXX this does not work with Automake!!! +# +# In fact the very concept is entirely antithetical to Automake. +# +# SUBDIRS are explicitly a listing of all the directories that make +# must recurse into BEFORE processing the current directory. +# +# These python scripts must be moved into a sub-directory, and _only_ +# executed IF they need to be, and all the nut-scanner sources need +# to be moved out of a sub-directory into this directory. +# +# Anyway, for the time being, we force build in ./ before nut-scanner, +# to have nutscan-{usb,snmp}.h built before going into the nut-scanner +# sub-directory SUBDIRS = . nut-scanner -EXTRA_DIST = nut-usbinfo.pl nut-hclinfo.py device-recorder.sh svn2cl.authors nut-snmpinfo.py +EXTRA_DIST = nut-usbinfo.pl nut-hclinfo.py nut-recorder.sh svn2cl.authors nut-snmpinfo.py all: nut-scanner-deps +# XXX these rules are all bogus! They cause un-named target files to +# always be rebuilt! None of that is ever the right way to use make, +# and especially not Automake. Explicit filenames and their exact +# dependencies need to be properly listed. nut-scanner-deps: @if python -c 1; then \ echo "Regenerating the SNMP helper files."; \ diff --git a/tools/Makefile.in b/tools/Makefile.in index 66f35e8..70c7439 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -190,6 +190,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -203,6 +204,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -210,6 +212,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ @@ -284,10 +287,22 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -# Force build in ./ before nut-scanner, to have nutscan-{usb,snmp}.h -# built before going into the nut-scanner sub-directory +# XXX this does not work with Automake!!! +# +# In fact the very concept is entirely antithetical to Automake. +# +# SUBDIRS are explicitly a listing of all the directories that make +# must recurse into BEFORE processing the current directory. +# +# These python scripts must be moved into a sub-directory, and _only_ +# executed IF they need to be, and all the nut-scanner sources need +# to be moved out of a sub-directory into this directory. +# +# Anyway, for the time being, we force build in ./ before nut-scanner, +# to have nutscan-{usb,snmp}.h built before going into the nut-scanner +# sub-directory SUBDIRS = . nut-scanner -EXTRA_DIST = nut-usbinfo.pl nut-hclinfo.py device-recorder.sh svn2cl.authors nut-snmpinfo.py +EXTRA_DIST = nut-usbinfo.pl nut-hclinfo.py nut-recorder.sh svn2cl.authors nut-snmpinfo.py all: all-recursive .SUFFIXES: @@ -640,6 +655,10 @@ uninstall-am: all: nut-scanner-deps +# XXX these rules are all bogus! They cause un-named target files to +# always be rebuilt! None of that is ever the right way to use make, +# and especially not Automake. Explicit filenames and their exact +# dependencies need to be properly listed. nut-scanner-deps: @if python -c 1; then \ echo "Regenerating the SNMP helper files."; \ diff --git a/tools/device-recorder.sh b/tools/nut-recorder.sh similarity index 80% rename from tools/device-recorder.sh rename to tools/nut-recorder.sh index 5b55a99..e2785c0 100755 --- a/tools/device-recorder.sh +++ b/tools/nut-recorder.sh @@ -1,16 +1,20 @@ #!/bin/sh ################################################################################ # -# device-recorder.sh -# 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. +# nut-recorder +# An utility to record device running sequence (Ie power failures or any +# other change) and dump it in a .seq format +# The .seq file can then be used by the 'dummy-ups driver to replay the +# sequence. # ################################################################################ # FIXME: -# - implement PAUSE / RESUME (do not increment TIMER) on pressing space +# - implement PAUSE / RESUME (do not increment TIMER) on pressing space (?) +# - implement support for creating either .dev (static dump) or .seq +# - implement dump of instcmd and upsrw ################################################################################ -strUsage="Usage: dummy-recorder.sh [output-file] [interval]" +strUsage="Usage: nut-recorder [output-file] [interval]" # log data each 5 seconds DEFAULT_INTERVAL=5 @@ -18,7 +22,7 @@ DEFAULT_INTERVAL=5 # temporary files location TEMP_DIR="/tmp" -# output to dummy-device.dev by default +# output this file by default DEFAULT_OUTPUT="dummy-device.seq" # Process command line parameters diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 0656e49..d4066d2 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -11,7 +11,7 @@ endif libnutscan_la_SOURCES = scan_nut.c scan_ipmi.c \ nutscan-device.c nutscan-ip.c nutscan-display.c nutscan-init.c \ scan_usb.c scan_snmp.c scan_xml_http.c scan_avahi.c -libnutscan_la_LIBADD = ../../clients/libupsclient.la $(NETLIBS) $(LIBLTDL_LIBS) +libnutscan_la_LIBADD = $(NETLIBS) $(LIBLTDL_LIBS) libnutscan_la_LDFLAGS = -version-info 1:0:0 libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include $(LIBLTDL_CFLAGS) diff --git a/tools/nut-scanner/Makefile.in b/tools/nut-scanner/Makefile.in index cf53410..9396c58 100644 --- a/tools/nut-scanner/Makefile.in +++ b/tools/nut-scanner/Makefile.in @@ -105,9 +105,8 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = @WITH_SSL_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) -libnutscan_la_DEPENDENCIES = ../../clients/libupsclient.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_2) +libnutscan_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) am_libnutscan_la_OBJECTS = libnutscan_la-scan_nut.lo \ libnutscan_la-scan_ipmi.lo libnutscan_la-nutscan-device.lo \ libnutscan_la-nutscan-ip.lo libnutscan_la-nutscan-display.lo \ @@ -229,6 +228,7 @@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OS_NAME = @OS_NAME@ @@ -242,6 +242,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDPATH = @PIDPATH@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -249,6 +250,7 @@ PORT = @PORT@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ +SBINDIR = @SBINDIR@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ @@ -328,8 +330,7 @@ libnutscan_la_SOURCES = scan_nut.c scan_ipmi.c \ nutscan-device.c nutscan-ip.c nutscan-display.c nutscan-init.c \ scan_usb.c scan_snmp.c scan_xml_http.c scan_avahi.c -libnutscan_la_LIBADD = ../../clients/libupsclient.la $(NETLIBS) \ - $(LIBLTDL_LIBS) $(am__append_2) +libnutscan_la_LIBADD = $(NETLIBS) $(LIBLTDL_LIBS) $(am__append_2) libnutscan_la_LDFLAGS = -version-info 1:0:0 libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include \ $(LIBLTDL_CFLAGS) $(am__append_1) $(am__append_3) \ diff --git a/tools/nut-scanner/nut-scanner.c b/tools/nut-scanner/nut-scanner.c index 2114674..b6cd221 100644 --- a/tools/nut-scanner/nut-scanner.c +++ b/tools/nut-scanner/nut-scanner.c @@ -470,5 +470,8 @@ display_help: display_func(dev[TYPE_IPMI]); nutscan_free_device(dev[TYPE_IPMI]); + + nutscan_free(); + return EXIT_SUCCESS; } diff --git a/tools/nut-scanner/nutscan-init.c b/tools/nut-scanner/nutscan-init.c index f668546..16ea760 100644 --- a/tools/nut-scanner/nutscan-init.c +++ b/tools/nut-scanner/nutscan-init.c @@ -18,10 +18,11 @@ */ #include "common.h" +#include int nutscan_avail_avahi = 0; int nutscan_avail_ipmi = 0; -int nutscan_avail_nut = 1; +int nutscan_avail_nut = 0; int nutscan_avail_snmp = 0; int nutscan_avail_usb = 0; int nutscan_avail_xml_http = 0; @@ -31,6 +32,7 @@ int nutscan_load_snmp_library(void); int nutscan_load_neon_library(void); int nutscan_load_avahi_library(void); int nutscan_load_ipmi_library(void); +int nutscan_load_upsclient_library(void); void nutscan_init(void) { @@ -49,4 +51,27 @@ void nutscan_init(void) #ifdef WITH_FREEIPMI nutscan_avail_ipmi = nutscan_load_ipmi_library(); #endif + nutscan_avail_nut = nutscan_load_upsclient_library(); +} + +void nutscan_free(void) +{ + if( nutscan_avail_usb ) { + lt_dlexit(); + } + if( nutscan_avail_snmp ) { + lt_dlexit(); + } + if( nutscan_avail_xml_http ) { + lt_dlexit(); + } + if( nutscan_avail_avahi ) { + lt_dlexit(); + } + if( nutscan_avail_ipmi ) { + lt_dlexit(); + } + if( nutscan_avail_nut ) { + lt_dlexit(); + } } diff --git a/tools/nut-scanner/nutscan-init.h b/tools/nut-scanner/nutscan-init.h index e952e6c..f72e14e 100644 --- a/tools/nut-scanner/nutscan-init.h +++ b/tools/nut-scanner/nutscan-init.h @@ -27,4 +27,5 @@ extern int nutscan_avail_usb; extern int nutscan_avail_xml_http; void nutscan_init(void); +void nutscan_free(void); #endif diff --git a/tools/nut-scanner/nutscan-snmp.h b/tools/nut-scanner/nutscan-snmp.h index 7af6cef..069da20 100644 --- a/tools/nut-scanner/nutscan-snmp.h +++ b/tools/nut-scanner/nutscan-snmp.h @@ -38,7 +38,7 @@ static snmp_device_id_t snmp_device_table[] = { { ".1.3.6.1.4.1.318.1.1.1.1.1.1.0" , "apcc", NULL}, { ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1" , "baytech", NULL}, { ".1.3.6.1.4.1.3808.1.1.1.1.1.1.0" , "cyberpower", ".1.3.6.1.4.1.3808"}, - { "1.3.6.1.4.1.232.165.3.1.1.0" , "cpqpower", NULL}, + { ".1.3.6.1.4.1.232.165.3.1.1.0" , "cpqpower", ".1.3.6.1.4.1.232.165.3"}, { ".1.3.6.1.4.1.4555.1.1.1.1.1.1.0" , "netvision", ".1.3.6.1.4.1.4555.1.1.1"}, /* Terminating entry */ { NULL, NULL, NULL} diff --git a/tools/nut-scanner/nutscan-usb.h b/tools/nut-scanner/nutscan-usb.h index 89a39fc..a20fdb7 100644 --- a/tools/nut-scanner/nutscan-usb.h +++ b/tools/nut-scanner/nutscan-usb.h @@ -32,6 +32,7 @@ typedef struct { static usb_device_id_t usb_device_table[] = { { 0x0001, 0x0000, "blazer_usb" }, + { 0x03f0, 0x0001, "usbhid-ups" }, { 0x03f0, 0x1f01, "bcmxcp_usb" }, { 0x03f0, 0x1f02, "bcmxcp_usb" }, { 0x03f0, 0x1f06, "usbhid-ups" }, @@ -40,6 +41,12 @@ static usb_device_id_t usb_device_table[] = { { 0x03f0, 0x1f0a, "usbhid-ups" }, { 0x03f0, 0x1fe0, "usbhid-ups" }, { 0x03f0, 0x1fe1, "usbhid-ups" }, + { 0x03f0, 0x1fe2, "usbhid-ups" }, + { 0x03f0, 0x1fe3, "usbhid-ups" }, + { 0x03f0, 0x1fe5, "usbhid-ups" }, + { 0x03f0, 0x1fe6, "usbhid-ups" }, + { 0x03f0, 0x1fe7, "usbhid-ups" }, + { 0x03f0, 0x1fe8, "usbhid-ups" }, { 0x0463, 0x0001, "usbhid-ups" }, { 0x0463, 0xffff, "usbhid-ups" }, { 0x047c, 0xffff, "usbhid-ups" }, @@ -58,8 +65,11 @@ static usb_device_id_t usb_device_table[] = { { 0x0592, 0x0004, "usbhid-ups" }, { 0x05b8, 0x0000, "blazer_usb" }, { 0x0665, 0x5161, "blazer_usb" }, - { 0x06da, 0x0002, "bcmxcp_usb" }, + { 0x06da, 0x0002, "blazer_usb" }, { 0x06da, 0x0003, "blazer_usb" }, + { 0x06da, 0x0004, "blazer_usb" }, + { 0x06da, 0x0005, "blazer_usb" }, + { 0x06da, 0x0201, "blazer_usb" }, { 0x06da, 0xffff, "usbhid-ups" }, { 0x075d, 0x0300, "usbhid-ups" }, { 0x0764, 0x0005, "usbhid-ups" }, diff --git a/tools/nut-scanner/scan_avahi.c b/tools/nut-scanner/scan_avahi.c index 7763b36..6e33724 100644 --- a/tools/nut-scanner/scan_avahi.c +++ b/tools/nut-scanner/scan_avahi.c @@ -36,6 +36,7 @@ #include /* dynamic link library stuff */ +static char * libname = "libavahi-client"; static lt_dlhandle dl_handle = NULL; static const char *dl_error = NULL; @@ -98,7 +99,7 @@ int nutscan_load_avahi_library() return 0; } - dl_handle = lt_dlopenext("libavahi-client"); + dl_handle = lt_dlopenext(libname); if (!dl_handle) { dl_error = lt_dlerror(); goto err; @@ -196,8 +197,10 @@ int nutscan_load_avahi_library() return 1; err: - fprintf(stderr, "%s\n", dl_error); + fprintf(stderr, "Cannot load AVAHI library (%s) : %s. AVAHI search disabled.\n", libname, dl_error); + dl_handle = (void *)1; + lt_dlexit(); return 0; } /* end of dynamic link library stuff */ diff --git a/tools/nut-scanner/scan_ipmi.c b/tools/nut-scanner/scan_ipmi.c index eac17c3..d47ee52 100644 --- a/tools/nut-scanner/scan_ipmi.c +++ b/tools/nut-scanner/scan_ipmi.c @@ -29,6 +29,7 @@ #define NUT_IPMI_DRV_NAME "nut-ipmipsu" /* dynamic link library stuff */ +static char * libname = "libfreeipmi"; static lt_dlhandle dl_handle = NULL; static const char *dl_error = NULL; @@ -77,7 +78,7 @@ int nutscan_load_ipmi_library() return 0; } - dl_handle = lt_dlopenext("libfreeipmi"); + dl_handle = lt_dlopenext(libname); if (!dl_handle) { dl_error = lt_dlerror(); goto err; @@ -163,8 +164,9 @@ int nutscan_load_ipmi_library() return 1; err: - fprintf(stderr, "%s\n", dl_error); + fprintf(stderr, "Cannot load IPMI library (%s) : %s. IPMI search disabled.\n", libname, dl_error); dl_handle = (void *)1; + lt_dlexit(); return 0; } /* end of dynamic link library stuff */ diff --git a/tools/nut-scanner/scan_nut.c b/tools/nut-scanner/scan_nut.c index 5fb8b70..55df68c 100644 --- a/tools/nut-scanner/scan_nut.c +++ b/tools/nut-scanner/scan_nut.c @@ -23,7 +23,20 @@ #ifdef HAVE_PTHREAD #include #endif +#include +/* dynamic link library stuff */ +static char * libname = "libupsclient"; +static lt_dlhandle dl_handle = NULL; +static const char *dl_error = NULL; + +static int (*nut_upscli_splitaddr)(const char *buf,char **hostname, int *port); +static int (*nut_upscli_tryconnect)(UPSCONN_t *ups, const char *host, int port, + int flags,struct timeval * timeout); +static int (*nut_upscli_list_start)(UPSCONN_t *ups, unsigned int numq, + const char **query); +static int (*nut_upscli_list_next)(UPSCONN_t *ups, unsigned int numq, + const char **query,unsigned int *numa, char ***answer); static nutscan_device_t * dev_ret = NULL; #ifdef HAVE_PTHREAD @@ -35,6 +48,64 @@ struct scan_nut_arg { long timeout; }; +/* return 0 on error */ +int nutscan_load_upsclient_library() +{ + + if( dl_handle != NULL ) { + /* if previous init failed */ + if( dl_handle == (void *)1 ) { + return 0; + } + /* init has already been done */ + return 1; + } + + if( lt_dlinit() != 0 ) { + fprintf(stderr, "Error initializing lt_init\n"); + return 0; + } + + dl_handle = lt_dlopenext(libname); + if (!dl_handle) { + dl_error = lt_dlerror(); + goto err; + } + + lt_dlerror(); /* Clear any existing error */ + + *(void **) (&nut_upscli_splitaddr) = lt_dlsym(dl_handle, + "upscli_splitaddr"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } + + *(void **) (&nut_upscli_tryconnect) = lt_dlsym(dl_handle, + "upscli_tryconnect"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } + + *(void **) (&nut_upscli_list_start) = lt_dlsym(dl_handle, + "upscli_list_start"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } + + *(void **) (&nut_upscli_list_next) = lt_dlsym(dl_handle, + "upscli_list_next"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } + + return 1; +err: + fprintf(stderr, "Cannot load NUT library (%s) : %s. NUT search disabled.\n", libname, dl_error); + dl_handle = (void *)1; + lt_dlexit(); + return 0; +} + /* FIXME: SSL support */ static void * list_nut_devices(void * arg) { @@ -56,28 +127,32 @@ static void * list_nut_devices(void * arg) query[0] = "UPS"; numq = 1; - if (upscli_splitaddr(target_hostname, &hostname, &port) != 0) { + if ((*nut_upscli_splitaddr)(target_hostname, &hostname, &port) != 0) { free(target_hostname); free(nut_arg); + free(ups); return NULL; } - if (upscli_tryconnect(ups, hostname, port,UPSCLI_CONN_TRYSSL,&tv) < 0) { + if ((*nut_upscli_tryconnect)(ups, hostname, port,UPSCLI_CONN_TRYSSL,&tv) < 0) { free(target_hostname); free(nut_arg); + free(ups); return NULL; } - if(upscli_list_start(ups, numq, query) < 0) { + if((*nut_upscli_list_start)(ups, numq, query) < 0) { free(target_hostname); free(nut_arg); + free(ups); return NULL; } - while (upscli_list_next(ups, numq, query, &numa, &answer) == 1) { + while ((*nut_upscli_list_next)(ups,numq, query, &numa, &answer) == 1) { /* UPS */ if (numa < 3) { free(target_hostname); free(nut_arg); + free(ups); return NULL; } /* FIXME: check for duplication by getting driver.port and device.serial @@ -109,6 +184,7 @@ static void * list_nut_devices(void * arg) free(target_hostname); free(nut_arg); + free(ups); return NULL; } diff --git a/tools/nut-scanner/scan_snmp.c b/tools/nut-scanner/scan_snmp.c index 32b2b1f..cba4c46 100644 --- a/tools/nut-scanner/scan_snmp.c +++ b/tools/nut-scanner/scan_snmp.c @@ -56,19 +56,25 @@ #endif #include "nutscan-snmp.h" +/* Address API change */ +#ifndef usmAESPrivProtocol +#define USMAESPRIVPROTOCOL "usmAES128PrivProtocol" +#else +#define USMAESPRIVPROTOCOL "usmAESPrivProtocol" +#endif #define SysOID ".1.3.6.1.2.1.1.2.0" static nutscan_device_t * dev_ret = NULL; #ifdef HAVE_PTHREAD static pthread_mutex_t dev_mutex; -static pthread_mutex_t lib_mutex; static pthread_t * thread_array = NULL; static int thread_count = 0; #endif long g_usec_timeout ; /* dynamic link library stuff */ +static char * libname = "libnetsnmp"; static lt_dlhandle dl_handle = NULL; static const char *dl_error = NULL; @@ -99,10 +105,6 @@ static oid * (*nut_usmDESPrivProtocol); /* return 0 on error */ int nutscan_load_snmp_library() { -#ifdef HAVE_PTHREAD - pthread_mutex_lock(&lib_mutex); -#endif - if( dl_handle != NULL ) { /* if previous init failed */ if( dl_handle == (void *)1 ) { @@ -117,7 +119,7 @@ int nutscan_load_snmp_library() return 0; } - dl_handle = lt_dlopenext("libnetsnmp"); + dl_handle = lt_dlopenext(libname); if (!dl_handle) { dl_error = lt_dlerror(); goto err; @@ -205,7 +207,7 @@ int nutscan_load_snmp_library() } *(void **) (&nut_usmAESPrivProtocol) = lt_dlsym(dl_handle, - "usmAESPrivProtocol"); + USMAESPRIVPROTOCOL); if ((dl_error = lt_dlerror()) != NULL) { goto err; } @@ -228,16 +230,11 @@ int nutscan_load_snmp_library() goto err; } -#ifdef HAVE_PTHREAD - pthread_mutex_unlock(&dev_mutex); -#endif return 1; err: - fprintf(stderr, "%s\n", dl_error); + fprintf(stderr, "Cannot load SNMP library (%s) : %s. SNMP search disabled.\n", libname, dl_error); dl_handle = (void *)1; -#ifdef HAVE_PTHREAD - pthread_mutex_unlock(&dev_mutex); -#endif + lt_dlexit(); return 0; } /* end of dynamic link library stuff */ @@ -660,7 +657,6 @@ nutscan_device_t * nutscan_scan_snmp(const char * start_ip, const char * stop_ip pthread_t thread; pthread_mutex_init(&dev_mutex,NULL); - pthread_mutex_init(&lib_mutex,NULL); #endif if( !nutscan_avail_snmp ) { diff --git a/tools/nut-scanner/scan_usb.c b/tools/nut-scanner/scan_usb.c index 3fac8a6..d6e1e4e 100644 --- a/tools/nut-scanner/scan_usb.c +++ b/tools/nut-scanner/scan_usb.c @@ -28,6 +28,7 @@ #include /* dynamic link library stuff */ +static char * libname = "libusb"; static lt_dlhandle dl_handle = NULL; static const char *dl_error = NULL; static int (*nut_usb_close)(usb_dev_handle *dev); @@ -57,7 +58,7 @@ int nutscan_load_usb_library() return 0; } - dl_handle = lt_dlopenext("libusb"); + dl_handle = lt_dlopenext(libname); if (!dl_handle) { dl_error = lt_dlerror(); goto err; @@ -106,8 +107,9 @@ int nutscan_load_usb_library() return 1; err: - fprintf(stderr, "%s\n", dl_error); + fprintf(stderr, "Cannot load USB library (%s) : %s. USB search disabled.\n", libname, dl_error); dl_handle = (void *)1; + lt_dlexit(); return 0; } /* end of dynamic link library stuff */ diff --git a/tools/nut-scanner/scan_xml_http.c b/tools/nut-scanner/scan_xml_http.c index b66f42f..d4bd220 100644 --- a/tools/nut-scanner/scan_xml_http.c +++ b/tools/nut-scanner/scan_xml_http.c @@ -33,6 +33,7 @@ #include /* dynamic link library stuff */ +static char * libname = "libneon"; static lt_dlhandle dl_handle = NULL; static const char *dl_error = NULL; @@ -63,7 +64,7 @@ int nutscan_load_neon_library() return 0; } - dl_handle = lt_dlopenext("libneon"); + dl_handle = lt_dlopenext(libname); if (!dl_handle) { dl_error = lt_dlerror(); goto err; @@ -93,8 +94,9 @@ int nutscan_load_neon_library() return 1; err: - fprintf(stderr, "%s\n", dl_error); + fprintf(stderr, "Cannot load XML library (%s) : %s. XML search disabled.\n", libname, dl_error); dl_handle = (void *)1; + lt_dlexit(); return 0; } @@ -210,7 +212,7 @@ nutscan_device_t * nutscan_scan_xml_http(long usec_timeout) ne_xml_parser *parser = (*nut_ne_xml_create)(); (*nut_ne_xml_push_handler)(parser, startelm_cb, NULL, NULL, nut_dev); - (*nut_ne_xml_parse)(parser, buf, strlen(buf)); + (*nut_ne_xml_parse)(parser, buf, recv_size); (*nut_ne_xml_destroy)(parser); nut_dev->driver = strdup("netxml-ups"); diff --git a/tools/nut-usbinfo.pl b/tools/nut-usbinfo.pl index 7833086..bd80000 100755 --- a/tools/nut-usbinfo.pl +++ b/tools/nut-usbinfo.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl -# Current Version : 1.1 -# Copyright (C) 2008 - 2011 +# Current Version : 1.2 +# Copyright (C) 2008 - 2012 # Arnaud Quette # dloic (loic.dardant AT gmail DOT com) # @@ -20,7 +20,11 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + +# TODO list: +# - rewrite using glob, as in other helper scripts +# - manage deps in Makefile.am + use File::Find; use strict; @@ -211,7 +215,8 @@ sub gen_usb_files sub find_usbdevs { - return $File::Find::prune = 1 if $_ eq '.svn'; + # maybe there's an option to turn off all .* files, but anyway this is stupid + return $File::Find::prune = 1 if ($_ eq '.svn') || ($_ =~ /^\.#/); my $nameFile=$_; my $lastComment=""; diff --git a/tools/svn2cl.authors b/tools/svn2cl.authors index 99086b3..660317e 100644 --- a/tools/svn2cl.authors +++ b/tools/svn2cl.authors @@ -11,3 +11,11 @@ fbohe-guest:Frederic Bohe aquette:Arnaud Quette clepple-guest:Charles Lepple adkorte-guest:Arjen de Korte +selinger-guest:Peter Selinger +carlosefr-guest:Carlos Rodrigues +nba-guest:Niels Baggesen +lyrgard-guest:Jonathan Dion +jongough-guest:Jon Gough +mihl-guest:Michal Hlavinka +acolombier-guest:Antoine Colombier +