apcupsd-3.14.10/0000775000076400007640000000000011634011374012223 5ustar adk0212adk0212apcupsd-3.14.10/autoconf/0000775000076400007640000000000011634011374014041 5ustar adk0212adk0212apcupsd-3.14.10/autoconf/acconfig.h0000664000076400007640000001117511177663032015776 0ustar adk0212adk0212/* acconfig.h This file is in the public domain. Descriptive text for the C preprocessor macros that the distributed Autoconf macros can define. No software package will use all of them; autoheader copies the ones your configure.in uses into your configuration header file templates. The entries are in sort -df order: alphabetical, case insensitive, ignoring punctuation (such as underscores). Although this order can split up related entries, it makes it easier to check whether a given entry is in the file. Leave the following blank line there!! Autoheader needs it. */ /* Define to 1 if NLS is requested. */ #undef ENABLE_NLS /* Define as 1 if you have catgets and don't want to use GNU gettext. */ #undef HAVE_CATGETS /* Define as 1 if you have gettext and don't want to use GNU gettext. */ #undef HAVE_GETTEXT /* Define if you have herror available in your bind library */ #undef HAVE_HERROR /* Define if your locale.h file contains LC_MESSAGES. */ #undef HAVE_LC_MESSAGES /* Define if you have res_search available in your bind library */ #undef HAVE_RES_SEARCH /* Define if you have strftime() */ #undef HAVE_STRFTIME /* Define as 1 if you have the stpcpy function. */ #undef HAVE_STPCPY /* Define if your C compiler allows void * as a function result */ #undef HAVE_VOIDPOINTER /* Define if your C compiler allows ANSI volatile */ #undef HAVE_VOLATILE /* Define if `union wait' is the type of the first arg to wait functions. */ #undef HAVE_UNION_WAIT /* Define if you have the strcasecmp function. */ #undef HAVE_STRCASECMP /* Define if you have the memmove function. */ #undef HAVE_MEMMOVE /* Define if you have GNU's getopt family of functions. */ #undef HAVE_GETOPTLONG /* Define if you have strstr */ #undef HAVE_STRSTR /* Define if you have localtime_r */ #undef HAVE_LOCALTIME_R /* Define if you have inet_pton */ #undef HAVE_INETPTON /* Define if you have vsyslog */ #undef HAVE_VSYSLOG /* Define if you have atexit */ #undef HAVE_ATEXIT /* Define if you have on_exit */ #undef HAVE_ON_EXIT /* Define if you have setrlimit */ #undef HAVE_SETRLIMIT /* Define if you have setproctitle */ #undef HAVE_SETPROCTITLE /* Define to the name of the distribution. */ #undef PACKAGE /* Define to help us deduce a 32-bit type (unneeded) */ #undef SIZEOF_INT #undef SIZEOF_SHORT #undef SIZEOF_LONG /* Define to the host we are compiling for. */ #undef HOST /* Define the default pid files directory. */ #undef PIDDIR /* Define the default "log" files directory. */ #undef LOGDIR /* Define the default serial port lock directory */ #undef LOCKDIR /* Define the default serial port device */ #undef SERIALDEV /* Network Information port */ #undef NISPORT /* Master/slave port */ #undef NETPORT /* UPSTYPE */ #undef UPSTYPE /* UPSCABLE */ #undef UPSCABLE /* tcp wrappers */ #undef HAVE_LIBWRAP /* ncurses */ #undef HAVE_MENU_H #undef HAVE_NCURSES_MENU_H /* OSes */ #undef HAVE_LINUX_OS #undef HAVE_FREEBSD_OS #undef HAVE_NETBSD_OS #undef HAVE_OPENBSD_OS #undef HAVE_BSDI_OS #undef HAVE_HPUX_OS #undef HAVE_SUN_OS #undef HAVE_AIX_OS #undef HAVE_SGI_OS #undef HAVE_CYGWIN #undef HAVE_OSF1_OS #undef HAVE_OPENSERVER_OS #undef HAVE_DARWIN_OS #undef HAVE_QNX_OS /* Compiler */ #undef HAVE_GCC /* sysconfdir */ #undef SYSCONFDIR /* Power fail dir */ #undef PWRFAILDIR /* nologdirr */ #undef NOLOGDIR #undef EXEEXT /* Win32 substitutions */ #undef WIN32 #undef WINLIBS #undef UTILPROGS /* Set if you have POSIX pthreads */ #undef HAVE_PTHREADS /* Set if you want Smart UPS support */ #undef HAVE_APCSMART_DRIVER /* Set if you want dumb support */ #undef HAVE_DUMB_DRIVER #undef HAVE_NANOSLEEP /* Set if you want NIS server support */ #undef HAVE_NISSERVER /* Set if you want NIS client support */ #undef HAVE_NET_DRIVER /* Set by configure if one of the two above are set */ #undef HAVE_NISLIB /* Set if you want USB support */ #undef HAVE_USB_DRIVER /* Set if you want SNMP support */ #undef HAVE_SNMP_DRIVER #undef HAVE_UCD_SNMP #undef HAVE_NET_SNMP /* Set if you want TEST driver */ #undef HAVE_TEST_DRIVER /* Set if you want the old master/slave network code */ #undef HAVE_OLDNET /* Set if you want to compile powerflute */ #undef HAVE_POWERFLUTE /* Definitions for GD graphic library */ #undef SYS_IMGFMT_PNG #undef SYS_IMGFMT_GIF #undef IMGFMT_GIF /* Set if have arps/nameser.h */ #undef HAVE_NAMESER_H /* Set if socklen_t defined */ #undef HAVE_SOCKLEN_T #undef SOCKLEN_T #undef HAVE_USLEEP /* Leave that blank line there!! Autoheader needs it. If you're adding to this file, keep in mind: The entries are in sort -df order: alphabetical, case insensitive, ignoring punctuation (such as underscores). */ apcupsd-3.14.10/autoconf/aclocal.m40000664000076400007640000002524311030300744015677 0ustar adk0212adk0212# Search path for a program which passes the given test. # Ulrich Drepper , 1996. # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU Public License # but which still want to provide support for the GNU gettext functionality. # Please note that the actual code is *not* freely available. # Define a conditional. AC_DEFUN(AM_CONDITIONAL, [AC_SUBST($1_TRUE) AC_SUBST($1_FALSE) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi]) AC_DEFUN(AC_TYPE_SOCKETLEN_T, [ dnl check for socklen_t (in Unix98) AC_MSG_CHECKING(for socklen_t) AC_TRY_COMPILE([ #include #include socklen_t x; ],[],[AC_MSG_RESULT(yes)],[ AC_TRY_COMPILE([ #include #include int accept (int, struct sockaddr *, size_t *); ],[],[ AC_MSG_RESULT(size_t) AC_DEFINE(socklen_t,size_t)], [ AC_MSG_RESULT(int) AC_DEFINE(socklen_t,int)])]) ]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # # Similar to PKG_CHECK_MODULES, make sure that the first instance of # this or PKG_CHECK_MODULES is called, or make sure to call # PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_ifval([$2], [$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$PKG_CONFIG"; then if test -n "$$1"; then pkg_cv_[]$1="$$1" else PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], [pkg_failed=yes]) fi else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags-only-I], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` else $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD ifelse([$4], , [AC_MSG_ERROR(dnl [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT ])], [$4]) elif test $pkg_failed = untried; then ifelse([$4], , [AC_MSG_FAILURE(dnl [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) ifelse([$3], , :, [$3]) fi[]dnl ])# PKG_CHECK_MODULES dnl @synopsis AX_FUNC_WHICH_GETHOSTBYNAME_R dnl dnl Determines which historical variant of the gethostbyname_r() call dnl (taking three, five, or six arguments) is available on the system dnl and defines one of the following macros accordingly: dnl dnl HAVE_FUNC_GETHOSTBYNAME_R_6 dnl HAVE_FUNC_GETHOSTBYNAME_R_5 dnl HAVE_FUNC_GETHOSTBYNAME_R_3 dnl dnl If used in conjunction with gethostname.c, the API demonstrated in dnl test.c can be used regardless of which gethostbyname_r() is dnl available. These example files can be found at dnl http://www.csn.ul.ie/~caolan/publink/gethostbyname_r dnl dnl based on David Arnold's autoconf suggestion in the threads faq dnl dnl Originally named "AC_caolan_FUNC_WHICH_GETHOSTBYNAME_R". Rewritten dnl for Autoconf 2.5x by Daniel Richard G. dnl dnl @category InstalledPackages dnl @author Caolan McNamara dnl @author Daniel Richard G. dnl @version 2005-01-21 dnl @license GPLWithACException AC_DEFUN([AX_FUNC_WHICH_GETHOSTBYNAME_R], [ AC_LANG_PUSH(C) AC_MSG_CHECKING([how many arguments gethostbyname_r() takes]) AC_CACHE_VAL(ac_cv_func_which_gethostbyname_r, [ ################################################################ ac_cv_func_which_gethostbyname_r=unknown # # ONE ARGUMENT (sanity check) # # This should fail, as there is no variant of gethostbyname_r() that takes # a single argument. If it actually compiles, then we can assume that # netdb.h is not declaring the function, and the compiler is thereby # assuming an implicit prototype. In which case, we're out of luck. # AC_COMPILE_IFELSE( AC_LANG_PROGRAM( [[#include ]], [[ char *name = "www.gnu.org"; (void)gethostbyname_r(name) /* ; */ ]]), ac_cv_func_which_gethostbyname_r=no) # # SIX ARGUMENTS # (e.g. Linux) # if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then AC_COMPILE_IFELSE( AC_LANG_PROGRAM( [[#include ]], [[ char *name = "www.gnu.org"; struct hostent ret, *retp; char buf@<:@1024@:>@; int buflen = 1024; int my_h_errno; (void)gethostbyname_r(name, &ret, buf, buflen, &retp, &my_h_errno) /* ; */ ]]), ac_cv_func_which_gethostbyname_r=six) fi # # FIVE ARGUMENTS # (e.g. Solaris) # if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then AC_COMPILE_IFELSE( AC_LANG_PROGRAM( [[#include ]], [[ char *name = "www.gnu.org"; struct hostent ret; char buf@<:@1024@:>@; int buflen = 1024; int my_h_errno; (void)gethostbyname_r(name, &ret, buf, buflen, &my_h_errno) /* ; */ ]]), ac_cv_func_which_gethostbyname_r=five) fi # # THREE ARGUMENTS # (e.g. AIX, HP-UX, Tru64) # if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then AC_COMPILE_IFELSE( AC_LANG_PROGRAM( [[#include ]], [[ char *name = "www.gnu.org"; struct hostent ret; struct hostent_data data; (void)gethostbyname_r(name, &ret, &data) /* ; */ ]]), ac_cv_func_which_gethostbyname_r=three) fi ################################################################ ]) dnl end AC_CACHE_VAL case "$ac_cv_func_which_gethostbyname_r" in three) AC_MSG_RESULT([three]) AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_3) ;; five) AC_MSG_RESULT([five]) AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_5) ;; six) AC_MSG_RESULT([six]) AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_6) ;; no) AC_MSG_RESULT([cannot find function declaration in netdb.h]) ;; unknown) AC_MSG_RESULT([can't tell]) ;; *) AC_MSG_ERROR([internal error]) ;; esac AC_LANG_POP(C) ]) dnl end AC_DEFUN dnl dnl Find GNU make dnl AC_DEFUN( [AC_PROG_GMAKE], [AC_CACHE_CHECK(for GNU make,_cv_gnu_make_command, _cv_gnu_make_command='' ; dnl Search all the common names for GNU make for a in "$MAKE" make gmake gnumake ; do if test -z "$a" ; then continue ; fi ; if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then _cv_gnu_make_command=$a ; break; fi done ; ) ; MAKE=$_cv_gnu_make_command; if test -z "$_cv_gnu_make_command" ; then AC_MSG_ERROR([Could not find GNU make]) ; fi ; ] ) dnl dnl AC_PATH_PROGS but fail with an error if none can be found dnl AC_DEFUN( [AC_REQ_PATH_PROGS], [AC_PATH_PROGS($1,$2,) if test "$$1" = "" ; then AC_ERROR(Missing required tool; need any one of: $2) fi ]) dnl dnl AC_PATH_PROG but fail with an error if it cannot be found dnl AC_DEFUN( [AC_REQ_PATH_PROG], [AC_PATH_PROG($1,$2,) if test "$$1" = "" ; then AC_ERROR(Missing required tool: $2) fi ]) apcupsd-3.14.10/autoconf/autoregen.sh0000775000076400007640000000103207523057007016372 0ustar adk0212adk0212#!/bin/sh # # Simple script for regenerating the autoconf and autoheader files. # autoconf --localdir=autoconf autoconf/configure.in > configure chmod 755 configure autoheader --localdir=autoconf autoconf/configure.in > autoconf/config.h.in ./configure --enable-powerflute --enable-cgi --enable-nls --with-included-gettext --with-catgets --with-libwrap=yes --enable-usb --enable-snmp --enable-net --enable-test --enable-pthreads --enable-oldnet if [ "$1" != "config" ] then make if [ "$1" != "compile" ] then make distclean fi fi apcupsd-3.14.10/autoconf/config.guess0000664000076400007640000011227407474703530016376 0ustar adk0212adk0212#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. timestamp='2001-07-12' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Written by Per Bothner . # Please send patches to . # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int dummy(){}" > $dummy.c ; for c in cc gcc c89 ; do ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; if test $? = 0 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # Netbsd (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # Determine the machine/vendor (is the vendor relevant). case "${UNAME_MACHINE}" in amiga) machine=m68k-unknown ;; arm32) machine=arm-unknown ;; atari*) machine=m68k-atari ;; sun3*) machine=m68k-sun ;; mac68k) machine=m68k-apple ;; macppc) machine=powerpc-apple ;; hp3[0-9][05]) machine=m68k-hp ;; ibmrt|romp-ibm) machine=romp-ibm ;; *) machine=${UNAME_MACHINE}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE}" in i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; arc64:OpenBSD:*:*) echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hkmips:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) case "${HPUX_REV}" in 11.[0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; esac ;; esac fi ;; esac if [ "${HP_ARCH}" = "" ]; then sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF eval $set_cc_for_build (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; hppa*:OpenBSD:*:*) echo hppa-unknown-openbsd exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*X-MP:*:*:*) echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in big) echo mips-unknown-linux-gnu && exit 0 ;; little) echo mipsel-unknown-linux-gnu && exit 0 ;; esac ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev67 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. ld_supported_targets=`cd /; ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf cat >$dummy.c < #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 printf ("%s-pc-linux-gnu\n", argv[1]); # else printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif # else printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif #else printf ("%s-pc-linux-gnuaout\n", argv[1]); #endif return 0; } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) if test "${UNAME_MACHINE}" = "x86pc"; then UNAME_MACHINE=pc fi echo `uname -p`-${UNAME_MACHINE}-nto-qnx exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[KW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: apcupsd-3.14.10/autoconf/config.h.in0000664000076400007640000002702311271707467016104 0ustar adk0212adk0212/* autoconf/config.h.in. Generated automatically from autoconf/configure.in by autoheader. */ /* Define if using alloca.c. */ #undef C_ALLOCA /* Define to empty if the keyword does not work. */ #undef const /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. This function is required for alloca.c support on those systems. */ #undef CRAY_STACKSEG_END /* Define to the type of elements in the array set by `getgroups'. Usually this is either `int' or `gid_t'. */ #undef GETGROUPS_T /* Define to `int' if doesn't define. */ #undef gid_t /* Define if you have alloca, as a function or macro. */ #undef HAVE_ALLOCA /* Define if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define if you have the strftime function. */ #undef HAVE_STRFTIME /* Define if you have the ANSI # stringizing operator in cpp. */ #undef HAVE_STRINGIZE /* Define if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define if your struct tm has tm_zone. */ #undef HAVE_TM_ZONE /* Define if you don't have tm_zone but do have the external array tzname. */ #undef HAVE_TZNAME /* Define as __inline if that's what the C compiler calls it. */ #undef inline /* Define to `int' if doesn't define. */ #undef mode_t /* Define if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Define to `long' if doesn't define. */ #undef off_t /* Define to `int' if doesn't define. */ #undef pid_t /* Define if you need to in order for stat and other things to work. */ #undef _POSIX_SOURCE /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE /* Define if the `setpgrp' function takes no argument. */ #undef SETPGRP_VOID /* Define to `unsigned' if doesn't define. */ #undef size_t /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define if the `S_IS*' macros in do not work properly. */ #undef STAT_MACROS_BROKEN /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if your declares struct tm. */ #undef TM_IN_SYS_TIME /* Define to `int' if doesn't define. */ #undef uid_t /* Define to 1 if NLS is requested. */ #undef ENABLE_NLS /* Define as 1 if you have catgets and don't want to use GNU gettext. */ #undef HAVE_CATGETS /* Define as 1 if you have gettext and don't want to use GNU gettext. */ #undef HAVE_GETTEXT /* Define if your locale.h file contains LC_MESSAGES. */ #undef HAVE_LC_MESSAGES /* Define if you have strftime() */ #undef HAVE_STRFTIME /* Define as 1 if you have the stpcpy function. */ #undef HAVE_STPCPY /* Define if `union wait' is the type of the first arg to wait functions. */ #undef HAVE_UNION_WAIT /* Define if you have the strcasecmp function. */ #undef HAVE_STRCASECMP /* Define if you have the memmove function. */ #undef HAVE_MEMMOVE /* Define if you have GNU's getopt family of functions. */ #undef HAVE_GETOPTLONG /* Define if you have strstr */ #undef HAVE_STRSTR /* Define if you have localtime_r */ #undef HAVE_LOCALTIME_R /* Define if you have inet_pton */ #undef HAVE_INETPTON /* Define if you have setproctitle */ #undef HAVE_SETPROCTITLE /* Define to the name of the distribution. */ #undef PACKAGE /* Define to the host we are compiling for. */ #undef HOST /* Define the default pid files directory. */ #undef PIDDIR /* Define the default "log" files directory. */ #undef LOGDIR /* Network Information port */ #undef NISPORT /* tcp wrappers */ #undef HAVE_LIBWRAP /* OSes */ #undef HAVE_LINUX_OS #undef HAVE_FREEBSD_OS #undef HAVE_NETBSD_OS #undef HAVE_OPENBSD_OS #undef HAVE_BSDI_OS #undef HAVE_HPUX_OS #undef HAVE_SUN_OS #undef HAVE_AIX_OS #undef HAVE_SGI_OS #undef HAVE_OSF1_OS #undef HAVE_OPENSERVER_OS #undef HAVE_DARWIN_OS #undef HAVE_QNX_OS #undef HAVE_MINGW /* Compiler */ #undef HAVE_GCC /* sysconfdir */ #undef SYSCONFDIR /* Power fail dir */ #undef PWRFAILDIR /* nologdirr */ #undef NOLOGDIR #undef EXEEXT /* Win32 substitutions */ #undef WIN32 /* Set if you have POSIX pthreads */ #undef HAVE_PTHREADS /* Set if you want Smart UPS support */ #undef HAVE_APCSMART_DRIVER /* Set if you want dumb support */ #undef HAVE_DUMB_DRIVER /* Set if you want NIS server support */ #undef HAVE_NISSERVER /* Set if you want NIS client support */ #undef HAVE_NET_DRIVER /* Set by configure if one of the two above are set */ #undef HAVE_NISLIB /* Set if you want USB support */ #undef HAVE_USB_DRIVER /* Set if you want SNMP support */ #undef HAVE_SNMP_DRIVER /* Set if you want SNMP Lite support */ #undef HAVE_SNMPLITE_DRIVER #undef HAVE_UCD_SNMP #undef HAVE_NET_SNMP /* Set if you want TEST driver */ #undef HAVE_TEST_DRIVER /* Set if you want PCNET driver */ #undef HAVE_PCNET_DRIVER /* Set if you want the old master/slave network code */ #undef HAVE_OLDNET /* Set if you want to compile powerflute */ #undef HAVE_POWERFLUTE /* Definitions for GD graphic library */ #undef SYS_IMGFMT_PNG #undef SYS_IMGFMT_GIF #undef IMGFMT_GIF /* Set if have arps/nameser.h */ #undef HAVE_NAMESER_H /* Set if socklen_t defined */ #undef HAVE_SOCKLEN_T /* Define if you have the __argz_count function. */ #undef HAVE___ARGZ_COUNT /* Define if you have the __argz_next function. */ #undef HAVE___ARGZ_NEXT /* Define if you have the __argz_stringify function. */ #undef HAVE___ARGZ_STRINGIFY /* Define if you have the abort function. */ #undef HAVE_ABORT /* Define if you have the calloc function. */ #undef HAVE_CALLOC /* Define if you have the dcgettext function. */ #undef HAVE_DCGETTEXT /* Define if you have the fork function. */ #undef HAVE_FORK /* Define if you have the getcwd function. */ #undef HAVE_GETCWD /* Define if you have the getpagesize function. */ #undef HAVE_GETPAGESIZE /* Define if you have the getpid function. */ #undef HAVE_GETPID /* Define if you have the ioctl function. */ #undef HAVE_IOCTL /* Define if you have the kill function. */ #undef HAVE_KILL /* Define if you have the munmap function. */ #undef HAVE_MUNMAP /* Define if you have the putenv function. */ #undef HAVE_PUTENV /* Define if you have the rewind function. */ #undef HAVE_REWIND /* Define if you have the select function. */ #undef HAVE_SELECT /* Define if you have the setenv function. */ #undef HAVE_SETENV /* Define if you have the setlocale function. */ #undef HAVE_SETLOCALE /* Define if you have the setpgrp function. */ #undef HAVE_SETPGRP /* Define if you have the setsid function. */ #undef HAVE_SETSID /* Define if you have the shmctl function. */ #undef HAVE_SHMCTL /* Define if you have the signal function. */ #undef HAVE_SIGNAL /* Define if you have the snprintf function. */ #undef HAVE_SNPRINTF /* Define if you have the stpcpy function. */ #undef HAVE_STPCPY /* Define if you have the strcasecmp function. */ #undef HAVE_STRCASECMP /* Define if you have the strchr function. */ #undef HAVE_STRCHR /* Define if you have the strdup function. */ #undef HAVE_STRDUP /* Define if you have the strerror function. */ #undef HAVE_STRERROR /* Define if you have the strncmp function. */ #undef HAVE_STRNCMP /* Define if you have the strncpy function. */ #undef HAVE_STRNCPY /* Define if you have the tcgetattr function. */ #undef HAVE_TCGETATTR /* Define if you have the vfprintf function. */ #undef HAVE_VFPRINTF /* Define if you have the vsnprintf function. */ #undef HAVE_VSNPRINTF /* Define if you have the wait function. */ #undef HAVE_WAIT /* Define if you have the wait3 function. */ #undef HAVE_WAIT3 /* Define if you have the waitpid function. */ #undef HAVE_WAITPID /* Define if you have the header file. */ #undef HAVE_ARGZ_H /* Define if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define if you have the header file. */ #undef HAVE_ARPA_NAMESER_H /* Define if you have the header file. */ #undef HAVE_CTYPE_H /* Define if you have the header file. */ #undef HAVE_CURSES_H /* Define if you have the header file. */ #undef HAVE_ERRNO_H /* Define if you have the header file. */ #undef HAVE_FCNTL_H /* Define if you have the header file. */ #undef HAVE_LIMITS_H /* Define if you have the header file. */ #undef HAVE_LOCALE_H /* Define if you have the header file. */ #undef HAVE_MALLOC_H /* Define if you have the header file. */ #undef HAVE_MENU_H /* Define if you have the header file. */ #undef HAVE_NCURSES_CURSES_H /* Define if you have the header file. */ #undef HAVE_NCURSES_MENU_H /* Define if you have the header file. */ #undef HAVE_NCURSES_PANEL_H /* Define if you have the header file. */ #undef HAVE_NETDB_H /* Define if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define if you have the header file. */ #undef HAVE_NL_TYPES_H /* Define if you have the header file. */ #undef HAVE_PANEL_H /* Define if you have the header file. */ #undef HAVE_PWD_H /* Define if you have the header file. */ #undef HAVE_SIGNAL_H /* Define if you have the header file. */ #undef HAVE_STDARG_H /* Define if you have the header file. */ #undef HAVE_STDIO_H /* Define if you have the header file. */ #undef HAVE_STDLIB_H /* Define if you have the header file. */ #undef HAVE_STRING_H /* Define if you have the header file. */ #undef HAVE_STRINGS_H /* Define if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define if you have the header file. */ #undef HAVE_SYS_IPC_H /* Define if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define if you have the header file. */ #undef HAVE_SYS_SEM_H /* Define if you have the header file. */ #undef HAVE_SYS_SHM_H /* Define if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define if you have the header file. */ #undef HAVE_SYSLOG_H /* Define if you have the header file. */ #undef HAVE_TERMIOS_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H /* Define if you have the i library (-li). */ #undef HAVE_LIBI /* Define if you have the inet library (-linet). */ #undef HAVE_LIBINET /* Define if you have the intl library (-lintl). */ #undef HAVE_LIBINTL /* Define if you have the nsl library (-lnsl). */ #undef HAVE_LIBNSL /* Define if you have the resolv library (-lresolv). */ #undef HAVE_LIBRESOLV /* Define if you have the socket library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define if you have the xnet library (-lxnet). */ #undef HAVE_LIBXNET #undef HAVE_NANOSLEEP #undef int32_t /* Which variant of gethostbyname_r() do we have */ #undef HAVE_FUNC_GETHOSTBYNAME_R_0 #undef HAVE_FUNC_GETHOSTBYNAME_R_3 #undef HAVE_FUNC_GETHOSTBYNAME_R_5 #undef HAVE_FUNC_GETHOSTBYNAME_R_6 apcupsd-3.14.10/autoconf/config.sub0000664000076400007640000006630507474703531016045 0ustar adk0212adk0212#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. timestamp='2001-06-08' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 \ | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ | hppa64 \ | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ | alphaev6[78] \ | we32k | ns16k | clipper | i370 | sh | sh[34] \ | powerpc | powerpcle \ | 1750a | dsp16xx | pdp10 | pdp11 \ | mips16 | mips64 | mipsel | mips64el \ | mips64orion | mips64orionel | mipstx39 | mipstx39el \ | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ | mips64vr5000 | mips64vr5000el | mcore | s390 | s390x \ | sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \ | v850 | c4x \ | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ | pj | pjl | h8500 | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. # FIXME: clean up the formatting here. vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ | xmp-* | ymp-* \ | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ | hppa2.0n-* | hppa64-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ | alphaev6[78]-* \ | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ | clipper-* | orion-* \ | sparclite-* | pdp10-* | pdp11-* | sh-* | sh[34]-* | sh[34]eb-* \ | powerpc-* | powerpcle-* | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ | mips16-* | mips64-* | mipsel-* \ | mips64el-* | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ | mipstx39-* | mipstx39el-* | mcore-* \ | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ | [cjt]90-* \ | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; [cjt]90) basic_machine=${basic_machine}-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=t3e-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; windows32) basic_machine=i386-pc os=-windows32-msvcrt ;; xmp) basic_machine=xmp-cray os=-unicos ;; xps | xps100) basic_machine=xps100-honeywell ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown else basic_machine=mips-mips fi ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4) basic_machine=sh-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; c4x*) basic_machine=c4x-none os=-coff ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto*) os=-nto-qnx ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: apcupsd-3.14.10/autoconf/configure.in0000664000076400007640000012130311437731553016363 0ustar adk0212adk0212dnl Autoconfigure input file for apcupsd (derived from fetchmail-4.7.4). dnl dnl Copyright (C) 1999-2000 Riccardo Facchetti dnl dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoheader to produce a config.h.in dnl dnl A distinctive file to look for in srcdir. AC_INIT(Developers) dnl Config header file. AC_CONFIG_HEADER(include/config.h:autoconf/config.h.in) topdir=`pwd` AC_CONFIG_AUX_DIR(${topdir}/autoconf) dnl dnl Absolute srcdir ABSSRCDIR=`pwd` AC_SUBST(ABSSRCDIR) AC_SUBST(topdir) dnl go up one more level cd .. TOP_DIR=`pwd` cd ${topdir} AC_SUBST(TOP_DIR) VERSION=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${srcdir}/include/version.h` AC_SUBST(VERSION) DATE=`sed -n -e 's/^.*[ \t]*ADATE.*"\(.*\)"$/\1/p' ${srcdir}/include/version.h` AC_SUBST(DATE) dnl dnl These need to be searched before. dnl AC_PATH_PROGS(TRUEPRG, true, :) AC_PATH_PROGS(FALSEPRG, false, :) dnl dnl Create a new path statement starting with what the user has and dnl adding directories we might need. dnl PATH=$PATH:/bin:/sbin:/etc:/usr/bin:/usr/bin/X11:/usr/sbin:/usr/local/bin:/usr/local/sbin export PATH dnl Interesting things are often in /usr/local CPPFLAGS="${CPPFLAGS} -I/usr/local/include" LDFLAGS="${LDFLAGS} -L/usr/local/lib64 -L/usr/local/lib" if test $HAVE_UNAME=yes -a x`uname -s` = xSunOS then dnl ---------------------------------------- dnl SunOS defaults dnl ---------------------------------------- AC_PREFIX_DEFAULT(/opt/apcupsd) dnl --exec-prefix == eprefix == prefix dnl --bindir == eprefix/bin dnl --sbindir == eprefix/sbin dnl dnl If the user has not set -sysconfdir, we set our default as dnl /etc/opt/apcupsd dnl if test x$sysconfdir = x'${prefix}/etc' ; then sysconfdir='/etc/opt/apcupsd' fi dnl dnl If the user has not set -sbindir, we set our default as /sbin dnl if test x$sbindir = x'${exec_prefix}/sbin' ; then sbindir='/etc/opt/apcupsd/sbin' fi dnl Solaris often has interesting things in /usr/sfw CPPFLAGS="${CPPFLAGS} -I/usr/sfw/include" LDFLAGS="${LDFLAGS} -L/usr/sfw/lib" else dnl ------------------------------------------- dnl non Sun defaults (i.e. all other platforms dnl ------------------------------------------- AC_PREFIX_DEFAULT(/usr) dnl dnl If the user has not set -sysconfdir, we set our default as /etc/apcupsd dnl if test x$sysconfdir = x'${prefix}/etc' ; then sysconfdir='/etc/apcupsd' fi dnl dnl If the user has not set -sbindir, we set our default as /sbin dnl if test x$sbindir = x'${exec_prefix}/sbin' ; then sbindir='/sbin' fi fi dnl dnl Sets `host_cpu', `host_vendor', and `host_os' to the current host type. dnl AC_CANONICAL_HOST dnl dnl Check for programs. dnl AC_PROG_CXX dnl We require a C++ compiler now AC_PROG_CC dnl Determine a C compiler to use. AC_PROG_CPP dnl Determine a C pre-processor to use. AC_PROG_INSTALL dnl Determine a BSD install program. AC_PROG_AWK AC_ISC_POSIX if test x$GCC = xyes; then AM_CONDITIONAL(HAVE_GCC, $TRUEPRG) AC_DEFINE(HAVE_GCC) else AM_CONDITIONAL(HAVE_GCC, $FALSEPRG) fi dnl Default linker is g++ if test x$LD = x ; then LD="$CC" fi AC_SUBST(DEBUG) AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) AC_SUBST(CXXFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(LIBS) AC_SUBST(DRVLIBS) AC_SUBST(APCDRVLIBS) dnl Initialize pthreads inclusion: warn PTHREAD_LFLAGS must contain only dnl the pthreads libraries, if needed. For linker flags, add them to dnl LDFLAGS. PTHREAD_CFLAGS="" PTHREAD_LFLAGS="-lpthread" with_pthreads=yes AC_DEFINE(HAVE_PTHREADS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_LFLAGS) APCACCESS=apcaccess SMTP=smtp APCTEST=apctest AC_SUBST(APCACCESS) AC_SUBST(SMTP) AC_SUBST(APCTEST) dnl Now check for programs AC_REQ_PATH_PROGS(SHUTDOWN, shutdown shutdown.bsd) AC_PATH_PROGS(APCUPSD_MAIL, mail, no) if test "$APCUPSD_MAIL" = "no" then AC_MSG_WARN([mail program not found !]) APCUPSD_MAIL=mail fi AC_REQ_PATH_PROGS(WALL, wall) AC_REQ_PATH_PROGS(SCRIPTSHELL, sh bash) AC_PROG_GMAKE AC_REQ_PATH_PROGS(RANLIB, ranlib true) AC_REQ_PATH_PROG(RM, rm) AC_REQ_PATH_PROG(CP, cp) AC_REQ_PATH_PROG(ECHO, echo) AC_REQ_PATH_PROG(LN, ln) AC_REQ_PATH_PROG(SED, sed) AC_REQ_PATH_PROG(AR, ar) AC_REQ_PATH_PROG(MV, mv) AC_PATH_PROG(RST2HTML, rst2html.py,) AC_PATH_PROG(RST2PDF, rst2pdf,) # ------------------------------------------------------------------------- # If the user has not set --mandir, we default to /usr/share/man # ------------------------------------------------------------------------- if test x$mandir = x'${prefix}/man' ; then mandir=/usr/share/man fi dnl Check for library functions. dnl dnl for fopen and friends I check only for fprintf. If it is there I suppose dnl all the other function should be there. dnl The same for open and friends: checking only for open. dnl and for all the other function groups. dnl AC_CHECK_FUNCS( abort fork calloc getpid \ ioctl kill rewind select setsid signal strerror strncmp \ strncpy tcgetattr vfprintf setpgrp,, [AC_MSG_ERROR([cannot find required function.])] ) AC_CHECK_FUNCS(snprintf vsnprintf) dnl Solaris hides nanosleep in one of two libraries depending on version dnl If we can't find it at all we'll just use our own substitute. AC_SEARCH_LIBS(nanosleep, [rt posix4], AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you have the nanosleep function.]), [LIBEXTRAOBJ="$LIBEXTRAOBJ sleep.o" EXTRAOBJ="$EXTRAOBJ lib/sleep.o"]) AC_MSG_CHECKING([for syslog]) AC_TRY_LINK( [#include ], [syslog(0, "%s", "test");], AC_MSG_RESULT([yes]), AC_CHECK_LIB(socket, std_syslog,, [AC_MSG_ERROR([cannot find required function.])]) AC_TRY_LINK( [#include ], [syslog(0, "%s", "test");], AC_MSG_RESULT([yes]), [AC_MSG_ERROR([cannot find required function.])]) ) AC_FUNC_STRFTIME dnl check for strftime. AC_FUNC_SETPGRP dnl check for BSD setpgrp. # Under sysV68, socket and friends are provided by the C library. # -linet does not provide socket, but causes multiple definition # errors at link-time. It is thus better to only use the C library. # So don't add -linet to the link list unless it's necessary # # With Solaris socket and friends seem not to be in C library. # I hope that if socket is found, all the BSD friends are in the same library # # - RF # AC_SEARCH_LIBS(socket, [xnet socket inet]) AC_SEARCH_LIBS(gethostname, [xnet socket inet]) AC_SEARCH_LIBS(gethostbyname, [nsl resolv]) AC_SEARCH_LIBS(gethostbyname_r, [nsl resolv]) dnl -------------------------------------------------------------------------- dnl Check for socklen_t dnl -------------------------------------------------------------------------- AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t, [AC_TRY_COMPILE([ #include #include ], [socklen_t x], ba_cv_header_socklen_t=yes, ba_cv_header_socklen_t=no)]) test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T) # The condition in this test copes with the presence of inet_addr in libc6. AC_SEARCH_LIBS(inet_addr, nsl) dnl Needed by Interactive UNIX System V/386 Release 3.2 AC_CHECK_FUNC(strchr, AC_MSG_RESULT([using libc's strchr]), AC_CHECK_LIB(cposix,strchr, [EXTRADEFS="$EXTRADEFS -D_SYSV3" LIBS="$LIBS -lcposix"])) AC_CHECK_FUNC(strstr, AC_DEFINE(HAVE_STRSTR), [LIBEXTRAOBJ="$LIBEXTRAOBJ strstr.o" EXTRAOBJ="$EXTRAOBJ lib/strstr.o"]) AC_CHECK_FUNC(strcasecmp, AC_DEFINE(HAVE_STRCASECMP), [LIBEXTRAOBJ="$LIBEXTRAOBJ strcasecmp.o" EXTRAOBJ="$EXTRAOBJ lib/strcasecmp.o"]) AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE), [LIBEXTRAOBJ="$LIBEXTRAOBJ memmove.o" EXTRAOBJ="$EXTRAOBJ lib/memmove.o"]) AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPTLONG), [LIBEXTRAOBJ="$LIBEXTRAOBJ getopt.o getopt1.o" EXTRAOBJ="$EXTRAOBJ lib/getopt.o lib/getopt1.o"]) AC_CHECK_FUNC(inet_pton, AC_DEFINE(HAVE_INETPTON), [LIBEXTRAOBJ="$LIBEXTRAOBJ inet_pton.o" EXTRAOBJ="$EXTRAOBJ lib/inet_pton.o"]) dnl dnl Check for presence of localtime_r dnl AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R), [LIBEXTRAOBJ="$LIBEXTRAOBJ localtime_r.o" EXTRAOBJ="$EXTRAOBJ lib/localtime_r.o"]) dnl dnl Check for header files. dnl AC_CHECK_HEADERS( arpa/inet.h ctype.h errno.h fcntl.h \ limits.h netdb.h netinet/in.h pwd.h signal.h \ stdarg.h stdio.h stdlib.h string.h strings.h sys/ioctl.h \ sys/socket.h sys/types.h syslog.h termios.h \ unistd.h ,,[AC_MSG_WARN([at least 1 header file is missing. This may not compile.])]) AC_CHECK_HEADERS(arpa/nameser.h,AC_DEFINE(HAVE_NAMESER_H)) AC_HEADER_STAT dnl Check for S_ISDIR and S_ISREG macros. AC_HEADER_TIME dnl Check for time.h and sys/time.h. AC_HEADER_SYS_WAIT dnl Check for dnl dnl Check for structures. dnl AC_STRUCT_TM dnl Check if time.h don't define struct tm. AC_STRUCT_TIMEZONE dnl Check how to have current timezone. dnl dnl Check for types. dnl AC_TYPE_GETGROUPS AC_TYPE_MODE_T AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIGNAL AC_TYPE_SIZE_T AC_TYPE_UID_T AC_TYPE_SOCKETLEN_T dnl Not always true, but close enough for the few platforms dnl that are missing this (Solaris 2.5.1). AC_CHECK_TYPE(int32_t, int) dnl dnl Check for system services. dnl AC_EXEEXT dnl Check for EXE extension. AC_PATH_XTRA dnl Is X Window System interesting ?. **GAPCMON** AC_SYS_INTERPRETER dnl Check for '#!' in shell scripts. dnl dnl UNIX variants dnl AC_SUBST(EXEEXT) AC_DEFINE_UNQUOTED(EXEEXT, "$EXEEXT") case $host in *-*-sunos*) AC_DEFINE(HAVE_SUN_OS) ;; *-*-solaris*) AC_DEFINE(HAVE_SUN_OS) ;; *-*-osf*) AC_DEFINE(HAVE_OSF1_OS) ;; *-*-aix*) AC_DEFINE(HAVE_AIX_OS) ;; *-*-hpux*) AC_DEFINE(HAVE_HPUX_OS) ;; *-*-linux*) AC_DEFINE(HAVE_LINUX_OS) ;; *-*-freebsd*) AC_DEFINE(HAVE_FREEBSD_OS) ;; *-*-netbsd*) AC_DEFINE(HAVE_NETBSD_OS) ;; *-*-openbsd*) AC_DEFINE(HAVE_OPENBSD_OS) ;; *-*-bsdi*) AC_DEFINE(HAVE_BSDI_OS) ;; *-*-irix*) AC_DEFINE(HAVE_SGI_OS) ;; *-*-darwin*) AC_DEFINE(HAVE_DARWIN_OS) ;; *-*-nto*) AC_DEFINE(HAVE_QNX_OS) ;; esac dnl dnl Check for enable particular features. dnl AC_ARG_ENABLE(all, [ AC_HELP_STRING([--enable-all], [Enable all optional modules])], [ if test "$enableval" = "yes" ; then enable_usb=yes enable_net=yes enable_snmp=yes enable_net_snmp=yes enable_test=yes enable_pcnet=yes enable_cgi=yes enable_gapcmon=yes fi], []) dnl dnl halpolicydir configuration dnl dnl Establish default case $host in *-*-linux*) HALPOLICYDIR="/usr/share/hal/fdi/policy/20thirdparty" ;; *) HALPOLICYDIR="" ;; esac dnl Allow user override AC_ARG_WITH(halpolicydir, [AC_HELP_STRING([--with-halpolicydir=DIR], [HAL policy directory (default is platform dependent)])], HALPOLICYDIR=$withval) dnl Report result if test "x$HALPOLICYDIR" != "x" ; then AC_MSG_RESULT([Using halpolicydir=$HALPOLICYDIR]) else AC_MSG_RESULT([Will not install HAL policy file]) fi AC_SUBST(HALPOLICYDIR) #-------------------------------------------------------------------- # Check for TCP wrapper support, code taken from Bacula KES-7Nov03 #-------------------------------------------------------------------- AC_ARG_WITH(libwrap, [AC_HELP_STRING([--with-libwrap=DIR], [Compile in libwrap (tcp_wrappers) support])], [ if test "x$withval" != "xno" ; then saved_LIBS="$LIBS" LIBS="$saved_LIBS -lwrap" AC_MSG_CHECKING([for libwrap]) AC_TRY_LINK( [ #include int deny_severity = 0; int allow_severity = 0; struct request_info *req; ], [ hosts_access(req); ], [ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_LIBWRAP) TCPW_MSG="yes" ], [ LIBS="$saved_LIBS -lwrap -lnsl" AC_TRY_LINK( [ #include int deny_severity = 0; int allow_severity = 0; struct request_info *req; ], [ hosts_access(req); ], [ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_LIBWRAP) TCPW_MSG="yes" ], [AC_MSG_ERROR([*** libwrap missing]) ] ] ) ) fi ] ) dnl dnl Check for enable of cgi program builds dnl ENABLE_CGI="no" CGI= GD_LIBS= SYS_GD_FOUND=no AC_ARG_ENABLE(cgi, [AC_HELP_STRING([--enable-cgi], [Compile CGI programs])], [ if test "$enableval" = "yes" then ENABLE_CGI="yes" CGI=cgi dnl dnl First search for system library that defines gdImagePng AC_CHECK_LIB(gd, gdImagePng, [ AC_MSG_RESULT([using PNG file format (/usr/lib).]) AC_DEFINE(SYS_IMGFMT_PNG) GD_LIBS="-lgd" SYS_GD_FOUND=yes ], [], [${X_LIBS}]) dnl dnl Second search for system library that defines gdImageGif if test "${SYS_GD_FOUND}" = "no" then AC_CHECK_LIB(gd, gdImageGif, [ AC_MSG_RESULT([using GIF file format (/usr/lib).]) AC_DEFINE(SYS_IMGFMT_GIF) GD_LIBS="-lgd" SYS_GD_FOUND=yes ], [], [${X_LIBS}]) fi dnl dnl Third in /usr/local search for system library that defines gdImagePng if test "${SYS_GD_FOUND}" = "no" then CPPFLAGS="${CPPFLAGS} -I/usr/local/include" LDFLAGS="${LDFLAGS} -L/usr/local/lib" dnl Destroy cached value unset ac_cv_lib_gd_gdImagePng AC_CHECK_LIB(gd, gdImagePng, [ AC_MSG_RESULT([using PNG file format (/usr/local/lib).]) AC_DEFINE(SYS_IMGFMT_PNG) GD_LIBS="-lgd" SYS_GD_FOUND=yes ], [], [${X_LIBS}]) fi dnl dnl Fourth in /usr/local search for system library that defines gdImageGif if test "${SYS_GD_FOUND}" = "no" then dnl Destroy cached value unset ac_cv_lib_gd_gdImageGif AC_CHECK_LIB(gd, gdImageGif, [ AC_MSG_RESULT([using GIF file format (/usr/local/lib).]) AC_DEFINE(SYS_IMGFMT_GIF) GD_LIBS="-lgd" SYS_GD_FOUND=yes ], [], [${X_LIBS}]) fi if test "${SYS_GD_FOUND}" = "no" then AC_MSG_ERROR([Your system lacks the GD library which is needed for compiling the apcupsd CGI programs. Please install libgd and re-run the ./configure script. Alternatively you can disable the CGI support.]) fi AC_CHECK_HEADER(gd.h, [ GDHEAD= ], [ AC_CHECK_HEADER(gd/gd.h, [ GDHEAD="gd/" ], [ AC_CHECK_HEADER(gd2/gd.h, [ GDHEAD="gd2/" ], [ AC_MSG_ERROR([Found system GD library but no header file. Please find the file gd.h in your system include directories and report its location to apcupsd-users@lists.sourceforge.net]) ]) ]) ]) AC_SUBST(GDHEAD) fi ]) dnl dnl Check for enable of drivers dnl AC_ARG_ENABLE(apcsmart, [ AC_HELP_STRING([--enable-apcsmart], [Compile APC SmartUPS serial driver (default)]) AC_HELP_STRING([--disable-apcsmart], [No APC SmartUPS serial driver])], [ if test "$enableval" = "yes" ; then dnl This is for C code inclusion AC_DEFINE(HAVE_APCSMART_DRIVER) dnl This is for Makefile.in inside src/drivers/ APCSMART_DRIVER="apcsmart" AC_SUBST(APCSMART_DRIVER) fi ], [ AC_DEFINE(HAVE_APCSMART_DRIVER) APCSMART_DRIVER="apcsmart" AC_SUBST(APCSMART_DRIVER) ]) AC_ARG_ENABLE(dumb, [ AC_HELP_STRING([--enable-dumb], [Compile dumb UPS driver (default)]) AC_HELP_STRING([--disable-dumb], [No dumb UPS driver])], [ if test "$enableval" = "yes" ; then AC_DEFINE(HAVE_DUMB_DRIVER) DUMB_DRIVER="dumb" AC_SUBST(DUMB_DRIVER) fi], [ AC_DEFINE(HAVE_DUMB_DRIVER) DUMB_DRIVER="dumb" AC_SUBST(DUMB_DRIVER) ]) dnl Allow user to force USB type to generic GENERICUSB="no" AC_ARG_WITH(generic-usb, [AC_HELP_STRING([--with-generic-usb], [Force use of generic USB driver]) ], [GENERICUSB="yes" ]) AC_ARG_ENABLE(usb, [ AC_HELP_STRING([--enable-usb], [Compile USB UPS code]) AC_HELP_STRING([--disable-usb], [No USB UPS code (default)])], [ if test "$enableval" = "yes" ; then dnl USB driver is usually determined by host system. dnl But if user forces generic_usb then fake it out. if test $GENERICUSB = "yes" ; then usbhost=forcegeneric else usbhost=$host fi dnl Also force generic_usb if this is FreeBSD 8.0 or newer case $usbhost in *-*-freebsd*) tmp=`uname -r` if test ${tmp%%.*} -ge 8 ; then usbhost=forcegeneric fi ;; esac case $usbhost in *-*-linux*) USB_TYPE="linux" AC_MSG_RESULT([Using Linux USB driver.]) ;; *-*-freebsd* | *-*-openbsd* | *-*-netbsd*) LIBUSBHIDINC="-I\$(topdir)/src/libusbhid" LIBUSBHID=libusbhid APCDRVLIBS="$APCDRVLIBS \$(topdir)/src/libusbhid/libusbhid.a" AC_SUBST(LIBUSBHID) AC_SUBST(LIBUSBHIDINC) USB_TYPE="bsd" AC_MSG_RESULT([Using BSD USB driver.]) ;; *) dnl Use libusb-config if found, otherwise fall back on AC_CHECK_LIB AC_PATH_PROG(usbcfg, libusb-config) if test x$usbcfg != x ; then LIBUSB=`$usbcfg --libs` LIBUSBH=`$usbcfg --prefix`/include/usb.h else AC_CHECK_LIB(usb, usb_init, [LIBUSB=-lusb LIBUSBH=usb.h], [AC_MSG_ERROR(Unable to find libusb)], [$DRVLIBS]) fi AC_SUBST(LIBUSBH) LIBUSBHIDINC="-I\$(topdir)/src/libusbhid" LIBUSBHID=libusbhid DRVLIBS="$DRVLIBS $LIBUSB" APCDRVLIBS="$APCDRVLIBS \$(topdir)/src/libusbhid/libusbhid.a" AC_SUBST(LIBUSBHID) AC_SUBST(LIBUSBHIDINC) USB_TYPE="generic" AC_MSG_RESULT([Using generic libusb USB driver.]) ;; esac AC_DEFINE(HAVE_USB_DRIVER) USB_DRIVER="usb" AC_SUBST(USB_DRIVER) AC_SUBST(USB_TYPE) DISPLAY_USB_DRIVER=$USB_TYPE-$USB_DRIVER fi ], []) AC_ARG_ENABLE(net, [ AC_HELP_STRING([--enable-net], [Compile networking driver for slaves (default)]) AC_HELP_STRING([--disable-net], [No network driver for slaves])], [ if test "$enableval" = "yes" ; then AC_DEFINE(HAVE_NET_DRIVER) NET_DRIVER="net" AC_SUBST(NET_DRIVER) fi ], [ AC_DEFINE(HAVE_NET_DRIVER) NET_DRIVER="net" AC_SUBST(NET_DRIVER) ]) AC_ARG_ENABLE(snmp, [ AC_HELP_STRING([--enable-snmp], [Compile SNMP driver (default)]) AC_HELP_STRING([--disable-snmp], [No SNMP driver])], [ if test "$enableval" = "yes" ; then AC_DEFINE(HAVE_SNMPLITE_DRIVER) SNMPLITE_DRIVER="snmplite" DISPLAY_SNMP_DRIVER="snmp" AC_SUBST(SNMPLITE_DRIVER) fi ], [ AC_DEFINE(HAVE_SNMPLITE_DRIVER) SNMPLITE_DRIVER="snmplite" DISPLAY_SNMP_DRIVER="snmp" AC_SUBST(SNMPLITE_DRIVER) ]) AC_ARG_ENABLE(net-snmp, [ AC_HELP_STRING([--enable-net-snmp], [Compile NET-SNMP UPS code (OBSOLETE)]) AC_HELP_STRING([--disable-net-snmp], [No NET-SNMP UPS code (default)])], [ if test "$enableval" = "yes" ; then dnl Check for optional crypto lib AC_CHECK_LIB(crypto, EVP_DigestInit, [echo ' including crypto library for snmp.' DRVLIBS="$DRVLIBS -lcrypto"], [], []) SNMP_LIB_FOUND="no" dnl libsnmp is often in /usr/local CPPFLAGS="${CPPFLAGS} -I/usr/local/include" LDFLAGS="${LDFLAGS} -L/usr/local/lib" dnl Start by looking for libnetsnmp (net-snmp). if test "$SNMP_LIB_FOUND" = "no" ; then AC_CHECK_LIB(netsnmp, snmp_open, [DRVLIBS="$DRVLIBS -lnetsnmp" AC_DEFINE(HAVE_NET_SNMP) SNMP_LIB_FOUND="yes"], [], [$DRVLIBS]) fi dnl If no lib yet, fall back on libsnmp (ucd-snmp) if test "$SNMP_LIB_FOUND" = "no" ; then AC_CHECK_LIB(snmp, snmp_open, [DRVLIBS="$DRVLIBS -lsnmp" AC_DEFINE(HAVE_UCD_SNMP) SNMP_LIB_FOUND="yes"], [], [$DRVLIBS]) fi if test "$SNMP_LIB_FOUND" = "no" ; then AC_MSG_ERROR([Cannot find SNMP libraries.]) fi dnl If we get this far, we found a valid lib AC_DEFINE(HAVE_SNMP_DRIVER) DISPLAY_NETSNMP_DRIVER="net-snmp" SNMP_DRIVER="snmp" AC_SUBST(SNMP_DRIVER) fi ], []) dnl Enable test driver AC_ARG_ENABLE(test, [ AC_HELP_STRING([--enable-test], [Compile TEST driver code]) AC_HELP_STRING([--disable-test], [No TEST driver (default)])], [ if test "$enableval" = "yes" ; then AC_DEFINE(HAVE_TEST_DRIVER) TEST_DRIVER="test" AC_SUBST(TEST_DRIVER) fi], []) dnl Enable pcnet driver AC_ARG_ENABLE(pcnet, [ AC_HELP_STRING([--enable-pcnet], [Compile PCNET driver code (default)]) AC_HELP_STRING([--disable-pcnet], [No PCNET driver])], [ if test "$enableval" = "yes" ; then AC_DEFINE(HAVE_PCNET_DRIVER) PCNET_DRIVER="pcnet" AC_SUBST(PCNET_DRIVER) fi], [ AC_DEFINE(HAVE_PCNET_DRIVER) PCNET_DRIVER="pcnet" AC_SUBST(PCNET_DRIVER) ]) dnl Force NIS to enabled since libnis is required by apcaccess. dnl Users may still disable NIS at runtime in apcupsd.conf. AC_DEFINE(HAVE_NISSERVER) AC_DEFINE(HAVE_NISLIB) NISSRV_ENABLED=yes dnl Allow setting of NISIP value NISIP="0.0.0.0" AC_ARG_WITH(nisip, [AC_HELP_STRING([--with-nisip=IP-ADDRESS], [Specify the IP address to bind to (default=0.0.0.0)])], [NISIP="$withval";]) AC_SUBST(NISIP) CGIBIN="/etc/apcupsd" AC_ARG_WITH(cgi-bin, [AC_HELP_STRING([--with-cgi-bin=DIR], [Specify cgi-bin directory (default=/etc/apcupsd)])], [CGIBIN="$withval";]) dnl dnl Check for enable of gapcmon dnl GAPCMON= GAPCMON_ENABLED=no AC_ARG_ENABLE(gapcmon, [AC_HELP_STRING([--enable-gapcmon], [Build GTK/GUI front-end to apcupsd (default=no)])], [ if test "$enableval" = "yes" ; then GAPCMON=gapcmon GAPCMON_ENABLED=yes dnl dnl Check for Gnome packages dnl PKG_CHECK_MODULES(GAPCMON, gtk+-2.0 >= 2.4.0 glib-2.0 gthread-2.0 gconf-2.0) GAPCMON_CFLAGS="$GAPCMON_CFLAGS -DVERSION=\\\"$VERSION\\\"" fi], []) AC_SUBST(GAPCMON) dnl dnl Check for enable of apcagent dnl APCAGENT= APCAGENT_ENABLED=no AC_ARG_ENABLE(apcagent, [AC_HELP_STRING([--enable-apcagent], [Build menubar app for Mac OS X (default=no)])], [ if test "$enableval" = "yes" ; then case $host in *-*-darwin*) APCAGENT=apcagent APCAGENT_ENABLED=yes ;; *) AC_MSG_ERROR([apcagent can only be built on Mac OS X]) ;; esac fi], [case $host in *-*-darwin*) APCAGENT=apcagent APCAGENT_ENABLED=yes ;; esac]) AC_SUBST(APCAGENT) dnl dnl Figure out which gethostbyname_r() variant we have dnl AX_FUNC_WHICH_GETHOSTBYNAME_R case "$ac_cv_func_which_gethostbyname_r" in three) AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_3) GAPCMON_CFLAGS="$GAPCMON_CFLAGS -DHAVE_FUNC_GETHOSTBYNAME_R_3" ;; five) AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_5) GAPCMON_CFLAGS="$GAPCMON_CFLAGS -DHAVE_FUNC_GETHOSTBYNAME_R_5" ;; six) AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_6) GAPCMON_CFLAGS="$GAPCMON_CFLAGS -DHAVE_FUNC_GETHOSTBYNAME_R_6" ;; no) AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_0) GAPCMON_CFLAGS="$GAPCMON_CFLAGS -DHAVE_FUNC_GETHOSTBYNAME_R_0" ;; *) AC_MSG_ERROR([gethostbyname_r is required]) ;; esac if test -n "$GCC"; then # Starting with GCC 3.0, you must link C++ programs against either # libstdc++ (shared by default), or libsupc++ (always static). If # you care about binary portability between Linux distributions, # you need to either 1) build your own GCC with static C++ libraries # or 2) link using gcc and libsupc++. We choose the latter since # CUPS doesn't (currently) use any of the stdc++ library. # # Previous versions of GCC do not have the reliance on the stdc++ # or g++ libraries, so the extra supc++ library is not needed. AC_MSG_CHECKING(if libsupc++ is required) SUPC="`$CXX -print-file-name=libsupc++.a 2>/dev/null`" case "$SUPC" in libsupc++.a*) # Library not found, so this is and older GCC... AC_MSG_RESULT(no) ;; *) # This is gcc 3.x, and it knows of libsupc++, so we need it LIBS="$LIBS -lsupc++" AC_MSG_RESULT(yes) # See if this system has a broken libsupc++ that requires # a workaround (FreeBSD 5.x, 6.x) case $host in *-*-freebsd*) AC_MSG_CHECKING(if libsupc++ is missing __terminate_handler) nm -C --defined-only "$SUPC" 2>/dev/null | grep __terminate_handler > /dev/null if test $? -eq 0 ; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes -- will attempt workaround) CPPFLAGS="$CPPFLAGS -DFREEBSD_SUPCPP_FIX" fi ;; esac ;; esac # See if GCC supports -fno-exceptions... AC_MSG_CHECKING(if GCC supports -fno-exceptions) OLDCXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -fno-exceptions" AC_TRY_COMPILE(,, AC_MSG_RESULT(yes), AC_MSG_RESULT(no) CXXFLAGS="$OLDCXXFLAGS") # See if GCC supports -fno-rtti... AC_MSG_CHECKING(if GCC supports -fno-rtti) OLDCXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -fno-rtti" AC_TRY_COMPILE(,, AC_MSG_RESULT(yes), AC_MSG_RESULT(no) CXXFLAGS="$OLDCXXFLAGS") # Use -Wall on gcc only CFLAGS="$CFLAGS -Wall" CXXFLAGS="$CXXFLAGS -Wall" fi AC_SUBST(POWERFLUTE) AC_SUBST(POWERLIBS) AC_SUBST(MAKE) AC_SUBST(CP) AC_SUBST(MV) AC_SUBST(ECHO) AC_SUBST(LN) AC_SUBST(SED) AC_SUBST(AR) AC_SUBST(RM) AC_SUBST(CC) AC_SUBST(CXX) AC_SUBST(LD) AC_SUBST(CGI) AC_SUBST(GD_LIBS) AC_SUBST(CGIBIN) AC_DEFINE_UNQUOTED(SYSCONFDIR, "$sysconfdir") AC_SUBST(SYSCONFDIR) AC_SUBST(RST2HTML) AC_SUBST(RST2PDF) dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we will probably dnl find the mkinstalldirs script in another subdir than ($topdir). dnl Try to locate it. MKINSTALLDIRS= if test -n "$ac_aux_dir"; then MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" fi if test x$MKINSTALLDIRS = x ; then MKINSTALLDIRS="\$(topdir)/autoconf/mkinstalldirs" fi AC_SUBST(MKINSTALLDIRS) dnl AC_CHECK_FUNC calls that might hack the Makefile must precede dnl the following AC_SUBSTs AC_SUBST(EXTRADEFS) AC_SUBST(LIBEXTRAOBJ) AC_SUBST(EXTRAOBJ) dnl Check out the wait reality. We have to assume sys/wait.h is present. AC_CHECK_FUNCS(wait waitpid wait3) AC_MSG_CHECKING([for union wait]); AC_TRY_LINK([#include #include ], [union wait status; int pid; pid = wait (&status); #ifdef WEXITSTATUS /* Some POSIXoid systems have both the new-style macros and the old union wait type, and they do not work together. If union wait conflicts with WEXITSTATUS et al, we don't want to use it at all. */ if (WEXITSTATUS (status) != 0) pid = -1; #endif #ifdef HAVE_WAITPID /* Make sure union wait works with waitpid. */ pid = waitpid (-1, &status, 0); #endif ], [AC_DEFINE(HAVE_UNION_WAIT) AC_MSG_RESULT([yes])], AC_MSG_RESULT([no])) if test "$ENABLE_CGI" = "yes" then AC_CHECK_FUNCS( snprintf,, [AC_MSG_ERROR([cannot find required function.])]) echo 'Enabling cgi program support...' else echo 'Disabling cgi support...' fi dnl dnl Find out the distribution. NOTE!!! Only determine the dnl distribution here. Do all additional work below. dnl # now allow user to specify DISTNAME AC_ARG_WITH(distname, [AC_HELP_STRING([--with-distname=NAME], [Specify DISTNAME])], [DISTNAME=$withval]) if test "x$DISTNAME" != "x" then echo "distname set to $DISTNAME" elif test $HAVE_UNAME=yes -a x`uname -s` = xOSF1 then DISTNAME=alpha elif test $HAVE_UNAME=yes -a x`uname -s` = xHP-UX then DISTNAME=hpux elif test $HAVE_UNAME=yes -a x`uname -s` = xSunOS then DISTNAME=sun elif test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD then DISTNAME=freebsd elif test $HAVE_UNAME=yes -a x`uname -s` = xNetBSD then DISTNAME=netbsd elif test $HAVE_UNAME=yes -a x`uname -s` = xOpenBSD then DISTNAME=openbsd elif test $HAVE_UNAME=yes -a x`uname -s` = xBSD/OS then DISTNAME=bsdi elif test $HAVE_UNAME=yes -a x`uname -s` = xDarwin then DISTNAME=darwin elif test $HAVE_UNAME=yes -a x`uname -s` = xQNX then DISTNAME=qnx elif test -f /etc/SuSE-release then DISTNAME=suse elif test -d /etc/SuSEconfig then DISTNAME=suse5 elif test -f /etc/mandrake-release then DISTNAME=mandrake elif test -f /etc/whitebox-release then DISTNAME=redhat elif test -f /etc/redhat-release then DISTNAME=redhat elif test -f /etc/yellowdog-release then DISTNAME=yellowdog elif test -f /etc/debian_version then DISTNAME=debian elif test -f /etc/slackware-version then DISTNAME=slackware elif test -f /etc/gentoo-release then DISTNAME=gentoo elif test -f /etc/engarde-version then DISTNAME=engarde else DISTNAME=unknown fi dnl dnl Check for enable install of distdir dnl DISTDIR=$DISTNAME with_distdir="yes" AC_ARG_ENABLE(install-distdir, [AC_HELP_STRING([--enable-install-distdir], [Install distribution])], [ if test "$enableval" = "no" ; then DISTDIR="" with_distdir="no" fi ]) AC_SUBST(DISTDIR) dnl dnl At this point, we define the apcupsd defaults for a dnl number of different values (directories, ports, etc) dnl When the distribution is determined a bit lower, the dnl default can be reset to correspond to the standard for dnl that system. dnl Finally, after that any value that the user has set via dnl command line options will apply. dnl # Define the default UPS UPSTYPE=apcsmart # Define the default Cable UPSCABLE=smart # set the default nologin directory nologdir=/etc # Find the default directory to put the root-mode PID file in for PIDDIR in "/var/run" "/etc/apcupsd" do if test -d $PIDDIR then break; fi done # Find the default directory to put the apcupsd.events and apcupsd.status files for LOGDIR in "/var/log" "/etc/apcupsd" do if test -d $LOGDIR then break; fi done # set the default serial port lock director for LOCKDIR in "/var/lock" "/var/spool/locks" "/etc/apcupsd" do if test -d $LOCKDIR then break; fi done # set the default PWRFAILDIR PWRFAILDIR=${sysconfdir} # define the default serial port device SERIALDEV=/dev/ttyS0 # define the default NIS (Network Information Server -- CGI) port NISPORT=3551 # # Now we set appropriate distribution specific # variables and defaults # case "$DISTNAME" in alpha) PTHREAD_LFLAGS="-lpthread -lexc" DISTVER=`uname -r` SERIALDEV=/dev/tty01 LOCKDIR=/var/spool/locks LOGDIR=/etc/apcupsd DFILES="\ platforms/alpha/apcupsd \ platforms/alpha/awkhaltprog" ;; bsdi) DISTVER=`uname -a |awk '{print $3}'` ;; debian) DISTVER=`cat /etc/debian_version` DFILES="\ platforms/debian/apcupsd \ platforms/debian/ups-monitor" ;; freebsd) DISTVER=`uname -a |awk '{print $3}'` SERIALDEV=/dev/cuaa0 nologdir=/var/run PWRFAILDIR=/var/run LOCKDIR=/var/spool/lock PTHREAD_CFLAGS="-pthread" PTHREAD_LFLAGS="" LDFLAGS="$LDFLAGS -pthread" DFILES="\ platforms/freebsd/apcupsd \ platforms/freebsd/apccontrol" ;; gentoo) DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release` DFILES="\ platforms/gentoo/apcupsd \ platforms/gentoo/halt" ;; hpux) DISTVER=`uname -r` SERIALDEV=/dev/tty0p0 PTHREAD_CFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_REENTRANT" DFILES="\ platforms/hpux/apcupsd \ platforms/hpux/halt" ;; netbsd) DISTVER=`uname -a |awk '{print $3}'` SERIALDEV=/dev/cua01 PTHREAD_CFLAGS="-pthread" PTHREAD_LFLAGS="" LDFLAGS="$LDFLAGS -pthread" DFILES="\ platforms/netbsd/apcupsd" ;; openbsd) DISTVER=`uname -a |awk '{print $3}'` SERIALDEV=/dev/cua01 LOCKDIR=/var/spool/lock PTHREAD_CFLAGS="-pthread" PTHREAD_LFLAGS="" LDFLAGS="$LDFLAGS -pthread" DFILES="\ platforms/openbsd/apcupsd \ platforms/openbsd/apccontrol" ;; mandrake) DISTVER=`cat /etc/mandrake-release | grep release | cut -f 5 -d ' '` DFILES="\ platforms/mandrake/apcupsd \ platforms/mandrake/apcupsd.spec \ platforms/mandrake/awkhaltprog" ;; redhat) if test -f /etc/whitebox-release ; then f=/etc/whitebox-release else f=/etc/redhat-release fi if test `cat $f | grep release | cut -f 3 -d ' '`x = "Enterprise"x ; then DISTVER="Enterprise "`cat $f | grep release | cut -f 6 -d ' '` else DISTVER=`cat /etc/redhat-release | grep release | cut -f 5 -d ' '` fi DFILES="\ platforms/redhat/apcupsd \ platforms/redhat/apcupsd.spec \ platforms/redhat/awkhaltprog" ;; yellowdog) if test `cat /etc/yellowdog-release | grep release | cut -f 3 -d ' '`x = "Enterprise"x ; then DISTVER="Enterprise "`cat /etc/yellowdog-release | grep release | cut -f 6 -d ' '` else DISTVER=`cat /etc/yellowdog-release | grep release | cut -f 5 -d ' '` fi DFILES="\ platforms/yellowdog/apcupsd \ platforms/yellowdog/apcupsd.spec \ platforms/yellowdog/awkhaltprog" ;; engarde) DISTVER=`cat /etc/engarde-release | grep ersion | cut -f 5 -d ' '` DFILES="\ platforms/engarde/apcupsd \ platforms/engarde/apcupsd.spec \ platforms/engarde/awkhaltprog" ;; slackware) DISTVER=`cat /etc/slackware-version` DFILES="\ platforms/slackware/apcupsd \ platforms/slackware/rc6.patch" ;; sun) DISTVER=Solaris SERIALDEV=/dev/ttya PWRFAILDIR=/etc PIDDIR=/var/run LOCKDIR=/var/spool/locks LOGDIR=${sysconfdir} APCUPSD_MAIL=/usr/bin/mailx PTHREAD_CFLAGS="-D_POSIX_PTHREAD_SEMANTICS" DFILES="\ platforms/sun/apcupsd \ platforms/sun/rc0.solaris \ platforms/sun/apccontrol" ;; suse) DISTVER=`cat /etc/SuSE-release |grep VERSION| cut -f 3 -d ' '` DFILES="\ platforms/suse/apcupsd \ platforms/suse/awkhaltprog" ;; suse5) DISTNAME=suse DISTVER=5.x DFILES="\ platforms/suse/apcupsd \ platforms/suse/halt-setup.sh \ platforms/suse/halt" ;; darwin) DISTVER=`uname -r` SERIALDEV= UPSTYPE=usb UPSCABLE=usb PIDDIR=/var/run LOCKDIR=/var/tmp DFILES="\ platforms/darwin/apcupsd \ platforms/darwin/apccontrol" ;; qnx) PTHREAD_LFLAGS="" DISTVER=`uname -r` SERIALDEV=/dev/ser1 DFILES="\ platforms/qnx/apcupsd \ platforms/qnx/apccontrol" ;; unknown) DISTVER=unknown DFILES="\ platforms/unknown/apcupsd \ platforms/unknown/halt" ;; *) AC_MSG_WARN([Something went wrong. Unknown DISTNAME $DISTNAME]) ;; esac dnl dnl Allow user to set nologdir dnl AC_ARG_WITH(nologin, [AC_HELP_STRING([--with-nologin=DIR], [Specify nologin file directory (default /etc)])], [ nologdir="$withval"; ]) # now allow the user to specify the PID directory AC_ARG_WITH(pid-dir, [AC_HELP_STRING([--with-pid-dir=DIR], [Specify PIDDIR directory (default is OS dependent)])], [PIDDIR="$withval";]) # now allow user to specify LOGDIR AC_ARG_WITH(log-dir, [AC_HELP_STRING([--with-log-dir=DIR], [Specify EVENTS and STATUS directory (default is OS dependent)])], [LOGDIR="$withval";]) # now allow user to specify LOCKDIR AC_ARG_WITH(lock-dir, [AC_HELP_STRING([--with-lock-dir=DIR], [Specify serial port lock directory (default is OS dependent)])], [LOCKDIR="$withval";]) # now allow user to specify PWRFAILDIR AC_ARG_WITH(pwrfail-dir, [AC_HELP_STRING([--with-pwrfail-dir=DIR], [Specify power failure file directory (default is OS dependent)])], [PWRFAILDIR="$withval";]) # now allow user to specify SERIALDEV AC_ARG_WITH(serial-dev, [AC_HELP_STRING([--with-serial-dev=DEV], [Specify serial port device])], [SERIALDEV="$withval";]) AC_ARG_WITH(dev, [AC_HELP_STRING([--with-dev=DEV], [Specify port or device])], [SERIALDEV="$withval";]) # now allow user to specify NISPORT AC_ARG_WITH(nis-port, [AC_HELP_STRING([--with-nis-port=PORT], [Specify NIS (CGI) port (default 3551 except Debian)])], [NISPORT="$withval";]) # now allow user to specify UPSTYPE AC_ARG_WITH(upstype, [AC_HELP_STRING([--with-upstype=TYPE], [Specify the UPS type])], [UPSTYPE="$withval";]) # now allow user to specify UPSCABLE AC_ARG_WITH(upscable, [AC_HELP_STRING([--with-upscable=CABLE], [Specify the UPS cable])], [UPSCABLE="$withval";]) AC_SUBST(DISTNAME) AC_SUBST(DISTVER) AC_SUBST(SERIALDEV) AC_DEFINE_UNQUOTED(PIDDIR, "$PIDDIR") AC_SUBST(PIDDIR) AC_DEFINE_UNQUOTED(LOGDIR, "$LOGDIR") AC_SUBST(LOGDIR) AC_DEFINE_UNQUOTED(NOLOGDIR, "$nologdir") AC_SUBST(nologdir) AC_DEFINE_UNQUOTED(PWRFAILDIR, "$PWRFAILDIR") AC_SUBST(PWRFAILDIR) AC_SUBST(LOCKDIR) AC_SUBST(NISPORT) AC_DEFINE_UNQUOTED(NISPORT, $NISPORT) AC_SUBST(UPSTYPE) AC_SUBST(UPSCABLE) HOST=$DISTNAME AC_DEFINE_UNQUOTED(HOST, "$HOST") AC_SUBST(HOST) dnl dnl Find out gcc's installation directory and include files. Used in dnl configure. dnl dnl Make sure a gccinclude variable exist. dnl '.' is innocuous. gccinclude="." if test "$CC" = "gcc" then rm -f $srcdir/gcc.v $CC -v 2> $srcdir/gcc.v gccinclude=`cat $srcdir/gcc.v|grep specs|awk '{print $4}'| \ sed -e 's|specs|include|g'` echo "gcc private include directory found." rm -f $srcdir/gcc.v fi dnl dnl First entry must always be "variables.mak" dnl GENERATE_FILES="\ autoconf/variables.mak \ platforms/apccontrol \ platforms/etc/changeme \ platforms/etc/commfailure \ platforms/etc/commok \ platforms/etc/offbattery \ platforms/etc/onbattery \ platforms/etc/apcupsd.conf \ examples/safe.apccontrol \ src/win32/Makefile \ $DFILES" if test "$USB_TYPE"x = "generic"x then GENERATE_FILES="$GENERATE_FILES \ src/drivers/usb/generic/libusb.h" fi if test "$ENABLE_CGI" = "yes" then GENERATE_FILES="$GENERATE_FILES src/cgi/cgiconfig.h" fi AC_OUTPUT([ ${GENERATE_FILES} ], []) chmod 755 examples/safe.apccontrol $MAKE clean # # A whole lot of hand springs to get the compiler version. # This is because gcc changed the output in version 3.0 # CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 3 -d ' '` if test "x${CXXVERSION}" = "x" ; then CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 1 -d ' '` fi eval srcdir=${srcdir} eval sbindir=${sbindir} eval sysconfdir=${sysconfdir} eval mandir=${mandir} echo " Configuration on `date`: Host: $host -- ${DISTNAME} ${DISTVER} Apcupsd version: ${VERSION} (${DATE}) Source code location: ${srcdir} Install binaries: ${sbindir} Install config files: ${sysconfdir} Install man files: ${mandir} Nologin file in: ${nologdir} PID directory: ${PIDDIR} LOG dir (events, status) ${LOGDIR} LOCK dir (for serial port) ${LOCKDIR} Power Fail dir ${PWRFAILDIR} Compiler: ${CXX} ${CXXVERSION} Compiler flags: ${CPPFLAGS} ${CXXFLAGS} ${PTHREAD_FLAGS} Linker: ${LD} Linker flags: ${LDFLAGS} Host and version: ${DISTNAME} ${DISTVER} Shutdown Program: ${SHUTDOWN} Port/Device: ${SERIALDEV} Network Info Port (CGI): ${NISPORT} UPSTYPE ${UPSTYPE} UPSCABLE ${UPSCABLE} drivers (no-* are disabled): ${APCSMART_DRIVER:-no-apcsmart} ${DUMB_DRIVER:-no-dumb} ${NET_DRIVER:-no-net} ${DISPLAY_USB_DRIVER:-no-usb} ${DISPLAY_SNMP_DRIVER:-no-snmp} ${DISPLAY_NETSNMP_DRIVER:-no-net-snmp} ${PCNET_DRIVER:-no-pcnet} ${TEST_DRIVER:-no-test} enable-nis: ${NISSRV_ENABLED} with-nisip: ${NISIP} enable-cgi: ${ENABLE_CGI} with-cgi-bin: ${CGIBIN} with-libwrap: ${with_libwrap} enable-pthreads: ${with_pthreads} enable-dist-install: ${with_distdir} enable-gapcmon: ${GAPCMON_ENABLED} enable-apcagent: ${APCAGENT_ENABLED} " > config.out cat config.out echo Configuration complete: Run \'$MAKE\' to build apcuspd. echo echo $PATH | grep /usr/ucb >/dev/null if test $? = 0 ; then AC_MSG_WARN([ WARNING! You have /usr/ucb on your path. We STRONGLY recommend that you remove it and rerun configure. Otherwise apcupsd may be unable to shutdown your system. ]); fi apcupsd-3.14.10/autoconf/has-c-files.sh0000775000076400007640000000013407501463525016500 0ustar adk0212adk0212#!/bin/sh /bin/ls *.c > /dev/null 2>&1 if test $? = 0 then echo yes else echo no fi apcupsd-3.14.10/autoconf/install-sh0000775000076400007640000001124407474703530016060 0ustar adk0212adk0212#! /bin/sh # # install - install a program, script, or datafile # This comes from X11R5. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. # # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" tranformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 apcupsd-3.14.10/autoconf/md5sum.sh0000664000076400007640000000044307474703521015621 0ustar adk0212adk0212#!/bin/sh # # To help track down file changes, I have decided to generate for each # release a manifest file containing the md5 checksums of all the files # distributed. # To verify the checksum, simply call 'md5sum MANIFEST'. # find . -type f ! -name MANIFEST -exec md5sum {} \; > MANIFEST apcupsd-3.14.10/autoconf/mkinstalldirs0000775000076400007640000000121210776253675016665 0ustar adk0212adk0212#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Last modified: 1994-03-25 # Public domain errstatus=0 for file in ${1+"$@"} ; do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d in ${1+"$@"} ; do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then # echo "mkdir $pathcomp" 1>&2 mkdir "$pathcomp" || errstatus=$? fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here apcupsd-3.14.10/autoconf/rebuild-makefile.sh0000775000076400007640000000053207501731515017605 0ustar adk0212adk0212#!/bin/sh # # It takes as argument the absolute source directory. # Rebuilds the Makefile in CWD. # # $1 = abssrcdir CURDIR="`pwd`" if test "$CURDIR" = "$1" then RELPATH="." else RELPATH="`echo $CURDIR | sed -e "s|$1/||g"`" fi export SINGLE_MAKEFILE=yes export CONFIG_FILES=$RELPATH/Makefile export CONFIG_HEADERS= cd $1 ./config.status apcupsd-3.14.10/autoconf/targets.mak0000664000076400007640000002112311260763232016205 0ustar adk0212adk0212# Pull in autoconf variables include $(topdir)/autoconf/variables.mak # Now that we have autoconf vars, overwrite $(topdir) with absolute path # version instead of relative version we inherited. The easy way to do this # would be to use $(abspath $(topdir)), but abspath is a gmake-3.81 feature. # So we let autoconf figure it out for us. topdir := $(abstopdir) # Older (pre-3.79) gmake does not have $(CURDIR) ifeq ($(CURDIR),) CURDIR := $(shell pwd) endif # By default we do pretty-printing only V := @ VV := @ NPD := --no-print-directory # Check verbose flag ifeq ($(strip $(VERBOSE)),1) V := NPD := endif ifeq ($(strip $(VERBOSE)),2) V := VV := NPD := endif # Relative path to this dir from $(topdir) RELDIR := $(patsubst /%,%,$(subst $(topdir),,$(CURDIR))) ifneq ($(strip $(RELDIR)),) RELDIR := $(RELDIR)/ endif # Strip extensions STRIPEXT = $(foreach file,$(1),$(basename $(file))) # Convert a list of sources to a list of objects in OBJDIR SRC2OBJ = $(foreach obj,$(call STRIPEXT,$(1)),$(dir $(obj))$(OBJDIR)/$(notdir $(obj)).o) # All objects, derived from all sources OBJS = $(call SRC2OBJ,$(SRCS)) # Dependency files, derived from all sources DEPS = $(foreach dep,$(call STRIPEXT,$(SRCS)),$(DEPDIR)/$(dep).P) # Default target: Build all subdirs, then reinvoke make to build local # targets. This is a little gross, but necessary to force make to build # subdirs first when running in parallel via 'make -jN'. Hopefully I will # discover a cleaner way to solve this someday. .PHONY: all all: all-subdirs $(VV)+$(MAKE) $(NPD) all-targets # 'all-targets' is supplied by lower level Makefile. It represents # all targets to be built at that level. We list it here with a do-nothing # action in order to suppress the "Nothing to do for all-targets" message # when all targets are up to date. .PHONY: all-targets all-targets: @# # standard install target: Same logic as 'all'. .PHONY: install install: all-subdirs $(VV)+$(MAKE) $(NPD) all-targets $(VV)+$(MAKE) $(NPD) all-install # 'all-install' is extended by lower-level Makefile to perform any # required install actions. .PHONY: all-install all-install: @# # no-op targets for use by lower-level Makefiles when a particular # component is not being installed. .PHONY: install- uninstall- install-: uninstall-: # standard uninstall target: Depends on subdirs to force recursion, # then reinvokes make to uninstall local targets. Same logic as 'install'. .PHONY: uninstall uninstall: all-subdirs $(VV)+$(MAKE) $(NPD) all-uninstall # 'all-uninstall' is extended by lower-level Makefiles to perform # any required uninstall actions. .PHONY: all-uninstall all-uninstall: @# # Typical clean target: Remove all objects and dependency files. .PHONY: clean clean: $(V)find . -depth \ \( -name $(OBJDIR) -o -name $(DEPDIR) -o -name \*.a \) \ -exec $(ECHO) " CLEAN" \{\} \; -exec $(RMF) \{\} \; # Template rule to build a subdirectory .PHONY: %_DIR %_DIR: @$(ECHO) " " $(RELDIR)$* $(VV)+$(MAKE) -C $* $(NPD) $(MAKECMDGOALS) # Collective all-subdirs target depends on subdir rule .PHONY: all-subdirs all-subdirs: $(foreach subdir,$(SUBDIRS),$(subdir)_DIR) # Echo with no newline # Pipline here is silly, but should be more portable # than 'echo -n' or 'echo ...\c'. Cannot use autoconf # to figure this out since 'make install' may be run # with root's shell when ./configure was run with user's # shell. Could also use 'printf' but not certain how # universal that is. define ECHO_N $(ECHO) $(1) | tr -d '\n' endef # How to build dependencies MAKEDEPEND = $(CC) -M $(CPPFLAGS) $< > $(df).d ifeq ($(strip $(NODEPS)),) define DEPENDS if test ! -d $(DEPDIR); then mkdir -p $(DEPDIR); fi; \ $(MAKEDEPEND); \ $(call ECHO_N,$(OBJDIR)/) > $(df).P; \ $(SED) -e 's/#.*//' -e '/^$$/ d' < $(df).d >> $(df).P; \ $(SED) -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ -e '/^$$/ d' -e 's/$$/ :/' < $(df).d >> $(df).P; \ $(RMF) $(df).d endef else DEPENDS := endif # Rule to build *.o from *.c and generate dependencies for it $(OBJDIR)/%.o: %.c @$(ECHO) " CXX " $(RELDIR)$< $(VV)if test ! -d $(OBJDIR); then mkdir -p $(OBJDIR); fi $(V)$(CXX) $(CXXFLAGS) -c -o $@ $< $(VV)$(DEPENDS) # Rule to build *.o from *.cpp and generate dependencies for it $(OBJDIR)/%.o: %.cpp @$(ECHO) " CXX " $(RELDIR)$< $(VV)if test ! -d $(OBJDIR); then mkdir -p $(OBJDIR); fi $(V)$(CXX) $(CXXFLAGS) -c -o $@ $< $(VV)$(DEPENDS) # Rule to build *.o from *.m and generate dependencies for it $(OBJDIR)/%.o: %.m @$(ECHO) " OBJC " $(RELDIR)$< $(VV)if test ! -d $(OBJDIR); then mkdir -p $(OBJDIR); fi $(V)$(OBJC) $(OBJCFLAGS) -c -o $@ $< $(VV)$(DEPENDS) # Rule to link an executable define LINK @$(ECHO) " LD " $(RELDIR)$@ $(V)$(LD) $(LDFLAGS) $^ -o $@ $(LIBS) endef # Rule to generate an archive (library) MAKELIB=$(call ARCHIVE,$@,$(OBJS)) define ARCHIVE @$(ECHO) " AR " $(RELDIR)$(1) $(VV)$(RMF) $(1) $(V)$(AR) rc $(1) $(2) $(V)$(RANLIB) $(1) endef # How to generate a *.nib from a *.xib %.nib: %.xib @$(ECHO) " NIB " $(RELDIR)$< $(VV)if test ! -d $(OBJDIR); then mkdir -p $(OBJDIR); fi $(V)$(NIB) $(NIBFLAGS) --compile $@ $< # Rule to create a directory during install define MKDIR $(if $(wildcard $(DESTDIR)$(1)),, \ @$(ECHO) " MKDIR" $(DESTDIR)$(1)) $(if $(wildcard $(DESTDIR)$(1)),, \ $(V)$(MKINSTALLDIRS) $(DESTDIR)$(1)) endef # Install a program file, given mode, src, and dest define INSTPROG @$(ECHO) " COPY " $(2) =\> $(DESTDIR)$(3) $(V)$(INSTALL_PROGRAM) $(STRIP) -m $(1) $(2) $(DESTDIR)$(3) endef # Install a data file, given mode, src, and dest define INSTDATA @$(ECHO) " COPY " $(2) =\> $(DESTDIR)$(3) $(V)$(INSTALL_DATA) -m $(1) $(2) $(DESTDIR)$(3) endef # Install a data file, given mode, src, and dest. # Existing dest file is preserved; new file is named *.new if dest exists. define INSTNEW @$(ECHO) " COPY " $(notdir $(2)) =\> $(DESTDIR)$(3)/$(notdir $(2))$(if $(wildcard $(DESTDIR)$(3)/$(notdir $(2))),.new,) $(V)$(INSTALL_DATA) -m $(1) $(2) $(DESTDIR)$(3)/$(notdir $(2))$(if $(wildcard $(DESTDIR)$(3)/$(notdir $(2))),.new,) endef # Install a data file, given mode, src, and dest. # Existing dest file is renamed to *.orig if it exists. define INSTORIG $(if $(wildcard $(DESTDIR)$(3)/$(notdir $(2))), \ @$(ECHO) " MV " $(DESTDIR)$(3)/$(notdir $(2)) =\> \ $(DESTDIR)$(3)/$(notdir $(2)).orig,) $(if $(wildcard $(DESTDIR)$(3)/$(notdir $(2))), \ $(V)$(MV) $(DESTDIR)$(3)/$(notdir $(2)) $(DESTDIR)$(3)/$(notdir $(2)).orig,) @$(ECHO) " COPY " $(notdir $(2)) =\> $(DESTDIR)$(3)/$(notdir $(2)) $(V)$(INSTALL_SCRIPT) -m $(1) $(2) $(DESTDIR)$(3) endef # Make a symlink define SYMLINK @$(ECHO) " LN " $(DESTDIR)/$(2) -\> $(1) $(V)$(LN) -sf $(1) $(DESTDIR)/$(2) endef # Copy a file define COPY @$(ECHO) " CP " $(1) =\> $(DESTDIR)/$(2) $(V)$(CP) -fR $(1) $(DESTDIR)/$(2) endef # Uninstall a file define UNINST @$(ECHO) " RM " $(DESTDIR)$(1) $(V)$(RMF) $(DESTDIR)$(1) endef # Announce distro install define DISTINST @$(ECHO) " ------------------------------------------------------------" @$(ECHO) " $(1) distribution installation" @$(ECHO) " ------------------------------------------------------------" endef # Announce distro uninstall define DISTUNINST @$(ECHO) " ------------------------------------------------------------" @$(ECHO) " $(1) distribution uninstall" @$(ECHO) " ------------------------------------------------------------" endef # If DESTDIR is set, we do no chkconfig processing ifeq ($(DESTDIR),) define CHKCFG $(if $(wildcard $(2)),@$(ECHO) " CKCFG" $(1):$(2)) $(if $(wildcard $(2)),$(V)$(CHKCONFIG) --$(1) apcupsd) endef endif # How to massage dependency list from rst2html ifeq ($(strip $(NODEPS)),) define RSTDEPENDS $(ECHO) $@: $< \\ > $(df).P; \ $(SED) -e '$$q' -e 's/^.*$$/& \\/' < $(df).d >> $(df).P; \ $(ECHO) $<: >> $(df).P; \ $(SED) -e 's/^.*$$/&:/' < $(df).d >> $(df).P; \ $(RMF) $(df).d endef else RSTDEPENDS := endif # Build *.html from *.rst and generate dependencies for it %.html: %.rst @$(ECHO) " HTML " $< ifneq ($(strip $(RST2HTML)),) $(VV)if test ! -d $(DEPDIR); then mkdir -p $(DEPDIR); fi; $(V)$(RST2HTML) $(RST2HTMLOPTS) $< $@ $(VV)$(RSTDEPENDS) else @$(ECHO) "--> Not building HTML due to missing rst2html" endif # Build *.pdf from *.rst %.pdf: %.rst @$(ECHO) " PDF " $< ifneq ($(strip $(RST2PDF)),) $(V)$(RST2PDF) $(RST2PDFOPTS) -o $@ $< else @$(ECHO) "--> Not building PDF due to missing rst2pdf" endif # Format a manpage into plain text define MANIFY @$(ECHO) " MAN " $(1) -\> $(2) $(V)man ./$(1) | col -b > $(2) endef apcupsd-3.14.10/autoconf/variables.mak.in0000664000076400007640000000466411437731442017130 0ustar adk0212adk0212# General rules for Makefile(s) subsystem. # In this file we will put everything that need to be # shared betweek all the Makefile(s). # This file must be included at the beginning of every Makefile # # Copyright (C) 1999-2002 Riccardo Facchetti # # package version PACKAGE = apcupsd DISTNAME = @DISTNAME@ DISTVER = @DISTVER@ VERSION = @VERSION@ # # programs needed by compilation CP = @CP@ MV = @MV@ ECHO = @ECHO@ RM = @RM@ RMF = $(RM) -rf LN = @LN@ SED = @SED@ MAKE = @MAKE@ SHELL = @SHELL@ RANLIB = @RANLIB@ AR = @AR@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ MKINSTALLDIRS = @MKINSTALLDIRS@ CHKCONFIG = /sbin/chkconfig RST2HTML := @RST2HTML@ RST2PDF := @RST2PDF@ # Files and directories (paths) prefix = @prefix@ exec_prefix = @exec_prefix@ sysconfdir = @sysconfdir@ cgibin = @CGIBIN@ VPATH = /usr/lib:/usr/local/lib srcdir = @srcdir@ abstopdir = @ABSSRCDIR@ sbindir = @sbindir@ piddir = @PIDDIR@ mandir=@mandir@ bindir = @bindir@ datadir = @datadir@ HALPOLICYDIR = @HALPOLICYDIR@ DISTDIR = @DISTDIR@ PWRFAILDIR = @PWRFAILDIR@ LOCKDIR = @LOCKDIR@ # Compilation macros. CC = @CC@ CXX = @CXX@ OBJC = $(CC) -x objective-c++ NIB = ibtool LD = @LD@ DEFS = @EXTRADEFS@ $(LOCALDEFS) # Libraries APCLIBS = $(topdir)/src/lib/libapc.a APCDRVLIBS = $(topdir)/src/drivers/libdrivers.a @APCDRVLIBS@ DRVLIBS = @PTHREAD_LFLAGS@ @DRVLIBS@ X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ CPPFLAGS = @CPPFLAGS@ -I$(topdir)/include $(EXTRAINCS) CFLAGS = $(CPPFLAGS) @CFLAGS@ @PTHREAD_CFLAGS@ CXXFLAGS = $(CPPFLAGS) @CXXFLAGS@ @PTHREAD_CFLAGS@ OBJCFLAGS = $(CPPFLAGS) $(CFLAGS) LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ LIBGD = @GD_LIBS@ POWERLIBS = @POWERLIBS@ GAPCMON_CFLAGS = @GAPCMON_CFLAGS@ GAPCMON_LIBS = @GAPCMON_LIBS@ LIBEXTRAOBJ = @LIBEXTRAOBJ@ RST2HTMLOPTS = --field-name-limit=0 --generator --time --no-footnote-backlinks --record-dependencies=$(df).d RST2PDFOPTS = --no-footnote-backlinks --real-footnotes NIBFLAGS = # Driver and package enable flags SMARTDRV := @APCSMART_DRIVER@ DUMBDRV := @DUMB_DRIVER@ USBDRV := @USB_DRIVER@ NETDRV := @NET_DRIVER@ PCNETDRV := @PCNET_DRIVER@ SNMPDRV := @SNMP_DRIVER@ SNMPLTDRV := @SNMPLITE_DRIVER@ TESTDRV := @TEST_DRIVER@ USBTYPE := @USB_TYPE@ CGIDIR := @CGI@ USBHIDDIR := @LIBUSBHID@ GAPCMON := @GAPCMON@ APCAGENT := @APCAGENT@ OBJDIR = .obj DEPDIR = .deps df = $(DEPDIR)/$(*F) DEVNULL := >/dev/null 2>&1 apcupsd-3.14.10/COPYING0000664000076400007640000004335310073605265013272 0ustar adk0212adk0212 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy 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. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. Please see the file "DISCLAIMER" for more details. apcupsd-3.14.10/ChangeLog0000664000076400007640000035371411634011267014013 0ustar adk0212adk0212/***************************************************************************/ /* ChangeLog of Apcupsd 3.14.x */ /* */ /* Adam Kropelin */ /* Kern Sibbald */ /* */ /* http://www.apcupsd.com/ */ /* http://sourceforge.net/projects/apcupsd */ /***************************************************************************/ 2011-09-02 15:17 adk0212 * platforms/: darwin/Info.plist, mingw/winusb/apcupsd.inf: Add PID 5 for SMX750 (at least that's what mine uses). Also change com.apple.kernel.iokit to com.apple.kpi.iokit in OS X plist as suggested in an apple dev list posting. It's unclear this does anything but it might help resolve issues with the kext not being selected on certain systems. 2011-09-02 11:44 adk0212 * src/win32/libusb-winusb-bridge.c: Report proper error numbers, not just -1. 2011-09-02 11:44 adk0212 * src/drivers/usb/: bsd/bsd-usb.c, generic/generic-usb.c, linux/linux-usb.c: Switch USB drivers to prefer FEATURE reports over INPUT reports. This fixes issues with a number of newer UPS models where they advertise INPUT reports but fail to send them when you query for them. Also check report length when processing an interrupt report and ignore it if the length is wrong. This fixes an issue where some UPSes sporadically send truncated interrupt reports. 2011-08-12 19:01 adk0212 * src/action.c: Ignore transitions to battery because of calibration. This can happen if user initiates calibration in apctest, then exits apctest and starts apcupsd before the calibration has completed. In this case we do not want to shut down the machine, so treat onbattery+cal as not on battery at all. Reported by Sergey . 2011-08-05 16:31 adk0212 * src/drivers/: apcsmart/smart.c, pcnet/pcnet.c: Use astrncpy instead of strncpy to avoid leaving strings without NUL termination in the overflow case 2011-08-05 16:30 adk0212 * include/struct.h: Enlarge upsmodel buffer to handle longer model strings. Needed for "Smart-UPS RT 5000 XL" as reported by Sergey 2011-08-05 16:29 adk0212 * include/extern.h: Add missing function prototype 2011-08-05 16:15 adk0212 * doc/manual/manual.html: Regen manual for 3.14.9 release 2011-08-05 16:14 adk0212 * examples/smartsim.c, include/defines.h, src/drivers/apcsmart/smart.c, src/drivers/apcsmart/smartsetup2.c, src/drivers/pcnet/pcnet.c, src/drivers/usb/usb.c, src/lib/apcstatus.c: Fix MODEL vs. APCMODEL confusion Remove APCMODEL, rename old MODEL aka mode to DRIVER. Update apcsmart driver to put model string into upsmodel field. Remove PCNET workaround for CI_UPSMODEL that is no longer needed. Change USB driver to leave mode field alone. 2011-08-04 19:19 adk0212 * doc/home-page/: index.html, index.wml: Add link to OS X binary for 3.14.9 now that it's been released 2011-08-04 19:17 adk0212 * platforms/darwin/Makefile: Work around PackageMaker bug that causes apcagent.app to be relocated at install time in spite of --no-relocate flag 2011-07-22 23:41 adk0212 * doc/home-page/: index.html, index.wml: Update web site for 3.14.9 release 2011-07-22 12:27 adk0212 * ChangeLog, ReleaseNotes, include/version.h: Prep for 3.14.9 release 2011-05-19 18:55 adk0212 * platforms/etc/apcupsd.conf.in, src/drivers/pcnet/pcnet.c: Add support for changing PCNET port in apcupsd.conf 2011-05-15 19:07 adk0212 * platforms/darwin/Info.plist: Add PIDs for AP9620 LCC 2011-05-15 19:04 adk0212 * src/drivers/snmplite/snmplite.cpp: Fix community probing, misc cleanup 2011-01-06 10:24 adk0212 * doc/home-page/: bugs.html, index.html, index.wml, license.html, lists.html, menu.inc, support.html, systems.html: Fix download links on web site; sf.net change the page format again so dl.php no longer works 2010-09-17 08:44 adk0212 * src/lib/apcexec.c: Change back so we no longer wait for threads to exit. This is necessary because pthread_cancel on OS X does not interrupt blocking calls, even those defined as cancellation points by SuSv3. Argh. Someday we need to fix apcupsd thread shutdown correctly, but for now this is no worse than before. 2010-09-10 10:50 adk0212 * include/extern.h, src/apctest.c, src/apcupsd.c, src/lib/apcexec.c, src/lib/apcsignal.c, src/win32/compat/compat.cpp: Rework signal handling to eliminate crashes and hangs. Old signal handler was doing many things wrong: calling unsafe functions in signal context, freeing memory before ensuring users were gone, invoking functions that lock the UPSINFO mutex resulting in deadlock if it's already locked, etc. FIx all this by using a signal handling thread waiting on sigwait() in place of raw handler. 2010-09-10 08:32 adk0212 * src/drivers/snmplite/snmp.cpp: Use "iter->" instead of "(*iter)." 2010-09-10 08:30 adk0212 * src/drivers/snmplite/: mge-mib.cpp, mge-oids.h: Update MGE MIB handler for SNMP sequence support. Contributed by Lars Taeuber 2010-09-09 09:40 adk0212 * src/drivers/apcsmart/smartoper.c: Fix shutdown command when utility power has been restored. Contributed by Michal Soltys 2010-09-09 09:17 adk0212 * src/apctest.c: Prevent apctest from locking up on UPSes that do not respond (at all) to the 'a' command. Contributed by Michal Soltys 2010-09-09 09:12 adk0212 * include/apc.h, include/apc_i18n.h, src/action.c, src/apcnis.c, src/apctest.c, src/apcupsd.c, src/device.c, src/devicedbg.c, src/options.c, src/reports.c, src/drivers/apcsmart/smarteeprom.c, src/drivers/apcsmart/smartoper.c, src/drivers/apcsmart/smartsetup.c, src/drivers/dumb/dumboper.c, src/drivers/dumb/dumbsetup.c, src/drivers/pcnet/pcnet.c, src/drivers/test/testdriver.c, src/drivers/usb/bsd/bsd-usb.c, src/drivers/usb/generic/generic-usb.c, src/drivers/usb/linux/linux-usb.c, src/gapcmon/eggtrayicon.c, src/lib/apcconfig.c, src/lib/apcerror.c, src/lib/apcevents.c, src/lib/apcexec.c, src/lib/asys.c, src/lib/newups.c, src/win32/winservice.cpp: Remove remaining NLS artifacts 2010-09-08 19:25 adk0212 * include/struct.h, src/apctest.c, src/apcupsd.c, src/device.c, src/reports.c, src/drivers/drivers.c, src/drivers/apcsmart/smart.c, src/drivers/apcsmart/smartoper.c, src/drivers/apcsmart/smartsetup.c, src/drivers/dumb/dumboper.c, src/lib/apcconfig.c, src/lib/apcstatus.c: Remove obsolete mode types and simplify cable vs. mode disambiguation logic. UPSTYPE wins. UPSCABLE is only used for dumb driver. Remove a bit of screwy BackUPS Pro and v/s logic that is long obsolete. 2010-09-08 19:23 adk0212 * doc/manual/smartprotocol.rst: Minor update to K command 2010-09-08 15:06 adk0212 * src/drivers/snmplite/rfc1628-mib.cpp: Average LOADPCT across all lines rather than summing them since mfgrs appear to not be adhering to the spec very closely. 2010-09-08 14:44 adk0212 * src/drivers/snmplite/: apc-oids.h, rfc1628-oids.h, snmp.cpp: Use GETNEXT instead of GET so OIDs no longer need trailing zero. 2010-09-07 11:35 adk0212 * src/drivers/snmplite/: apc-oids.h, asn.cpp, asn.h, rfc1628-mib.cpp, rfc1628-oids.h, snmp.cpp, snmp.h, snmplite.cpp: Add support for fetching SNMP table columns as sequences and use it in RFC1628 MIB support. 2010-09-03 16:36 adk0212 * doc/manual/: manual.html, manual.rst: Fix misformatted path due to missing back-tick 2010-09-03 16:33 adk0212 * doc/manual/: manual.html, manual.rst: Update manual for Ed Dondlinger's Windows email scripts 2010-09-03 16:18 adk0212 * doc/manual/: manual.html, manual.rst: More updates for new winusb driver 2010-09-03 16:13 adk0212 * doc/manual/: manual.html, manual.rst: Update supported OSes list...USB on x86_64 Windows is now supported. USB on Win98/ME/2000 is no longer supported. 2010-09-03 14:41 adk0212 * src/win32/Makefile.in: Fix snmplite build on win32 by adding missing mge-mib 2010-09-03 14:40 adk0212 * platforms/mingw/commfailure.vbs, platforms/mingw/offbattery.vbs, platforms/mingw/onbattery.vbs, src/win32/installer/winapcupsd.nsi: Add Windows email scripts and include them in win32 installs as examples Contributed by Ed Dondlinger 2010-09-02 15:31 adk0212 * src/drivers/snmplite/rfc1628-mib.cpp: Reorder cases so they are in numerical order 2010-09-02 15:29 adk0212 * src/drivers/snmplite/rfc1628-mib.cpp: Add missing break 2010-09-02 15:26 adk0212 * src/drivers/snmplite/rfc1628-mib.cpp: Minor correction to low battery logic: Depleted also counts as low. 2010-09-02 15:05 adk0212 * src/drivers/snmplite/rfc1628-oids.h: Missed a couple with table workaround 2010-09-02 14:51 adk0212 * src/drivers/snmplite/rfc1628-oids.h: Workaround for line in and line out data on RFC MIB. Blindly use first index in table. 2010-09-02 10:23 adk0212 * configure, autoconf/configure.in: docutils appears to no longer include a rst2html wrapper for rst2html.py. Update configure accordingly. 2010-09-02 10:22 adk0212 * autoconf/variables.mak.in: Enable generation of footnotes at the bottom of the page in rst2pdf. 2010-09-02 09:26 adk0212 * doc/manual/: manual.html, manual.rst: Update SNMP section 2010-09-02 08:27 adk0212 * src/drivers/snmplite/: snmp.h, snmplite.cpp: Add community probing 2010-09-01 13:14 adk0212 * src/drivers/snmplite/snmplite.cpp: Screen out LTRANS, HTRANS, NOMOUTV, NOMINV, NOMPOWER which are reading zero via an RFC1628 Generex CS121 on a Newave Conceptpower DPA UPS. 2010-09-01 08:41 adk0212 * src/drivers/snmplite/snmplite.cpp: Fix compile error on newer glibc. Passing a const for the first argument of strstr() causes the return value to be const. This is Correct (TM) but annoying in this case. So just cast away the constness of the first arg. 2010-08-31 19:17 adk0212 * src/drivers/snmplite/snmplite.cpp: Remove unnecessary checks for NULL oid. Verify returned data type matches expectation. 2010-08-31 14:57 adk0212 * src/drivers/snmplite/: apc-mib.cpp, mge-mib.cpp, mibs.h, rfc1628-mib.cpp, snmplite.cpp: Remove strategy-specific probe hook. We don't need it now and probably will never need it. 2010-08-31 14:06 adk0212 * src/drivers/snmplite/: apc-mib.cpp, mge-mib.cpp, mibs.cpp, mibs.h, rfc1628-mib.cpp, snmplite-common.h, snmplite.cpp: Add support for MIB autodetection by probing for CI_STATUS OID. Also rework NOTRAP handling to not require a special notrap MibStrategy for each MIB. 2010-08-30 14:41 adk0212 * src/drivers/snmplite/snmplite.cpp: Allow user to omit one or more subsections of SNMP DEVICE string. Contributed by Lars Täer 2010-08-30 14:18 adk0212 * src/drivers/snmplite/asn.cpp: Fix typo. Contributed by Lars Täer 2010-08-30 14:18 adk0212 * src/drivers/snmplite/: mge-mib.cpp, mge-oids.h, mibs.cpp: Add support for MGE SNMP MIB. Contributed by Lars Täer 2010-08-20 20:34 adk0212 * doc/manual/maintaining_ups.rst: Add SU1000INET battery constant 2010-08-17 14:24 adk0212 * include/version.h: Update for 3.14.9-test1 release 2010-08-16 19:18 adk0212 * src/win32/Makefile.in: Default to winusb driver 2010-08-16 19:15 adk0212 * src/win32/Makefile.in: Update for new files in snmplite 2010-08-13 14:52 adk0212 * src/drivers/snmplite/rfc1628-mib.cpp: Take another guess at RFC1628 killpower/shutdown based on TrippLite's interpretation of upsAutoRestart. 2010-08-13 14:40 adk0212 * src/drivers/snmplite/rfc1628-mib.cpp: Attempt to implement shutdown/killpower for RFC1628 SNMP MIB. MIB docs are somewhat unclear so this is a best guess. 2010-08-13 14:02 adk0212 * src/drivers/snmplite/: mibs.h, mibs.cpp: Add missing file. 2010-08-13 14:00 adk0212 * src/drivers/snmplite/: apc-mib.cpp, rfc1628-mib.cpp, snmplite-common.h, snmplite.cpp, snmplite.h: Reorganize multiple MIB support. Vendor names are now associated with MIB strategies directly. killpower and shutdown operations are deferred to the strategy as is trap waiting. Other general cleanup. 2010-07-30 18:04 adk0212 * src/drivers/snmplite/: apc-mib.cpp, apc-oids.h, mib.cpp, oids.h, rfc1628-mib.cpp, rfc1628-oids.h, snmplite.cpp, snmplite.h: Add support for RFC1628 SNMP MIB. Refactor APC MIB and create MibStrategy struct for associating MIB/CI mapping with corresponding processing function. RFC1628 strategy is coded per the MIB but untested. 2010-07-10 11:32 adk0212 * platforms/mingw/: apcupsd.inf, winusb/apcupsd.inf: Update Windows *.inf files for LCC PIDs 2010-05-16 18:11 adk0212 * src/apctest.c: Remove unused variable shm_OK 2010-05-16 18:09 adk0212 * src/win32/compat/compat.cpp: When logging events, convert LOG_CRIT to a WARNING on Win32 rather than an ERROR since apcupsd uses it for power events which aren't really daemon errors. LOG_ERR is still converted to ERROR for use in true error cases. 2010-05-16 17:57 adk0212 * src/apcupsd.c: Fix bug where pid file was overwritten even when lock file indicates another instance is running. Now we only write the pid file after writing the lock file successfully. Also automatically remove pid file on termination if we created it in the first place. Reported by Justin Killen 2010-04-29 19:25 adk0212 * src/win32/installer/winapcupsd.nsi: When running uninstaller in silent mode, always remove config and events files without prompting. Reported by Zdenek Jirous 2010-04-29 19:20 adk0212 * src/win32/installer/winapcupsd.nsi: Honor INSTDIR specified on command line via /D. Reported by Zdenek Jirous 2010-02-20 10:09 adk0212 * src/reports.c: Variable largebuf may be overflowed by the buf data, which can cause overwriting of subsequent variables. I: Statement might be overflowing a buffer in strncat. Common mistake: BAD: strncat(buffer,charptr,sizeof(buffer)) is wrong, it takes the left over size as 3rd argument GOOD: strncat(buffer,charptr,sizeof(buffer)-strlen(buffer)-1) E: apcupsd bufferoverflowstrncat reports.c:110 Reported by Stanislav Brabec 2010-01-31 12:16 adk0212 * doc/manual/: manual.html, smartprotocol.rst: Update SmartUPS protocol register 2 bit 5. This is supported on SmartUPSes. 2010-01-31 11:10 adk0212 * src/drivers/usb/: usb.c, usb_common.h, bsd/bsd-usb.c, generic/generic-usb.c, linux/linux-usb.c: Add missing handling for DALARM. Also PWSUM is a LOGICAL collection, not a PYSICAL collection, so add support for checking LOGICAL collection and update known_info table appropriately. This fixes BATTV and MANDATE on certain newer APC models. 2010-01-24 08:19 adk0212 * src/lib/apcstatus.c: Remove unnecessary debug print 2010-01-17 19:12 adk0212 * src/drivers/usb/generic/generic-usb.c: When using generic-usb driver, interpret DEVICE setting as the serial number of the UPS to monitor. This allows the user to control which UPS is monitored if more than one is connected. A blank DEVICE setting continues to mean autodetect. 2010-01-17 13:58 adk0212 * configure: Fix define 2010-01-17 13:37 adk0212 * configure, autoconf/configure.in, src/lib/Makefile, src/lib/libsupc++fix.cpp: Add workaround for FreeBSD libsupc++.a issue (FreeBSD PR #99702) This will allow snmplite driver to compile/link on FreeBSD 5.x 2010-01-17 10:58 adk0212 * configure, autoconf/configure.in: Force use of generic_usb on FreeBSD 8.0 and higher. FreeBSD USB API was changed in 8.0, so from now on we will use libusb. 2010-01-17 10:38 adk0212 * src/drivers/snmplite/snmplite.cpp: Fix compile warning 2010-01-17 10:30 adk0212 * autoconf/configure.in: Fix comment 2010-01-17 10:29 adk0212 * configure, autoconf/configure.in: If libusb-config is not found, fall back on a plain old AC_CHECK_LIB. This will allow building against the new libusb-1.x with compatibility API. 2010-01-17 10:26 adk0212 * doc/manual/manual.html: Regen manual for release 2010-01-16 15:16 adk0212 * doc/home-page/: bugs.html, index.html, index.wml, license.html, lists.html, menu.inc, support.html, systems.html: Update for 3.14.8 release 2010-01-16 11:09 adk0212 * ChangeLog, ReleaseNotes, include/version.h: Prep for 3.14.8 release 2010-01-16 11:01 adk0212 * doc/apctest.8: Update apctest manpage for USB changes 2010-01-16 10:19 adk0212 * platforms/mingw/winusb/amd64/WdfCoInstaller01009.dll, platforms/mingw/winusb/amd64/winusbcoinstaller2.dll, platforms/mingw/winusb/i386/WdfCoInstaller01009.dll, platforms/mingw/winusb/i386/winusbcoinstaller2.dll, src/win32/installer/winapcupsd.nsi: Move winusb coinstallers to depkgs-win32 so they do not bloat the source tree. 2010-01-12 18:07 adk0212 * examples/: client.c, megaclient.c, newslave.c, smartsim.c, upsapm.c: Fix compiler warnings. Also remove whitespace at the end of lines. Contributed by Andy O'Shaughnessy 2010-01-10 16:50 adk0212 * platforms/darwin/apcupsd-uninstall: Remove apcagent application in darwin uninstall script 2010-01-10 16:45 adk0212 * platforms/: mandrake/apcupsd.spec.in, redhat/apcupsd.spec.in, suse/apcupsd.spec.in: spec updates for new SNMP driver 2010-01-10 16:44 adk0212 * src/win32/libusb-winusb-bridge.h: Minor style changes 2010-01-10 16:30 adk0212 * doc/manual/: manual.html, manual.rst: Minor updates for SNMP. Also add gapcmon and apcagent configure options. 2010-01-10 15:32 adk0212 * src/win32/listview.cpp: Fix bug that caused key/value columns to become mismatched if a row was removed from the list. 2010-01-10 15:14 adk0212 * src/drivers/snmplite/snmp.cpp: Increase SNMP query timeout to prevent false failures when UPS is being hit by two SNMP clients at once. 2010-01-10 15:05 adk0212 * configure, autoconf/configure.in, platforms/etc/apcupsd.conf.in, platforms/mingw/apcupsd.conf.in, src/lib/apcconfig.c: Fix up SNMP driver selection. Config file "snmp" selects snmplite, while old driver remains available as 'netsnmp'. Same for ./configure script. 2010-01-10 15:02 adk0212 * include/defines.h: Fix DALARM (depends on alarm timer setting from upsAdvConfigAlarmTimer) 2010-01-10 15:00 adk0212 * src/win32/installer/winapcupsd.nsi: Improve warning message for USB driver install failure 2010-01-10 14:59 adk0212 * src/drivers/snmplite/: mib.cpp, snmplite.cpp: Fix DALARM (depends on alarm timer setting from upsAdvConfigAlarmTimer) 2010-01-10 12:59 adk0212 * platforms/mingw/winusb/install.txt: Add a troubleshooting section describing that the common cause of failure with "Error Code 10" is that the driver was installed on the wrong device. 2010-01-10 12:58 adk0212 * platforms/mingw/winusb/apcupsd.inf: Add a driver version to assist with upgrading. 2010-01-10 10:39 adk0212 * src/apctest.c: Consolidate get/set USB options. Since all 'set' operations allow you to bail out without changing anything, they also serve as 'get'. 2010-01-10 10:29 adk0212 * include/defines.h, src/apctest.c, src/drivers/usb/usb.c: Add apctest support for reading/setting self-test interval on USB. Also show current setting in UPS status. Contributed by James Belleau 2010-01-10 10:02 adk0212 * src/apctest.c: Use 'Q' to exit menus instead of the last number which is always changing. Contributed by James Belleau 2010-01-09 13:35 adk0212 * src/: drivers/usb/win/Makefile, drivers/usb/win/hidutils.c, drivers/usb/win/hidutils.h, drivers/usb/win/win-usb.c, drivers/usb/win/winusb.h, win32/Makefile.in, win32/libusb-winusb-bridge.c, win32/libusb-winusb-bridge.h, win32/winusb.h: Consolidate win-usb driver back into generic-usb by writing a simple libusb API adapter for winusb (libusb-winusb-bridge). This eliminates the code duplication between win-usb and generic-usb. 2010-01-08 19:23 adk0212 * src/win32/installer/winapcupsd.nsi: Update detail text while waiting for apps to exit so user knows why we're sitting here for a few seconds. Also skip apctray exit wait if we've installed the main apcupsd package since that means we've already ensured apctray is not running. 2010-01-08 19:11 adk0212 * src/win32/installer/: DrvSetup.nsh, winapcupsd.nsi: Update installer to automatically install WinUSB driver when possible. 2010-01-03 20:51 adk0212 * src/win32/installer/winapcupsd.nsi: Win2k3 has an extra icon in shell32.dll which throws off the numbering causing the manpages to have the wrong icon. Just use the same icon for manpages and user manual. 2010-01-03 20:19 adk0212 * src/win32/installer/winapcupsd.nsi: Set icons for start menu shortcuts. For now, just use common icons from shell32.dll. 2010-01-03 17:02 adk0212 * src/win32/installer/winapcupsd.nsi: Include driver install instructions text file 2010-01-03 17:01 adk0212 * platforms/mingw/winusb/apcupsd.inf: Cleanup INF naming, class, etc. 2010-01-03 17:00 adk0212 * platforms/mingw/winusb/install.txt: Initial rev of winusb driver install instructions. 2010-01-03 13:08 adk0212 * src/win32/Makefile.in: Update VERSION munging for resource script to accomodate version strings with a -foo extension. 2010-01-03 12:46 adk0212 * src/win32/Makefile.in: Fix build order so libusb.h is created before it is needed. 2010-01-03 12:33 adk0212 * src/win32/: Makefile.in, installer/winapcupsd.nsi: Add support for building and installing WinUSB. Default remains as generic-usb. To build for WinUSB set USBTYPE=winusb. 2010-01-03 12:32 adk0212 * src/win32/installer/: StrReplace.nsh, util.nsh: Move StrReplace to its own file. Remove unused version functions now that we're using the built-in WinVer.nsh. 2010-01-03 12:27 adk0212 * src/win32/build-win32-cross-tools: Enable building the NSIS System plugin. 2010-01-03 10:29 adk0212 * platforms/mingw/winusb/: apcupsd.inf, amd64/WdfCoInstaller01009.dll, amd64/winusbcoinstaller2.dll, i386/WdfCoInstaller01009.dll, i386/winusbcoinstaller2.dll: WinUsb-based INF file customized for APCUPSD and driver coinstallers from Win7 DDK. 2010-01-03 10:22 adk0212 * src/drivers/usb/win/: Makefile, hidutils.c, hidutils.h, win-usb.c, winusb.h: First rev of Windows-specific USB driver based on Microsoft's WinUsb framework for user mode USB drivers. 2010-01-02 16:28 adk0212 * src/drivers/snmp/drv_powernet.c: Revert previous change: Locks are already held by snmp.c wrapper funcs. 2010-01-02 14:58 adk0212 * src/win32/installer/winapcupsd.nsi: Remove old non-txt files so they do not get stuck around after an install-in-place. 2010-01-02 14:50 adk0212 * platforms/mingw/apcupsd.conf.in, src/win32/Makefile.in, src/win32/installer/winapcupsd.nsi: Convert win32 config and doc files to DOS line endings so they can be viewed and edited in notepad. This is necessary because the workaround of using write.exe for UNIX format files does not work well on Win7 due to it using wide margins that unpleasantly word-wraps all the text. Use a *.txt extension on filenames where possible and use default 'open' behavior so if user has configured an alternate editor for *.txt it will be used. 2010-01-02 14:47 adk0212 * src/win32/build-win32-cross-tools: Update to nsis-2.46 and w32api-3.14 2010-01-02 13:42 adk0212 * src/win32/installer/: common.nsh, winapcupsd.nsi: Update installer to use /kill switch to shutdown apps again. This will provide more reliable shutdowns, especially on Vista/Win7 where apcupsd service is running in another session and therefore is inaccessible by the window message mechanism. Remove old window message based shutdown logic. 2010-01-01 12:02 adk0212 * src/drivers/snmplite/: snmp.cpp, snmp.h, snmplite.cpp: Add support for APC_NOTRAP vendor which disabled trap catching. 2010-01-01 11:41 adk0212 * src/drivers/snmp/drv_powernet.c: Hold the write lock while updating UPSINFO state variables. This is necessary to prevent NIS clients from seeing partially-updated state. 2010-01-01 11:13 adk0212 * platforms/mingw/apccontrol.bat: Only do popups on Win95/98/ME/NT. Newer OSes will run apctray which shows events in a balloon notification. 2010-01-01 11:12 adk0212 * src/win32/apctray.cpp: Bring back /kill support. Registry change detection no longer needed. 2010-01-01 11:11 adk0212 * src/win32/popup.c: Remove conditionals; always display a popup. 2009-11-21 12:34 adk0212 * doc/home-page/dl.php: Center date field now that sf.net is not reporting time info. 2009-11-21 12:32 adk0212 * doc/home-page/dl.php: Fix issue with displaying DMG .sig info for 3.14.7 source code link. Something at the top of the source is messing up the regexp, but can't figure out exactly what. So just chop off the top of the page completely. We only want the data in the All Files section anyway. 2009-11-15 12:56 adk0212 * doc/images/: Makefile, apcupsd-logo.eps, apcupsd.eps, back.eps, back.png, charging.eps, commlost.eps, home.eps, home.png, image_convert.pl, image_scales, img1.eps, img1.png, img10.eps, img10.png, img11.eps, img11.png, img12.eps, img12.png, img13.eps, img13.png, img14.eps, img14.png, img2.eps, img2.png, img3.eps, img3.png, img4.eps, img4.png, img5.eps, img5.png, img6.eps, img6.png, img7.eps, img7.png, img8.eps, img8.png, img9.eps, img9.png, main_configs.eps, multimon.eps, next.eps, next.png, onbatt.eps, online.eps, status.eps, thanks.eps, wininstall1.eps, wininstall1.png, wininstall2.eps, wininstall2.png, wininstall3.eps, wininstall3.png, wininstall4.eps, wininstall4.png, wininstall5.eps, wininstall5.png, wininstall6.eps, wininstall7.eps, wininstall7.png: Remove obsolete image files. 2009-11-15 10:05 adk0212 * doc/home-page/dl.php: Update for change in sf.net HTML (data format changed) 2009-11-15 09:18 adk0212 * src/drivers/usb/usb.c: Add support for reading battery voltage from the PowerSummary instead of the Battery physical usage. At least one Back-UPS model appears to place its battery readout there instead of the normal place. Back-UPS 500 FW: 6.3.I USB FW: c1 2009-11-09 21:19 adk0212 * src/smtp.c: Fix timezone on Windows. This has always been wrong. 2009-11-09 21:05 adk0212 * include/extern.h, src/lib/apclog.c, src/lib/apcstatus.c: Switch time/date output format to simplified ISO "YYYY-MM-DD HH:MM:SS +/-UTC" 2009-11-09 21:03 adk0212 * src/lib/autil.cpp: Fix compile error. 2009-10-31 11:32 adk0212 * include/aiter.h, include/alist.h, include/amap.h, include/amutex.h, include/aqueue.h, include/astring.h, include/athread.h, include/atimer.h, include/autil.h, src/lib/amutex.cpp, src/lib/astring.cpp, src/lib/athread.cpp, src/lib/atimer.cpp, src/lib/autil.cpp: Sync alib with gelogger project 2009-10-31 10:04 adk0212 * src/drivers/usb/bsd/hidutils.c: Fix compile warning 2009-10-31 09:59 adk0212 * src/drivers/snmplite/snmplite.cpp: Fix compile warning 2009-10-31 09:31 adk0212 * include/apc.h, src/drivers/snmplite/snmp.cpp, src/lib/apclibnis.c: Move INADDR_NONE define to common header 2009-10-31 09:28 adk0212 * src/: drivers/snmplite/snmp.cpp, lib/apclibnis.c: Fix signed/unsigned comparison warning 2009-10-31 09:24 adk0212 * src/drivers/snmplite/snmp.cpp: Fix compile error on Solaris 10 2009-10-31 08:55 adk0212 * src/win32/Makefile.in: win32 build fixes 2009-10-31 08:42 adk0212 * src/lib/apclibnis.c: Fix comment 2009-10-31 08:37 adk0212 * src/lib/apclibnis.c: Switch libnis to thread-safe gethostname_re() 2009-10-27 20:31 adk0212 * src/win32/: Makefile.in, compat/winconfig.h: Updates so win32 will build with gethostbyname_r 2009-10-27 20:24 adk0212 * configure, autoconf/config.h.in, autoconf/configure.in, include/extern.h, src/drivers/snmplite/snmp.cpp, src/drivers/snmplite/snmp.h, src/lib/Makefile, src/lib/gethostname.c: Switch SnmpEngine to thread-safe resolver, gethostbyname_r() 2009-10-27 19:28 adk0212 * src/drivers/snmplite/: asn.cpp, asn.h, snmp.cpp, snmp.h: Misc cleanup 2009-10-27 19:19 adk0212 * src/drivers/snmplite/: asn.cpp, asn.h, snmp.cpp, snmp.h: Make lengths universally unsigned 2009-10-27 19:11 adk0212 * src/drivers/snmplite/: asn.cpp, asn.h: Add ability to calculate marshalled size of each data type without actually marshalling the data. This allows Sequence to precalculate its size which in turn allows us to encode length fields in the minimum possible number of octets instead of always using 4. This reduces packet size substantially. 2009-10-26 19:37 adk0212 * src/drivers/snmplite/traps.h: Definitions for APC UPS traps. Not used yet, but may be handy someday. 2009-10-26 19:36 adk0212 * src/drivers/snmplite/asn.h: Spacing changes 2009-10-26 19:36 adk0212 * src/drivers/snmplite/: snmp.cpp, snmp.h, snmplite.cpp: Add support for SNMP trap catching 2009-10-25 21:30 adk0212 * src/drivers/snmplite/asn.h: Toy with spacing 2009-10-25 21:07 adk0212 * src/: device.c, drivers/drivers.c, drivers/snmplite/mib.cpp, drivers/snmplite/snmplite.cpp, drivers/snmplite/snmplite.h: Add snmplite support for shutdown and killpower 2009-10-25 21:07 adk0212 * src/drivers/snmplite/: asn.h, snmp.cpp, snmp.h: Add SET command support to SnmpEngine and support classes 2009-10-25 18:00 adk0212 * src/drivers/snmplite/snmplite.cpp: Update comments 2009-10-25 17:48 adk0212 * src/lib/apcstatus.c: Add units to ambient humidity and temp status lines 2009-10-25 17:45 adk0212 * src/drivers/snmplite/snmplite.cpp: Remove sanity filter on ambient temp and humidity readings. These both read zero if your MeasureUPS probe is not connected, so we don't want to exclude them in that case. 2009-10-25 17:37 adk0212 * src/drivers/snmplite/snmplite.cpp: Add support for detecting and recovering from network errors 2009-10-25 16:47 adk0212 * src/drivers/snmplite/: asn.cpp, asn.h: Misc cleanup 2009-10-25 16:31 adk0212 * include/version.h: Bump version string 2009-10-25 15:56 adk0212 * src/apcagent/InstanceManager.m: Reorder function 2009-10-25 15:53 adk0212 * src/drivers/snmplite/: mib.cpp, oids.h: Spit OID arrays out into their own file so they're not cluttering mib.cpp. Also wrap gcc-specific attribute. 2009-10-25 15:41 adk0212 * src/win32/Makefile.in: Add snmplite driver to win32 build 2009-10-25 15:41 adk0212 * src/drivers/snmplite/: asn.cpp, mib.cpp, snmp.cpp, snmp.h: Minor changes so snmplite can build for win32 2009-10-25 15:28 adk0212 * src/drivers/snmplite/: mib.cpp, snmplite.cpp: Update MIB map with more CIs from old powernet driver. 2009-10-25 14:48 adk0212 * include/defines.h, src/drivers/snmplite/snmplite.cpp: Updates for compatibility with old AP960x SNMP cards. 2009-10-25 12:14 adk0212 * src/drivers/snmplite/snmp.cpp: Remove some debug 2009-10-25 11:54 adk0212 * src/drivers/snmplite/: asn.cpp, asn.h, snmp.cpp, snmp.h: Rearrange ASN types. Although it seems like a good idea to have a strict separation between ASN and SNMP such that the ASN layer is not polluted with SNMP types, this isn't working very well in practice. So teach ASN about the basic SNMP types and get rid of the Snmp::PduType. 2009-10-25 11:03 adk0212 * configure, autoconf/config.h.in, autoconf/configure.in, autoconf/variables.mak.in, include/struct.h, platforms/etc/apcupsd.conf.in, src/drivers/Makefile, src/drivers/drivers.c, src/drivers/snmplite/Makefile, src/drivers/snmplite/asn.cpp, src/drivers/snmplite/asn.h, src/drivers/snmplite/mib.cpp, src/drivers/snmplite/snmp.cpp, src/drivers/snmplite/snmp.h, src/drivers/snmplite/snmplite.cpp, src/drivers/snmplite/snmplite.h, src/lib/apcconfig.c, src/lib/apcstatus.c: Add SNMP Lite driver which does not depend on net-snmp library. This makes it more portable and eliminates need to move libsnmp.so to /lib in order to do a killpower on systems where /usr is unmounted. 2009-10-25 10:58 adk0212 * include/alist.h: Make size unsigned 2009-10-24 15:41 adk0212 * include/aarray.h: Simple (and inefficient) dynamic array template class 2009-10-24 10:04 adk0212 * platforms/darwin/Makefile: Force use of HFS+ rather than HFSX (case-sensitive HFS+) so 10.5+ will open the image without crying about it. 2009-10-15 20:46 adk0212 * configure, autoconf/configure.in: Revert snmp static lib change. This is too incompatible. Solaris only has static versions of libnetsnmp but not libcrypto. Darwin doesn't seem to have static versions of either of them. 2009-10-15 18:42 adk0212 * autoconf/configure.in, configure: Link with static snmp libs since some platforms do not have the shared ones in /lib. Contributed by Brad King via Debian bugtracker. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=316932 2009-10-15 18:13 adk0212 * platforms/apccontrol.in: Merge WALL fix from Justin T Pryzby http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=546019 2009-10-14 19:14 adk0212 * src/apcagent/MainMenu.xib: Update status window control layout to match apctray 2009-10-12 19:22 adk0212 * src/win32/Makefile.in: Lowercase $(COMMA) 2009-10-12 19:15 adk0212 * src/win32/: Makefile.in, winres.rc: Patch version info into resource file on the fly 2009-10-12 18:53 adk0212 * src/win32/winres.rc: Set operating system field correctly 2009-10-12 18:50 adk0212 * src/win32/winres.rc: Update file information block. Still not sure what to do about version info 2009-10-12 18:35 adk0212 * src/win32/: balloonmgr.cpp, balloonmgr.h, winabout.cpp, winabout.h, winconfig.cpp, winconfig.h, winevents.cpp, winevents.h, winstat.cpp, winstat.h, wintray.cpp, wintray.h: Convert all member variable names to leading underscore convention 2009-10-12 18:27 adk0212 * src/apcagent/: AppController.h, AppController.m: Update for StatMgr::GetAll() changes 2009-10-12 18:17 adk0212 * include/statmgr.h, src/lib/statmgr.cpp, src/win32/winstat.cpp: Change StatMgr::GetAll() to return keys and values separately instead of combining them into a single string which the caller then has to split. 2009-10-12 18:09 adk0212 * src/win32/: listview.cpp, listview.h, winevents.cpp, winstat.cpp: Consolidate listview update code into ListView wrapper class. 2009-10-12 17:43 adk0212 * src/win32/: apctray.cpp, winevents.cpp, winevents.h, winstat.cpp, winstat.h, wintray.cpp, wintray.h: Fix issue with events and status dialogs not updating until the next poll thread tick. Kicking the poll thread inline with window creation does not work since new window is not yet fully created (WM_INITDIALOG has not been processed yet). Fix is to have status and events dialogs request a refresh when WM_INITDIALOG arrives. 2009-10-11 18:51 adk0212 * src/win32/wintray.cpp: Minor cleanup 2009-10-11 18:33 adk0212 * src/win32/: instmgr.cpp, instmgr.h, resource.h, winres.rc, wintray.cpp, wintray.h: Add menu item for controlling autostart 2009-10-11 15:21 adk0212 * src/win32/: resource.h, winevents.cpp, winevents.h, winres.rc, winstat.cpp, winstat.h, wintray.cpp: Change events and status dialogs to not use cached statmgr since it will be replaced when user changes config. Update events window to use listview and have resize capability. 2009-10-11 13:04 adk0212 * src/win32/: wintray.cpp, wintray.h: Move reconfig to poll thread so UI is not held up when applying a new config. This is in line with what the OS X apcagent does. 2009-10-11 12:41 adk0212 * src/win32/: apctray.cpp, wintray.cpp, wintray.h: Fix redrawing icons when explorer restarts with new taskbar 2009-10-11 12:15 adk0212 * src/win32/instmgr.cpp: Minor cleanup 2009-10-11 12:15 adk0212 * src/lib/statmgr.cpp: Rework network error handling so Update() only retries on soft errors, not hard errors. This helps minimize the length of time a given monitor will ignore UI events when it is unable to connect to an apcupsd. 2009-10-11 12:12 adk0212 * src/win32/wintray.cpp: Fix thread hang by lengthening thread exit wait to accomodate worst case 2009-10-11 12:12 adk0212 * src/win32/winres.rc: Move runtime field onto same line as status and shrink dialog to match 2009-10-10 13:39 adk0212 * src/win32/: winabout.cpp, winres.rc, resource.h: About box updates: Remove old logo, fix version/date info, update copyright 2009-10-10 11:56 adk0212 * src/win32/winconfig.cpp: Set focus to first invalid control 2009-10-10 11:55 adk0212 * src/win32/winres.rc: Restrict port and refresh fields to digits only 2009-10-10 11:42 adk0212 * src/win32/: instmgr.cpp, instmgr.h, winconfig.cpp, winconfig.h, wintray.cpp: Add support for disabling popups. Other misc cleanup. 2009-10-08 18:59 adk0212 * src/win32/: winconfig.cpp, winconfig.h, wintray.cpp, wintray.h: Fixes for config dialog. Implement basic input validation. 2009-10-08 18:05 adk0212 * src/win32/winstat.cpp: Fix row deletion bug when number of items decreases 2009-10-07 20:36 adk0212 * src/win32/: winconfig.cpp, winconfig.h: First pass at config dialog 2009-10-07 20:36 adk0212 * src/win32/: Makefile.in, apctray.cpp, instmgr.cpp, instmgr.h, winabout.cpp, winabout.h, winevents.cpp, winevents.h, winstat.cpp, winstat.h, wintray.cpp, wintray.h: First pass at configuration dialog. 2009-10-07 19:10 adk0212 * src/win32/: apctray.cpp, instmgr.cpp, instmgr.h, resource.h, winres.rc, wintray.cpp, wintray.h, winups.h: Multiple instances working again now. New 'add' menu option to add a new monitor. Rearrange menu items to match OS X. Lots of code cleanup. 2009-10-07 19:08 adk0212 * include/alist.h: Add support for operator->() on iterator 2009-10-07 08:02 adk0212 * src/win32/: Makefile.in, apctray.cpp, instmgr.cpp, instmgr.h, listview.cpp, resource.h, winprop.cpp, winprop.h, winres.rc, winstat.cpp, wintray.cpp, wintray.h: Begin to clean up instance management by creating an InstanceManager. Basic functions are working again, but add/remove instance needs work. 2009-10-05 20:35 adk0212 * src/win32/winstat.cpp: Fix possible crash if FillStatusBox() were to be called at just the wrong instant. 2009-10-05 20:07 adk0212 * src/win32/winstat.cpp: Don't leak ListView wrappers 2009-10-05 20:05 adk0212 * src/win32/Makefile.in: Add wrapper class for listview and use it from winstat 2009-10-05 20:04 adk0212 * src/win32/: listview.cpp, listview.h, winstat.cpp, winstat.h: Add wrapper class for listview and use it in winstat. 2009-10-05 19:35 adk0212 * src/win32/: meter.cpp, meter.h, winstat.cpp, winstat.h: Add/update copyright banners 2009-10-05 19:34 adk0212 * src/win32/: Makefile.in, meter.cpp, meter.h, winstat.cpp, winstat.h: Colorize load and battery meters, as per apcagent. Break meter code out into a separate wrapper class -- a poor man's MFC essentially. Only update controls when their values change to further reduce refresh flicker. Misc cleanup. 2009-10-04 13:02 adk0212 * include/astring.h, src/lib/astring.cpp, src/win32/apctray.cpp, src/win32/balloonmgr.cpp, src/win32/popup.c, src/win32/resource.h, src/win32/winabout.cpp, src/win32/winevents.cpp, src/win32/winres.h, src/win32/winres.rc, src/win32/winstat.cpp, src/win32/winstat.h, src/win32/wintray.cpp: Rewrite apctray status dialog to mimic apcagent on OS X. Window now updates on the fly, is resizeable, and has summary info at the top. Also uses ListView control for raw status info so it is in two nice columns and no longer needs to be rendered in an ugly fixed-width font. Switch to ResEdit (http://www.resedit.net) for GUI resource editing instead of tweaking winres.rc by hand. This requires renaming winres.h to resource.h since that's what ResEdit wants to generate. 2009-10-03 13:26 adk0212 * src/apcagent/MainMenu.xib: Fix preferences window label text being obscured by the surrounding box. Issue only appeared on 10.4, but probably just getting lucky with drawing order on 10.5. 2009-10-03 10:20 adk0212 * src/apcagent/AppController.m: Fix issue with popups not appearing if Growl is installed while apcagent is running. 2009-09-30 19:15 adk0212 * autoconf/targets.mak, platforms/darwin/Makefile, src/apcagent/Makefile: Include apcagent in OS X installer DMG 2009-09-29 19:20 adk0212 * configure, autoconf/configure.in, autoconf/variables.mak.in, src/Makefile: Build apcagent automatically on OS X but let user disable it via configure if s/he so desires. 2009-09-29 18:58 adk0212 * src/apcagent/: AppController.h, AppController.m, InstanceConfig.h, InstanceConfig.m, MainMenu.xib, Makefile, growl.plist, main.m: Add support for popup notifications via Growl 2009-09-27 19:39 adk0212 * src/apcagent/LoginItemsAE.c: Fix login item creation on 10.4. Problem and solution is nicely documented by Jake Sprouse here: http://jakesprouse.net/2007/03/28/debugging-apples-loginitemsaec-on-intel-macs 2009-09-27 16:03 adk0212 * src/apcagent/Makefile: Overwrite dmg 2009-09-27 15:56 adk0212 * src/apcagent/: AppController.h, AppController.m, InstanceManager.h, InstanceManager.m, MainMenu.xib: Add menu item to enable/disable starting at login 2009-09-27 14:37 adk0212 * src/apcagent/: AppController.h, AppController.m, InstanceManager.h, InstanceManager.m, LoginItemsAE.c, LoginItemsAE.h, MainMenu.xib, Makefile, main.m: Add UPS and HOST info to top of menu a'la apctray on win32. Automatically add user login item when apcagent is started for the first time. Remove login item when last monitor is removed. Add menu option to remove all monitors at once. Reorder menu items slightly. 2009-09-27 10:57 adk0212 * src/apcagent/: AppController.h, AppController.m, InstanceConfig.h, InstanceConfig.m, InstanceManager.h, InstanceManager.m, MainMenu.xib, Makefile, NSString+uuid.h, NSString+uuid.m, main.m: Support for multiple instances 2009-09-23 20:14 adk0212 * src/lib/statmgr.cpp: Interpret failure to read any status items as failure of the connection and close it. Retry Update() once in case it fails. 2009-09-23 18:19 adk0212 * src/apcagent/Makefile: Fix linking of libapc.a so it is included as a dependency. 2009-09-23 18:17 adk0212 * src/lib/apclibnis.c: Ignore SIGPIPE, which can happen when writing to a socket where the remote end has closed the connection. Also improve error handling in write_nbytes(). 2009-09-23 18:16 adk0212 * include/statmgr.h, src/lib/statmgr.cpp: Copy hostname so caller doesn't have to keep it valid. 2009-09-20 19:47 adk0212 * src/apcagent/AppController.m: Minor cleanups 2009-09-20 19:29 adk0212 * src/apcagent/AppController.m: Minor optimization to DataSource classes 2009-09-20 19:07 adk0212 * src/apcagent/: AppController.h, AppController.m, Info.plist, MainMenu.xib: Plumb in about panel. Expand copyright text slightly. Rename menu items to more closely match other OS X app naming conventions. 2009-09-20 18:23 adk0212 * doc/images/: charging.png, onbatt.png, online.png: Make icon backgrounds transparent 2009-09-20 17:25 adk0212 * src/apcagent/: AppController.m, MainMenu.xib: Add horizontal separators to the menu 2009-09-20 17:13 adk0212 * src/apcagent/Makefile: Remove InfoPlist.strings dependency 2009-09-20 17:11 adk0212 * src/apcagent/: Info.plist, InfoPlist.strings, Makefile: Update Info.plist with copyright and version info. Version is substituted at build time for __VERSION__. Remove unused InfoPlist.strings file. 2009-09-20 17:11 adk0212 * src/apcagent/AppController.m: Minor cleanup 2009-09-20 16:39 adk0212 * src/apcagent/: AppController.h, AppController.m, Info.plist, InfoPlist.strings, MainMenu.xib, Makefile, PkgInfo, main.m: Add apcagent, an apctray-like applet for Mac OS X 2009-09-20 16:26 adk0212 * include/statmgr.h, src/lib/statmgr.cpp, src/win32/wintray.cpp: Move FetchStatus() to StatMgr class and rename to GetSummary() 2009-09-20 16:11 adk0212 * platforms/darwin/build-notes.txt, src/win32/Makefile.in, src/win32/statmgr.cpp, src/win32/statmgr.h, src/win32/winevents.cpp, src/win32/winstat.cpp, src/win32/wintray.cpp, src/win32/wintray.h: Convert win32 apctray to use shared statmgr and alib classes. 2009-09-20 15:47 adk0212 * include/statmgr.h, src/lib/statmgr.cpp: Add copy of win32 statmgr with win32-isms replaced with alib equivalents 2009-09-20 15:46 adk0212 * include/aiter.h, include/alist.h, include/amap.h, include/amutex.h, include/aqueue.h, include/astring.h, include/athread.h, include/atimer.h, include/autil.h, src/lib/amutex.cpp, src/lib/astring.cpp, src/lib/athread.cpp, src/lib/atimer.cpp, src/lib/autil.cpp: Add lightweight STL-like class library 2009-09-20 15:41 adk0212 * autoconf/targets.mak, autoconf/variables.mak.in, examples/Makefile, src/Makefile, src/cgi/Makefile, src/drivers/apcsmart/Makefile, src/drivers/dumb/Makefile, src/drivers/net/Makefile, src/drivers/pcnet/Makefile, src/drivers/snmp/Makefile, src/drivers/test/Makefile, src/drivers/usb/Makefile, src/drivers/usb/bsd/Makefile, src/drivers/usb/generic/Makefile, src/drivers/usb/linux/Makefile, src/gapcmon/Makefile, src/lib/Makefile, src/libusbhid/Makefile: Add support for building Objective-C files (*.m) 2009-09-20 15:39 adk0212 * platforms/darwin/build-notes.txt: Forgot -arch flags for apcupsd build 2009-09-13 18:08 adk0212 * platforms/darwin/build-notes.txt: And more updates to the notes. Nearly done now, I think. 2009-09-13 17:36 adk0212 * platforms/darwin/build-notes.txt: More build notes updates. 2009-09-13 17:28 adk0212 * platforms/darwin/build-notes.txt: More updates to Darwin build notes. 2009-09-13 17:05 adk0212 * platforms/darwin/: ApcupsdDaemon.postflight, ApcupsdDaemon.preflight, Makefile: Disable PackageMaker's "suggested permissions" in favor of using our own explicit permissions. Tweak perms on /Library to keep PackageMaker happy. Remove permission fixups from preflight/postflight scripts. Copy the apcupsd-uninstall script to /sbin during install. 2009-09-13 17:02 adk0212 * platforms/darwin/apcupsd-uninstall: Add uninstall script. 2009-09-13 09:29 adk0212 * platforms/darwin/ApcupsdDaemon.preflight: Work around PackageMaker bug that gets ApcupsdDummy.kext directory permissions wrong. 2009-09-11 20:01 adk0212 * platforms/darwin/build-notes.txt: Update OS X build notes with more info I've discovered. 2009-09-08 18:03 adk0212 * doc/apctest.8: Update apctest manpage for USB battery calibration function. 2009-09-01 20:30 adk0212 * src/apctest.c: Implement battery calibration in apctest for USB models. Thanks to James Belleau for the original implementation which has been modified somewhat in this commit. 2009-08-30 11:24 adk0212 * doc/manual/: manual.html, manual.rst: Update Darwin USB section to call out libusb-0.1.12 specifically. 2009-08-30 11:14 adk0212 * src/apctest.c: Fix TTY mode comms option on Win32. 2009-08-30 10:15 adk0212 * platforms/darwin/: build-notes.txt, building-universal-binaries.txt: Add notes about compatibility builds. Update universal binaries notes. Rename file to 'build-notes.txt'. 2009-08-29 14:33 adk0212 * configure: Regen configure with autoconf-2.61 (Darwin XCode-3.3) to fix some warnings when configuring on OS X. 2009-08-29 14:27 adk0212 * configure, autoconf/configure.in, platforms/darwin/ApcupsdDaemon.Description.plist, platforms/darwin/ApcupsdDaemon.Info.plist, platforms/darwin/ApcupsdDaemon.Info.plist.in, platforms/darwin/ApcupsdDaemon.postflight, platforms/darwin/ApcupsdPkg.Description.plist, platforms/darwin/ApcupsdPkg.Info.plist.in, platforms/darwin/ApcupsdUsbShim.Description.plist, platforms/darwin/ApcupsdUsbShim.Info.plist.in, platforms/darwin/ApcupsdUsbShim.postflight, platforms/darwin/Makefile: Update OS X installer for XCode-3.x Unable to find a simple way to create metapackages from the command line so separate Daemon and UsbShim subpackages are gone. Everything is now in the top-level package. On the up side, however, we can now override the version string from the command line so we no longer need autoconf to preprocess the plist. Additionally, packagemaker generates the plist now and just merges in any overrides we specify. Much nicer. 2009-08-23 15:04 adk0212 * src/drivers/net/net.c: Add missing NOMINV, NOMOUTV, and NOMPOWER to clients. Reported by Luciano De Rosa 2009-08-14 11:02 adk0212 * doc/home-page/: bugs.html, dl.php, index.html, index.wml, license.html, lists.html, menu.inc, phpinfo.php, publishsite, support.html, systems.html: Introduce new download page since sf.net is so hard to navigate now. 2009-08-07 08:15 adk0212 * doc/home-page/: index.html, index.wml: Change ReleaseNotes links to point at versions in CVS since SF isn't properly serving the file if you point to the downloads section. 2009-08-02 10:36 adk0212 * doc/home-page/: index.html, index.wml: Update for 3.14.7 release. 2009-08-01 13:29 adk0212 * ChangeLog, include/version.h: Final prep for 3.14.7 release. 2009-08-01 10:41 fleetworks * platforms/: mandrake/apcupsd.spec.in, redhat/apcupsd.spec.in, suse/apcupsd.spec.in: 3.14.7 spec update 2009-08-01 08:18 adk0212 * src/win32/: README.cygwin, README.win32: Remove obsolete files 2009-08-01 08:01 adk0212 * configure, autoconf/config.h.in, autoconf/configure.in, autoconf/variables.mak.in, src/Makefile, src/powerflute.c, src/win32/compat/compat.h, src/win32/compat/sys/ioctl.h: Remove remnants of powerflute 2009-07-31 16:23 adk0212 * ChangeLog, ReleaseNotes, include/version.h: Prep for 3.14.7 release 2009-07-31 16:19 adk0212 * configure, autoconf/configure.in: Fix configure not noticing when C++ compiler does not exist. Annoyingly, only the first of AC_PROG_CXX and AC_PROG_CC actually error out if the conpiler does not exist. The second one just quietly sets a default and keeps going. Temporary fix is to just move CXX detection to be first since that's the compiler we really need. 2009-07-31 15:35 adk0212 * doc/manual/: manual.html, manual.rst: Document multimon cgi programs for Windows. 2009-07-31 11:34 adk0212 * autoconf/targets.mak: Add support for formatting manpages into plain text 2009-07-31 11:33 adk0212 * src/win32/installer/winapcupsd.nsi: Include plain text manpages in windows install. Organize documentation and provide start menu shortcuts. Also add a shortcut for editing the config file. 2009-07-31 11:33 adk0212 * doc/Makefile: Format manpages into plain text. 2009-07-31 10:22 adk0212 * src/win32/installer/winapcupsd.nsi: Add CGI scripts to Windows installer. 2009-07-31 10:22 adk0212 * src/win32/Makefile.in: Build CGI programs for WIN32. 2009-07-31 10:21 adk0212 * src/win32/: apctray.cpp, winmain.cpp: Remove manual calls to WSA_Init(). It's done automatically in libnis now. 2009-07-31 10:20 adk0212 * src/win32/compat/: compat.cpp, netcompat.c: Split network-related compat functions into their own file so users don't have to link in all of compat.cpp. 2009-07-31 10:18 adk0212 * src/lib/apclibnis.c: Automatically invoke WSA_Init() during static initialization on WIN32. 2009-07-31 10:16 adk0212 * src/cgi/upsimage.c: Set stdout to binary mode on WIN32 to prevent corruption of image data. 2009-07-26 10:50 adk0212 * src/drivers/: apcsmart/smartsetup.c, dumb/dumbsetup.c: Automatically add \\.\ UNC prefix to COMx device name on Windows. This allows selection of ports above COM9. 2009-07-26 10:42 adk0212 * src/drivers/usb/usb.c: Remove CI_BattReplaceDate because it does not seem to be populated on any modern UPS. CI_BATTDAT works just fine. 2009-07-07 20:31 adk0212 * include/: amap.h, amutex.h, aqueue.h, atimer.h: Prevent use of default assignment operator and copy constructor. 2009-07-07 20:31 adk0212 * include/amap.h: file amap.h was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2009-07-07 20:31 adk0212 * include/amutex.h: file amutex.h was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2009-07-07 20:31 adk0212 * include/aqueue.h: file aqueue.h was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2009-07-07 20:31 adk0212 * include/atimer.h: file atimer.h was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2009-07-07 20:31 adk0212 * include/alist.h: Implement assignment operator and copy constructor. 2009-07-07 20:31 adk0212 * include/alist.h: file alist.h was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2009-06-07 21:15 adk0212 * src/win32/build-win32-cross-tools: Update to NSIS-2.45. 2009-06-02 20:45 adk0212 * doc/manual/: manual.html, smartprotocol.rst: Fix typo. 2009-05-31 12:18 adk0212 * doc/manual/: maintaining_ups.rst, manual.html, smartprotocol.rst: Spell check. 2009-05-31 12:14 adk0212 * doc/manual/: manual.html, manual.rst: Spell check. 2009-05-31 11:13 adk0212 * doc/manual/: manual.html, manual.rst: Fix a few "apcupd" typos. 2009-05-20 20:43 adk0212 * examples/newslave.c, src/cgi/upsstats.c: Fix UPS version in CGI stats and examples. 2009-05-16 12:46 adk0212 * doc/home-page/: bugs.html, index.html, index.wml, license.html, lists.html, menu.inc, support.html, systems.html: Update web site for 3.14.6 release. 2009-05-16 12:46 adk0212 * doc/manual/publishdoc: Update script 2009-05-16 10:07 adk0212 * ChangeLog: Final prep for 3.14.6. Locked and loaded. 2009-05-16 09:05 fleetworks * platforms/: mandrake/apcupsd.spec.in, redhat/apcupsd.spec.in, suse/apcupsd.spec.in: Comment out latex build. 2009-05-15 20:13 adk0212 * ChangeLog, ReleaseNotes, include/version.h: Prep for 3.14.6 release (again). 2009-05-15 20:13 adk0212 * src/cgi/upsfetch.c: Fix miscalculated length. Noticed by Stacy Millions 2009-05-15 19:57 adk0212 * autoconf/variables.mak.in: Add --no-footnote-backlinks to RST2PDF options. It's now supported in rst2pdf SVN trunk. 2009-05-15 19:44 adk0212 * platforms/: mandrake/apcupsd.spec.in, redhat/apcupsd.spec.in, suse/apcupsd.spec.in: changes for new user manual location and format 2009-05-15 19:32 adk0212 * doc/manual/publishdoc: Add script to publish the manual to the web site. 2009-05-15 19:23 adk0212 * doc/manual/manual.html: Keep a preformatted copy of the user manual in CVS to ease tool dependencies for packagers. 2009-05-15 19:07 adk0212 * src/win32/installer/winapcupsd.nsi: Update for new user manual location. 2009-05-15 18:43 adk0212 * doc/manual/manual.rst: Fix Scott's name being misinterpreted as an enumerated (elettered?) list. 2009-05-13 19:49 adk0212 * doc/manual/maintaining_ups.rst: Applied updates from Trevor Roydhouse 2009-05-12 19:45 adk0212 * doc/manual/manual.rst: Remove Linux /proc/bus/usb text files from appendix. They're a ton of baggage for not much gain. 2009-05-12 19:35 adk0212 * doc/manual/smartprotocol.rst: Minor formatting and typo fixes to smart protocol docs. 2009-05-09 09:04 adk0212 * doc/manual/manual.rst: Fix some {} style markup I missed on the first pass. 2009-05-09 08:50 adk0212 * doc/manual/manual.rst: Fix expansion of APC acronym. 2009-05-07 21:10 adk0212 * doc/manual/: manual.rst, smartprotocol.rst: Some tweaks for better compatibility with rst2pdf. 2009-05-06 21:51 adk0212 * doc/manual/: maintaining_ups.rst, manual.rst, smartprotocol.rst: Several updates to the manual. Replace existing section on UPS maintenance with a new one contributed by Trevor Roydhouse . Replace old disclaimer with a new one, also from Trev. Add some hyperlinks in the smart protocol section. Clean up some table formatting in that section as well. 2009-05-06 21:50 adk0212 * doc/manual/apcupsd.png: Noninterlaced version of logo for compatibility with rst2pdf. 2009-05-05 17:51 adk0212 * doc/apcupsd.conf.5: Add allowable settings for LOWBATT. From Trevor Roydhouse 2009-05-04 18:21 adk0212 * configure, autoconf/configure.in, autoconf/targets.mak, autoconf/variables.mak.in: Autodetect locations of rst2pdf and rst2html. Politely skip typesetting each format if the generator is not available. 2009-05-04 18:20 adk0212 * platforms/qnx/: Makefile, apccontrol.in, apcupsd.in: Add support for QNX. Tested on QNX 6.3.2. Contributed by Mikhail Gruzdev 2009-05-04 18:03 adk0212 * configure, autoconf/acconfig.h, autoconf/config.h.in, autoconf/configure.in, include/apc.h, src/apcupsd.c, src/drivers/apcsmart/smartsetup.c, src/lib/apcexec.c: Add support for QNX. Tested on QNX 6.3.2. Contributed by Mikhail Gruzdev 2009-05-04 17:56 adk0212 * examples/index.php: s/batteryload/load/. Contributed by Mikhail Gruzdev 2009-05-03 17:56 adk0212 * autoconf/targets.mak, autoconf/variables.mak.in, doc/manual/Makefile: Generate PDF manual automatically. 2009-05-03 17:55 adk0212 * doc/manual/manual.rst: Fix typo. 2009-05-03 13:31 adk0212 * doc/manual/manual.rst: Fix broken references. Now formats cleanly with no errors or warnings. 2009-05-03 12:31 adk0212 * doc/manual/smartprotocol.rst: Minor tweaks to spacing, etc. 2009-05-03 12:27 adk0212 * doc/manual/: manual.rst, smartprotocol.rst: Rejuvinate smart protocol section and add it back in. Merged with updates from NUT site. 2009-05-02 19:46 adk0212 * doc/manual/manual.rst: Add EEPROM configuration directives. Text stolen shamelessly from Trevor's apcupsd.conf(5). 2009-05-02 19:30 adk0212 * doc/manual/manual.rst: Minor fixes to apctest section. This needs major updates eventually. 2009-05-02 19:20 adk0212 * doc/manual/manual.rst: Bring in a shortened version of the supportedupses text. 2009-05-02 18:37 adk0212 * doc/manual/manual.rst: Add Windows 7. Split Solaris into 8/9 (no USB) and 10 (USB supported). 2009-05-02 18:30 adk0212 * doc/manual/manual.rst: Rewrite and add in supported operating systems section. 2009-05-02 18:29 adk0212 * autoconf/variables.mak.in: Don't generate backrefs for footnotes; they make the footnotes hard to read. 2009-05-02 12:11 adk0212 * doc/manual/manual.rst: Surround TOC with transition dividers to help set it apart. I wish the text for the TOC title were rendered larger. Need to investigate alternate stylesheets. 2009-05-02 12:00 adk0212 * autoconf/targets.mak, autoconf/variables.mak.in, doc/manual/Makefile: Add preliminary Makefile support for rst2html. Dependencies are working. Not tied in to top-level make yet since not everyone will have rst2html. 'make clean' not working yet. Need to figure out what to do about that. 2009-05-02 10:30 adk0212 * src/action.c: Change log level of UPS self-test messages to WARNING from ALERT. Given that self-test messages are routine, they do not belong at LOG_ALERT. Contributed by Dave Ewart . 2009-05-02 10:21 adk0212 * autoconf/variables.mak.in, doc/Makefile: Install manpages as part of 'make install'. 2009-05-02 10:05 adk0212 * doc/apcupsd.man: Remove one leftover old manpage. 2009-05-02 10:04 adk0212 * doc/: apcaccess.8, apccontrol.8, apctest.8, apctest.man, apcupsd.8, apcupsd.conf.5: Replace old manpages with shiny new ones, courtesy of Trevor Roydhousea . Many thanks, Trev! 2009-04-30 19:20 adk0212 * doc/manual/: cables.rst, manual.rst: Minor updates plus clean up and add back in the cables section. 2009-04-26 19:12 adk0212 * doc/manual/: apcupsd.png, charging.png, commlost.png, main_configs.png, manual.rst, multimon.png, onbatt.png, online.png, smartprotocol.rst, status.png, thanks.png, wininstall6.png: First pass at converting apcupsd user manual to reStructuredText. Initial conversion via Pandoc, then lots of hand editing. It's in pretty good shape now. Need to fix up external files. 2009-04-25 11:04 adk0212 * src/apcupsd.c: Make startup success message appear in logs again. From Trevor Roydhouse : apcupsd stopped printing startup success messages at some point. Looking through the code it is because it was decided that the LOG_INFO facility level should only be used for data file logging and so it filters out other uses. Unfortunately the startup message is set to that level. Changing the startup message to LOG_WARNING works and is consistent with the normal shutdown message facility level. 2009-04-25 10:58 adk0212 * src/lib/apcconfig.c: Remove EVENTFILE, EVENTFILEMAX config directives. These were replaced by the plural versions that are in use today (EVENTSFILE, EVENTSFILEMAX) almost 10 years ago. It's time to kill the old names. (h/t Trevor Roydhouse ) 2009-04-25 10:47 adk0212 * src/options.c: Add -P,--pid-file to -h output. Update copyright. (h/t Trevor Roydhouse ) 2009-04-25 10:45 adk0212 * examples/nagios_plugin_check_apcupsd.c, examples/newslave.c, include/struct.h, src/cgi/upsfetch.c, src/drivers/net/net.c, src/lib/apcconfig.c, src/lib/apcstatus.c: RELEASE is merely a subset of VERSION. Remove RELEASE. (h/t Trevor Roydhouse ) 2009-03-19 19:18 adk0212 * doc/home-page/: bugs.html, index.html, license.html, lists.html, support.html, systems.html, template.inc: Update sf.net logo per new guidelines. 2009-03-02 18:16 adk0212 * ChangeLog, ReleaseNotes, include/version.h: Pseudo-prep for 3.14.6 2009-03-02 17:52 adk0212 * src/drivers/apcsmart/smart.c: Workaround for crash during process shutdown. Contributed by Andrey Sharandakov 2009-03-02 17:48 adk0212 * doc/apcupsd.man, include/drivers.h, include/extern.h, src/action.c, src/apctest.c, src/apcupsd.c, src/device.c, src/options.c, src/drivers/drivers.c, src/drivers/apcsmart/apcsmart.h, src/drivers/apcsmart/smart.c, src/drivers/apcsmart/smartoper.c, src/drivers/usb/usb.c, src/drivers/usb/usb.h, src/lib/apclock.c: Add support for turning the UPS off completely. This complements existing hibernate (aka killpower) functionality. Turn-off is implemented for apcsmart and USB drivers, subject to support for the relevant commands in the UPS itself. Contributed by Keith Campbell . 2009-03-01 10:03 adk0212 * src/apcaccess.c: Fix build with gcc-4.4. Contributed by Michal Hlavinka . 2009-02-14 16:35 adk0212 * src/drivers/usb/linux/linux-usb.c: Fix number of array entries which was causing a buffer overflow. Contributed by David Fries . Also change loop counters to unsigned, eliminating a new warning introduced by the above change plus allowing removal of unnecessary casts to int. 2009-02-10 18:39 adk0212 * src/drivers/apcsmart/: smart.c, smartsetup2.c: Fix some deadlocks in the case of a comm failure when smart_poll() is called without holding the UPS lock. Contributed by Keith Campbell : On one of our machines, apcupsd 3.14.5 (using a smart serial cable) would occasionally not finish starting up. Running strace revealed that it was stuck in deadlock on a futex() system call. I've traced this to some poorly written code inside the apcsmart driver. Inside smart.c there is a UPSlinkCheck() function which according to the documentation must be called with the UPS lock held (ugh). smart_poll() calls the UPSlinkCheck() function (but only in a rarely followed error handling branch), so therefore it must also be called with the lock held. The problem is, many things call smart_poll() but some call it without the lock, and other with the lock. I've put locks around a few smart_poll() calls in smartsetup2.c which corrected the problem I was seeing. 2009-01-15 17:57 adk0212 * doc/home-page/: index.html, index.wml: Year++ h/t Kirill S. Bychkov 2009-01-14 18:00 adk0212 * doc/home-page/publishsite: Update publish scripts for sf.net changes 2009-01-14 17:49 adk0212 * doc/home-page/: index.html, index.wml: Update for 3.14.5 release. 2009-01-10 15:02 adk0212 * ChangeLog, include/version.h: 3.14.5 for real this time. 2008-11-10 19:14 adk0212 * examples/nagios_plugin_check_apcupsd.c: Compile fixes for nagios plugin. Contributed by Ronald J. Yacketta 2008-11-01 11:03 adk0212 * platforms/redhat/apcupsd.in: Remove unused DISTVER code. Contributed by Miloň Papežík 2008-10-26 10:25 adk0212 * ChangeLog, ReleaseNotes, include/version.h: Prep for 3.14.5 release (again) 2008-10-20 18:19 adk0212 * src/win32/build-win32-cross-tools: Update to nsis-2.40. 2008-09-16 00:58 skoona * src/gapcmon/gapcmon.c: Corrected the timebase on the sockopts(0 api call. I intended to set the timeout for two tenths of a second, instead I set it for 200 usec. The results was un-stability and frequently dropped session on my quad-core; dual and single cores didn't seem to be bothered. Now is it set for 200000 usec as I originally intended. James, 2008-09-16 00:34 skoona * src/gapcmon/: ChangeLog, README: Corrected person references, FreeBSD is the platform Jason Hale maintains 2008-09-16 00:23 skoona * src/gapcmon/: ChangeLog, README, eggtrayicon.c, gapcmon.c: Applied two patches 1. eggtrayicon.c -- applies background transparency when in systray mode to systray icon. 2. gapcmon.c -- Add include for BSD sockaddr_in, no impact on other platforms. Note: Socket timeout timers were shortened in a prior update James, 2008-09-10 18:34 adk0212 * src/apctest.c: Do not create pid file in apctest. There is little reason for it since apctest is a command-line tool, not a daemon. Plus nothing ever deletes the file so it interferes with apcupsd operation. Reported by Eddie Atherton 2008-09-09 17:51 adk0212 * src/options.c: Change -? to -h for the sake of consistency with other software. Contributed by Thomas Pfaff 2008-08-17 11:01 adk0212 * platforms/darwin/Makefile: Work around PackageMaker bug in XCode-2.5. 2008-08-17 10:43 adk0212 * platforms/darwin/building-universal-binaries.txt: Update Darwin universal binary instructions. 2008-08-15 01:24 skoona * src/gapcmon/gapcmon.c: Added setsockopt() to sknet_open() to resolve timeout related issue. I set it to 200ms initially, need to test a bet before releasing. James, 2008-08-03 16:24 adk0212 * platforms/darwin/building-universal-binaries.txt: A convenient side-effect of the flags split is that deps now work correctly during a universal binary build. 2008-08-03 12:51 adk0212 * src/cgi/upsfetch.c: Fix a few unsafe uses of sprintf and strcat. Although OpenBSD warns about several more, these other instances are demonstrably correct as-written and are therefore unchanged. 2008-08-03 11:13 adk0212 * platforms/darwin/building-universal-binaries.txt: Update Darwin build instructions for CPPFLAGS/CFLAGS/CXXFLAGS split. 2008-08-03 11:00 adk0212 * src/gapcmon/Makefile: gapcmon build fixes for new CPPFLAGS/CFLAGS/CXXFLAGS split. 2008-08-03 10:51 adk0212 * configure: Regen configure script on Linux. OpenBSD autoconf searches for X11 differently (and possibly incorrectly). 2008-08-03 10:48 adk0212 * configure, autoconf/configure.in, autoconf/targets.mak, autoconf/variables.mak.in: Fix configure warnings for gd.h by properly splitting compiler flags versus preprocessor flags. CFLAGS=C compiler flags, CXXFLAGS=C++ compiler flags, CPPFLAGS=C preprocessor flags. 2008-08-02 19:13 adk0212 * configure: Regen configure script from configure.in. 2008-08-02 19:11 adk0212 * autoconf/configure.in, src/cgi/Makefile: Fix cgi build on OpenBSD. libgd on OpenBSD requires X_LIBS for libfreetype and libfontconfig. 2008-07-25 10:17 adk0212 * ChangeLog: Update ChangeLog after win32 exit fix. 2008-07-25 09:18 adk0212 * src/win32/winmain.cpp: Fix handling of old-style exit requests (WM_QUIT message to hidden window). Apparently PeekMessage() is not sufficient, so go back to using GetMessage and spawn a separate thread to watch for the global exit event. 2008-07-24 16:29 adk0212 * ChangeLog, ReleaseNotes, include/version.h: Prep for 3.14.5 release. 2008-07-24 16:12 adk0212 * src/win32/installer/winapcupsd.nsi: Save $INSTDIR in registry for future use. Also remove examples/ directory from install package since almost nothing in there applies to win32. 2008-07-24 16:10 adk0212 * examples/: slave.apcupsd.conf, master.apcupsd.conf: Remove another obsolete sample config. 2008-07-24 16:08 adk0212 * examples/: apcupsd.master.conf, apcupsd.slave.conf: Remove obsolete configuration examples. 2008-07-12 22:51 skoona * src/gapcmon/: ChangeLog, gapcmon.c: Update the ChangeLog 2008-07-12 22:32 skoona * src/gapcmon/gapcmon.c: Fix two of two: KDE issue, because of the _iconify() api issue, _hide() was chosen. _ hide() presents a useability issue where its possible hide all windows in such a way that no artifact is visible for you to use to restore a window. This is caused by the use of gtk_widget_hide() instead of gtk_window_iconify(); thus the only solution is to remove the close buttons off both the main window and all monitor windows. Its the close button that presents the active-but-no-window effect. Problem Cause: KDE Window Manager Behaviour Changed -- gtk_window_iconify() ignored. Problem Resolved: Removed Close Button from all windows. Switched to gtk_widget_hide() to manage window visibility. James, 2008-07-12 20:23 skoona * src/gapcmon/gapcmon.c: Part two of the kde fix failed. Icon-mode works fine. Window mode can find itself without a takslist entry and effecctively invisible with no way to recall the active program. 2008-07-12 15:13 adk0212 * src/win32/build-win32-cross-tools: Update to nsis-2.38 2008-07-12 13:53 skoona * src/gapcmon/gapcmon.c: Part two of two parts -- kde iconify fix 2008-07-12 12:54 skoona * src/gapcmon/gapcmon.c: Part one of two parts -- kde iconify fix 2008-07-07 20:31 adk0212 * include/athread.h, src/lib/athread.cpp: Misc cleanup and documentation. 2008-07-07 20:31 adk0212 * src/lib/athread.cpp: file athread.cpp was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2008-07-07 20:31 adk0212 * include/athread.h: file athread.h was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2008-07-03 09:04 adk0212 * src/lib/atimer.cpp: file atimer.cpp was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2008-07-03 09:04 adk0212 * src/lib/atimer.cpp: Add debounce timers on shutdown triggers. 2008-06-29 20:07 adk0212 * include/atimer.h, src/lib/atimer.cpp: Update main state machine to use state class pattern. 2008-06-29 11:12 adk0212 * src/action.c: Fix bug in LOWBATT glitch handling. We must examine LOWBATT for changes every time thru the status loop, not just during the OnBattery state. Otherwise we can miss the initial LOWBATT assertion, which defeats the glitch rejection logic. 2008-06-24 19:24 adk0212 * autoconf/targets.mak: Silly spacing fix. 2008-06-24 19:22 adk0212 * configure, autoconf/aclocal.m4, autoconf/configure.in, autoconf/targets.mak: Fail configure if required tools are not found. Fix targets.mak to reference a few more tools by variable instead of hardcoded name. 2008-06-21 17:04 adk0212 * src/win32/: Makefile.in, compat/compat.cpp, compat/compat.h, compat/getopt.c, compat/getopt.h, compat/print.cpp, compat/winapi.c, compat/winapi.h: Clean up win32 compat. Remove unused functions and files. Remove wide char support. Organize compat.h. 2008-06-21 14:43 adk0212 * src/win32/: apctray.cpp, winmain.cpp, winups.h, compat/winapi.c, compat/winapi.h: Improve apctray multiple instance behavior for /add, /del, and /kill on modern platforms (Win2K and newer). Monitor registry for changes caused by /add and /del and automatically reset when a change is detected. Also ensure /kill will terminate all apctray instances, even those running in other sessions. 2008-06-19 18:23 adk0212 * src/win32/: winmain.cpp, winservice.cpp, winservice.h, winups.h, compat/winapi.c, compat/winapi.h: Support shutting down apcupsd instances running in other sessions (such as terminal services or remote desktop sessions). 2008-06-15 14:11 adk0212 * autoconf/targets.mak: Use 'tr' to strip trailing newline from 'echo' instead of 'echo -n'. 2008-06-15 09:15 adk0212 * platforms/: yellowdog/Makefile, engarde/Makefile, mandrake/Makefile: Update install to use new CHKCFG macro. 2008-06-15 09:10 adk0212 * platforms/redhat/Makefile: Update redhat to use new CHKCFG macro. 2008-06-15 09:04 adk0212 * src/options.c: Fix harmless but annoying compiler warning on suse. 2008-06-15 09:03 adk0212 * autoconf/targets.mak, autoconf/variables.mak.in, platforms/suse/Makefile: Fix 'make install' on suse. Sadly, suse's chkconfig always returns success for --list even when the service does not exist. So we add a more sophisticated chkconfig handler which tests for existence of the init script manually, then invokes chkconfig. The whole thing is hidden behind a macro. Also add CHKCONFIG definition (currently always /sbin/chkconfig) in case we someday encounter a distro that hides it elsewhere. 2008-06-11 07:39 adk0212 * include/extern.h, src/drivers/pcnet/pcnet.c, src/lib/apclog.c, src/drivers/usb/bsd/hidutils.c, src/drivers/usb/generic/hidutils.c: Add a hex dump function and use it from pcnet and usb drivers instead of manually coding ugly loops. 2008-06-11 07:20 adk0212 * src/drivers/pcnet/packets/: README, packet0.dat, packet1.dat, packet2.dat: Add captured packets for testing PCNET driver. 2008-06-09 21:22 adk0212 * autoconf/targets.mak: Use $(ECHO). Important for 'echo -n' on some platforms, and we might as well use it everywhere we use 'echo'. Thanks to Jeremy Daniel for finding and fixing this on Mac OS X. 2008-06-09 21:16 adk0212 * configure, autoconf/configure.in: Remove conditional HAVE_NISLIB settings. HAVE_NISLIB is set already set unconditionally. 2008-06-01 17:57 adk0212 * doc/home-page/index.html, platforms/alpha/Makefile, platforms/darwin/Makefile, platforms/debian/Makefile, platforms/engarde/Makefile, platforms/freebsd/Makefile, platforms/gentoo/Makefile, platforms/mandrake/Makefile, platforms/netbsd/Makefile, platforms/openbsd/Makefile, platforms/redhat/Makefile, platforms/slackware/Makefile, platforms/sun/Makefile, platforms/suse/Makefile, platforms/yellowdog/Makefile: Fix first install failure on redhat and suse. We were unconditionally running 'chkconfig --del apcupsd' which failed if apcupsd was not already installed. Now we check 'chkconfig --list apcupsd' first to see if chkconfig believes apcupsd is installed. Make same fix in uninstall. Also change most uninstall steps to allow failure. This facilitates the best- effort uninstall of an aborted or otherwise botched install. 2008-05-31 08:42 fleetworks * platforms/: redhat/apcupsd.spec.in, suse/apcupsd.spec.in: Add restart of daemon on upgrade. 2008-05-26 20:28 adk0212 * include/amutex.h: Fix circular dependency. 2008-05-25 14:46 adk0212 * doc/home-page/: index.html, index.wml: Update for 3.14.4 release. 2008-05-18 14:21 adk0212 * ChangeLog: Update ChangeLog. 2008-05-18 14:18 adk0212 * platforms/suse/Makefile: Fix init script location on SuSE. It should be /etc/rc.d, but we were placing the file in /etc/rc.d/init.d. 2008-05-18 13:16 adk0212 * ReleaseNotes, include/version.h: Fix release date. 2008-05-18 13:15 adk0212 * ChangeLog, ReleaseNotes, include/version.h: Prep for 3.14.4 release. 2008-05-18 13:12 adk0212 * Makefile, doc/Makefile, doc/Makefile.in: Add 'make install' support for man pages. 2008-05-12 20:09 adk0212 * platforms/: README, install-symlinks.sh: Remove obsolete files. 2008-05-12 20:06 adk0212 * Developers: Update contributors list. This is probably still way out of date. 2008-05-11 18:34 adk0212 * platforms/: mandrake/apcupsd.spec.in, redhat/apcupsd.spec.in, suse/apcupsd.spec.in: Remove --with-powerflute flag from specs. 2008-05-11 18:18 adk0212 * ChangeLog.old: Remove old changelog. 2008-05-11 17:00 adk0212 * ChangeLog, ReleaseNotes, include/version.h: Prep for 3.14.4 test release. 2008-05-11 16:23 adk0212 * ABOUT-NLS: Remove unused file. 2008-05-11 10:24 adk0212 * platforms/darwin/building-universal-binaries.txt: Update Mac OS X universal binary build instructions. 2008-05-11 10:10 adk0212 * platforms/: Makefile, alpha/Makefile, darwin/Makefile, debian/Makefile, engarde/Makefile, etc/Makefile, redhat/Makefile: Remove unnecessary dependency includes. 2008-05-11 09:56 adk0212 * include/Makefile.in, src/libusbhid/Makefile.in: Remove some obsolete Makefile.in 2008-05-11 09:56 adk0212 * examples/: Makefile, Makefile.in, client.c, megaclient.c, readfifo.c, smartsim.c, snoopdecode.c: New Makefile for examples/ and source fixes to build with C++ compiler. 2008-05-10 20:10 adk0212 * autoconf/targets.mak: Micor cleanups: Rename 'INST' to 'COPY'. Remove extraneous semicolons. 2008-05-10 20:07 adk0212 * autoconf/targets.mak, src/Makefile, src/cgi/Makefile, src/gapcmon/Makefile: Better solution for install ordering. Invoke make explicitly to build targets and then again to perform the install. This is just an extension of the same trick used to force 'all' to build subdirs before local targets. 2008-05-10 13:54 adk0212 * src/: Makefile, cgi/Makefile, gapcmon/Makefile: Fix parallel 'make install' from an unbuilt tree. Requires manually making install-* depend on all-targets. I'd prefer this be done automatically but I cannot find a way that works (yet). 2008-05-10 11:19 adk0212 * platforms/Makefile: Do not perform platform install in parallel. 2008-05-10 11:18 adk0212 * Makefile: Recurse into platforms/ after src/. 2008-05-10 10:52 adk0212 * platforms/alpha/Makefile: Install banners for alpha. 2008-05-10 10:51 adk0212 * platforms/: darwin/Makefile, debian/Makefile, engarde/Makefile, redhat/Makefile: Add banners to 'make install'. 2008-05-10 10:47 adk0212 * autoconf/targets.mak: Tweak install/uninstall banner spacing. 2008-05-10 10:47 adk0212 * platforms/: unifix/Makefile, unifix/Makefile.in, yellowdog/Makefile, yellowdog/Makefile.in: 'make install' support for unifix and yellowdog. 2008-05-09 20:04 adk0212 * configure, autoconf/configure.in, platforms/suse/Makefile, platforms/suse/Makefile.in, platforms/suse/Makefile.in.old, platforms/suse/apcupsd.in.old, platforms/suse/apcupsd.spec.in.old, platforms/suse/halt-setup.sh.in, platforms/suse/halt.in, platforms/suse/rc.config.sh: 'make install' support for SuSE. Plus remove some bitrotted platform files for SuSE 8.x. 2008-05-09 19:39 adk0212 * platforms/sun/: Makefile, Makefile.in: 'make install' support for sun. 2008-05-08 19:37 adk0212 * configure, autoconf/configure.in: Do not autogenerate platform/*/Makefile any more. 2008-05-08 19:36 adk0212 * autoconf/targets.mak: Add install/uninstall banner macros. 2008-05-08 19:36 adk0212 * autoconf/variables.mak.in: Add some path variables needed by platform install scripts. 2008-05-08 19:35 adk0212 * platforms/: gentoo/Makefile, gentoo/Makefile.in, hpux/Makefile, hpux/Makefile.in, mandrake/Makefile, mandrake/Makefile.in, slackware/Makefile, slackware/Makefile.in, unknown/Makefile: 'make install' support for gentoo, hpux, mandrake, slackware. 2008-05-08 18:57 adk0212 * platforms/: freebsd/Makefile, freebsd/Makefile.in, netbsd/Makefile, netbsd/Makefile.in, openbsd/Makefile, openbsd/Makefile.in: 'make install' support for *BSD 2008-05-06 20:16 skoona * src/gapcmon/gapcmon.c: Corrected the use of NOMPOWER and the calc of current usage amount 2008-05-04 11:30 adk0212 * configure, autoconf/configure.in: Remove powerflute option from configure. Powerflute has been broken for several releases after the removal of rawupsstats support from NIS 2008-05-04 11:13 adk0212 * src/drivers/usb/usb.c: Add a heuristic to fix up incorrect NOMINV or NOMOUTV. Some UPSes (RS 500) report decivolts instead of volts. Reported by Kirill S. Bychkov . 2008-05-04 10:43 adk0212 * src/win32/build-win32-cross-tools: Update to NSIS 2.37. 2008-05-04 10:43 adk0212 * configure, autoconf/configure.in: Add win32/Makefile to generate list. Necessary since we're not rewriting the win32 Makefile stuff yet. 2008-04-20 19:03 skoona * src/gapcmon/: ChangeLog, Makefile, gapcmon.c, gapcmon.h: - Removed close() fron sknet_net_close() api. g_io_channel_shutdown() handled the close and shutdown of the socket. second close was actually closing an active socket from another thread (i.e. reuse #) discovered on a quad-core platform. - Added ICON_DIR to compiler makefiles to support _load_icons ability to find icons at run-time. $(datadir) is passed into ICON_DIR; its assumed datadir include $(DISTDIR). This change was pointed out by Kirill S. Bychkov in Feb/2008. James, 2008-04-19 10:12 adk0212 * examples/safe.apccontrol.in: Remove mention of serial port since there are many other comms types now. 2008-04-07 19:03 adk0212 * autoconf/targets.mak, autoconf/variables.mak.in, platforms/alpha/Makefile, platforms/alpha/Makefile.in, platforms/darwin/Makefile, platforms/darwin/Makefile.in, platforms/debian/Makefile, platforms/debian/Makefile.in, platforms/engarde/Makefile, platforms/engarde/Makefile.in, platforms/redhat/Makefile, platforms/unknown/Makefile, platforms/unknown/Makefile.in: Add 'make install' support for alpha, darwin, debian, engarde, and unknown. Also misc fixes to existing install support. 2008-04-06 20:24 adk0212 * configure, autoconf/configure.in: Don't autogenerate redhat Makefile. 2008-04-06 19:35 adk0212 * src/: drivers/Makefile.in, drivers/apcsmart/Makefile.in, drivers/dumb/Makefile.in, drivers/net/Makefile.in, drivers/pcnet/Makefile.in, drivers/snmp/Makefile.in, drivers/test/Makefile.in, drivers/usb/Makefile.in, drivers/usb/bsd/Makefile.in, drivers/usb/generic/Makefile.in, drivers/usb/linux/Makefile.in, gd1.2/Makefile.in, gd1.2/README, gd1.2/demoin.gif, gd1.2/gd.c, gd1.2/gd.h, gd1.2/gddemo.c, gd1.2/gdfontg.c, gd1.2/gdfontg.h, gd1.2/gdfontl.c, gd1.2/gdfontl.h, gd1.2/gdfontmb.c, gd1.2/gdfontmb.h, gd1.2/gdfonts.c, gd1.2/gdfonts.h, gd1.2/gdfontt.c, gd1.2/gdfontt.h, gd1.2/giftogd.c, gd1.2/index.html, gd1.2/mathmake.c, gd1.2/mtables.c, gd1.2/webgif.c, intl/ChangeLog, intl/Makefile.in, intl/VERSION, intl/bindtextdom.c, intl/cat-compat.c, intl/dcgettext.c, intl/dgettext.c, intl/explodename.c, intl/finddomain.c, intl/gettext.c, intl/gettext.h, intl/gettextP.h, intl/hash-string.h, intl/intl-compat.c, intl/l10nflist.c, intl/libgettext.h, intl/linux-msg.sed, intl/loadinfo.h, intl/loadmsgcat.c, intl/localealias.c, intl/po2tbl.sed.in, intl/textdomain.c, intl/xopen-msg.sed, lib/Makefile.in, po/Makefile.in, po/POTFILES.in, po/apcupsd.pot, po/ca.po, po/cat-id-tbl.c, po/cs.po, po/da.po, po/de.po, po/el.po, po/es.po, po/et_EE.po, po/eu_ES.po, po/fi.po, po/fo_FO.po, po/fr.po, po/ga_IE.po, po/gr_GR.po, po/hr.po, po/hu.po, po/in_ID.po, po/is.po, po/is_IS.po, po/is_is.po, po/it.po, po/iw_IL.po, po/ja.po, po/kl_GL.po, po/ko.po, po/lt_LT.po, po/lv_LV.po, po/nl.po, po/no.po, po/pl.po, po/pt.po, po/ro_RO.po, po/ru.po, po/sk.po, po/sl.po, po/sr.po, po/stamp-cat-id, po/sv.po, po/tr.po, po/uk_UA.po, po/wa.po, po/zh_TW.Big5.po: Remove unused files: Various Makefile.in, gd1.2/, intl/, po/. 2008-04-06 19:09 adk0212 * autoconf/Makefile.in: Remove unused file. 2008-04-06 19:07 adk0212 * Makefile.in, configure, autoconf/configure.in, autoconf/mkinstalldirs, autoconf/targets.mak, autoconf/variables.mak.in, platforms/Makefile, platforms/Makefile.in, platforms/etc/Makefile, platforms/etc/Makefile.in, platforms/redhat/Makefile, platforms/redhat/Makefile.in, src/Makefile, src/Makefile.in, src/cgi/Makefile, src/cgi/Makefile.in, src/gapcmon/Makefile, src/gapcmon/Makefile.in: First round of 'make install' implementation. Basic install/uninstall is working. Only platform implemented so far is redhat. 2008-04-04 19:11 adk0212 * autoconf/targets.mak: Fix clean output on Solaris. 2008-04-04 19:01 adk0212 * configure, autoconf/configure.in, src/gapcmon/Makefile: Fix gapcmon build on OpenSolaris. On OpenSolaris, gethostbyname_r() is in libnsl. Also fix up some tests in configure to use AC_SEARCH_LIBS. Thanks to James Dean for loaning me an ssh login on his OpenSolaris box. 2008-04-02 18:55 adk0212 * Makefile, configure, autoconf/aclocal.m4, autoconf/configure.in, autoconf/targets.mak, autoconf/variables.mak.in, src/Makefile, src/cgi/Makefile, src/drivers/Makefile, src/drivers/apcsmart/Makefile, src/drivers/dumb/Makefile, src/drivers/net/Makefile, src/drivers/pcnet/Makefile, src/drivers/snmp/Makefile, src/drivers/test/Makefile, src/drivers/usb/Makefile, src/drivers/usb/bsd/Makefile, src/drivers/usb/generic/Makefile, src/drivers/usb/linux/Makefile, src/gapcmon/Makefile, src/lib/Makefile, src/libusbhid/Makefile: Add new make system - configure and build works (including dependencies and parallel make) - 'make install' not yet implemented - i18n support removed - included libgd support removed - obsolete Makefile.in files will remain until 'make install' is complete 2008-02-06 17:53 adk0212 * platforms/80-apcupsd-ups-policy.fdi: Fix hal policy file syntax. For some reason this blatantly incorrect file actually works on RHEL5 (hal-0.5.8). Thanks to Andrew Telford for correcting it. 2008-02-03 16:37 adk0212 * autoconf/aclocal.m4, autoconf/configure.in, src/gapcmon/gapcmon.c: Revert ctime_r() change. It is not actually necessary. 2008-02-03 15:48 adk0212 * configure, autoconf/aclocal.m4, autoconf/configure.in, src/gapcmon/gapcmon.c: Fix gapcmon compile error on Solaris: Multiple variants of ctime_r(). 2008-02-03 15:32 adk0212 * include/apc.h: Fix libapcnis.c compile error on Solaris. 2008-02-03 12:19 fleetworks * platforms/: mandrake/apcupsd.spec.in, redhat/apcupsd.spec.in, suse/apcupsd.spec.in: Add debug package to strip suse. 2008-01-29 19:01 adk0212 * src/gapcmon/gapcmon.c: Fix build on OpenBSD: Need to include netinet/in.h for struct sockaddr_in. 2008-01-28 21:14 adk0212 * configure, autoconf/configure.in, src/gapcmon/gethostname.c: Add fake (not thread-safe) gethostbyname_r() for platforms that don't have it. I'm looking at you, OpenBSD. 2008-01-27 12:00 adk0212 * include/struct.h, platforms/etc/apcupsd.conf.in, platforms/mingw/apcupsd.conf.in, src/device.c, src/drivers/net/net.c, src/drivers/snmp/drv_powernet.c, src/lib/apcconfig.c: Add POLLTIME directive to control UPS polling interval. NETTIME is accepted as a synonym for compatibility with old config files. 2008-01-27 11:22 adk0212 * src/lib/apclibnis.c, src/powerflute.c, src/cgi/multimon.c, src/cgi/upsfetch.c, src/cgi/upsfetch.h, include/nis.h, src/apcaccess.c: Sanify net error handling. All net library functions now return -errno on failure. Kill off global net_errno and net_errmsg. Improve apcaccess error messages. 2008-01-27 10:20 adk0212 * include/amutex.h: Add debug trace wrappers around mutex lock/unlock operations. 2008-01-27 09:56 adk0212 * src/drivers/usb/bsd/bsd-usb.c: Another missing update. 2008-01-27 09:49 adk0212 * src/drivers/usb/bsd/bsd-usb.c: Fix compile errors from incomplete input vs feature report conversion. 2008-01-26 19:04 adk0212 * include/amutex.h: Remove unnecessary include. 2008-01-26 18:55 adk0212 * include/amutex.h: Remove const_cast grunge in favor of mutable attribute. 2008-01-26 17:55 adk0212 * include/amap.h: Fix contains(). 2008-01-26 17:49 adk0212 * include/: aiter.h, alist.h, amap.h: Add const iterators. It's tempting to leave these for later, but once you abandon constness, it's awful hard to find it again. 2008-01-26 17:49 adk0212 * include/aiter.h: file aiter.h was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2008-01-26 14:58 adk0212 * include/alist.h, include/amutex.h, include/aqueue.h, include/astring.h, include/athread.h, include/atimer.h, src/lib/athread.cpp, src/lib/atimer.cpp: Milestone checkin. Basic functionality is working with new core. Many more changes to come. 2008-01-26 14:58 adk0212 * include/astring.h: file astring.h was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2008-01-22 20:10 adk0212 * configure, autoconf/configure.in: Debian is now using the standard NIS port, 3551. Contributed by imacat 2008-01-20 14:58 adk0212 * doc/home-page/: index.html, index.wml: Update web site for 3.14.3. 2008-01-19 16:48 adk0212 * ChangeLog, ReleaseNotes, include/version.h: Updates for 3.14.3 release. 2008-01-19 13:43 adk0212 * src/gapcmon/gapcmon.c: Merge gapcmon changes from HEAD 1.41. 2007-12-02 11:38 adk0212 * src/apcaccess.c: Fix compile warning. 2007-11-29 19:49 adk0212 * platforms/darwin/building-universal-binaries.txt: Update build instructions for XCode3/Leopard. Many thanks to Dennis Wurster for loaning me a Leopard-capable G4 to develop on. 2007-11-21 17:09 adk0212 * src/: apcaccess.c, drivers/net/net.c, lib/apclibnis.c: Fix bugs that could cause NIS-net driver to get stuck waiting for comms to be restored instead of shutting down. This included adding a timeout for connection attempts in net_open() and removing a wait-for-comms loop from the net driver. Also fix up fallout from apclibnis cleanups in apcaccess. Thanks to Daniel Born for reporting the issue and testing fixes. 2007-11-21 17:05 adk0212 * Makefile.in, configure: Add configure parameter to control location of HAL policy file. Install policy file to this path. By default, the policy file is only installed on Linux systems. Other platforms need to specify --with-halpolicydir=DIR to configure. Linux systems can use this same switch to change the default install path. (Files missed in last commit.) 2007-11-18 10:24 fleetworks * platforms/: mandrake/apcupsd.spec.in, redhat/apcupsd.spec.in, suse/apcupsd.spec.in: Add halpolicydir to configure statement. 2007-11-18 10:18 fleetworks * platforms/: mandrake/apcupsd.spec.in, redhat/apcupsd.spec.in, suse/apcupsd.spec.in: Make installs the hal policy file now. 2007-11-17 14:09 adk0212 * autoconf/configure.in, platforms/Makefile.in: Add configure parameter to control location of HAL policy file. Install policy file to this path. By default, the policy file is only installed on Linux systems. Other platforms need to specify --with-halpolicydir=DIR to configure. Linux systems can use this same switch to change the default install path. 2007-11-17 14:06 adk0212 * platforms/redhat/Makefile.in: Revert HAL policy file change. We'll do this at a higher level instead. 2007-11-17 10:45 fleetworks * platforms/: mandrake/apcupsd.spec.in, redhat/apcupsd.spec.in, suse/apcupsd.spec.in: Add hal policy file. 2007-11-17 10:00 adk0212 * src/win32/build-win32-cross-tools: Upgrade to nsis-2.33. 2007-11-17 09:48 adk0212 * platforms/80-apcupsd-ups-policy.fdi: Remove extraneous comment close tag. 2007-11-17 09:34 adk0212 * platforms/: 80-apcupsd-ups-policy.fdi, redhat/Makefile.in: Add policy file to disable hald-addon-hid-ups. Automatically install and uninstall this policy on Redhat systems. 2007-11-10 08:17 fleetworks * platforms/: mandrake/apcupsd.spec.in, redhat/apcupsd.spec.in, suse/apcupsd.spec.in: Update for suse 10.3 2007-11-09 18:34 adk0212 * src/win32/build-win32-cross-tools: Update to nsis-2.32. 2007-10-30 18:46 adk0212 * doc/home-page/: index.html, index.wml: Fix changelog links for 3.14.2. 2007-10-27 13:15 adk0212 * src/drivers/usb/bsd/bsd-usb.c: Missed part of write report conversion. 2007-10-27 13:14 adk0212 * src/apctest.c: Add support for reading/writing transfer voltage on USB models. 2007-10-27 13:13 adk0212 * src/drivers/usb/: bsd/bsd-usb.c, generic/generic-usb.c, linux/linux-usb.c: When reading, use INPUT or FEATURE report (prefer INPUT). When writing, use FEATURE report only. This is necessary to properly support writes on UPSes that offer the same usage in both types of reports. 2007-10-15 18:13 adk0212 * src/lib/: amutex.cpp, astring.cpp, autil.cpp: Correct filenames in comments. 2007-10-15 18:13 adk0212 * src/lib/amutex.cpp: file amutex.cpp was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2007-10-15 18:13 adk0212 * src/lib/astring.cpp: file astring.cpp was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2007-10-15 18:13 adk0212 * src/lib/autil.cpp: file autil.cpp was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2007-10-15 18:12 adk0212 * include/autil.h: file autil.h was added on branch Branch-3_14 on 2009-09-20 19:46:13 +0000 2007-10-15 18:12 adk0212 * include/alist.h, include/amap.h, include/amutex.h, include/astring.h, include/autil.h, src/lib/amutex.cpp, src/lib/astring.cpp, src/lib/autil.cpp: Add license text for a* utility classes. 2007-10-15 18:05 adk0212 * include/alist.h, include/amap.h, include/astring.h, src/lib/autil.cpp: Add simple list and map classes and convert pcnet driver to use them. 2007-10-06 10:52 adk0212 * include/drivers.h, include/extern.h, include/nis.h, include/struct.h, src/apcaccess.c, src/apcnis.c, src/apctest.c, src/powerflute.c, src/reports.c, src/smtp.c, src/cgi/cgilib.c, src/cgi/cgilib.h, src/cgi/multimon.c, src/cgi/upsfetch.c, src/drivers/drivers.c, src/drivers/apcsmart/apcsmart.h, src/drivers/apcsmart/smarteeprom.c, src/drivers/apcsmart/smartsetup2.c, src/drivers/dumb/dumb.h, src/drivers/dumb/dumboper.c, src/drivers/net/net.c, src/drivers/net/net.h, src/drivers/pcnet/pcnet.c, src/drivers/pcnet/pcnet.h, src/drivers/snmp/drv_powernet.c, src/drivers/snmp/snmp.c, src/drivers/snmp/snmp.h, src/drivers/test/testdriver.c, src/drivers/test/testdriver.h, src/drivers/usb/usb.c, src/drivers/usb/usb.h, src/drivers/usb/usb_common.h, src/drivers/usb/linux/linux-usb.c, src/lib/apcconfig.c, src/lib/apcexec.c, src/lib/apcfile.c, src/lib/apclibnis.c, src/lib/apclog.c, src/lib/apcstatus.c, src/lib/newups.c: Eliminate "warning: deprecated conversion from string constant to 'char*'" warnings emitted from gcc-4.2.1 (earlier versions with -Wwrite-strings). Contributed by Steve Yarmie . 2007-10-04 18:33 adk0212 * include/amutex.h, include/astring.h, include/autil.h, src/lib/amutex.cpp, src/lib/astring.cpp, src/lib/autil.cpp: Add smart string and mutex classes. 2007-09-30 15:45 adk0212 * src/gapcmon/: gapcmon.c, gapcmon.h: Merge gapcmon changes from HEAD. 2007-09-22 13:35 adk0212 * src/lib/apcstatus.c: Add units to NOMINV, NOMOUTV, and NOMBATTV stats. 2007-09-22 13:33 adk0212 * include/defines.h, include/struct.h, src/drivers/usb/usb.c, src/lib/apcstatus.c: Add support for Nominal Power (aka Configured Active Power) reading. Credit to Lars Randers for most of the code. 2007-09-22 13:10 adk0212 * include/defines.h: Convert eleventy skillion CI_* defines to an enumeration. 2007-09-22 08:48 adk0212 * doc/home-page/: index.html, index.wml: Update web site for 3.14.2 release. 2007-09-15 17:07 adk0212 * ChangeLog, ReleaseNotes, include/version.h: Update ChangeLog, ReleaseNotes, and date for 3.14.2 release. 2007-09-15 10:48 adk0212 * src/win32/installer/: Apctray.ini, winapcupsd.nsi: Remove commented-out code. 2007-09-15 10:48 adk0212 * src/win32/winmain.cpp: Misc cleanup. 2007-09-15 10:48 adk0212 * src/win32/: balloonmgr.cpp, statmgr.cpp, wintray.cpp, wintray.h: Fix handle leaks when adding/deleting instances. 2007-09-10 19:35 adk0212 * src/win32/build-win32-cross-tools: Update NSIS to 2.30. 2007-09-10 19:31 adk0212 * include/version.h: Bump version to 3.14.2. 2007-09-10 19:09 adk0212 * src/drivers/usb/: bsd/bsd-usb.c, generic/generic-usb.c, linux/linux-usb.c: Prefer FEATURE reports over INPUT reports when searching for usages. This will fix compatiblity with BackUPS LCD models which have present but non- functional INPUT reports. It may break compatibility with other models, so fingers are crossed. 2007-09-10 19:08 adk0212 * src/win32/balloonmgr.cpp: Minor cleanup and spelling fix. 2007-08-28 19:57 adk0212 * configure, autoconf/configure.in: Address g++ linker vs. libsupc++ differently: Default linker to gcc if none is specified. This avoids overriding LD= passed to configure since if the user asks for an explicit LD we really should honor it (and it's needed for building universal binaries on OS X). 2007-08-28 19:02 adk0212 * configure, autoconf/configure.in: Remove dependency on libc++ (again). Must use gcc as linker when using libsupc++ since g++ automatically links against full libc++. 2007-08-25 15:01 adk0212 * src/lib/newups.c: Fix race between attach_ups() and detach_ups() which could result in the UPSINFO structure being freed prematurely. Thanks to James Abbott for running many tests to help me find this bug. 2007-08-23 18:43 adk0212 * platforms/etc/multimon.conf: Correct multimon.conf humidity monitoring. Problem fixed by Patrick Frei. Reference: https://bugzilla.novell.com/show_bug.cgi?id=199834 2007-08-06 20:17 adk0212 * src/win32/apctray.cpp: Exit apctray if GetMessage() returns an error. 2007-08-06 20:16 adk0212 * src/win32/winups.h: Use enum for application-defined messages. 2007-08-06 20:16 adk0212 * src/win32/: wintray.cpp, wintray.h: Redraw tray icons politely after an Explorer crash. 2007-08-05 17:31 adk0212 * src/lib/apclibnis.c: Fix bug with multi-threaded net_open() calls. net_open() was using a global buffer for the destination address. Yikes! Bug manifestied itself in apctray with multiple monitors occasionally (and timing-dependently) pointing to the wrong UPS. 2007-08-03 15:08 adk0212 * src/: apctest.c, apcupsd.c, lib/apcconfig.c: More argvalue to its primary user, apcconfig.c. 2007-08-03 15:08 adk0212 * src/drivers/pcnet/pcnet.c: Remove SO_REUSEADDR; we'd only need this for TCP. Set SO_BROADCAST since some platforms (Windows) seem to require it in order to receive broadcast packets. (Most platforms use it only to enable *sending* broadcasts.) 2007-08-03 14:41 adk0212 * src/lib/apcexec.c: Don't leak unnecessary descriptors to child when execing apccontrol. 2007-08-03 11:49 adk0212 * src/drivers/apcsmart/smart.c: Wait 20 seconds before declaring COMMLOST. This is necessary when using a smart serial cable on an UPS with an SNMP monitoring card installed. The SNMP card appears to disrupt serial comms for several seconds when interesting events are in progress. 2007-08-03 11:47 adk0212 * examples/smartsim.c: Add command help key since I can never remember what the keycodes are. 2007-08-03 11:20 adk0212 * INSTALL, examples/safe.apccontrol.in, platforms/apccontrol.in, platforms/darwin/apccontrol.in, platforms/freebsd/apccontrol.in, platforms/mingw/apccontrol.bat, platforms/openbsd/apccontrol.in, platforms/sun/apccontrol.in: apccontrol cleanups: powerout and mainsback should not wall; that is done by onbattery/offbattery under the control of ONBATTERYDELAY. Also remove obsolete 'restartme' event from scripts and documentation. 2007-08-03 11:17 adk0212 * src/apcaccess.c: Remove lots of obsolete code. 'status' is now the only supported option. 2007-08-01 19:05 adk0212 * src/drivers/pcnet/pcnet.c: Enable SO_REUSEADDR on pcnet socket to prevent false EADDRINUSE after quick restarts. 2007-07-26 16:36 adk0212 * platforms/mingw/apccontrol.bat: Remove duplicate line. Noticed by David P. Mott . 2007-07-20 12:17 adk0212 * examples/smartsim.c: Add support for simulating comm failure. 2007-07-17 18:54 adk0212 * examples/hid-ups.c: Include /dev in hiddev search. 2007-07-17 18:50 adk0212 * examples/hid-ups.c: Report time delta from start of program when displaying events. Contributed by David Fries . 2007-07-16 20:28 adk0212 * src/drivers/usb/usb.c: Add workaround for broken BackUPS Pro model that returns certain reports encoded in ASCII. Based on a patch from David Fries . 2007-07-14 13:26 adk0212 * src/win32/: apctray.cpp, winups.h: Add/remove tray icons on the fly as instances are added or deleted. 2007-07-14 13:05 adk0212 * src/win32/: winres.h, winres.rc, wintray.cpp, wintray.h: Add HOST field showing hostname:port to context menu. 2007-07-14 13:04 adk0212 * src/win32/build-win32-cross-tools: Update NSIS to version 2.29. 2007-07-14 12:53 adk0212 * src/win32/apctray.cpp: Disable autorun when last instance removed. 2007-07-01 14:30 adk0212 * src/drivers/snmp/snmp.c: Fix SNMP port selection. Newer versions of Net-SNMP appear to ignore the session remote_port setting. The only way to override the default port is to include it in the peername string. 2007-06-29 18:18 adk0212 * src/drivers/usb/linux/linux-usb.c: Fix linux-usb device detection bug when multiple hiddev nodes are present. Fixes Fedora Bugzilla #245864: 2007-06-19 20:43 adk0212 * doc/home-page/: index.html, index.wml: Update for 3.14.2-win32beta2 release. 2007-06-18 20:23 adk0212 * ChangeLog: Regen ChangeLog after committing forgotten files. 2007-06-18 19:49 adk0212 * include/defines.h: Change CMD* definitions to enumeration. 2007-06-18 19:49 adk0212 * src/action.c: Remove unused CMDDOREBOOT. 2007-06-18 19:47 adk0212 * src/lib/apcevents.c: Remove unused code. 2007-06-18 19:45 adk0212 * ChangeLog: Regen ChangeLog for 3.14.2-win32beta2. 2007-06-18 19:38 adk0212 * ReleaseNotes, include/version.h: Update for 3.14.2-win32beta2 release. 2007-06-17 20:19 adk0212 * src/win32/: statmgr.cpp, statmgr.h, wintray.cpp: Change StatMgr::Get() to return a managed string. 2007-06-17 20:14 adk0212 * src/win32/: apctray.cpp, statmgr.cpp, statmgr.h, wintray.cpp, wintray.h: Clean up apctray needless inlining and memory management. 2007-06-17 19:49 adk0212 * src/win32/balloonmgr.cpp: Cleanup. 2007-06-17 19:47 adk0212 * src/win32/balloonmgr.cpp: Gracefully handle unexpected return values from WaitForMultipleObjects(). 2007-06-17 16:07 adk0212 * src/win32/popup.c: Remove balloon notice support from popup utility. Furthermore, only display popup if we're on an ancient OS, apctray is not running, or balloon tips are disabled via a group policy. This way win98 and NT users will still get notifications of events, as will users not running apctray. 2007-06-17 15:54 adk0212 * src/win32/wintray.cpp: Misc improvements: Detect self-test and set status string accordingly. Include UPS name in tool tip, when we know it. Change status string for NIS connection errors to distinguish that state from COMMLOST. 2007-06-17 15:19 adk0212 * src/win32/: apctray.cpp, winmain.cpp: Windows NT doesn't like the "Global\\" prefix on semaphore names. 2007-06-17 13:19 adk0212 * src/win32/wintray.cpp: Fix bug where COMMLOST status transition was not reflected by icon. 2007-06-17 13:15 adk0212 * src/win32/wintray.cpp: Suppress initial status balloon. 2007-06-17 13:12 adk0212 * src/win32/balloonmgr.cpp: Misc cleanup. 2007-06-17 12:14 adk0212 * src/win32/: Makefile.in, apctray.cpp, balloonmgr.cpp, balloonmgr.h, winres.rc, wintray.cpp, wintray.h: Completely rewrite balloon tip handling. Balloon tips are posted automatically when the status text changes. This eliminates the need for the clunky "Receive local notifications" setting and allows us to post balloons for state changes on remote Apcupsd instances. Introduce the BalloonMgr to work around Windows one-balloon-at-a-time limitation. When monitoring multiple Apcupsd instances it will be common to need to post multiple balloon tips at once. The BalloonMgr handles posting the tips one at a time and timing the active balloon out early if new ones are waiting. This way all balloons will be shown, one after another. 2007-06-17 09:42 adk0212 * examples/smartsim.c: Add support for simulating battery attach/detach. 2007-06-17 08:54 adk0212 * src/win32/email.c: Fix indentation. 2007-06-13 20:07 adk0212 * src/win32/winevents.cpp: Reverse order of events in listbox so most recent is always at the top. 2007-06-13 18:35 adk0212 * src/win32/apctray.cpp: Use NotifyUser when notifying about multiple instances so it obeys the /quiet flag. 2007-06-13 18:34 adk0212 * src/win32/apctray.cpp: Prevent multiple instances of Apctray. 2007-06-13 18:29 adk0212 * src/win32/: statmgr.cpp, statmgr.h, winstat.cpp, winevents.cpp: Use some STL to simplify GetAll() and GetEvents() calls. 2007-06-10 16:05 adk0212 * src/win32/winstat.cpp: Fix indentation. 2007-06-10 16:05 adk0212 * src/win32/winres.rc: Add refresh button to events box. 2007-06-10 16:04 adk0212 * src/win32/winevents.cpp: Add refresh button list stats now has. 2007-06-10 14:03 adk0212 * doc/home-page/: index.html, index.wml: Update web site for 3.14.2-beta1 release. 2007-06-10 10:13 adk0212 * ChangeLog, ReleaseNotes, include/version.h: Final updates for apcupsd-3.14.2-win32beta1 release. 2007-06-10 09:34 adk0212 * src/win32/apctray.cpp: Misc updates and small bug fixes. 2007-06-10 09:33 adk0212 * src/win32/installer/: Apctray.ini, winapcupsd.nsi: Updates for multi-instance apctray. Remove apctray parameter customization option for now. 2007-06-09 21:34 adk0212 * src/win32/: winres.h, winres.rc, winstat.cpp, wintray.cpp, wintray.h: More multiple instance improvements. Also add refresh button to detailed status dialog. 2007-06-09 20:02 adk0212 * src/win32/: apctray.cpp, winres.h, winres.rc, wintray.cpp, wintray.h, winups.h: More changes for better multiple monitor support. 2007-06-09 15:47 adk0212 * src/win32/: apctray.cpp, statmgr.cpp, winres.h, winres.rc, wintray.cpp, wintray.h, winups.h: Major rework to support monitoring multiple apcupsds with a single apctray instantiation. Includes basic management of monitoring instances. More fancy stuff to come. 2007-06-07 19:43 adk0212 * src/win32/: apctray.cpp, wintray.cpp, wintray.h, installer/common.nsh: Updates for running multiple apctray instances simultaneously and properly shutting them down. 2007-06-06 22:11 adk0212 * src/win32/wintray.cpp: Fix timeout bug. 2007-06-06 22:06 adk0212 * src/win32/: wintray.cpp, wintray.h: Shutdown status polling thread cleanly. 2007-06-06 22:05 adk0212 * src/win32/: statmgr.cpp, statmgr.h: Grab lock during destruction to prevent further operations. Also add copyright blocks. 2007-06-06 21:26 adk0212 * src/win32/: statmgr.cpp, statmgr.h: Reuse sockets in StatMgr. This prevents build-up of large numbers of sockets in the TIME_WAIT state. Also implement proper locking. 2007-06-06 19:53 adk0212 * src/lib/apcstatus.c: Kill FillEventsBox function and associated grunge that is no longer used. 2007-06-06 19:49 adk0212 * src/win32/apcupsd.rc: Remove unused file. 2007-06-06 19:44 adk0212 * src/win32/Makefile.in: Build object files in obj/ to reduce source dir clutter. 2007-06-06 18:53 adk0212 * src/win32/: Apctray.ini, EditApcupsdConf.ini, InstallService.ini, Makefile.in, common.nsh, params.nsh, util.nsh, winapcupsd.nsi, installer/Apctray.ini, installer/EditApcupsdConf.ini, installer/InstallService.ini, installer/common.nsh, installer/params.nsh, installer/util.nsh, installer/winapcupsd.nsi: Move installer files to installer/ directory. There are enough of them now that we should stop cluttering the main win32 source dir. 2007-06-06 18:29 adk0212 * src/win32/winapcupsd.nsi: Add back in the finish page with ReleaseNotes and apcupsd.org link. 2007-06-06 18:28 adk0212 * src/win32/common.nsh: Increase sleep time to 2 seconds. 1 second was borderline. 2007-06-05 20:42 adk0212 * src/win32/: common.nsh, winapcupsd.nsi: More start/stop rework. Add new common.nsh file to be shared between normal and uninstall context. 2007-06-05 20:41 adk0212 * src/win32/: apctray.cpp, wintray.cpp: Fix refresh again. Pretty soon I am going to run out of ways to screw this up. 2007-06-05 18:43 adk0212 * src/win32/: Apctray.ini, InstallService.ini, winapcupsd.nsi: Many more installer updates. Move static text to page .ini files. Add code to handle polite start/stop of apcupsd and apctray. 2007-06-05 18:39 adk0212 * src/win32/winservice.h: Maintain a registry flag to indicate if apcupsd is installed as a service. This used to be done by the installer, but would get out of sync if the user ran 'apcupsd /install' by hand. 2007-06-05 18:34 adk0212 * src/win32/winservice.cpp: Maintain a registry flag to indicate if apcupsd is installed as a service. This used to be done by the installer, but would get out of sync if the user ran 'apcupsd /install' by hand. 2007-06-05 18:33 adk0212 * src/win32/apctray.cpp: When installing, only add command line parameters if they were supplied by the user. Do not add them when using default settings. Also fix bug where default refresh was 1000 seconds (should be 1 second). 2007-06-03 22:38 adk0212 * src/win32/: Apctray.ini, winapcupsd.nsi: Add custom page for installing Apctray and configuring its parameters. 2007-06-03 13:05 adk0212 * src/win32/: InstallService.ini, winapcupsd.nsi: Add custom page for installing apcupsd as a service and optionally starting it instead of using popup dialogs during file install. 2007-06-03 13:04 adk0212 * src/win32/EditApcupsdConf.ini: Add definition for edit apcupsd.conf custom page. 2007-06-03 12:38 adk0212 * src/win32/winservice.cpp: Suppress service-already-exists errors when in quiet mode. 2007-06-03 12:31 adk0212 * src/win32/: compat/compat.cpp, compat/compat.h, apctray.cpp, winmain.cpp, winservice.cpp, winservice.h: Move GetArg() to common library and use it from winmain and apctray. Add /quiet switch to winmain to suppress /install and /remove dialogs. 2007-06-03 11:35 adk0212 * src/win32/winapcupsd.nsi: Add custom installer page for editing apcupsd.conf instead of using a popup during file installation. 2007-06-02 23:48 adk0212 * src/win32/build-win32-cross-tools: Update NSIS to 2.27 for better x64 compatibility. 2007-06-02 23:48 adk0212 * src/win32/winapcupsd.nsi: Updates for apctray. Create -Startup and -Finish hidden sections for common operations. 2007-06-02 23:45 adk0212 * src/win32/statmgr.cpp: Tweak spacing in GetAll() to match apcaccess format for longer keys. 2007-06-02 23:24 adk0212 * src/win32/apctray.cpp: Add /kill command line option for shutting down apctray instance. 2007-06-02 19:07 adk0212 * src/win32/popup.c: Update window name used by popup.exe so it finds apctray now. 2007-06-02 18:57 adk0212 * src/win32/: statmgr.cpp, wintray.cpp: Rework sprintf_realloc_append() to account for the fact that on Win98 vsnprintf() returns -1 if the string will not fit rather than the number of characters required. Argh. Also remove unnecessary UpdateTrayIcon() calls from wintray.c. 2007-06-02 18:22 adk0212 * src/win32/: apctray.cpp, winres.h, winres.rc, wintray.cpp: Add menu option to remove apctray from registry. All well-behaved tray applets should have this! 2007-06-02 18:04 adk0212 * src/win32/apctray.cpp: Add command line options to install and remove apctray from autorun list in the registry. 2007-06-02 17:34 adk0212 * src/win32/apctray.cpp: Add support for setting host, port, and refresh interval via command line. 2007-06-02 16:28 adk0212 * src/win32/winres.rc: Update about box. 2007-06-02 15:22 adk0212 * src/win32/: apctray.cpp, statmgr.cpp, wintray.cpp, wintray.h: Move status polling to a thread instead of a timer so we don't block the message loop while updating status. This fixes the annoying pauses in GUI response. More misc cleanups and small bug fixes. 2007-06-02 13:46 adk0212 * src/win32/: apctray.cpp, statmgr.cpp, winevents.cpp, winstat.cpp, wintray.cpp, wintray.h: Misc fixes. apctray is working now. 2007-06-02 13:23 adk0212 * src/win32/: Makefile.in, apctray.cpp, statmgr.cpp, statmgr.h, winevents.cpp, winevents.h, winstat.cpp, winstat.h, wintray.cpp, wintray.h: More refactoring. Add StatMgr class to handle fetching stats from the UPS using NIS. Kill global variables and move global stats and events code to their proper classes. 2007-06-02 11:12 adk0212 * src/win32/: Makefile.in, apctray.cpp, wintray.cpp, wintray.h: Move modified tray menu code back to wintray.cpp. Misc cleanups to wintray. 2007-06-01 20:12 adk0212 * src/win32/: apctray.cpp, winabout.cpp, winabout.h, winevents.cpp, winevents.h, winstat.cpp, winstat.h, wintray.h, winups.h: Cleanup of winabout, winevents, and winstat. Everthing compiles again. 2007-05-31 20:11 adk0212 * src/win32/: Makefile.in, apctray.cpp, winmain.cpp, winservice.cpp, winservice.h, winups.h, compat/compat.h: First step of major win32 service and tray icon code refactor/rewrite. This is part of the changes necessary for tray icon support on Vista. Clean up winservice and winmain. Eliminate lots of unused code. Simplify code where possible. Remove tray icon code from apcupsd itself. Add apctray.cpp for standalone tray icon module designed to gather status via NIS. 2007-05-31 20:11 adk0212 * src/win32/build-win32-cross-tools: Remove OpenGL and DirectX libraries, as they are not needed for Apcupsd. 2007-05-28 07:03 fleetworks * platforms/: mandrake/apcupsd.spec.in, suse/apcupsd.spec.in: RHEL5 update. 2007-05-27 13:20 adk0212 * platforms/contrib-rpm/build_rpm.sh: Add rhel5 to contrib-rpm. 2007-05-27 13:17 adk0212 * platforms/redhat/apcupsd.spec.in: Fix changelog copy-n-paste error. 2007-05-27 13:15 adk0212 * platforms/redhat/apcupsd.spec.in: Add rhel5 support in spec. 2007-05-26 15:07 adk0212 * doc/home-page/: index.html, index.wml: Update website for 3.14.1 release. 2007-05-04 19:18 adk0212 * ChangeLog: Update ChangeLog. 2007-05-04 19:17 adk0212 * ReleaseNotes, include/version.h: Maybe this time... 2007-05-03 18:31 adk0212 * src/action.c: Do not attempt to cancel shutdowns. Once a shutdown has been started there is no way to cleanly stop it and recover. Plus deleting the powerfail file causes killpower to be skipped, leaving the server shutdown and not restarted. Reported by Yvon Lafaille . 2007-05-01 20:26 adk0212 * src/drivers/usb/linux/linux-usb.c: Rewrite device opening logic. The new logic works as follows: - If user specifies a DEVICE, we will open that device and that device only. There is no fallback to autodetect. This is generaly what users expect when they explicitly give DEVICE. - If no DEVICE is specified, we autodetect as before. Furthermore, if we lose the connection to the device, we prefer to re-open the same device again, but will restart autodetection if that fails. - If DEVICE is specified using the deprecated '[]' syntax, just do normal autodetection as if DEVICE had not been specified at all. 2007-04-30 22:14 adk0212 * src/drivers/snmp/drv_powernet.c: Disable a few CIs that SNMP cards do not support. 2007-04-30 21:37 adk0212 * src/: action.c, apctest.c: Increase self-test timeout to 40 seconds to accomodate the RS 800. Contributed by Lars Randers . 2007-04-27 19:30 adk0212 * src/apctest.c: Fix apctest crash. When in the EEPROM programming section of apctest, if you try to print EEPROM values (item 1) more than once during the same session, the program segfaults. Contributed by Ivaylo Haratcherev . 2007-04-27 19:25 adk0212 * src/action.c: Normalize shut remote message. 2007-04-27 19:24 adk0212 * src/drivers/pcnet/pcnet.c: Add support for PCNET remote shutdown (SD) signal. Contributed by Ivaylo Haratcherev and Moshe Hyzon . 2007-04-23 19:47 adk0212 * ChangeLog: Rev ChangeLog. 2007-04-23 19:45 adk0212 * include/version.h: Did I say "final"? 2007-04-23 19:37 adk0212 * src/apctest.c: Fix typo in error message. Reported by Ashley M. Kirchner 2007-04-23 19:35 adk0212 * platforms/redhat/apcupsd.in: Update to match Fedora Extras packaging: - Add "force-reload" aliased to "restart" - "reload" outputs a not implemented error - "status" uses the status() function to return the proper LSB status code and runs apcaccess only if the daemon is running. Contributed by Orion Poplawski . 2007-04-21 20:37 adk0212 * ChangeLog: Update ChangeLog for 3.14.1 (again). 2007-04-21 20:35 adk0212 * ReleaseNotes, include/version.h: Final updates for 3.14.1. 2007-04-21 19:27 adk0212 * src/apctest.c: Fix link error with --disable-apcsmart (getline missing). Reported by Ashley M. Kirchner 2007-04-18 19:33 adk0212 * ChangeLog: Updated changelog for 3.14.1. 2007-04-18 19:30 adk0212 * ReleaseNotes, include/version.h: Prep for 3.14.1 release. 2007-03-25 15:38 adk0212 * src/lib/apclibnis.c: Prevent infinite hang in read_nbytes() when server disappears. Many thanks to Jan Ceuleers for reporting the hanging and gathering data to track down the cause. 2007-03-25 15:34 adk0212 * src/libusbhid/parse.c: Remove references to int8_t and int16_t. 2007-03-05 22:41 adk0212 * src/libusbhid/usbcompat.h: Kill stdint.h include since OpenBSD does not appear to have it. 2007-03-03 16:40 adk0212 * platforms/darwin/: ApcupsdDaemon.Info.plist, ApcupsdDaemon.Info.plist.in, ApcupsdPkg.Info.plist, ApcupsdPkg.Info.plist.in, ApcupsdUsbShim.Info.plist, ApcupsdUsbShim.Info.plist.in: Hey, genius... Archive foo.bar.in, not foo.bar. 2007-03-03 16:28 adk0212 * configure: Regen with Mac OS X installer changes. 2007-03-03 16:23 adk0212 * autoconf/configure.in, platforms/darwin/ApcupsdDaemon.Description.plist, platforms/darwin/ApcupsdDaemon.Info.plist, platforms/darwin/ApcupsdDaemon.postflight, platforms/darwin/ApcupsdDaemon.preflight, platforms/darwin/ApcupsdPkg.Description.plist, platforms/darwin/ApcupsdPkg.Info.plist, platforms/darwin/ApcupsdUsbShim.Description.plist, platforms/darwin/ApcupsdUsbShim.Info.plist, platforms/darwin/ApcupsdUsbShim.postflight, platforms/darwin/Makefile.in, platforms/darwin/Welcome.txt: Add binary installer support for Mac OS X. 2007-02-17 12:02 adk0212 * autoconf/aclocal.m4: Add missing newline at end of file. Discovered by Sergey Y. Afonin . 2007-02-17 12:00 adk0212 * platforms/mingw/apccontrol.bat: Fix typo: "%sbindir\%popup" -> "%sbindir%\popup" Discovered by Stefan.Hegnauer@elektrobit.com. 2007-02-13 19:02 adk0212 * src/win32/popup.c: Detect when balloon tips have been disabled via a group policy and fall back on the standard popup message box. apcupsd-3.14.10/DISCLAIMER0000664000076400007640000000210510073605265013564 0ustar adk0212adk0212 Please see COPYING for the copyright and general disclaimer. IN NO EVENT SHALL ANY AND ALL PERSONS INVOLVED IN THE DEVELOPMENT OF THIS PACKAGE, NOW REFERRED TO AS "APCUPSD-Team" BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ANY OR ALL OF THE "APCUPSD-Team" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE "APCUPSD-Team" SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE "APCUPSD-Team" HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. THE "APCUPSD-Team" HAS ABSOLUTELY NO CONNECTION WITH THE COMPANY AMERICAN POWER CONVERSION, "APCC". THE "APCUPSD-Team" DID NOT AND HAS NOT SIGNED ANY NON-DISCLOSURE AGREEMENTS WITH "APCC". ANY AND ALL OF THE LOOK-A-LIKE ( UPSlink(tm) Language ) WAS DERIVED FROM THE SOURCES LISTED BELOW. apcupsd-3.14.10/Developers0000664000076400007640000000346311012155631014257 0ustar adk0212adk0212 Current Code Maintainer and Project Manager: Adam Kropelin RPM Packager: D. Scott Barninger Former Project Manager: Kern Sibbald Project Starter and Former Code Maintainer: Andre Hedrick Alpha Port: J. Rochate testing and machine loan HP-UX Port Carl Erhorn Robert K Nelson SOLARIS Port: Carl Erhorn OpenBSD Port: Devin Reade NetBSD Port: Neil Darlow Win32 Port: Kern Sibbald Paul Z. Stagner testing WEB Interfaces: Kern Sibbald Joseph Acosta Hard Core Coders: Kern Sibbald Adam Kropelin Distribution Maintainers: Alpha: J. Rochate ???? Debian: Leon Breedt FreeBSD/BSDi: Jeff Palmer NetBSD: Neil Darlow HP-UX: Carl Erhorn , Robert K Nelson OpenBSD: Devin Reade RedHat: Kern Sibbald Fedora: Kern Sibbald Slackware: Devin Reade Sparc Solaris: Carl Erhorn SuSE: None Win32: Kern Sibbald Project Discussions: APCUPSD Mailing List apcupsd-3.14.10/INSTALL0000664000076400007640000003220010654643673013267 0ustar adk0212adk0212Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Become root if not already with `su'. 4. Type `make install' to install the programs and any data files and documentation. If you have a previously installed version of this package, it is advisable to issue a `make uninstall' before doing the installation. This will clean the halt.local script for suse and any other old halt script for other distributions. We can not guarantee a good behaviour of the software if you install a new version over an older one without prior uninstall the older one. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. 6. You can remove the program from where it was installed with `make uninstall.' Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in /usr/local/sbin and /usr/local/man. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. Usually good installation paths are `--prefix=/usr' and `--sbindir=/sbin'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. Configure options for APC UPS Daemon ==================================== The apcupsd have a number of `configure' time options that can be enabled for additional features. These options are: `--enable-powerflute' Enable the compilation of `powerflute' an ncurses based program to monitor the UPS. `--enable-nls' Enable the support for Native Language Support. `--with-included-gettext' Enable the compilation of the GNU gettext library that is included in this package. Gettext is part of NLS support so there's no point enabling this option and with NLS support disabled. `--with-catgets' Enable the use of the `catgets' function if available. `--with-libwrap=yes or --with-libwrap=[DIR] Enable the use of libwrap. When set to yes enables libwrap system library. When set to [DIR] enables libwrap in DIR. For RedHat Linux 9 users, some useful configure options are: =========================================================== ./configure --enable-threads --enable-cgi --with-cgi-bin=/var/www/cgi-bin Adjust --with-cgi-bin argument to reflect the location of your web server pages. Prior to running configure, make sure the following to packages are installed on your system. gd-1.8.4-11 gd-devel-1.8.4-11 These packages are on the RedHat 9 distribution disks. If these packages are installed, the cgi code will use these libraries for generation of png images. If these are not installed, the version included with apcupsd will be used instead. Configuring Apache HTTP Server for use with cgi support ======================================================= If you configure apcupsd with the --enable-cgi support you may need to make configuration changes to the httpd.conf file. The changes you will need to make depend on what directory you choose install the cgi files in. There are five files which are installed in the cgi-bin directory. Four of these are .cgi files which are executable images and the fifth file is apcupsd.css which is a style sheet used to give a common style to all output. There are two ways of enabling cgi support for Apache. The first method is to add the following line to httpd.conf: ScriptAlias /cgi-bin /var/www/cgi-bin The second method is to add the following lines to httpd.conf: Alias /cgi-bin /var/www/cgi-bin Options +ExecCGI AddHandler cgi-script .cgi The first example tells Apache that all files in the cgi-bin directory are executable cgi programs. The second example tells Apache that programs in the cgi-bin directory may be executable cgi programs if the file extension is .cgi. You can also add extra extensions to the AddHandler directive if you have other files in the directory. For example, if you have perl files in your cgi-bin directory: AddHandler cgi-script .cgi .pl Using the first example, you will have a problem with trying to serve the file apcupsd.css. Since this file is installed in the cgi-bin directory, Apache will assume it is an executable program and will produce an error when trying to serve it. You must use the second method of enabling cgi support. If you are using the default Apache configuration file, you will need to remove (or comment out) the first example and replace it with the second. If you install the apcupsd cgi files in another directory, you will need to add the second example to your httpd.conf file and adjust the pathname accordingly. Customization of apcupsd events ================================ Note, this is somewhat out of date, please check the installed apccontrol script for exact details of these events. When apcupsd detects anomalies from your UPS device, it will make some decisions that usually result in one or more calls to the script located in `${sysconf}/apcupsd/apccontrol'. The apcaction file is a shell script that acts on the first argument that `apcupsd' passes to it. These actions are set up by default to sane behaviour for all possible situations apcupsd is likely to detect from the UPS. Nevertheless you can change the apccontrol behaviour for every single action. To do so create a file with the same name as the action, which is passed as the first argument (argv[1], or $1 for shell scripts). Put your script in `${sysconf}/apcupsd/' directory. At present the arguments that apcaction can recognize are: Keyword Default Action ============ ============================================================== `powerout' `wall' a message telling `There are power problems'. `onbattery' `wall' a message telling `System is on battery'. `offbattery' None `mainsback' Attempt to cancel a running `shutdown' sequence. `failing' `wall' a message telling `Battery power is failing'. `timeout' `wall' a message telling `Timeout on Battery reached'. `loadlimit' `wall' a message telling `Battery load limit reached'. `runlimit' `wall' a message telling `Battery runtime limit reached'. `doreboot' Begins the `shutdown -r' sequence. `doshutdown' Begins the `shutdown -h' sequence. `annoyme' `wall' a message telling `Power problems, logoff now'. `emergency' Begins an emercengy `shutdown' sequence. `changeme' `wall' a message telling `Battery failed, change them now'. `remotedown' Begins the `shutdown' sequence, called from remote. If for example you want to write your own routine for the `powerout' action, you can write your own shell script called `powerout' and put it in the lib directory. Doing so will _completely disable_ the `apcaction' default behaviour and enable your script. If you want to write your customized scripts you are encouraged to edit the `${libdir}/apcupsd/apccontrol' script and at least mimic its behaviour into your own script. Writing faulty scripts may cause your system to crash due to power failures. apcupsd-3.14.10/Makefile0000664000076400007640000000053511014061576013667 0ustar adk0212adk0212topdir:=. SUBDIRS=src platforms doc include autoconf/targets.mak # Force platforms/ to build after src/ platforms_DIR: src_DIR configure: autoconf/configure.in autoconf/aclocal.m4 -rm -f config.cache config.log config.out config.status include/config.h autoconf --prepend-include=autoconf autoconf/configure.in > configure chmod 755 configure apcupsd-3.14.10/ReleaseNotes0000664000076400007640000004715611634011267014555 0ustar adk0212adk0212 Release Notes for Apcupsd 3.14.x Apcupsd 3.14.x is the latest STABLE release, containing many bug fixes and new features over the previous 3.12.x stable series. Users of all previous versions are encouraged to upgrade. IF YOU USE THE OLD STYLE MASTER/SLAVE NETWORKING MODE, BE SURE TO READ THE 3.14.0 RELEASE NOTES BELOW. 3.14.10 -- 13 September 2011 (Maintenance Release) BUG FIXES * Fix missing status and spurrious incorrect status on newer BackUPS CS models using USB interface. * USB compatibility fixes for Mac OS X Lion * USB driver support for newer Microlink models on Mac OS X Lion and Windows * Ignore transitions to battery due to calibration (possible if user initiates calibration, then exits apctest and starts apcupsd before calibration completes. * Fix truncation of long UPS model names such as "Smart-UPS RT 5000 XL" * Fix MODEL vs. APCMODEL confusion. Remove APCMODEL and rename old MODEL aka 'mode' to DRIVER. 3.14.9 -- 22 July 2011 (Maintenance Release) NEW FEATURES * SNMP enhancements: - Autodetection of MIB and community if they are not specified in apcupsd.conf - Support for RFC1628 MIB - Support for MGE MIB (Contributed by Lars Taeuber ) * Windows USB support for 64-bit platforms * USB support for latest APC models such as SMT* and SMX* series - No support for Microlink, but basic USB interface should be detected and provide status now. * When using the generic USB driver (Windows, OS X, newer FreeBSD) DEVICE string in apcupsd.conf can be set as serial number of UPS to monitor. This is useful in order to "lock" apcupsd to a specific UPS if you have more than one connected to the server. * Ed Dondlinger's Windows email scripts are included in the Win32 install package now. Documentation includes information on how to hook them in. BUG FIXES * general: Rework signal handling to eliminate crashes and hangs. * general: Fix issue of overwriting pid file even when we failed to acquire the lock file * snmp: Add workaround for FreeBSD libsupc++.a issue (FreeBSD PR #99702) This will allow snmplite driver to compile/link on FreeBSD 5.x. * usb: Automatically use generic_usb driver on FreeBSD 8.0 and newer. FreeBSD USB API was changed in 8.0, so from now on we will use libusb. * usb: Add support for DALARM * usb: Fix BATTV and MANDATE on certain newer APC models * win32: Honor INSTDIR specified on command line via /D * win32: When running uninstaller in silent mode, always remove config and events files without prompting. * win32: When logging events, convert LOG_CRIT to a WARNING rather than an ERROR since apcupsd uses it for power events which aren't really daemon errors. 3.14.8 -- 16 January 2010 (Maintenance Release) NEW FEATURES * Mac OS X version of apctray (apcagent) for monitoring apcupsd instances. Same feature set as apctray on Windows (monitor multiple instances, get detailed status and events logs). Popup notifications delivered via Growl, if available. * Major update to win32 version of apctray. Includes many visual and usability improvements to match OS X version. * apctest now supports battery calibration and self-test interval control on USB models. Many thanks to James Belleau for contributing these features. * New SNMP driver that does not require libsnmp.so, thus eliminating issues with not finding the library during shutdown when /usr has been unmounted. The new driver is the default for 'UPSTYPE snmp'. The old driver is still available as "UPSTYPE netsnmp" if needed. BUG FIXES * Add missing NOMINV, NOMOUTV, and NOMPOWER to net clients * Fix missing WALL in apccontrol (debian bug #546019) http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=546019 * Change all time/date strings to simplified ISO format: "YYYY-MM-DD HH:MM:SS +/-UTC" * Fix battery voltage readout on "Back-UPS 500 FW: 6.3.I USB FW: c1" * Remove obsolete image files from source tree * Fix issues with popup.exe running when it shouldn't and sometimes hanging and/or generating an "Interactive Services Dialog Detected" error. * Use /kill switch from the installer to shut down running instances of apcupsd and apctray. This will provide more reliable termination on Vista/Win7. * Update apctest to use 'Q' to exit any menu instead of a number that is always changing. Contributed by James Belleau * apctest: Fix compiler warnings. Contributed by Andy O'Shaughnessy 3.14.7 -- 31 July 2009 (Maintenance Release) NEW FEATURES * Multimon CGI programs are included with the Windows binary package BUG FIXES * Windows COM ports above COM9 now work without user needing to manually add \\.\ UNC prefix in apcupsd.conf * Fix configure script not noticing when C++ compiler is missing * Fix for battery date (BATTDAT) displaying invalid values on USB models * Fix version reporting in cgi and examples * Misc documentation fixes for typos, etc. 3.14.6 -- 16 May 2009 (Maintenance Release) NEW FEATURES * Major updates to the User Manual. Rewritten battery maintenance section courtesy of Trevor Roydhouse . Many other updates including the SmartUPS protocol and OS support sections. Furthermore, the manual is now formatted in reStructuredText (http://docutils.sourceforge.net/rst.html) and as a result is very easy to update. (The only down side is the multi-page HTML version is no longer available; the HTML version is all on a single page.) * New manpages for apcupsd, apcupsd.conf, apctest, apcaccess, and apccontrol. Many thanks to Trevor Roydhouse for the hard work! * Support for QNX. Tested on QNX 6.3.2. Contributed by Mikhail Gruzdev * Add support for turning the UPS off completely. This complements existing hibernate (aka killpower) functionality. Turn-off is implemented for apcsmart and USB drivers, subject to support for the relevant commands in the UPS itself. Contributed by Keith Campbell . BUG FIXES * apcsmart: Deadlock fixes during comms failures. Contributed by Keith Campbell * linux-usb: Fix out-of-bounds array access. Contributed by David Fries * Fix build with gcc-4.4. Contributed by Michal Hlavinka * apcsmart: Fix crash during process shutdown (SIGTERM). Contributed by Andrey Sharandakov * Several other minor fixes and improvements. See ChangeLog for details. 3.14.5 -- 26 October 2008 (Maintenance Release) BUG FIXES * docs: Document the /refresh switch for apctray. * apctest: Do not create pid file. There is little reason for it since apctest is a command-line tool, not a daemon. Plus nothing ever deletes the file so it interferes with apcupsd operation. * gapcmon: Network connect timeout fix. * Fix a few unsafe uses of sprintf and strcat. * Makefile: Fix cgi build on OpenBSD. libgd on OpenBSD requires X_LIBS for libfreetype and libfontconfig. * gapcmon: Iconify fixes for KDE * Fix LOWBATT glitch handling bug that could cause us to act on a LOWBATT signal immediately instead of waiting for the debounce time. * apctray: Improve multiple instance behavior for /add, /del, and /kill on modern platforms (Win2K and newer). * Support shutting down apcupsd instances running in other sessions (such as terminal services or remote desktop sessions). * Makefile: 'make install' fixes for first install on RedHat/SuSE. * docs: PCNET minimum password length is 15 chars, default username is 'apc', no known way to change the username. * Makefile: Fix dependency build errors on Darwin and other platforms. ('echo -n' is not portable; use 'tr' to strip newline instead) * RPMs: Automatically restart apcupsd when upgrading 3.14.4 -- 18 May 2008 (Maintenance Release) MAJOR CHANGES * Build system rewrite: All Makefiles have been rewritten from scratch. Improvements include reliable dependencies, support for parallel make, elimination of Makefile.in -> Makefile conversion, consistent use of DESTDIR during 'make install', and pretty-printed output during builds. NEW BUILD SYSTEM NOTES - GNU make is required. The configure script checks for this and tells you how to invokve it (on some platforms it is 'gmake' instead of 'make'). - Output during build is pretty-printed by default. To see more details, use 'make VERBOSE=1' for output similar to the old build system. For even more verbosity, use 'make VERBOSE=2'. - Parallel builds work well. If you have a multiprocessor (or multicore) system, try 'make -j' for the fastest possible build. * Built-in version of libgd for multimon cgi has been removed. The version previously included in apcupsd was old and likely had security issues. It is safer to use libgd from the target system. Therefore, your system must provide libgd if you choose to build cgi now. Generally this is easy to achieve by installing a vendor-supplied package. * Removal of NLS support: The NLS code was terribly bit-rotted with many non-internationalized messages and almost every translated message was incorrect. At this point the maintenance burden of keeping NLS support building was deemed too high considering the small benefit it was able to provide. * Powerflute has been disabled. It has been broken for the last several releases because it relied on an untrushworthy source of UPS status (rawupsstats) which was itself removed. Powerflute could be converted to use the standard NIS status mechanism and its source code remains in the tree in case someone has the desire to contribute this code. NEW FEATURES * Add POLLTIME directive to control UPS polling interval. This directive specifies the number of seconds to delay between polling the UPS for status. Previously, NETTIME allowed this to be adjusted for network connections only (snmp, pcnet, nis-net). POLLTIME configures the delay for all connection types. NETTIME is accepted as a synonym for compatibility with old config files. BUG FIXES * gapcmon: Corrected the use of NOMPOWER and the calc of current usage amount. Thanks to James Scott Jr . * Add a heuristic to fix up incorrect NOMINV or NOMOUTV. Some UPSes (RS 500) report decivolts instead of volts. Reported by Kirill S. Bychkov . * Various build fixes on Solaris and OpenSolaris. Thanks to James Dean for loaning me an ssh login on his OpenSolaris box. * Fix hal policy file syntax. For some reason this blatantly incorrect file actually works on RHEL5 (hal-0.5.8). Thanks to Andrew Telford for correcting it. * Fix gapcmon build on OpenBSD. * Fix BSD USB driver build. * Fix default NIS port on Debian. Debian is now using the standard NIS port, 3551. Contributed by imacat 3.14.3 -- 20 January 2008 (Maintenance Release) NEW FEATURES * A HAL policy file is automatically installed on Linux systems to disable the hald-addon-hid-ups module which conflicts with apcupsd's control of USB UPSes. The file is automatically removed when apcupsd is uninstalled. BUG FIXES * Add support for Nominal Power (aka Configured Active Power) reading. Credit to Lars Randers for most of the code. * Add units to NOMINV, NOMOUTV, and NOMBATTV stats. * Eliminate "warning: deprecated conversion from string constant to 'char*'" warnings emitted from gcc-4.2.1 (earlier versions with -Wwrite-strings). Contributed by Steve Yarmie . * Fix killpower and eeprom settings bug on USB models introduced when INPUT reports were prioritized over FEATURE reports. * Fix bugs that could cause NIS-net driver to get stuck waiting for comms to be restored instead of shutting down. 3.14.2 -- 15 September 2007 (Maintenance Release) NEW FEATURES * Tray icon support on Vista. Vista does not allow background services to interact with the user's desktop, so winapcupsd's built-in tray icon did not work. * Tray icon is now a standalone application "apctray" which is capable of monitoring multiple Apcupsd instances via Apcupsd's NIS. Any Apcupsd running NIS can be monitored. By default the icon monitors a single apcupsd at 127.0.0.1:3551. See command line options below for adding additional monitors. * Tray icon can be installed individually (disable other packages in the installer) for users who want to use the icon only. * Apctray command line options: apctray.exe - No parameters: Start any instances listed in registry. If no instances in reg, start a default instance monitoring the local machine (127.0.0.1:3551). apctray.exe /host foo /port 3551 /add - Add a monitor for the given host and port. apctray.exe /host foo /port 3551 /del - Remove the given monitor. apctray.exe /del - Remove all monitors. apctray.exe /install - Configure apctray to start automatically. apctray.exe /remove - Do not start automatically. apctray.exe /kill - Shut down apctray BUG FIXES * The win32 portions of winapcupsd have been almost entirely rewritten. The code is cleaner (mostly) and lots of unused baggage has been removed. * USB fix for BackUPS LCD series. This fix carries a risk of breaking other models, but test results are positive so far. * Fix linux-usb device detection bug when multiple hiddev nodes are present. Fixes Fedora Bugzilla #245864: * Fix SNMP port selection when using SNMP driver * Add workaround for broken BackUPS Pro model that returns certain reports encoded in ASCII. Based on a patch from David Fries . * apcsmart: Wait 20 seconds before declaring COMMLOST. This is necessary when using a smart serial cable on an UPS with an SNMP monitoring card installed. The SNMP card appears to disrupt serial comms for several seconds when interesting events are in progress. * Documentation updates: Fix up udev info for modern Linux distros. Update Windows section for apctray. * Don't leak unnecessary descriptors to child when execing apccontrol. * Fix bug with multi-threaded net_open() calls. net_open() was using a global buffer for the destination address. Yikes! Bug manifestied itself in apctray with multiple monitors occasionally (and timing-dependently) pointing to the wrong UPS. * Correct multimon.conf humidity monitoring. Problem fixed by Patrick Frei. Reference: https://bugzilla.novell.com/show_bug.cgi?id=199834 * Fix race between attach_ups() and detach_ups() which could result in the UPSINFO structure being freed prematurely. Thanks to James Abbott for running many tests to help me find this bug. * Remove dependency on libc++ (again). Must use gcc as linker when using libsupc++ since g++ automatically links against full libc++. 3.14.1 -- 04 May 2007 (Maintenance Release) NEW FEATURES * MacOS X GUI installer * PCNET driver supports remote shutdown request from UPS web interface BUG FIXES * (win32) Detect when balloon tips have been disabled via a group policy and fall back on the standard popup message box. * (win32) Fix typo: "%sbindir\%popup" -> "%sbindir%\popup" in apccontrol.bat Discovered by Stefan.Hegnauer@elektrobit.com. * (all) Fix potential NIS client lockup when server disappears. Many thanks to Jan Ceuleers for reporting the problem and gathering data to track down the cause. * (apctest) Fix link error after configuring with --disable-apcsmart. * (doc) Document how to force ugen binding on NetBSD 4.x. Contributed by Curt Sampson . * (apctest) Fix crash when displaying EEPROM values more than once. Contributed by Ivaylo Haratcherev . * Increase self-test timeout to 40 seconds to accomodate the RS 800. Contributed by Lars Randers . * (linux-usb) Rewrite device opening logic to be more reliable. See ChangeLog for details. * (apcupsd) Do not attempt to cancel shutdowns. 3.14.0 -- 09 February 2007 (Feature Release) NEW FEATURES * USB support for 3 new platforms: - Windows (Win98SE, WinME, Win2000, Win2003 Server, WinXP) - Mac OS X (Darwin) - Solaris 10 (x86 and SPARC) Please see the Apcupsd manual for details on USB configuration for the new platforms. * Native Windows port The winapcupsd port has been completely rewritten to use native Win32 libraries (based on MinGW32). It no longer relies on a Cygwin translation layer, thus improving compatibility and performance. * PowerChute Network Shutdown driver Apcupsd now supports the PowerChute Network Shutdown protocol (PCNET) offered by the AP9617 family of smart slot modules. This protocol is much lighter-weight than SNMP and offers better security. Please see the Apcupsd manual for details on PCNET configuration. * GAPCMON GUI monitoring tool Apcupsd is now packaged with the GAPCMON GUI monitoring application thanks to James Scott, Jr. This is a Gnome/GTK based application which integrates into most desktop panels (not just Gnome). It monitors one or more Apcupsd instances using Apcupsd's NIS networking server. The status of each UPS is shown with a icon similar to the Win32 tray icon in winapcupsd. Enable building of gapcmon at compile time via --enable-gapcmon or install the apcupsd-gapcmon RPM. * Unreliable MASTER/SLAVE networking mode is removed Yes, this is a feature. The old MASTER/SLAVE mode for shutting down multiple servers from one UPS has historically been unreliable and prone to loss of communications or lockups. Apcupsd has long had a replacement networking mode using the NIS server (NIS stands for Network Information Server, and has nothing to do with Sun's NIS/YP protocol). The NIS net mode is very reliable and has none of the lockup bugs that have plagued MASTER/SLAVE mode. In 3.14.x, MASTER/SLAVE mode has been removed and the associated configuration directives are now obsolete. Please see the Apcupsd manual for a very simple NIS networking configuration to replace MASTER/SLAVE. * New configuration directives to set paths at runtime Several new (optional) configuration directives have been added to allow overriding compiled-in paths at runtime. The directives are: - SCRIPTDIR (sets location of apccontrol and event scripts) - PWRFAILDIR (sets location where powerfail file will be written) - NOLOGINDIR (set location where nologin file will be written) These directives can be used to rearrange the Apcupsd installation after compiling, or to run multiple Apcupsd instances on the same machine without compiling separate copies. See the Apcupsd manual for details on these new directives. apcupsd-3.14.10/VERIFYING0000664000076400007640000000271607707715236013534 0ustar adk0212adk0212 All apcupsd packages released on Source Forge after 24 July 2003 will be signed with the apcupsd Distribution Verification Key. By obtaining a copy of the apcupsd Distribution Verification Public key from either the home site (www.apcupsd.com) or from the Source Forge project page, (www.sourceforge.net/projects/apcupsd). you can verify that the code you have is complete, unaltered, and packaged by myself (Kern Sibbald) or D. Scott Barninger. Putting the apcupsd Key in your Keyring: Once you download the apcupsd public key, you must insert it in your keyring. The procedure will differ depending on whether you are using PGP or GPG. For GPG, assuming you have put the key in apcupsd.k, the procedure is: gpg --import apcupsd.key Verifying an RPM: The procedure for verification differs slightly if you are using rpms or tar.gz files. For rpms, the signature becomes part of the rpm package, and once the apcupsd public key is in your keyring you check the package with: rpm --checksig apcupsd-3.10.xx.rpm Verifying tar files: Tar files are distributed as they always have been in the past, unchanged. However, for each xxxx.tar.gz file that is released there will be a second file released with the same name but with .sig appended, for example xxxx.tar.gz.sig. To verify the apcupsd distribution, you download both the files and put them in the same directory, then for GPG, you use the following command to do the verification: gpg --verify xxxx.tar.gz.sig apcupsd-3.14.10/c0000664000076400007640000000127310242577560012403 0ustar adk0212adk0212/* Copyright (C) 2000-2005 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ apcupsd-3.14.10/configure0000775000076400007640000137570211437731553014162 0ustar adk0212adk0212#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="Developers" ac_default_prefix=/opt/apcupsd ac_default_prefix=/usr # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS ABSSRCDIR topdir TOP_DIR VERSION DATE TRUEPRG FALSEPRG build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK HAVE_GCC_TRUE HAVE_GCC_FALSE DEBUG DRVLIBS APCDRVLIBS PTHREAD_CFLAGS PTHREAD_LFLAGS APCACCESS SMTP APCTEST SHUTDOWN APCUPSD_MAIL WALL SCRIPTSHELL RANLIB RM CP ECHO LN SED AR MV RST2HTML RST2PDF EGREP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS HALPOLICYDIR GDHEAD APCSMART_DRIVER DUMB_DRIVER LIBUSBHID LIBUSBHIDINC usbcfg LIBUSBH USB_DRIVER USB_TYPE NET_DRIVER SNMPLITE_DRIVER SNMP_DRIVER TEST_DRIVER PCNET_DRIVER NISIP PKG_CONFIG ac_pt_PKG_CONFIG GAPCMON_CFLAGS GAPCMON_LIBS GAPCMON APCAGENT POWERFLUTE POWERLIBS MAKE LD CGI GD_LIBS CGIBIN SYSCONFDIR MKINSTALLDIRS EXTRADEFS LIBEXTRAOBJ EXTRAOBJ DISTDIR DISTNAME DISTVER SERIALDEV PIDDIR LOGDIR nologdir PWRFAILDIR LOCKDIR NISPORT UPSTYPE UPSCABLE HOST LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_env_PKG_CONFIG_value=$PKG_CONFIG ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG ac_env_GAPCMON_CFLAGS_set=${GAPCMON_CFLAGS+set} ac_env_GAPCMON_CFLAGS_value=$GAPCMON_CFLAGS ac_cv_env_GAPCMON_CFLAGS_set=${GAPCMON_CFLAGS+set} ac_cv_env_GAPCMON_CFLAGS_value=$GAPCMON_CFLAGS ac_env_GAPCMON_LIBS_set=${GAPCMON_LIBS+set} ac_env_GAPCMON_LIBS_value=$GAPCMON_LIBS ac_cv_env_GAPCMON_LIBS_set=${GAPCMON_LIBS+set} ac_cv_env_GAPCMON_LIBS_value=$GAPCMON_LIBS # # Report the --help message. # 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 this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-all Enable all optional modules --enable-cgi Compile CGI programs --enable-apcsmart Compile APC SmartUPS serial driver (default) --disable-apcsmart No APC SmartUPS serial driver --enable-dumb Compile dumb UPS driver (default) --disable-dumb No dumb UPS driver --enable-usb Compile USB UPS code --disable-usb No USB UPS code (default) --enable-net Compile networking driver for slaves (default) --disable-net No network driver for slaves --enable-snmp Compile SNMP driver (default) --disable-snmp No SNMP driver --enable-net-snmp Compile NET-SNMP UPS code (OBSOLETE) --disable-net-snmp No NET-SNMP UPS code (default) --enable-test Compile TEST driver code --disable-test No TEST driver (default) --enable-pcnet Compile PCNET driver code (default) --disable-pcnet No PCNET driver --enable-gapcmon Build GTK/GUI front-end to apcupsd (default=no) --enable-apcagent Build menubar app for Mac OS X (default=no) --enable-install-distdir Install distribution Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-x use the X Window System --with-halpolicydir=DIR HAL policy directory (default is platform dependent) --with-libwrap=DIR Compile in libwrap (tcp_wrappers) support --with-generic-usb Force use of generic USB driver --with-nisip=IP-ADDRESS Specify the IP address to bind to (default=0.0.0.0) --with-cgi-bin=DIR Specify cgi-bin directory (default=/etc/apcupsd) --with-distname=NAME Specify DISTNAME --with-nologin=DIR Specify nologin file directory (default /etc) --with-pid-dir=DIR Specify PIDDIR directory (default is OS dependent) --with-log-dir=DIR Specify EVENTS and STATUS directory (default is OS dependent) --with-lock-dir=DIR Specify serial port lock directory (default is OS dependent) --with-pwrfail-dir=DIR Specify power failure file directory (default is OS dependent) --with-serial-dev=DEV Specify serial port device --with-dev=DEV Specify port or device --with-nis-port=PORT Specify NIS (CGI) port (default 3551 except Debian) --with-upstype=TYPE Specify the UPS type --with-upscable=CABLE Specify the UPS cable Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CC C compiler command CFLAGS C compiler flags CPP C preprocessor PKG_CONFIG path to pkg-config utility GAPCMON_CFLAGS C compiler flags for GAPCMON, overriding pkg-config GAPCMON_LIBS linker flags for GAPCMON, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers include/config.h:autoconf/config.h.in" topdir=`pwd` ac_aux_dir= for ac_dir in ${topdir}/autoconf $srcdir/${topdir}/autoconf; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ${topdir}/autoconf $srcdir/${topdir}/autoconf" >&5 echo "$as_me: error: cannot find install-sh or install.sh in ${topdir}/autoconf $srcdir/${topdir}/autoconf" >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. ABSSRCDIR=`pwd` cd .. TOP_DIR=`pwd` cd ${topdir} VERSION=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${srcdir}/include/version.h` DATE=`sed -n -e 's/^.* \t*ADATE.*"\(.*\)"$/\1/p' ${srcdir}/include/version.h` for ac_prog in true do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_TRUEPRG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $TRUEPRG in [\\/]* | ?:[\\/]*) ac_cv_path_TRUEPRG="$TRUEPRG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_TRUEPRG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi TRUEPRG=$ac_cv_path_TRUEPRG if test -n "$TRUEPRG"; then echo "$as_me:$LINENO: result: $TRUEPRG" >&5 echo "${ECHO_T}$TRUEPRG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$TRUEPRG" && break done test -n "$TRUEPRG" || TRUEPRG=":" for ac_prog in false do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_FALSEPRG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $FALSEPRG in [\\/]* | ?:[\\/]*) ac_cv_path_FALSEPRG="$FALSEPRG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_FALSEPRG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi FALSEPRG=$ac_cv_path_FALSEPRG if test -n "$FALSEPRG"; then echo "$as_me:$LINENO: result: $FALSEPRG" >&5 echo "${ECHO_T}$FALSEPRG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$FALSEPRG" && break done test -n "$FALSEPRG" || FALSEPRG=":" PATH=$PATH:/bin:/sbin:/etc:/usr/bin:/usr/bin/X11:/usr/sbin:/usr/local/bin:/usr/local/sbin export PATH CPPFLAGS="${CPPFLAGS} -I/usr/local/include" LDFLAGS="${LDFLAGS} -L/usr/local/lib64 -L/usr/local/lib" if test $HAVE_UNAME=yes -a x`uname -s` = xSunOS then if test x$sysconfdir = x'${prefix}/etc' ; then sysconfdir='/etc/opt/apcupsd' fi if test x$sbindir = x'${exec_prefix}/sbin' ; then sbindir='/etc/opt/apcupsd/sbin' fi CPPFLAGS="${CPPFLAGS} -I/usr/sfw/include" LDFLAGS="${LDFLAGS} -L/usr/sfw/lib" else if test x$sysconfdir = x'${prefix}/etc' ; then sysconfdir='/etc/apcupsd' fi if test x$sbindir = x'${exec_prefix}/sbin' ; then sbindir='/sbin' fi fi # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5 echo $ECHO_N "checking for C++ compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C++ compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C++ compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5 echo $ECHO_N "checking whether the C++ compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking for library containing strerror" >&5 echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 if test "${ac_cv_search_strerror+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_strerror=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strerror (); int main () { strerror (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_strerror="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_strerror" = no; then for ac_lib in cposix; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strerror (); int main () { strerror (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_strerror="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 echo "${ECHO_T}$ac_cv_search_strerror" >&6 if test "$ac_cv_search_strerror" != no; then test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" fi if test x$GCC = xyes; then if $TRUEPRG; then HAVE_GCC_TRUE= HAVE_GCC_FALSE='#' else HAVE_GCC_TRUE='#' HAVE_GCC_FALSE= fi cat >>confdefs.h <<\_ACEOF #define HAVE_GCC 1 _ACEOF else if $FALSEPRG; then HAVE_GCC_TRUE= HAVE_GCC_FALSE='#' else HAVE_GCC_TRUE='#' HAVE_GCC_FALSE= fi fi if test x$LD = x ; then LD="$CC" fi PTHREAD_CFLAGS="" PTHREAD_LFLAGS="-lpthread" with_pthreads=yes cat >>confdefs.h <<\_ACEOF #define HAVE_PTHREADS 1 _ACEOF APCACCESS=apcaccess SMTP=smtp APCTEST=apctest for ac_prog in shutdown shutdown.bsd do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_SHUTDOWN+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $SHUTDOWN in [\\/]* | ?:[\\/]*) ac_cv_path_SHUTDOWN="$SHUTDOWN" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_SHUTDOWN="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi SHUTDOWN=$ac_cv_path_SHUTDOWN if test -n "$SHUTDOWN"; then echo "$as_me:$LINENO: result: $SHUTDOWN" >&5 echo "${ECHO_T}$SHUTDOWN" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$SHUTDOWN" && break done if test "$SHUTDOWN" = "" ; then { { echo "$as_me:$LINENO: error: Missing required tool; need any one of: shutdown shutdown.bsd" >&5 echo "$as_me: error: Missing required tool; need any one of: shutdown shutdown.bsd" >&2;} { (exit 1); exit 1; }; } fi for ac_prog in mail do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_APCUPSD_MAIL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $APCUPSD_MAIL in [\\/]* | ?:[\\/]*) ac_cv_path_APCUPSD_MAIL="$APCUPSD_MAIL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_APCUPSD_MAIL="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi APCUPSD_MAIL=$ac_cv_path_APCUPSD_MAIL if test -n "$APCUPSD_MAIL"; then echo "$as_me:$LINENO: result: $APCUPSD_MAIL" >&5 echo "${ECHO_T}$APCUPSD_MAIL" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$APCUPSD_MAIL" && break done test -n "$APCUPSD_MAIL" || APCUPSD_MAIL="no" if test "$APCUPSD_MAIL" = "no" then { echo "$as_me:$LINENO: WARNING: mail program not found !" >&5 echo "$as_me: WARNING: mail program not found !" >&2;} APCUPSD_MAIL=mail fi for ac_prog in wall do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_WALL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $WALL in [\\/]* | ?:[\\/]*) ac_cv_path_WALL="$WALL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_WALL="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi WALL=$ac_cv_path_WALL if test -n "$WALL"; then echo "$as_me:$LINENO: result: $WALL" >&5 echo "${ECHO_T}$WALL" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$WALL" && break done if test "$WALL" = "" ; then { { echo "$as_me:$LINENO: error: Missing required tool; need any one of: wall" >&5 echo "$as_me: error: Missing required tool; need any one of: wall" >&2;} { (exit 1); exit 1; }; } fi for ac_prog in sh bash do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_SCRIPTSHELL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $SCRIPTSHELL in [\\/]* | ?:[\\/]*) ac_cv_path_SCRIPTSHELL="$SCRIPTSHELL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_SCRIPTSHELL="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi SCRIPTSHELL=$ac_cv_path_SCRIPTSHELL if test -n "$SCRIPTSHELL"; then echo "$as_me:$LINENO: result: $SCRIPTSHELL" >&5 echo "${ECHO_T}$SCRIPTSHELL" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$SCRIPTSHELL" && break done if test "$SCRIPTSHELL" = "" ; then { { echo "$as_me:$LINENO: error: Missing required tool; need any one of: sh bash" >&5 echo "$as_me: error: Missing required tool; need any one of: sh bash" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: checking for GNU make" >&5 echo $ECHO_N "checking for GNU make... $ECHO_C" >&6 if test "${_cv_gnu_make_command+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else _cv_gnu_make_command='' ; for a in "$MAKE" make gmake gnumake ; do if test -z "$a" ; then continue ; fi ; if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then _cv_gnu_make_command=$a ; break; fi done ; fi echo "$as_me:$LINENO: result: $_cv_gnu_make_command" >&5 echo "${ECHO_T}$_cv_gnu_make_command" >&6 ; MAKE=$_cv_gnu_make_command; if test -z "$_cv_gnu_make_command" ; then { { echo "$as_me:$LINENO: error: Could not find GNU make" >&5 echo "$as_me: error: Could not find GNU make" >&2;} { (exit 1); exit 1; }; } ; fi ; for ac_prog in ranlib true do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $RANLIB in [\\/]* | ?:[\\/]*) ac_cv_path_RANLIB="$RANLIB" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_RANLIB="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi RANLIB=$ac_cv_path_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$RANLIB" && break done if test "$RANLIB" = "" ; then { { echo "$as_me:$LINENO: error: Missing required tool; need any one of: ranlib true" >&5 echo "$as_me: error: Missing required tool; need any one of: ranlib true" >&2;} { (exit 1); exit 1; }; } fi # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_RM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $RM in [\\/]* | ?:[\\/]*) ac_cv_path_RM="$RM" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi RM=$ac_cv_path_RM if test -n "$RM"; then echo "$as_me:$LINENO: result: $RM" >&5 echo "${ECHO_T}$RM" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$RM" = "" ; then { { echo "$as_me:$LINENO: error: Missing required tool: rm" >&5 echo "$as_me: error: Missing required tool: rm" >&2;} { (exit 1); exit 1; }; } fi # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_CP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $CP in [\\/]* | ?:[\\/]*) ac_cv_path_CP="$CP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi CP=$ac_cv_path_CP if test -n "$CP"; then echo "$as_me:$LINENO: result: $CP" >&5 echo "${ECHO_T}$CP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$CP" = "" ; then { { echo "$as_me:$LINENO: error: Missing required tool: cp" >&5 echo "$as_me: error: Missing required tool: cp" >&2;} { (exit 1); exit 1; }; } fi # Extract the first word of "echo", so it can be a program name with args. set dummy echo; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_ECHO+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $ECHO in [\\/]* | ?:[\\/]*) ac_cv_path_ECHO="$ECHO" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ECHO="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi ECHO=$ac_cv_path_ECHO if test -n "$ECHO"; then echo "$as_me:$LINENO: result: $ECHO" >&5 echo "${ECHO_T}$ECHO" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$ECHO" = "" ; then { { echo "$as_me:$LINENO: error: Missing required tool: echo" >&5 echo "$as_me: error: Missing required tool: echo" >&2;} { (exit 1); exit 1; }; } fi # Extract the first word of "ln", so it can be a program name with args. set dummy ln; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_LN+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $LN in [\\/]* | ?:[\\/]*) ac_cv_path_LN="$LN" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LN="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi LN=$ac_cv_path_LN if test -n "$LN"; then echo "$as_me:$LINENO: result: $LN" >&5 echo "${ECHO_T}$LN" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$LN" = "" ; then { { echo "$as_me:$LINENO: error: Missing required tool: ln" >&5 echo "$as_me: error: Missing required tool: ln" >&2;} { (exit 1); exit 1; }; } fi # Extract the first word of "sed", so it can be a program name with args. set dummy sed; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_SED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $SED in [\\/]* | ?:[\\/]*) ac_cv_path_SED="$SED" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi SED=$ac_cv_path_SED if test -n "$SED"; then echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$SED" = "" ; then { { echo "$as_me:$LINENO: error: Missing required tool: sed" >&5 echo "$as_me: error: Missing required tool: sed" >&2;} { (exit 1); exit 1; }; } fi # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $AR in [\\/]* | ?:[\\/]*) ac_cv_path_AR="$AR" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi AR=$ac_cv_path_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$AR" = "" ; then { { echo "$as_me:$LINENO: error: Missing required tool: ar" >&5 echo "$as_me: error: Missing required tool: ar" >&2;} { (exit 1); exit 1; }; } fi # Extract the first word of "mv", so it can be a program name with args. set dummy mv; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_MV+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MV in [\\/]* | ?:[\\/]*) ac_cv_path_MV="$MV" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_MV="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi MV=$ac_cv_path_MV if test -n "$MV"; then echo "$as_me:$LINENO: result: $MV" >&5 echo "${ECHO_T}$MV" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$MV" = "" ; then { { echo "$as_me:$LINENO: error: Missing required tool: mv" >&5 echo "$as_me: error: Missing required tool: mv" >&2;} { (exit 1); exit 1; }; } fi # Extract the first word of "rst2html.py", so it can be a program name with args. set dummy rst2html.py; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_RST2HTML+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $RST2HTML in [\\/]* | ?:[\\/]*) ac_cv_path_RST2HTML="$RST2HTML" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_RST2HTML="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi RST2HTML=$ac_cv_path_RST2HTML if test -n "$RST2HTML"; then echo "$as_me:$LINENO: result: $RST2HTML" >&5 echo "${ECHO_T}$RST2HTML" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "rst2pdf", so it can be a program name with args. set dummy rst2pdf; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_RST2PDF+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $RST2PDF in [\\/]* | ?:[\\/]*) ac_cv_path_RST2PDF="$RST2PDF" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_RST2PDF="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi RST2PDF=$ac_cv_path_RST2PDF if test -n "$RST2PDF"; then echo "$as_me:$LINENO: result: $RST2PDF" >&5 echo "${ECHO_T}$RST2PDF" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # ------------------------------------------------------------------------- # If the user has not set --mandir, we default to /usr/share/man # ------------------------------------------------------------------------- if test x$mandir = x'${prefix}/man' ; then mandir=/usr/share/man fi for ac_func in abort fork calloc getpid \ ioctl kill rewind select setsid signal strerror strncmp \ strncpy tcgetattr vfprintf setpgrp do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else { { echo "$as_me:$LINENO: error: cannot find required function." >&5 echo "$as_me: error: cannot find required function." >&2;} { (exit 1); exit 1; }; } fi done for ac_func in snprintf vsnprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for library containing nanosleep" >&5 echo $ECHO_N "checking for library containing nanosleep... $ECHO_C" >&6 if test "${ac_cv_search_nanosleep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_nanosleep=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char nanosleep (); int main () { nanosleep (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_nanosleep="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_nanosleep" = no; then for ac_lib in rt posix4; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char nanosleep (); int main () { nanosleep (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_nanosleep="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_nanosleep" >&5 echo "${ECHO_T}$ac_cv_search_nanosleep" >&6 if test "$ac_cv_search_nanosleep" != no; then test "$ac_cv_search_nanosleep" = "none required" || LIBS="$ac_cv_search_nanosleep $LIBS" cat >>confdefs.h <<\_ACEOF #define HAVE_NANOSLEEP 1 _ACEOF else LIBEXTRAOBJ="$LIBEXTRAOBJ sleep.o" EXTRAOBJ="$EXTRAOBJ lib/sleep.o" fi echo "$as_me:$LINENO: checking for syslog" >&5 echo $ECHO_N "checking for syslog... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { syslog(0, "%s", "test"); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: checking for std_syslog in -lsocket" >&5 echo $ECHO_N "checking for std_syslog in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_std_syslog+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char std_syslog (); int main () { std_syslog (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_std_syslog=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_std_syslog=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_std_syslog" >&5 echo "${ECHO_T}$ac_cv_lib_socket_std_syslog" >&6 if test $ac_cv_lib_socket_std_syslog = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF LIBS="-lsocket $LIBS" else { { echo "$as_me:$LINENO: error: cannot find required function." >&5 echo "$as_me: error: cannot find required function." >&2;} { (exit 1); exit 1; }; } fi cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { syslog(0, "%s", "test"); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot find required function." >&5 echo "$as_me: error: cannot find required function." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext for ac_func in strftime do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else # strftime is in -lintl on SCO UNIX. echo "$as_me:$LINENO: checking for strftime in -lintl" >&5 echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6 if test "${ac_cv_lib_intl_strftime+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strftime (); int main () { strftime (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_intl_strftime=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_intl_strftime=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5 echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6 if test $ac_cv_lib_intl_strftime = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRFTIME 1 _ACEOF LIBS="-lintl $LIBS" fi fi done echo "$as_me:$LINENO: checking whether setpgrp takes no argument" >&5 echo $ECHO_N "checking whether setpgrp takes no argument... $ECHO_C" >&6 if test "${ac_cv_func_setpgrp_void+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot check setpgrp when cross compiling" >&5 echo "$as_me: error: cannot check setpgrp when cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if HAVE_UNISTD_H # include #endif int main () { /* If this system has a BSD-style setpgrp which takes arguments, setpgrp(1, 1) will fail with ESRCH and return -1, in that case exit successfully. */ exit (setpgrp (1,1) == -1 ? 0 : 1); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_setpgrp_void=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_setpgrp_void=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_setpgrp_void" >&5 echo "${ECHO_T}$ac_cv_func_setpgrp_void" >&6 if test $ac_cv_func_setpgrp_void = yes; then cat >>confdefs.h <<\_ACEOF #define SETPGRP_VOID 1 _ACEOF fi # Under sysV68, socket and friends are provided by the C library. # -linet does not provide socket, but causes multiple definition # errors at link-time. It is thus better to only use the C library. # So don't add -linet to the link list unless it's necessary # # With Solaris socket and friends seem not to be in C library. # I hope that if socket is found, all the BSD friends are in the same library # # - RF # echo "$as_me:$LINENO: checking for library containing socket" >&5 echo $ECHO_N "checking for library containing socket... $ECHO_C" >&6 if test "${ac_cv_search_socket+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_socket=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char socket (); int main () { socket (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_socket="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_socket" = no; then for ac_lib in xnet socket inet; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char socket (); int main () { socket (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_socket="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_socket" >&5 echo "${ECHO_T}$ac_cv_search_socket" >&6 if test "$ac_cv_search_socket" != no; then test "$ac_cv_search_socket" = "none required" || LIBS="$ac_cv_search_socket $LIBS" fi echo "$as_me:$LINENO: checking for library containing gethostname" >&5 echo $ECHO_N "checking for library containing gethostname... $ECHO_C" >&6 if test "${ac_cv_search_gethostname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_gethostname=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostname (); int main () { gethostname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_gethostname="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_gethostname" = no; then for ac_lib in xnet socket inet; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostname (); int main () { gethostname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_gethostname="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_gethostname" >&5 echo "${ECHO_T}$ac_cv_search_gethostname" >&6 if test "$ac_cv_search_gethostname" != no; then test "$ac_cv_search_gethostname" = "none required" || LIBS="$ac_cv_search_gethostname $LIBS" fi echo "$as_me:$LINENO: checking for library containing gethostbyname" >&5 echo $ECHO_N "checking for library containing gethostbyname... $ECHO_C" >&6 if test "${ac_cv_search_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_gethostbyname=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_gethostbyname="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_gethostbyname" = no; then for ac_lib in nsl resolv; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_gethostbyname="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_search_gethostbyname" >&6 if test "$ac_cv_search_gethostbyname" != no; then test "$ac_cv_search_gethostbyname" = "none required" || LIBS="$ac_cv_search_gethostbyname $LIBS" fi echo "$as_me:$LINENO: checking for library containing gethostbyname_r" >&5 echo $ECHO_N "checking for library containing gethostbyname_r... $ECHO_C" >&6 if test "${ac_cv_search_gethostbyname_r+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_gethostbyname_r=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname_r (); int main () { gethostbyname_r (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_gethostbyname_r="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_gethostbyname_r" = no; then for ac_lib in nsl resolv; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname_r (); int main () { gethostbyname_r (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_gethostbyname_r="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_gethostbyname_r" >&5 echo "${ECHO_T}$ac_cv_search_gethostbyname_r" >&6 if test "$ac_cv_search_gethostbyname_r" != no; then test "$ac_cv_search_gethostbyname_r" = "none required" || LIBS="$ac_cv_search_gethostbyname_r $LIBS" fi echo "$as_me:$LINENO: checking for socklen_t" >&5 echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 if test "${ba_cv_header_socklen_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { socklen_t x ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ba_cv_header_socklen_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ba_cv_header_socklen_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ba_cv_header_socklen_t" >&5 echo "${ECHO_T}$ba_cv_header_socklen_t" >&6 test $ba_cv_header_socklen_t = yes && cat >>confdefs.h <<\_ACEOF #define HAVE_SOCKLEN_T 1 _ACEOF # The condition in this test copes with the presence of inet_addr in libc6. echo "$as_me:$LINENO: checking for library containing inet_addr" >&5 echo $ECHO_N "checking for library containing inet_addr... $ECHO_C" >&6 if test "${ac_cv_search_inet_addr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_inet_addr=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char inet_addr (); int main () { inet_addr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_inet_addr="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_inet_addr" = no; then for ac_lib in nsl; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char inet_addr (); int main () { inet_addr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_inet_addr="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_inet_addr" >&5 echo "${ECHO_T}$ac_cv_search_inet_addr" >&6 if test "$ac_cv_search_inet_addr" != no; then test "$ac_cv_search_inet_addr" = "none required" || LIBS="$ac_cv_search_inet_addr $LIBS" fi echo "$as_me:$LINENO: checking for strchr" >&5 echo $ECHO_N "checking for strchr... $ECHO_C" >&6 if test "${ac_cv_func_strchr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define strchr to an innocuous variant, in case declares strchr. For example, HP-UX 11i declares gettimeofday. */ #define strchr innocuous_strchr /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strchr (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef strchr /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strchr (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_strchr) || defined (__stub___strchr) choke me #else char (*f) () = strchr; #endif #ifdef __cplusplus } #endif int main () { return f != strchr; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_strchr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_strchr=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_strchr" >&5 echo "${ECHO_T}$ac_cv_func_strchr" >&6 if test $ac_cv_func_strchr = yes; then echo "$as_me:$LINENO: result: using libc's strchr" >&5 echo "${ECHO_T}using libc's strchr" >&6 else echo "$as_me:$LINENO: checking for strchr in -lcposix" >&5 echo $ECHO_N "checking for strchr in -lcposix... $ECHO_C" >&6 if test "${ac_cv_lib_cposix_strchr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcposix $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strchr (); int main () { strchr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_cposix_strchr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_cposix_strchr=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_cposix_strchr" >&5 echo "${ECHO_T}$ac_cv_lib_cposix_strchr" >&6 if test $ac_cv_lib_cposix_strchr = yes; then EXTRADEFS="$EXTRADEFS -D_SYSV3" LIBS="$LIBS -lcposix" fi fi echo "$as_me:$LINENO: checking for strstr" >&5 echo $ECHO_N "checking for strstr... $ECHO_C" >&6 if test "${ac_cv_func_strstr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define strstr to an innocuous variant, in case declares strstr. For example, HP-UX 11i declares gettimeofday. */ #define strstr innocuous_strstr /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strstr (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef strstr /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strstr (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_strstr) || defined (__stub___strstr) choke me #else char (*f) () = strstr; #endif #ifdef __cplusplus } #endif int main () { return f != strstr; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_strstr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_strstr=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_strstr" >&5 echo "${ECHO_T}$ac_cv_func_strstr" >&6 if test $ac_cv_func_strstr = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRSTR 1 _ACEOF else LIBEXTRAOBJ="$LIBEXTRAOBJ strstr.o" EXTRAOBJ="$EXTRAOBJ lib/strstr.o" fi echo "$as_me:$LINENO: checking for strcasecmp" >&5 echo $ECHO_N "checking for strcasecmp... $ECHO_C" >&6 if test "${ac_cv_func_strcasecmp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define strcasecmp to an innocuous variant, in case declares strcasecmp. For example, HP-UX 11i declares gettimeofday. */ #define strcasecmp innocuous_strcasecmp /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strcasecmp (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef strcasecmp /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strcasecmp (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_strcasecmp) || defined (__stub___strcasecmp) choke me #else char (*f) () = strcasecmp; #endif #ifdef __cplusplus } #endif int main () { return f != strcasecmp; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_strcasecmp=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_strcasecmp=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_strcasecmp" >&5 echo "${ECHO_T}$ac_cv_func_strcasecmp" >&6 if test $ac_cv_func_strcasecmp = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRCASECMP 1 _ACEOF else LIBEXTRAOBJ="$LIBEXTRAOBJ strcasecmp.o" EXTRAOBJ="$EXTRAOBJ lib/strcasecmp.o" fi echo "$as_me:$LINENO: checking for memmove" >&5 echo $ECHO_N "checking for memmove... $ECHO_C" >&6 if test "${ac_cv_func_memmove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define memmove to an innocuous variant, in case declares memmove. For example, HP-UX 11i declares gettimeofday. */ #define memmove innocuous_memmove /* System header to define __stub macros and hopefully few prototypes, which can conflict with char memmove (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef memmove /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char memmove (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_memmove) || defined (__stub___memmove) choke me #else char (*f) () = memmove; #endif #ifdef __cplusplus } #endif int main () { return f != memmove; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_memmove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_memmove=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_memmove" >&5 echo "${ECHO_T}$ac_cv_func_memmove" >&6 if test $ac_cv_func_memmove = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_MEMMOVE 1 _ACEOF else LIBEXTRAOBJ="$LIBEXTRAOBJ memmove.o" EXTRAOBJ="$EXTRAOBJ lib/memmove.o" fi echo "$as_me:$LINENO: checking for getopt_long" >&5 echo $ECHO_N "checking for getopt_long... $ECHO_C" >&6 if test "${ac_cv_func_getopt_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define getopt_long to an innocuous variant, in case declares getopt_long. For example, HP-UX 11i declares gettimeofday. */ #define getopt_long innocuous_getopt_long /* System header to define __stub macros and hopefully few prototypes, which can conflict with char getopt_long (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef getopt_long /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getopt_long (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_getopt_long) || defined (__stub___getopt_long) choke me #else char (*f) () = getopt_long; #endif #ifdef __cplusplus } #endif int main () { return f != getopt_long; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_getopt_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_getopt_long=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_getopt_long" >&5 echo "${ECHO_T}$ac_cv_func_getopt_long" >&6 if test $ac_cv_func_getopt_long = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETOPTLONG 1 _ACEOF else LIBEXTRAOBJ="$LIBEXTRAOBJ getopt.o getopt1.o" EXTRAOBJ="$EXTRAOBJ lib/getopt.o lib/getopt1.o" fi echo "$as_me:$LINENO: checking for inet_pton" >&5 echo $ECHO_N "checking for inet_pton... $ECHO_C" >&6 if test "${ac_cv_func_inet_pton+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define inet_pton to an innocuous variant, in case declares inet_pton. For example, HP-UX 11i declares gettimeofday. */ #define inet_pton innocuous_inet_pton /* System header to define __stub macros and hopefully few prototypes, which can conflict with char inet_pton (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef inet_pton /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char inet_pton (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_inet_pton) || defined (__stub___inet_pton) choke me #else char (*f) () = inet_pton; #endif #ifdef __cplusplus } #endif int main () { return f != inet_pton; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_inet_pton=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_inet_pton=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_inet_pton" >&5 echo "${ECHO_T}$ac_cv_func_inet_pton" >&6 if test $ac_cv_func_inet_pton = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_INETPTON 1 _ACEOF else LIBEXTRAOBJ="$LIBEXTRAOBJ inet_pton.o" EXTRAOBJ="$EXTRAOBJ lib/inet_pton.o" fi echo "$as_me:$LINENO: checking for localtime_r" >&5 echo $ECHO_N "checking for localtime_r... $ECHO_C" >&6 if test "${ac_cv_func_localtime_r+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define localtime_r to an innocuous variant, in case declares localtime_r. For example, HP-UX 11i declares gettimeofday. */ #define localtime_r innocuous_localtime_r /* System header to define __stub macros and hopefully few prototypes, which can conflict with char localtime_r (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef localtime_r /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char localtime_r (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_localtime_r) || defined (__stub___localtime_r) choke me #else char (*f) () = localtime_r; #endif #ifdef __cplusplus } #endif int main () { return f != localtime_r; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_localtime_r=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_localtime_r=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_localtime_r" >&5 echo "${ECHO_T}$ac_cv_func_localtime_r" >&6 if test $ac_cv_func_localtime_r = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LOCALTIME_R 1 _ACEOF else LIBEXTRAOBJ="$LIBEXTRAOBJ localtime_r.o" EXTRAOBJ="$EXTRAOBJ lib/localtime_r.o" fi echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in arpa/inet.h ctype.h errno.h fcntl.h \ limits.h netdb.h netinet/in.h pwd.h signal.h \ stdarg.h stdio.h stdlib.h string.h strings.h sys/ioctl.h \ sys/socket.h sys/types.h syslog.h termios.h \ unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else { echo "$as_me:$LINENO: WARNING: at least 1 header file is missing. This may not compile." >&5 echo "$as_me: WARNING: at least 1 header file is missing. This may not compile." >&2;} fi done for ac_header in arpa/nameser.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_NAMESER_H 1 _ACEOF fi done echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6 if test "${ac_cv_header_stat_broken+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if defined(S_ISBLK) && defined(S_IFDIR) # if S_ISBLK (S_IFDIR) You lose. # endif #endif #if defined(S_ISBLK) && defined(S_IFCHR) # if S_ISBLK (S_IFCHR) You lose. # endif #endif #if defined(S_ISLNK) && defined(S_IFREG) # if S_ISLNK (S_IFREG) You lose. # endif #endif #if defined(S_ISSOCK) && defined(S_IFREG) # if S_ISSOCK (S_IFREG) You lose. # endif #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "You lose" >/dev/null 2>&1; then ac_cv_header_stat_broken=yes else ac_cv_header_stat_broken=no fi rm -f conftest* fi echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5 echo "${ECHO_T}$ac_cv_header_stat_broken" >&6 if test $ac_cv_header_stat_broken = yes; then cat >>confdefs.h <<\_ACEOF #define STAT_MACROS_BROKEN 1 _ACEOF fi echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_sys_wait_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 if test $ac_cv_header_sys_wait_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_WAIT_H 1 _ACEOF fi echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm *tp; tp->tm_sec; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking for struct tm.tm_zone" >&5 echo $ECHO_N "checking for struct tm.tm_zone... $ECHO_C" >&6 if test "${ac_cv_member_struct_tm_tm_zone+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_cv_struct_tm> int main () { static struct tm ac_aggr; if (ac_aggr.tm_zone) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_member_struct_tm_tm_zone=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_cv_struct_tm> int main () { static struct tm ac_aggr; if (sizeof ac_aggr.tm_zone) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_member_struct_tm_tm_zone=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_tm_tm_zone=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_zone" >&5 echo "${ECHO_T}$ac_cv_member_struct_tm_tm_zone" >&6 if test $ac_cv_member_struct_tm_tm_zone = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 _ACEOF fi if test "$ac_cv_member_struct_tm_tm_zone" = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_TM_ZONE 1 _ACEOF else echo "$as_me:$LINENO: checking for tzname" >&5 echo $ECHO_N "checking for tzname... $ECHO_C" >&6 if test "${ac_cv_var_tzname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifndef tzname /* For SGI. */ extern char *tzname[]; /* RS6000 and others reject char **tzname. */ #endif int main () { atoi(*tzname); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_var_tzname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_var_tzname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_var_tzname" >&5 echo "${ECHO_T}$ac_cv_var_tzname" >&6 if test $ac_cv_var_tzname = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_TZNAME 1 _ACEOF fi fi echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6 if test "${ac_cv_type_uid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 echo "${ECHO_T}$ac_cv_type_uid_t" >&6 if test $ac_cv_type_uid_t = no; then cat >>confdefs.h <<\_ACEOF #define uid_t int _ACEOF cat >>confdefs.h <<\_ACEOF #define gid_t int _ACEOF fi echo "$as_me:$LINENO: checking type of array argument to getgroups" >&5 echo $ECHO_N "checking type of array argument to getgroups... $ECHO_C" >&6 if test "${ac_cv_type_getgroups+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_type_getgroups=cross else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Thanks to Mike Rendell for this test. */ #include #define NGID 256 #undef MAX #define MAX(x, y) ((x) > (y) ? (x) : (y)) int main () { gid_t gidset[NGID]; int i, n; union { gid_t gval; long lval; } val; val.lval = -1; for (i = 0; i < NGID; i++) gidset[i] = val.gval; n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1, gidset); /* Exit non-zero if getgroups seems to require an array of ints. This happens when gid_t is short but getgroups modifies an array of ints. */ exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_getgroups=gid_t else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_type_getgroups=int fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_type_getgroups = cross; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "getgroups.*int.*gid_t" >/dev/null 2>&1; then ac_cv_type_getgroups=gid_t else ac_cv_type_getgroups=int fi rm -f conftest* fi fi echo "$as_me:$LINENO: result: $ac_cv_type_getgroups" >&5 echo "${ECHO_T}$ac_cv_type_getgroups" >&6 cat >>confdefs.h <<_ACEOF #define GETGROUPS_T $ac_cv_type_getgroups _ACEOF echo "$as_me:$LINENO: checking for mode_t" >&5 echo $ECHO_N "checking for mode_t... $ECHO_C" >&6 if test "${ac_cv_type_mode_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((mode_t *) 0) return 0; if (sizeof (mode_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_mode_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_mode_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5 echo "${ECHO_T}$ac_cv_type_mode_t" >&6 if test $ac_cv_type_mode_t = yes; then : else cat >>confdefs.h <<_ACEOF #define mode_t int _ACEOF fi echo "$as_me:$LINENO: checking for off_t" >&5 echo $ECHO_N "checking for off_t... $ECHO_C" >&6 if test "${ac_cv_type_off_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((off_t *) 0) return 0; if (sizeof (off_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_off_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 echo "${ECHO_T}$ac_cv_type_off_t" >&6 if test $ac_cv_type_off_t = yes; then : else cat >>confdefs.h <<_ACEOF #define off_t long _ACEOF fi echo "$as_me:$LINENO: checking for pid_t" >&5 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 if test "${ac_cv_type_pid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((pid_t *) 0) return 0; if (sizeof (pid_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_pid_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_pid_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 echo "${ECHO_T}$ac_cv_type_pid_t" >&6 if test $ac_cv_type_pid_t = yes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi echo "$as_me:$LINENO: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifdef signal # undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=int fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF echo "$as_me:$LINENO: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6 if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((size_t *) 0) return 0; if (sizeof (size_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6 if test $ac_cv_type_size_t = yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned _ACEOF fi echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6 if test "${ac_cv_type_uid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 echo "${ECHO_T}$ac_cv_type_uid_t" >&6 if test $ac_cv_type_uid_t = no; then cat >>confdefs.h <<\_ACEOF #define uid_t int _ACEOF cat >>confdefs.h <<\_ACEOF #define gid_t int _ACEOF fi echo "$as_me:$LINENO: checking for socklen_t" >&5 echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include socklen_t x; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int accept (int, struct sockaddr *, size_t *); int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: size_t" >&5 echo "${ECHO_T}size_t" >&6 cat >>confdefs.h <<\_ACEOF #define socklen_t size_t _ACEOF else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: int" >&5 echo "${ECHO_T}int" >&6 cat >>confdefs.h <<\_ACEOF #define socklen_t int _ACEOF fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: checking for int32_t" >&5 echo $ECHO_N "checking for int32_t... $ECHO_C" >&6 if test "${ac_cv_type_int32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((int32_t *) 0) return 0; if (sizeof (int32_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_int32_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int32_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 echo "${ECHO_T}$ac_cv_type_int32_t" >&6 if test $ac_cv_type_int32_t = yes; then : else cat >>confdefs.h <<_ACEOF #define int32_t int _ACEOF fi echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" fi; # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -fr conftest.dir if mkdir conftest.dir; then cd conftest.dir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'_ACEOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' _ACEOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -fr conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XrmInitialize () ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/libXt.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. cat >>confdefs.h <<\_ACEOF #define X_DISPLAY_MISSING 1 _ACEOF X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case `(uname -sr) 2>/dev/null` in "SunOS 5"*) echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5 echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_nospace=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_nospace=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_R_nospace = yes; then echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_space=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_space=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_R_space = yes; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 X_LIBS="$X_LIBS -R $x_libraries" else echo "$as_me:$LINENO: result: neither works" >&5 echo "${ECHO_T}neither works" >&6 fi fi LIBS=$ac_xsave_LIBS esac fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn Johnson says this is needed for Ultrix, if the X # libraries were built with DECnet support. And Karl Berry says # the Alpha needs dnet_stub (dnet does not exist). ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XOpenDisplay (); int main () { XOpenDisplay (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_dnet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_stub_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. echo "$as_me:$LINENO: checking for gethostbyname" >&5 echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define gethostbyname to an innocuous variant, in case declares gethostbyname. For example, HP-UX 11i declares gettimeofday. */ #define gethostbyname innocuous_gethostbyname /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef gethostbyname /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) choke me #else char (*f) () = gethostbyname; #endif #ifdef __cplusplus } #endif int main () { return f != gethostbyname; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 if test $ac_cv_func_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 if test $ac_cv_lib_nsl_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5 echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 if test $ac_cv_lib_bsd_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says Simon Leinen: it contains gethostby* # variants that don't use the name server (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. echo "$as_me:$LINENO: checking for connect" >&5 echo $ECHO_N "checking for connect... $ECHO_C" >&6 if test "${ac_cv_func_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define connect to an innocuous variant, in case declares connect. For example, HP-UX 11i declares gettimeofday. */ #define connect innocuous_connect /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef connect /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_connect) || defined (__stub___connect) choke me #else char (*f) () = connect; #endif #ifdef __cplusplus } #endif int main () { return f != connect; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6 if test $ac_cv_func_connect = no; then echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); int main () { connect (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 if test $ac_cv_lib_socket_connect = yes; then X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi # Guillermo Gomez says -lposix is necessary on A/UX. echo "$as_me:$LINENO: checking for remove" >&5 echo $ECHO_N "checking for remove... $ECHO_C" >&6 if test "${ac_cv_func_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define remove to an innocuous variant, in case declares remove. For example, HP-UX 11i declares gettimeofday. */ #define remove innocuous_remove /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef remove /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_remove) || defined (__stub___remove) choke me #else char (*f) () = remove; #endif #ifdef __cplusplus } #endif int main () { return f != remove; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_remove=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5 echo "${ECHO_T}$ac_cv_func_remove" >&6 if test $ac_cv_func_remove = no; then echo "$as_me:$LINENO: checking for remove in -lposix" >&5 echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 if test "${ac_cv_lib_posix_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); int main () { remove (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_posix_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_posix_remove=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5 echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 if test $ac_cv_lib_posix_remove = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo "$as_me:$LINENO: checking for shmat" >&5 echo $ECHO_N "checking for shmat... $ECHO_C" >&6 if test "${ac_cv_func_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shmat to an innocuous variant, in case declares shmat. For example, HP-UX 11i declares gettimeofday. */ #define shmat innocuous_shmat /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shmat /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shmat) || defined (__stub___shmat) choke me #else char (*f) () = shmat; #endif #ifdef __cplusplus } #endif int main () { return f != shmat; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shmat=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5 echo "${ECHO_T}$ac_cv_func_shmat" >&6 if test $ac_cv_func_shmat = no; then echo "$as_me:$LINENO: checking for shmat in -lipc" >&5 echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 if test "${ac_cv_lib_ipc_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); int main () { shmat (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ipc_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ipc_shmat=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5 echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 if test $ac_cv_lib_ipc_shmat = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS=$LDFLAGS test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char IceConnectionNumber (); int main () { IceConnectionNumber (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ICE_IceConnectionNumber=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi LDFLAGS=$ac_save_LDFLAGS fi echo "$as_me:$LINENO: checking whether #! works in shell scripts" >&5 echo $ECHO_N "checking whether #! works in shell scripts... $ECHO_C" >&6 if test "${ac_cv_sys_interpreter+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo '#! /bin/cat exit 69 ' >conftest chmod u+x conftest (SHELL=/bin/sh; export SHELL; ./conftest >/dev/null) if test $? -ne 69; then ac_cv_sys_interpreter=yes else ac_cv_sys_interpreter=no fi rm -f conftest fi echo "$as_me:$LINENO: result: $ac_cv_sys_interpreter" >&5 echo "${ECHO_T}$ac_cv_sys_interpreter" >&6 interpval=$ac_cv_sys_interpreter cat >>confdefs.h <<_ACEOF #define EXEEXT "$EXEEXT" _ACEOF case $host in *-*-sunos*) cat >>confdefs.h <<\_ACEOF #define HAVE_SUN_OS 1 _ACEOF ;; *-*-solaris*) cat >>confdefs.h <<\_ACEOF #define HAVE_SUN_OS 1 _ACEOF ;; *-*-osf*) cat >>confdefs.h <<\_ACEOF #define HAVE_OSF1_OS 1 _ACEOF ;; *-*-aix*) cat >>confdefs.h <<\_ACEOF #define HAVE_AIX_OS 1 _ACEOF ;; *-*-hpux*) cat >>confdefs.h <<\_ACEOF #define HAVE_HPUX_OS 1 _ACEOF ;; *-*-linux*) cat >>confdefs.h <<\_ACEOF #define HAVE_LINUX_OS 1 _ACEOF ;; *-*-freebsd*) cat >>confdefs.h <<\_ACEOF #define HAVE_FREEBSD_OS 1 _ACEOF ;; *-*-netbsd*) cat >>confdefs.h <<\_ACEOF #define HAVE_NETBSD_OS 1 _ACEOF ;; *-*-openbsd*) cat >>confdefs.h <<\_ACEOF #define HAVE_OPENBSD_OS 1 _ACEOF ;; *-*-bsdi*) cat >>confdefs.h <<\_ACEOF #define HAVE_BSDI_OS 1 _ACEOF ;; *-*-irix*) cat >>confdefs.h <<\_ACEOF #define HAVE_SGI_OS 1 _ACEOF ;; *-*-darwin*) cat >>confdefs.h <<\_ACEOF #define HAVE_DARWIN_OS 1 _ACEOF ;; *-*-nto*) cat >>confdefs.h <<\_ACEOF #define HAVE_QNX_OS 1 _ACEOF ;; esac # Check whether --enable-all or --disable-all was given. if test "${enable_all+set}" = set; then enableval="$enable_all" if test "$enableval" = "yes" ; then enable_usb=yes enable_net=yes enable_snmp=yes enable_net_snmp=yes enable_test=yes enable_pcnet=yes enable_cgi=yes enable_gapcmon=yes fi fi; case $host in *-*-linux*) HALPOLICYDIR="/usr/share/hal/fdi/policy/20thirdparty" ;; *) HALPOLICYDIR="" ;; esac # Check whether --with-halpolicydir or --without-halpolicydir was given. if test "${with_halpolicydir+set}" = set; then withval="$with_halpolicydir" HALPOLICYDIR=$withval fi; if test "x$HALPOLICYDIR" != "x" ; then echo "$as_me:$LINENO: result: Using halpolicydir=$HALPOLICYDIR" >&5 echo "${ECHO_T}Using halpolicydir=$HALPOLICYDIR" >&6 else echo "$as_me:$LINENO: result: Will not install HAL policy file" >&5 echo "${ECHO_T}Will not install HAL policy file" >&6 fi #-------------------------------------------------------------------- # Check for TCP wrapper support, code taken from Bacula KES-7Nov03 #-------------------------------------------------------------------- # Check whether --with-libwrap or --without-libwrap was given. if test "${with_libwrap+set}" = set; then withval="$with_libwrap" if test "x$withval" != "xno" ; then saved_LIBS="$LIBS" LIBS="$saved_LIBS -lwrap" echo "$as_me:$LINENO: checking for libwrap" >&5 echo $ECHO_N "checking for libwrap... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int deny_severity = 0; int allow_severity = 0; struct request_info *req; int main () { hosts_access(req); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define HAVE_LIBWRAP 1 _ACEOF TCPW_MSG="yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS="$saved_LIBS -lwrap -lnsl" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int deny_severity = 0; int allow_severity = 0; struct request_info *req; int main () { hosts_access(req); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define HAVE_LIBWRAP 1 _ACEOF TCPW_MSG="yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: *** libwrap missing" >&5 echo "$as_me: error: *** libwrap missing" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi fi; ENABLE_CGI="no" CGI= GD_LIBS= SYS_GD_FOUND=no # Check whether --enable-cgi or --disable-cgi was given. if test "${enable_cgi+set}" = set; then enableval="$enable_cgi" if test "$enableval" = "yes" then ENABLE_CGI="yes" CGI=cgi echo "$as_me:$LINENO: checking for gdImagePng in -lgd" >&5 echo $ECHO_N "checking for gdImagePng in -lgd... $ECHO_C" >&6 if test "${ac_cv_lib_gd_gdImagePng+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgd ${X_LIBS} $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gdImagePng (); int main () { gdImagePng (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_gd_gdImagePng=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_gd_gdImagePng=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_gd_gdImagePng" >&5 echo "${ECHO_T}$ac_cv_lib_gd_gdImagePng" >&6 if test $ac_cv_lib_gd_gdImagePng = yes; then echo "$as_me:$LINENO: result: using PNG file format (/usr/lib)." >&5 echo "${ECHO_T}using PNG file format (/usr/lib)." >&6 cat >>confdefs.h <<\_ACEOF #define SYS_IMGFMT_PNG 1 _ACEOF GD_LIBS="-lgd" SYS_GD_FOUND=yes fi if test "${SYS_GD_FOUND}" = "no" then echo "$as_me:$LINENO: checking for gdImageGif in -lgd" >&5 echo $ECHO_N "checking for gdImageGif in -lgd... $ECHO_C" >&6 if test "${ac_cv_lib_gd_gdImageGif+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgd ${X_LIBS} $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gdImageGif (); int main () { gdImageGif (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_gd_gdImageGif=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_gd_gdImageGif=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_gd_gdImageGif" >&5 echo "${ECHO_T}$ac_cv_lib_gd_gdImageGif" >&6 if test $ac_cv_lib_gd_gdImageGif = yes; then echo "$as_me:$LINENO: result: using GIF file format (/usr/lib)." >&5 echo "${ECHO_T}using GIF file format (/usr/lib)." >&6 cat >>confdefs.h <<\_ACEOF #define SYS_IMGFMT_GIF 1 _ACEOF GD_LIBS="-lgd" SYS_GD_FOUND=yes fi fi if test "${SYS_GD_FOUND}" = "no" then CPPFLAGS="${CPPFLAGS} -I/usr/local/include" LDFLAGS="${LDFLAGS} -L/usr/local/lib" unset ac_cv_lib_gd_gdImagePng echo "$as_me:$LINENO: checking for gdImagePng in -lgd" >&5 echo $ECHO_N "checking for gdImagePng in -lgd... $ECHO_C" >&6 if test "${ac_cv_lib_gd_gdImagePng+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgd ${X_LIBS} $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gdImagePng (); int main () { gdImagePng (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_gd_gdImagePng=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_gd_gdImagePng=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_gd_gdImagePng" >&5 echo "${ECHO_T}$ac_cv_lib_gd_gdImagePng" >&6 if test $ac_cv_lib_gd_gdImagePng = yes; then echo "$as_me:$LINENO: result: using PNG file format (/usr/local/lib)." >&5 echo "${ECHO_T}using PNG file format (/usr/local/lib)." >&6 cat >>confdefs.h <<\_ACEOF #define SYS_IMGFMT_PNG 1 _ACEOF GD_LIBS="-lgd" SYS_GD_FOUND=yes fi fi if test "${SYS_GD_FOUND}" = "no" then unset ac_cv_lib_gd_gdImageGif echo "$as_me:$LINENO: checking for gdImageGif in -lgd" >&5 echo $ECHO_N "checking for gdImageGif in -lgd... $ECHO_C" >&6 if test "${ac_cv_lib_gd_gdImageGif+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgd ${X_LIBS} $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gdImageGif (); int main () { gdImageGif (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_gd_gdImageGif=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_gd_gdImageGif=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_gd_gdImageGif" >&5 echo "${ECHO_T}$ac_cv_lib_gd_gdImageGif" >&6 if test $ac_cv_lib_gd_gdImageGif = yes; then echo "$as_me:$LINENO: result: using GIF file format (/usr/local/lib)." >&5 echo "${ECHO_T}using GIF file format (/usr/local/lib)." >&6 cat >>confdefs.h <<\_ACEOF #define SYS_IMGFMT_GIF 1 _ACEOF GD_LIBS="-lgd" SYS_GD_FOUND=yes fi fi if test "${SYS_GD_FOUND}" = "no" then { { echo "$as_me:$LINENO: error: Your system lacks the GD library which is needed for compiling the apcupsd CGI programs. Please install libgd and re-run the ./configure script. Alternatively you can disable the CGI support." >&5 echo "$as_me: error: Your system lacks the GD library which is needed for compiling the apcupsd CGI programs. Please install libgd and re-run the ./configure script. Alternatively you can disable the CGI support." >&2;} { (exit 1); exit 1; }; } fi if test "${ac_cv_header_gd_h+set}" = set; then echo "$as_me:$LINENO: checking for gd.h" >&5 echo $ECHO_N "checking for gd.h... $ECHO_C" >&6 if test "${ac_cv_header_gd_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_gd_h" >&5 echo "${ECHO_T}$ac_cv_header_gd_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking gd.h usability" >&5 echo $ECHO_N "checking gd.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking gd.h presence" >&5 echo $ECHO_N "checking gd.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: gd.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: gd.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: gd.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: gd.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: gd.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: gd.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: gd.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: gd.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: gd.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: gd.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: gd.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: gd.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: gd.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: gd.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: gd.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: gd.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for gd.h" >&5 echo $ECHO_N "checking for gd.h... $ECHO_C" >&6 if test "${ac_cv_header_gd_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_gd_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_gd_h" >&5 echo "${ECHO_T}$ac_cv_header_gd_h" >&6 fi if test $ac_cv_header_gd_h = yes; then GDHEAD= else if test "${ac_cv_header_gd_gd_h+set}" = set; then echo "$as_me:$LINENO: checking for gd/gd.h" >&5 echo $ECHO_N "checking for gd/gd.h... $ECHO_C" >&6 if test "${ac_cv_header_gd_gd_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_gd_gd_h" >&5 echo "${ECHO_T}$ac_cv_header_gd_gd_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking gd/gd.h usability" >&5 echo $ECHO_N "checking gd/gd.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking gd/gd.h presence" >&5 echo $ECHO_N "checking gd/gd.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: gd/gd.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: gd/gd.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: gd/gd.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: gd/gd.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: gd/gd.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: gd/gd.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: gd/gd.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: gd/gd.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: gd/gd.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: gd/gd.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: gd/gd.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: gd/gd.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: gd/gd.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: gd/gd.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: gd/gd.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: gd/gd.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for gd/gd.h" >&5 echo $ECHO_N "checking for gd/gd.h... $ECHO_C" >&6 if test "${ac_cv_header_gd_gd_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_gd_gd_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_gd_gd_h" >&5 echo "${ECHO_T}$ac_cv_header_gd_gd_h" >&6 fi if test $ac_cv_header_gd_gd_h = yes; then GDHEAD="gd/" else if test "${ac_cv_header_gd2_gd_h+set}" = set; then echo "$as_me:$LINENO: checking for gd2/gd.h" >&5 echo $ECHO_N "checking for gd2/gd.h... $ECHO_C" >&6 if test "${ac_cv_header_gd2_gd_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_gd2_gd_h" >&5 echo "${ECHO_T}$ac_cv_header_gd2_gd_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking gd2/gd.h usability" >&5 echo $ECHO_N "checking gd2/gd.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking gd2/gd.h presence" >&5 echo $ECHO_N "checking gd2/gd.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: gd2/gd.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: gd2/gd.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: gd2/gd.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: gd2/gd.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: gd2/gd.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: gd2/gd.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: gd2/gd.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: gd2/gd.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: gd2/gd.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: gd2/gd.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: gd2/gd.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: gd2/gd.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: gd2/gd.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: gd2/gd.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: gd2/gd.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: gd2/gd.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for gd2/gd.h" >&5 echo $ECHO_N "checking for gd2/gd.h... $ECHO_C" >&6 if test "${ac_cv_header_gd2_gd_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_gd2_gd_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_gd2_gd_h" >&5 echo "${ECHO_T}$ac_cv_header_gd2_gd_h" >&6 fi if test $ac_cv_header_gd2_gd_h = yes; then GDHEAD="gd2/" else { { echo "$as_me:$LINENO: error: Found system GD library but no header file. Please find the file gd.h in your system include directories and report its location to apcupsd-users@lists.sourceforge.net" >&5 echo "$as_me: error: Found system GD library but no header file. Please find the file gd.h in your system include directories and report its location to apcupsd-users@lists.sourceforge.net" >&2;} { (exit 1); exit 1; }; } fi fi fi fi fi; # Check whether --enable-apcsmart or --disable-apcsmart was given. if test "${enable_apcsmart+set}" = set; then enableval="$enable_apcsmart" if test "$enableval" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_APCSMART_DRIVER 1 _ACEOF APCSMART_DRIVER="apcsmart" fi else cat >>confdefs.h <<\_ACEOF #define HAVE_APCSMART_DRIVER 1 _ACEOF APCSMART_DRIVER="apcsmart" fi; # Check whether --enable-dumb or --disable-dumb was given. if test "${enable_dumb+set}" = set; then enableval="$enable_dumb" if test "$enableval" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_DUMB_DRIVER 1 _ACEOF DUMB_DRIVER="dumb" fi else cat >>confdefs.h <<\_ACEOF #define HAVE_DUMB_DRIVER 1 _ACEOF DUMB_DRIVER="dumb" fi; GENERICUSB="no" # Check whether --with-generic-usb or --without-generic-usb was given. if test "${with_generic_usb+set}" = set; then withval="$with_generic_usb" GENERICUSB="yes" fi; # Check whether --enable-usb or --disable-usb was given. if test "${enable_usb+set}" = set; then enableval="$enable_usb" if test "$enableval" = "yes" ; then if test $GENERICUSB = "yes" ; then usbhost=forcegeneric else usbhost=$host fi case $usbhost in *-*-freebsd*) tmp=`uname -r` if test ${tmp%%.*} -ge 8 ; then usbhost=forcegeneric fi ;; esac case $usbhost in *-*-linux*) USB_TYPE="linux" echo "$as_me:$LINENO: result: Using Linux USB driver." >&5 echo "${ECHO_T}Using Linux USB driver." >&6 ;; *-*-freebsd* | *-*-openbsd* | *-*-netbsd*) LIBUSBHIDINC="-I\$(topdir)/src/libusbhid" LIBUSBHID=libusbhid APCDRVLIBS="$APCDRVLIBS \$(topdir)/src/libusbhid/libusbhid.a" USB_TYPE="bsd" echo "$as_me:$LINENO: result: Using BSD USB driver." >&5 echo "${ECHO_T}Using BSD USB driver." >&6 ;; *) # Extract the first word of "libusb-config", so it can be a program name with args. set dummy libusb-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_usbcfg+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $usbcfg in [\\/]* | ?:[\\/]*) ac_cv_path_usbcfg="$usbcfg" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_usbcfg="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi usbcfg=$ac_cv_path_usbcfg if test -n "$usbcfg"; then echo "$as_me:$LINENO: result: $usbcfg" >&5 echo "${ECHO_T}$usbcfg" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x$usbcfg != x ; then LIBUSB=`$usbcfg --libs` LIBUSBH=`$usbcfg --prefix`/include/usb.h else echo "$as_me:$LINENO: checking for usb_init in -lusb" >&5 echo $ECHO_N "checking for usb_init in -lusb... $ECHO_C" >&6 if test "${ac_cv_lib_usb_usb_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lusb $DRVLIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char usb_init (); int main () { usb_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_usb_usb_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_usb_usb_init=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_usb_usb_init" >&5 echo "${ECHO_T}$ac_cv_lib_usb_usb_init" >&6 if test $ac_cv_lib_usb_usb_init = yes; then LIBUSB=-lusb LIBUSBH=usb.h else { { echo "$as_me:$LINENO: error: Unable to find libusb" >&5 echo "$as_me: error: Unable to find libusb" >&2;} { (exit 1); exit 1; }; } fi fi LIBUSBHIDINC="-I\$(topdir)/src/libusbhid" LIBUSBHID=libusbhid DRVLIBS="$DRVLIBS $LIBUSB" APCDRVLIBS="$APCDRVLIBS \$(topdir)/src/libusbhid/libusbhid.a" USB_TYPE="generic" echo "$as_me:$LINENO: result: Using generic libusb USB driver." >&5 echo "${ECHO_T}Using generic libusb USB driver." >&6 ;; esac cat >>confdefs.h <<\_ACEOF #define HAVE_USB_DRIVER 1 _ACEOF USB_DRIVER="usb" DISPLAY_USB_DRIVER=$USB_TYPE-$USB_DRIVER fi fi; # Check whether --enable-net or --disable-net was given. if test "${enable_net+set}" = set; then enableval="$enable_net" if test "$enableval" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_NET_DRIVER 1 _ACEOF NET_DRIVER="net" fi else cat >>confdefs.h <<\_ACEOF #define HAVE_NET_DRIVER 1 _ACEOF NET_DRIVER="net" fi; # Check whether --enable-snmp or --disable-snmp was given. if test "${enable_snmp+set}" = set; then enableval="$enable_snmp" if test "$enableval" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_SNMPLITE_DRIVER 1 _ACEOF SNMPLITE_DRIVER="snmplite" DISPLAY_SNMP_DRIVER="snmp" fi else cat >>confdefs.h <<\_ACEOF #define HAVE_SNMPLITE_DRIVER 1 _ACEOF SNMPLITE_DRIVER="snmplite" DISPLAY_SNMP_DRIVER="snmp" fi; # Check whether --enable-net-snmp or --disable-net-snmp was given. if test "${enable_net_snmp+set}" = set; then enableval="$enable_net_snmp" if test "$enableval" = "yes" ; then echo "$as_me:$LINENO: checking for EVP_DigestInit in -lcrypto" >&5 echo $ECHO_N "checking for EVP_DigestInit in -lcrypto... $ECHO_C" >&6 if test "${ac_cv_lib_crypto_EVP_DigestInit+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char EVP_DigestInit (); int main () { EVP_DigestInit (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_crypto_EVP_DigestInit=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_crypto_EVP_DigestInit=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_EVP_DigestInit" >&5 echo "${ECHO_T}$ac_cv_lib_crypto_EVP_DigestInit" >&6 if test $ac_cv_lib_crypto_EVP_DigestInit = yes; then echo ' including crypto library for snmp.' DRVLIBS="$DRVLIBS -lcrypto" fi SNMP_LIB_FOUND="no" CPPFLAGS="${CPPFLAGS} -I/usr/local/include" LDFLAGS="${LDFLAGS} -L/usr/local/lib" if test "$SNMP_LIB_FOUND" = "no" ; then echo "$as_me:$LINENO: checking for snmp_open in -lnetsnmp" >&5 echo $ECHO_N "checking for snmp_open in -lnetsnmp... $ECHO_C" >&6 if test "${ac_cv_lib_netsnmp_snmp_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnetsnmp $DRVLIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char snmp_open (); int main () { snmp_open (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_netsnmp_snmp_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_netsnmp_snmp_open=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_netsnmp_snmp_open" >&5 echo "${ECHO_T}$ac_cv_lib_netsnmp_snmp_open" >&6 if test $ac_cv_lib_netsnmp_snmp_open = yes; then DRVLIBS="$DRVLIBS -lnetsnmp" cat >>confdefs.h <<\_ACEOF #define HAVE_NET_SNMP 1 _ACEOF SNMP_LIB_FOUND="yes" fi fi if test "$SNMP_LIB_FOUND" = "no" ; then echo "$as_me:$LINENO: checking for snmp_open in -lsnmp" >&5 echo $ECHO_N "checking for snmp_open in -lsnmp... $ECHO_C" >&6 if test "${ac_cv_lib_snmp_snmp_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsnmp $DRVLIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char snmp_open (); int main () { snmp_open (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_snmp_snmp_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_snmp_snmp_open=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_snmp_snmp_open" >&5 echo "${ECHO_T}$ac_cv_lib_snmp_snmp_open" >&6 if test $ac_cv_lib_snmp_snmp_open = yes; then DRVLIBS="$DRVLIBS -lsnmp" cat >>confdefs.h <<\_ACEOF #define HAVE_UCD_SNMP 1 _ACEOF SNMP_LIB_FOUND="yes" fi fi if test "$SNMP_LIB_FOUND" = "no" ; then { { echo "$as_me:$LINENO: error: Cannot find SNMP libraries." >&5 echo "$as_me: error: Cannot find SNMP libraries." >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<\_ACEOF #define HAVE_SNMP_DRIVER 1 _ACEOF DISPLAY_NETSNMP_DRIVER="net-snmp" SNMP_DRIVER="snmp" fi fi; # Check whether --enable-test or --disable-test was given. if test "${enable_test+set}" = set; then enableval="$enable_test" if test "$enableval" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_TEST_DRIVER 1 _ACEOF TEST_DRIVER="test" fi fi; # Check whether --enable-pcnet or --disable-pcnet was given. if test "${enable_pcnet+set}" = set; then enableval="$enable_pcnet" if test "$enableval" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_PCNET_DRIVER 1 _ACEOF PCNET_DRIVER="pcnet" fi else cat >>confdefs.h <<\_ACEOF #define HAVE_PCNET_DRIVER 1 _ACEOF PCNET_DRIVER="pcnet" fi; cat >>confdefs.h <<\_ACEOF #define HAVE_NISSERVER 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_NISLIB 1 _ACEOF NISSRV_ENABLED=yes NISIP="0.0.0.0" # Check whether --with-nisip or --without-nisip was given. if test "${with_nisip+set}" = set; then withval="$with_nisip" NISIP="$withval"; fi; CGIBIN="/etc/apcupsd" # Check whether --with-cgi-bin or --without-cgi-bin was given. if test "${with_cgi_bin+set}" = set; then withval="$with_cgi_bin" CGIBIN="$withval"; fi; GAPCMON= GAPCMON_ENABLED=no if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi PKG_CONFIG=$ac_pt_PKG_CONFIG else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 PKG_CONFIG="" fi fi # Check whether --enable-gapcmon or --disable-gapcmon was given. if test "${enable_gapcmon+set}" = set; then enableval="$enable_gapcmon" if test "$enableval" = "yes" ; then GAPCMON=gapcmon GAPCMON_ENABLED=yes pkg_failed=no echo "$as_me:$LINENO: checking for GAPCMON" >&5 echo $ECHO_N "checking for GAPCMON... $ECHO_C" >&6 if test -n "$PKG_CONFIG"; then if test -n "$GAPCMON_CFLAGS"; then pkg_cv_GAPCMON_CFLAGS="$GAPCMON_CFLAGS" else if test -n "$PKG_CONFIG" && \ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0 >= 2.4.0 glib-2.0 gthread-2.0 gconf-2.0\"") >&5 ($PKG_CONFIG --exists --print-errors "gtk+-2.0 >= 2.4.0 glib-2.0 gthread-2.0 gconf-2.0") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then pkg_cv_GAPCMON_CFLAGS=`$PKG_CONFIG --cflags-only-I "gtk+-2.0 >= 2.4.0 glib-2.0 gthread-2.0 gconf-2.0" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then if test -n "$GAPCMON_LIBS"; then pkg_cv_GAPCMON_LIBS="$GAPCMON_LIBS" else if test -n "$PKG_CONFIG" && \ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0 >= 2.4.0 glib-2.0 gthread-2.0 gconf-2.0\"") >&5 ($PKG_CONFIG --exists --print-errors "gtk+-2.0 >= 2.4.0 glib-2.0 gthread-2.0 gconf-2.0") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then pkg_cv_GAPCMON_LIBS=`$PKG_CONFIG --libs "gtk+-2.0 >= 2.4.0 glib-2.0 gthread-2.0 gconf-2.0" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then GAPCMON_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "gtk+-2.0 >= 2.4.0 glib-2.0 gthread-2.0 gconf-2.0"` else GAPCMON_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gtk+-2.0 >= 2.4.0 glib-2.0 gthread-2.0 gconf-2.0"` fi # Put the nasty error message in config.log where it belongs echo "$GAPCMON_PKG_ERRORS" >&5 { { echo "$as_me:$LINENO: error: Package requirements (gtk+-2.0 >= 2.4.0 glib-2.0 gthread-2.0 gconf-2.0) were not met: $GAPCMON_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables GAPCMON_CFLAGS and GAPCMON_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&5 echo "$as_me: error: Package requirements (gtk+-2.0 >= 2.4.0 glib-2.0 gthread-2.0 gconf-2.0) were not met: $GAPCMON_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables GAPCMON_CFLAGS and GAPCMON_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&2;} { (exit 1); exit 1; }; } elif test $pkg_failed = untried; then { { echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables GAPCMON_CFLAGS and GAPCMON_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details." >&5 echo "$as_me: error: The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables GAPCMON_CFLAGS and GAPCMON_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else GAPCMON_CFLAGS=$pkg_cv_GAPCMON_CFLAGS GAPCMON_LIBS=$pkg_cv_GAPCMON_LIBS echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 : fi GAPCMON_CFLAGS="$GAPCMON_CFLAGS -DVERSION=\\\"$VERSION\\\"" fi fi; APCAGENT= APCAGENT_ENABLED=no # Check whether --enable-apcagent or --disable-apcagent was given. if test "${enable_apcagent+set}" = set; then enableval="$enable_apcagent" if test "$enableval" = "yes" ; then case $host in *-*-darwin*) APCAGENT=apcagent APCAGENT_ENABLED=yes ;; *) { { echo "$as_me:$LINENO: error: apcagent can only be built on Mac OS X" >&5 echo "$as_me: error: apcagent can only be built on Mac OS X" >&2;} { (exit 1); exit 1; }; } ;; esac fi else case $host in *-*-darwin*) APCAGENT=apcagent APCAGENT_ENABLED=yes ;; esac fi; ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how many arguments gethostbyname_r() takes" >&5 echo $ECHO_N "checking how many arguments gethostbyname_r() takes... $ECHO_C" >&6 if test "${ac_cv_func_which_gethostbyname_r+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ################################################################ ac_cv_func_which_gethostbyname_r=unknown # # ONE ARGUMENT (sanity check) # # This should fail, as there is no variant of gethostbyname_r() that takes # a single argument. If it actually compiles, then we can assume that # netdb.h is not declaring the function, and the compiler is thereby # assuming an implicit prototype. In which case, we're out of luck. # cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *name = "www.gnu.org"; (void)gethostbyname_r(name) /* ; */ ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_which_gethostbyname_r=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # # SIX ARGUMENTS # (e.g. Linux) # if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *name = "www.gnu.org"; struct hostent ret, *retp; char buf[1024]; int buflen = 1024; int my_h_errno; (void)gethostbyname_r(name, &ret, buf, buflen, &retp, &my_h_errno) /* ; */ ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_which_gethostbyname_r=six else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi # # FIVE ARGUMENTS # (e.g. Solaris) # if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *name = "www.gnu.org"; struct hostent ret; char buf[1024]; int buflen = 1024; int my_h_errno; (void)gethostbyname_r(name, &ret, buf, buflen, &my_h_errno) /* ; */ ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_which_gethostbyname_r=five else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi # # THREE ARGUMENTS # (e.g. AIX, HP-UX, Tru64) # if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *name = "www.gnu.org"; struct hostent ret; struct hostent_data data; (void)gethostbyname_r(name, &ret, &data) /* ; */ ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_which_gethostbyname_r=three else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi ################################################################ fi case "$ac_cv_func_which_gethostbyname_r" in three) echo "$as_me:$LINENO: result: three" >&5 echo "${ECHO_T}three" >&6 cat >>confdefs.h <<\_ACEOF #define HAVE_FUNC_GETHOSTBYNAME_R_3 1 _ACEOF ;; five) echo "$as_me:$LINENO: result: five" >&5 echo "${ECHO_T}five" >&6 cat >>confdefs.h <<\_ACEOF #define HAVE_FUNC_GETHOSTBYNAME_R_5 1 _ACEOF ;; six) echo "$as_me:$LINENO: result: six" >&5 echo "${ECHO_T}six" >&6 cat >>confdefs.h <<\_ACEOF #define HAVE_FUNC_GETHOSTBYNAME_R_6 1 _ACEOF ;; no) echo "$as_me:$LINENO: result: cannot find function declaration in netdb.h" >&5 echo "${ECHO_T}cannot find function declaration in netdb.h" >&6 ;; unknown) echo "$as_me:$LINENO: result: can't tell" >&5 echo "${ECHO_T}can't tell" >&6 ;; *) { { echo "$as_me:$LINENO: error: internal error" >&5 echo "$as_me: error: internal error" >&2;} { (exit 1); exit 1; }; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu case "$ac_cv_func_which_gethostbyname_r" in three) cat >>confdefs.h <<\_ACEOF #define HAVE_FUNC_GETHOSTBYNAME_R_3 1 _ACEOF GAPCMON_CFLAGS="$GAPCMON_CFLAGS -DHAVE_FUNC_GETHOSTBYNAME_R_3" ;; five) cat >>confdefs.h <<\_ACEOF #define HAVE_FUNC_GETHOSTBYNAME_R_5 1 _ACEOF GAPCMON_CFLAGS="$GAPCMON_CFLAGS -DHAVE_FUNC_GETHOSTBYNAME_R_5" ;; six) cat >>confdefs.h <<\_ACEOF #define HAVE_FUNC_GETHOSTBYNAME_R_6 1 _ACEOF GAPCMON_CFLAGS="$GAPCMON_CFLAGS -DHAVE_FUNC_GETHOSTBYNAME_R_6" ;; no) cat >>confdefs.h <<\_ACEOF #define HAVE_FUNC_GETHOSTBYNAME_R_0 1 _ACEOF GAPCMON_CFLAGS="$GAPCMON_CFLAGS -DHAVE_FUNC_GETHOSTBYNAME_R_0" ;; *) { { echo "$as_me:$LINENO: error: gethostbyname_r is required" >&5 echo "$as_me: error: gethostbyname_r is required" >&2;} { (exit 1); exit 1; }; } ;; esac if test -n "$GCC"; then # Starting with GCC 3.0, you must link C++ programs against either # libstdc++ (shared by default), or libsupc++ (always static). If # you care about binary portability between Linux distributions, # you need to either 1) build your own GCC with static C++ libraries # or 2) link using gcc and libsupc++. We choose the latter since # CUPS doesn't (currently) use any of the stdc++ library. # # Previous versions of GCC do not have the reliance on the stdc++ # or g++ libraries, so the extra supc++ library is not needed. echo "$as_me:$LINENO: checking if libsupc++ is required" >&5 echo $ECHO_N "checking if libsupc++ is required... $ECHO_C" >&6 SUPC="`$CXX -print-file-name=libsupc++.a 2>/dev/null`" case "$SUPC" in libsupc++.a*) # Library not found, so this is and older GCC... echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; *) # This is gcc 3.x, and it knows of libsupc++, so we need it LIBS="$LIBS -lsupc++" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 # See if this system has a broken libsupc++ that requires # a workaround (FreeBSD 5.x, 6.x) case $host in *-*-freebsd*) echo "$as_me:$LINENO: checking if libsupc++ is missing __terminate_handler" >&5 echo $ECHO_N "checking if libsupc++ is missing __terminate_handler... $ECHO_C" >&6 nm -C --defined-only "$SUPC" 2>/dev/null | grep __terminate_handler > /dev/null if test $? -eq 0 ; then echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 else echo "$as_me:$LINENO: result: yes -- will attempt workaround" >&5 echo "${ECHO_T}yes -- will attempt workaround" >&6 CPPFLAGS="$CPPFLAGS -DFREEBSD_SUPCPP_FIX" fi ;; esac ;; esac # See if GCC supports -fno-exceptions... echo "$as_me:$LINENO: checking if GCC supports -fno-exceptions" >&5 echo $ECHO_N "checking if GCC supports -fno-exceptions... $ECHO_C" >&6 OLDCXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -fno-exceptions" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 CXXFLAGS="$OLDCXXFLAGS" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # See if GCC supports -fno-rtti... echo "$as_me:$LINENO: checking if GCC supports -fno-rtti" >&5 echo $ECHO_N "checking if GCC supports -fno-rtti... $ECHO_C" >&6 OLDCXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -fno-rtti" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 CXXFLAGS="$OLDCXXFLAGS" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Use -Wall on gcc only CFLAGS="$CFLAGS -Wall" CXXFLAGS="$CXXFLAGS -Wall" fi cat >>confdefs.h <<_ACEOF #define SYSCONFDIR "$sysconfdir" _ACEOF MKINSTALLDIRS= if test -n "$ac_aux_dir"; then MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" fi if test x$MKINSTALLDIRS = x ; then MKINSTALLDIRS="\$(topdir)/autoconf/mkinstalldirs" fi for ac_func in wait waitpid wait3 do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for union wait" >&5 echo $ECHO_N "checking for union wait... $ECHO_C" >&6; cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { union wait status; int pid; pid = wait (&status); #ifdef WEXITSTATUS /* Some POSIXoid systems have both the new-style macros and the old union wait type, and they do not work together. If union wait conflicts with WEXITSTATUS et al, we don't want to use it at all. */ if (WEXITSTATUS (status) != 0) pid = -1; #endif #ifdef HAVE_WAITPID /* Make sure union wait works with waitpid. */ pid = waitpid (-1, &status, 0); #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\_ACEOF #define HAVE_UNION_WAIT 1 _ACEOF echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ENABLE_CGI" = "yes" then for ac_func in snprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else { { echo "$as_me:$LINENO: error: cannot find required function." >&5 echo "$as_me: error: cannot find required function." >&2;} { (exit 1); exit 1; }; } fi done echo 'Enabling cgi program support...' else echo 'Disabling cgi support...' fi # now allow user to specify DISTNAME # Check whether --with-distname or --without-distname was given. if test "${with_distname+set}" = set; then withval="$with_distname" DISTNAME=$withval fi; if test "x$DISTNAME" != "x" then echo "distname set to $DISTNAME" elif test $HAVE_UNAME=yes -a x`uname -s` = xOSF1 then DISTNAME=alpha elif test $HAVE_UNAME=yes -a x`uname -s` = xHP-UX then DISTNAME=hpux elif test $HAVE_UNAME=yes -a x`uname -s` = xSunOS then DISTNAME=sun elif test $HAVE_UNAME=yes -a x`uname -s` = xFreeBSD then DISTNAME=freebsd elif test $HAVE_UNAME=yes -a x`uname -s` = xNetBSD then DISTNAME=netbsd elif test $HAVE_UNAME=yes -a x`uname -s` = xOpenBSD then DISTNAME=openbsd elif test $HAVE_UNAME=yes -a x`uname -s` = xBSD/OS then DISTNAME=bsdi elif test $HAVE_UNAME=yes -a x`uname -s` = xDarwin then DISTNAME=darwin elif test $HAVE_UNAME=yes -a x`uname -s` = xQNX then DISTNAME=qnx elif test -f /etc/SuSE-release then DISTNAME=suse elif test -d /etc/SuSEconfig then DISTNAME=suse5 elif test -f /etc/mandrake-release then DISTNAME=mandrake elif test -f /etc/whitebox-release then DISTNAME=redhat elif test -f /etc/redhat-release then DISTNAME=redhat elif test -f /etc/yellowdog-release then DISTNAME=yellowdog elif test -f /etc/debian_version then DISTNAME=debian elif test -f /etc/slackware-version then DISTNAME=slackware elif test -f /etc/gentoo-release then DISTNAME=gentoo elif test -f /etc/engarde-version then DISTNAME=engarde else DISTNAME=unknown fi DISTDIR=$DISTNAME with_distdir="yes" # Check whether --enable-install-distdir or --disable-install-distdir was given. if test "${enable_install_distdir+set}" = set; then enableval="$enable_install_distdir" if test "$enableval" = "no" ; then DISTDIR="" with_distdir="no" fi fi; # Define the default UPS UPSTYPE=apcsmart # Define the default Cable UPSCABLE=smart # set the default nologin directory nologdir=/etc # Find the default directory to put the root-mode PID file in for PIDDIR in "/var/run" "/etc/apcupsd" do if test -d $PIDDIR then break; fi done # Find the default directory to put the apcupsd.events and apcupsd.status files for LOGDIR in "/var/log" "/etc/apcupsd" do if test -d $LOGDIR then break; fi done # set the default serial port lock director for LOCKDIR in "/var/lock" "/var/spool/locks" "/etc/apcupsd" do if test -d $LOCKDIR then break; fi done # set the default PWRFAILDIR PWRFAILDIR=${sysconfdir} # define the default serial port device SERIALDEV=/dev/ttyS0 # define the default NIS (Network Information Server -- CGI) port NISPORT=3551 # # Now we set appropriate distribution specific # variables and defaults # case "$DISTNAME" in alpha) PTHREAD_LFLAGS="-lpthread -lexc" DISTVER=`uname -r` SERIALDEV=/dev/tty01 LOCKDIR=/var/spool/locks LOGDIR=/etc/apcupsd DFILES="\ platforms/alpha/apcupsd \ platforms/alpha/awkhaltprog" ;; bsdi) DISTVER=`uname -a |awk '{print $3}'` ;; debian) DISTVER=`cat /etc/debian_version` DFILES="\ platforms/debian/apcupsd \ platforms/debian/ups-monitor" ;; freebsd) DISTVER=`uname -a |awk '{print $3}'` SERIALDEV=/dev/cuaa0 nologdir=/var/run PWRFAILDIR=/var/run LOCKDIR=/var/spool/lock PTHREAD_CFLAGS="-pthread" PTHREAD_LFLAGS="" LDFLAGS="$LDFLAGS -pthread" DFILES="\ platforms/freebsd/apcupsd \ platforms/freebsd/apccontrol" ;; gentoo) DISTVER=`awk '/version / {print $5}' < /etc/gentoo-release` DFILES="\ platforms/gentoo/apcupsd \ platforms/gentoo/halt" ;; hpux) DISTVER=`uname -r` SERIALDEV=/dev/tty0p0 PTHREAD_CFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_REENTRANT" DFILES="\ platforms/hpux/apcupsd \ platforms/hpux/halt" ;; netbsd) DISTVER=`uname -a |awk '{print $3}'` SERIALDEV=/dev/cua01 PTHREAD_CFLAGS="-pthread" PTHREAD_LFLAGS="" LDFLAGS="$LDFLAGS -pthread" DFILES="\ platforms/netbsd/apcupsd" ;; openbsd) DISTVER=`uname -a |awk '{print $3}'` SERIALDEV=/dev/cua01 LOCKDIR=/var/spool/lock PTHREAD_CFLAGS="-pthread" PTHREAD_LFLAGS="" LDFLAGS="$LDFLAGS -pthread" DFILES="\ platforms/openbsd/apcupsd \ platforms/openbsd/apccontrol" ;; mandrake) DISTVER=`cat /etc/mandrake-release | grep release | cut -f 5 -d ' '` DFILES="\ platforms/mandrake/apcupsd \ platforms/mandrake/apcupsd.spec \ platforms/mandrake/awkhaltprog" ;; redhat) if test -f /etc/whitebox-release ; then f=/etc/whitebox-release else f=/etc/redhat-release fi if test `cat $f | grep release | cut -f 3 -d ' '`x = "Enterprise"x ; then DISTVER="Enterprise "`cat $f | grep release | cut -f 6 -d ' '` else DISTVER=`cat /etc/redhat-release | grep release | cut -f 5 -d ' '` fi DFILES="\ platforms/redhat/apcupsd \ platforms/redhat/apcupsd.spec \ platforms/redhat/awkhaltprog" ;; yellowdog) if test `cat /etc/yellowdog-release | grep release | cut -f 3 -d ' '`x = "Enterprise"x ; then DISTVER="Enterprise "`cat /etc/yellowdog-release | grep release | cut -f 6 -d ' '` else DISTVER=`cat /etc/yellowdog-release | grep release | cut -f 5 -d ' '` fi DFILES="\ platforms/yellowdog/apcupsd \ platforms/yellowdog/apcupsd.spec \ platforms/yellowdog/awkhaltprog" ;; engarde) DISTVER=`cat /etc/engarde-release | grep ersion | cut -f 5 -d ' '` DFILES="\ platforms/engarde/apcupsd \ platforms/engarde/apcupsd.spec \ platforms/engarde/awkhaltprog" ;; slackware) DISTVER=`cat /etc/slackware-version` DFILES="\ platforms/slackware/apcupsd \ platforms/slackware/rc6.patch" ;; sun) DISTVER=Solaris SERIALDEV=/dev/ttya PWRFAILDIR=/etc PIDDIR=/var/run LOCKDIR=/var/spool/locks LOGDIR=${sysconfdir} APCUPSD_MAIL=/usr/bin/mailx PTHREAD_CFLAGS="-D_POSIX_PTHREAD_SEMANTICS" DFILES="\ platforms/sun/apcupsd \ platforms/sun/rc0.solaris \ platforms/sun/apccontrol" ;; suse) DISTVER=`cat /etc/SuSE-release |grep VERSION| cut -f 3 -d ' '` DFILES="\ platforms/suse/apcupsd \ platforms/suse/awkhaltprog" ;; suse5) DISTNAME=suse DISTVER=5.x DFILES="\ platforms/suse/apcupsd \ platforms/suse/halt-setup.sh \ platforms/suse/halt" ;; darwin) DISTVER=`uname -r` SERIALDEV= UPSTYPE=usb UPSCABLE=usb PIDDIR=/var/run LOCKDIR=/var/tmp DFILES="\ platforms/darwin/apcupsd \ platforms/darwin/apccontrol" ;; qnx) PTHREAD_LFLAGS="" DISTVER=`uname -r` SERIALDEV=/dev/ser1 DFILES="\ platforms/qnx/apcupsd \ platforms/qnx/apccontrol" ;; unknown) DISTVER=unknown DFILES="\ platforms/unknown/apcupsd \ platforms/unknown/halt" ;; *) { echo "$as_me:$LINENO: WARNING: Something went wrong. Unknown DISTNAME $DISTNAME" >&5 echo "$as_me: WARNING: Something went wrong. Unknown DISTNAME $DISTNAME" >&2;} ;; esac # Check whether --with-nologin or --without-nologin was given. if test "${with_nologin+set}" = set; then withval="$with_nologin" nologdir="$withval"; fi; # now allow the user to specify the PID directory # Check whether --with-pid-dir or --without-pid-dir was given. if test "${with_pid_dir+set}" = set; then withval="$with_pid_dir" PIDDIR="$withval"; fi; # now allow user to specify LOGDIR # Check whether --with-log-dir or --without-log-dir was given. if test "${with_log_dir+set}" = set; then withval="$with_log_dir" LOGDIR="$withval"; fi; # now allow user to specify LOCKDIR # Check whether --with-lock-dir or --without-lock-dir was given. if test "${with_lock_dir+set}" = set; then withval="$with_lock_dir" LOCKDIR="$withval"; fi; # now allow user to specify PWRFAILDIR # Check whether --with-pwrfail-dir or --without-pwrfail-dir was given. if test "${with_pwrfail_dir+set}" = set; then withval="$with_pwrfail_dir" PWRFAILDIR="$withval"; fi; # now allow user to specify SERIALDEV # Check whether --with-serial-dev or --without-serial-dev was given. if test "${with_serial_dev+set}" = set; then withval="$with_serial_dev" SERIALDEV="$withval"; fi; # Check whether --with-dev or --without-dev was given. if test "${with_dev+set}" = set; then withval="$with_dev" SERIALDEV="$withval"; fi; # now allow user to specify NISPORT # Check whether --with-nis-port or --without-nis-port was given. if test "${with_nis_port+set}" = set; then withval="$with_nis_port" NISPORT="$withval"; fi; # now allow user to specify UPSTYPE # Check whether --with-upstype or --without-upstype was given. if test "${with_upstype+set}" = set; then withval="$with_upstype" UPSTYPE="$withval"; fi; # now allow user to specify UPSCABLE # Check whether --with-upscable or --without-upscable was given. if test "${with_upscable+set}" = set; then withval="$with_upscable" UPSCABLE="$withval"; fi; cat >>confdefs.h <<_ACEOF #define PIDDIR "$PIDDIR" _ACEOF cat >>confdefs.h <<_ACEOF #define LOGDIR "$LOGDIR" _ACEOF cat >>confdefs.h <<_ACEOF #define NOLOGDIR "$nologdir" _ACEOF cat >>confdefs.h <<_ACEOF #define PWRFAILDIR "$PWRFAILDIR" _ACEOF cat >>confdefs.h <<_ACEOF #define NISPORT $NISPORT _ACEOF HOST=$DISTNAME cat >>confdefs.h <<_ACEOF #define HOST "$HOST" _ACEOF gccinclude="." if test "$CC" = "gcc" then rm -f $srcdir/gcc.v $CC -v 2> $srcdir/gcc.v gccinclude=`cat $srcdir/gcc.v|grep specs|awk '{print $4}'| \ sed -e 's|specs|include|g'` echo "gcc private include directory found." rm -f $srcdir/gcc.v fi GENERATE_FILES="\ autoconf/variables.mak \ platforms/apccontrol \ platforms/etc/changeme \ platforms/etc/commfailure \ platforms/etc/commok \ platforms/etc/offbattery \ platforms/etc/onbattery \ platforms/etc/apcupsd.conf \ examples/safe.apccontrol \ src/win32/Makefile \ $DFILES" if test "$USB_TYPE"x = "generic"x then GENERATE_FILES="$GENERATE_FILES \ src/drivers/usb/generic/libusb.h" fi if test "$ENABLE_CGI" = "yes" then GENERATE_FILES="$GENERATE_FILES src/cgi/cgiconfig.h" fi ac_config_files="$ac_config_files ${GENERATE_FILES}" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "${GENERATE_FILES}" ) CONFIG_FILES="$CONFIG_FILES ${GENERATE_FILES}" ;; "include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/config.h:autoconf/config.h.in" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@ABSSRCDIR@,$ABSSRCDIR,;t t s,@topdir@,$topdir,;t t s,@TOP_DIR@,$TOP_DIR,;t t s,@VERSION@,$VERSION,;t t s,@DATE@,$DATE,;t t s,@TRUEPRG@,$TRUEPRG,;t t s,@FALSEPRG@,$FALSEPRG,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@CPP@,$CPP,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@AWK@,$AWK,;t t s,@HAVE_GCC_TRUE@,$HAVE_GCC_TRUE,;t t s,@HAVE_GCC_FALSE@,$HAVE_GCC_FALSE,;t t s,@DEBUG@,$DEBUG,;t t s,@DRVLIBS@,$DRVLIBS,;t t s,@APCDRVLIBS@,$APCDRVLIBS,;t t s,@PTHREAD_CFLAGS@,$PTHREAD_CFLAGS,;t t s,@PTHREAD_LFLAGS@,$PTHREAD_LFLAGS,;t t s,@APCACCESS@,$APCACCESS,;t t s,@SMTP@,$SMTP,;t t s,@APCTEST@,$APCTEST,;t t s,@SHUTDOWN@,$SHUTDOWN,;t t s,@APCUPSD_MAIL@,$APCUPSD_MAIL,;t t s,@WALL@,$WALL,;t t s,@SCRIPTSHELL@,$SCRIPTSHELL,;t t s,@RANLIB@,$RANLIB,;t t s,@RM@,$RM,;t t s,@CP@,$CP,;t t s,@ECHO@,$ECHO,;t t s,@LN@,$LN,;t t s,@SED@,$SED,;t t s,@AR@,$AR,;t t s,@MV@,$MV,;t t s,@RST2HTML@,$RST2HTML,;t t s,@RST2PDF@,$RST2PDF,;t t s,@EGREP@,$EGREP,;t t s,@X_CFLAGS@,$X_CFLAGS,;t t s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t s,@X_LIBS@,$X_LIBS,;t t s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t s,@HALPOLICYDIR@,$HALPOLICYDIR,;t t s,@GDHEAD@,$GDHEAD,;t t s,@APCSMART_DRIVER@,$APCSMART_DRIVER,;t t s,@DUMB_DRIVER@,$DUMB_DRIVER,;t t s,@LIBUSBHID@,$LIBUSBHID,;t t s,@LIBUSBHIDINC@,$LIBUSBHIDINC,;t t s,@usbcfg@,$usbcfg,;t t s,@LIBUSBH@,$LIBUSBH,;t t s,@USB_DRIVER@,$USB_DRIVER,;t t s,@USB_TYPE@,$USB_TYPE,;t t s,@NET_DRIVER@,$NET_DRIVER,;t t s,@SNMPLITE_DRIVER@,$SNMPLITE_DRIVER,;t t s,@SNMP_DRIVER@,$SNMP_DRIVER,;t t s,@TEST_DRIVER@,$TEST_DRIVER,;t t s,@PCNET_DRIVER@,$PCNET_DRIVER,;t t s,@NISIP@,$NISIP,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@GAPCMON_CFLAGS@,$GAPCMON_CFLAGS,;t t s,@GAPCMON_LIBS@,$GAPCMON_LIBS,;t t s,@GAPCMON@,$GAPCMON,;t t s,@APCAGENT@,$APCAGENT,;t t s,@POWERFLUTE@,$POWERFLUTE,;t t s,@POWERLIBS@,$POWERLIBS,;t t s,@MAKE@,$MAKE,;t t s,@LD@,$LD,;t t s,@CGI@,$CGI,;t t s,@GD_LIBS@,$GD_LIBS,;t t s,@CGIBIN@,$CGIBIN,;t t s,@SYSCONFDIR@,$SYSCONFDIR,;t t s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t s,@EXTRADEFS@,$EXTRADEFS,;t t s,@LIBEXTRAOBJ@,$LIBEXTRAOBJ,;t t s,@EXTRAOBJ@,$EXTRAOBJ,;t t s,@DISTDIR@,$DISTDIR,;t t s,@DISTNAME@,$DISTNAME,;t t s,@DISTVER@,$DISTVER,;t t s,@SERIALDEV@,$SERIALDEV,;t t s,@PIDDIR@,$PIDDIR,;t t s,@LOGDIR@,$LOGDIR,;t t s,@nologdir@,$nologdir,;t t s,@PWRFAILDIR@,$PWRFAILDIR,;t t s,@LOCKDIR@,$LOCKDIR,;t t s,@NISPORT@,$NISPORT,;t t s,@UPSTYPE@,$UPSTYPE,;t t s,@UPSCABLE@,$UPSCABLE,;t t s,@HOST@,$HOST,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi chmod 755 examples/safe.apccontrol $MAKE clean # # A whole lot of hand springs to get the compiler version. # This is because gcc changed the output in version 3.0 # CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 3 -d ' '` if test "x${CXXVERSION}" = "x" ; then CXXVERSION=`${CXX} --version | tr '\n' ' ' | cut -f 1 -d ' '` fi eval srcdir=${srcdir} eval sbindir=${sbindir} eval sysconfdir=${sysconfdir} eval mandir=${mandir} echo " Configuration on `date`: Host: $host -- ${DISTNAME} ${DISTVER} Apcupsd version: ${VERSION} (${DATE}) Source code location: ${srcdir} Install binaries: ${sbindir} Install config files: ${sysconfdir} Install man files: ${mandir} Nologin file in: ${nologdir} PID directory: ${PIDDIR} LOG dir (events, status) ${LOGDIR} LOCK dir (for serial port) ${LOCKDIR} Power Fail dir ${PWRFAILDIR} Compiler: ${CXX} ${CXXVERSION} Compiler flags: ${CPPFLAGS} ${CXXFLAGS} ${PTHREAD_FLAGS} Linker: ${LD} Linker flags: ${LDFLAGS} Host and version: ${DISTNAME} ${DISTVER} Shutdown Program: ${SHUTDOWN} Port/Device: ${SERIALDEV} Network Info Port (CGI): ${NISPORT} UPSTYPE ${UPSTYPE} UPSCABLE ${UPSCABLE} drivers (no-* are disabled): ${APCSMART_DRIVER:-no-apcsmart} ${DUMB_DRIVER:-no-dumb} ${NET_DRIVER:-no-net} ${DISPLAY_USB_DRIVER:-no-usb} ${DISPLAY_SNMP_DRIVER:-no-snmp} ${DISPLAY_NETSNMP_DRIVER:-no-net-snmp} ${PCNET_DRIVER:-no-pcnet} ${TEST_DRIVER:-no-test} enable-nis: ${NISSRV_ENABLED} with-nisip: ${NISIP} enable-cgi: ${ENABLE_CGI} with-cgi-bin: ${CGIBIN} with-libwrap: ${with_libwrap} enable-pthreads: ${with_pthreads} enable-dist-install: ${with_distdir} enable-gapcmon: ${GAPCMON_ENABLED} enable-apcagent: ${APCAGENT_ENABLED} " > config.out cat config.out echo Configuration complete: Run \'$MAKE\' to build apcuspd. echo echo $PATH | grep /usr/ucb >/dev/null if test $? = 0 ; then { echo "$as_me:$LINENO: WARNING: WARNING! You have /usr/ucb on your path. We STRONGLY recommend that you remove it and rerun configure. Otherwise apcupsd may be unable to shutdown your system. " >&5 echo "$as_me: WARNING: WARNING! You have /usr/ucb on your path. We STRONGLY recommend that you remove it and rerun configure. Otherwise apcupsd may be unable to shutdown your system. " >&2;}; fi apcupsd-3.14.10/kernstodo0000775000076400007640000012524510266000255014166 0ustar adk0212adk0212 Kern's ToDo List - Convert Windows emulation from Cygwin to native Win32 The main missing piece here is an emulation layer for the serial port. - Implement USB support for Windows - Convert the manual to LaTeX This will be done in the next couple of months. - Consider converting apcupsd to C++ This will be done in the next couple months -- after the 3.10.17 release. - UPS 500ES with cable 094-0127B BATTERYLEVEL -5 otherwise the UPS would shut off immediately. - The UPS sensitivity can be adjusted using the UPS front-panel. You press and hold the Power Switch for more than 10 seconds and then press again repeatedly until the required number of front-panel indicators are displayed. The UPS manual includes information on adjusting the Transfer Voltage using this procedure. - Add a call to a script on restart after a powerfailure. Can we have the init.d script call the apccontrol script with a some kind of "restart" event if the powerfail file existed? - If you --disable-nis, then the build of apcaccess fails. - See if NISIP is properly documented saying that it restricts to the IP you set. - Fix make file dependencies by adding libaries to dependencies in src/Makefile.in, but do not add $(LIBS). - Document problem with Dmsg() going to serial port. - Document apctest. - Document that manually running the UPS you should send Y first of all. - Fix DNS for apcupsd.com and apcupsd.org being set by Italian server. - Check if new net code does the following on a slave during a power failure: Fri Sep 05 15:19:55 CEST 2003 Power failure. Fri Sep 05 15:19:55 CEST 2003 Running on UPS batteries. Fri Sep 05 15:20:02 CEST 2003 Power is back. UPS running on mains. Fri Sep 05 15:20:07 CEST 2003 Power failure. Fri Sep 05 15:20:07 CEST 2003 Running on UPS batteries. Fri Sep 05 15:20:10 CEST 2003 Power is back. UPS running on mains. === USB on windows ==== usbhidioc2.zip in apcupsd/others Re: Apcupsd for Win32 with USB support ? From: "Vladislav Staroselskiy" To: kern@sibbald.com CC: "Apcupsd-users" Hi Kern ! > > Is there any chance to see Apcupsd for Win32 with USB support at the near > > future ? > Very unlikely, unless someone sends me or points me to some sample code > that reads and writes USB via Windows. Even then, I'm not too > enthusiastic about programming in Windows. There are code examples here: http://www.alanmacek.com/usb/deviceAPI.html There are also few helpful links: USB Central: http://www.lvr.com/usb.htm USB drivers page on MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceddk40/html/cxconusbdrivers.asp MSDN newsgroups, where programming questions can be asked: http://msdn.microsoft.com/newsgroups/ P.S. Please, don't drop this idea, the most of modern UPS's don't have serial port anymore, but Windows is still OS, that users like to have on their workstations... and THANKS for doing this project, apcupsd is great ! Sincerely yours, Vladislav Staroselskiy. ====== ===== In PowerChute Plus a daemon "_upsd" starts during the booting process (or it could be started manually) by reading the "pwrchute.ini" file such as "apcups.conf" in APCUPSD. This file specify the parameters to the daemon, in which several variables are included. The interesting one is ups turn off and wakeup time in hours. By reading the ups turn off time the daemon execute the process to turn off the Computer and ups at specific time, based on the system clock. This process would be summarized as follows: 1. At the specific time the daemon (_upsd) execute a script to shutdown the system. This script contain the command to shutdown the system (system dependent) 2. An script file is written on root directory called "upsoff.cmd" by the daemon. This file consist the command to turn off the ups. Such as: !/bin/sh /usr/lib/powerchute/upsoff /dev/ttyd0 Normal UUS^@ The above script produced during the power failure situation and similarly the following script will be produced during the scheduled shutdown, in which "upsoff" is a binary in PowerChute Plus package to turnoff the UPS. The above scenario is as power failing situation in APCUPSD with "killpower" option. !/bin/sh /usr/lib/powerchute/upsoff /dev/ttyd0 Normal @165^@ The final parameter specifies the amount of time UPS has to go on sleep, i.e., the above script is executed by the "halt" script in RedHat and removed. So that, it turn of the UPS (or make it to sleep for specific time in 24 hors time period) then it the UPS will wake up after the prescribed time. Just as power failing situation in APCUPSD with "killpower" option. Then the system will up as usual. The last parameter variables specify from the command set of the UPS (as I hope). === - Possibly add a user configurable delay before declaring a power outage. - If you add a battery pack, there is a special procedure to do that is documented in the APC Knowledge Base in order for the timeleft to be updated properly. - Put the apcupsd events into Win system log. - To whom it may concern: May 2003 I have found a vendor for the APC 940-0095A cables as well as all of the other cables that APC makes. The discount of the cable equates to roughly 30%. I bought a 940-0095A for $30.00 US + shipping from Stonewall Cable, Inc. www.stonewallcable.com James Widener - I have a quantity of new in the package 940-0127A cables you mention on your website for UPS. Do you know of anyone needing a large quantity of these? Also manual/packets and other short electronic type cables. Please feel free to pass on my name if you can. Thank you. Carl Lindahl May 2003 Hardware Engineer American Systems Corporation 7001 University Blvd Winter Park, Fl 32792 carl.lindahl@2asc.com 407-678-8500 x6033 407-678-5178 fax - Add minVolt maxVolt to apcupsd (calculate them ourselves). - Apparently apcaccess status crashes for apcupsd without threads. - Try adding -lm if a local copy of libgd is used (or patch the makefile). - Please consider creating a graphical setup for APCUPSD which would walk the user through the type of UPS, how it is conneted, the type cable used similar to the Palm configuration in Ximian Evolution. After several attempts, I was unsuccessful at using APCUPSD, until I found (http://www.mandrake.com/en/archives/cooker/2002-04/msg01252.php) which provides all of the configuration needed to use APCUPSD with Mandrake 8.2. - Produce a more reasonable error message in attempting EEPROM configuration on a USB device. - Check that 3.10.5 will autostart on XP - Neither 3.8.6 nor 3.10.5 has a description of the service displayed under admintools/services/properties/description on XP (Gorm Jensen). - Make NISP handle multiple devices or addresses. - Make sure that log dir and lock dir are created if they do not exist in "make install". - Add a ./configure option for setting NISIP. - See if 3.10.4 takes longer to link up with the UPS than 3.8.5 - Make sure old copies of scripts are saved during install. - Don't delete old apccontrol -- may be modified by user. - Add CONFIG_USB_HIDDEV=y possible fix to manual. - Make sure apcnisd works (at least for forked version). - Fix CI_VBATT that doesn't seem to work. - Look into shutdown delay (perhaps add MASTERDELAY). Check document. - Consider MASTERKILLPOWERDELAY - Implement install_slave - Add Master shutdown delay. - If in power loss and slave looses connection with master, initiate shutdown -- after a user definable timout. - Document LOGSTATS - Document or remove NETACCESS - --prefix reportedly does not work in ./configure - Add relative links to the bottom of the multimon stats page -> href-"multimon.cgi" or back to the home. - Try to find the right mail program on Solaris (i.e. mailx rather then mail) or document the smtp program. - Possibly use shutdown -i5 on Solaris instead of shutdown -i0 -- check with Carl - For FreeBSD use shutdown -h according to Neil. - Failure to connect to the UPS should generate an event and perhaps apcupsd should continue running and periodically generate events rather than exiting in error. - Fix hot swapping of USB UPSes with a different UPS model. Need to update static data from USB. - Implement kill power for USB. - Cleanup apcreports and apcstatus code to use Status word. Especially the dumb UPS code. - Become daemon sooner to avoid network hangs. - Avoid opening, closing, then reopening the serial port. - Close all open file descriptors before execing. - add /sbin/halt -i -d -p to shutdown See above for FreeBSD and Solaris. - Don't try to create nologin or powerfail files if doing a killpower. - Make suggested changes to Makefiles (see emails). - Figure out po stuff works. - When running the --killpower, delete the powerfail file if we are not in a powerfail condition. - look at use of snprintf and vsnprintf! - Add SSL - Add "File | Save" to Windows shutdown. - Add optional delay on onbattery to eliminate messages for short outages (or add a new event). - Look into making rpm relocatable or at least the cgi part. - Add calibrate runtime option. - Setuid of network processes to "nobody". - Document porting issues. - enhance manual for master/slave stuff especially the network problems. - Fix power off problems for Dumb UPSes which don't know about 2 minute delay of modern dumb UPSes. Email from Richar Lovison Concerning Bacuk-UPS ES series and cables. One more thing I should let you know. For some reason the function, doshutdown, is not being called in apccontrol. That explains why I was getting a shutdown when I saw the "Emergency shutdown" xconsole message since the emergency function has the shutdown command as part of the function. For now I worked around this by inserting the line: ${SHUTDOWN} -h now "apcupsd remote shutdown" at the end of the failing, timeout, loadlimit and runlimit functions in the apccontrol file. Maybe this is a problem with version 3.8.1? In any case, I now get a proper shutdown with the batteries fully charged after a designated TIMEOUT. After your vacation, if you wish any further help from me I'd be willing to give it... my way of giving back I guess. [:)] Next release focus: improved documentation, simpler installation, improved security and networking. Key: - => to be done; + => in beta; * => completed A.1 * Linux USB (implemented in 3.9.4 - kill power doesn't work) A.2 * Configure USB code on/off (implemented in 3.9.5) A.3 - Configure Network Information Server (CGI) code on/off (smaller footprint) A.4 - Configure master/slave code on/off (smaller footprint) A.5 - Add universal Dumb UPS configurator similar to what exists in powerd, but much more comprehensive. (general cleanup and allows support of ANY Dumb UPS with ANY cable). A.6 * Drivers (USB, Smart, Dumb) (general cleanup of core code). (implemented by Riccardo). (implemented in 3.9.5) A.7 * Configure drivers code on/off (smaller footprint) (implemented in 3.9.5). A.8 * Add port to hosts.conf (implemented in 3.8.3). A.9 * Log errors in apccontrol. A.10 * Persistent slave connections. Currently connection is made and broken each communication. (implemented in 3.9.4). A.11 - CRAM-MD5 authentication for master/slave (security - requires A.10). A.12 + Ensure that ANNOY and ANNOYDELAY work (correctly documented). Need possible coding changed to separate ANNOY and NOLOGON. A.13 * Reduced STATUS output by eliminating lines with N/A (implemented in 3.8.3). A.14 * Detect, log, and generate event when master/slave not responding (improved error detection) (implemented in 3.9.6) A.15 - Eliminate of unnecessary/confusing configuration directives (this requires a good deal of thought and implmentation of A.6). A.16 * Additional documentation including pdf version of document. A.17 - Merge of specific 4.0 code/features (e.g. new Makefiles, eeprom programming, ...) Possibilities: B.1 + New master/slave protocol using same network code as CGI (future releases would be be upward compatible -- needs A.6) B.2 - Built-in mini-Web server (Carl's suggestion) with SSL. B.3 - GUI via mini-Web server or CGI code. B.4 * Support of multiple-UPSes (implemented in 3.8.3). B.5 - General cleanup of configuration file reading code possibly with new configuration file syntax. (this is only needed if B.4 is implemented). B.6 - Move EEPROM programming code to a separate program and add additional features. User Requests: C.1 * More documentation, including pdf format; better organization of documentation (work here progressing but it is a continuing effort). C.2 - Develop a formalized release test plan. C.3 * Implement an effective bug tracking system. C.4 + Identification of people responsible for various functions (platform maintenance, testing, web site maintenance, documentation, ...) (Job descriptions written -- several people formally identified). C.5 * Reorganize code for efficiency and for easier maintenance (part of A.6 and A.17). Design: UPSTYPE = Smart/Dumb/USB/Slave CABLE = DUMB GETPORT SETPORT Where: = POWERFAIL | LOWBATT | LINEDOWN (ONBATT) = INITUPS | POWERFAIL | SHUTDOWN (EXIT) action-spec = | ... signal-spec = ... signal = CTS | DSR | RNG | ST | CSR | RTS state = SET | CLEAR sleep-spec = SLEEP N


To do:
========
Hello,

Yes, what you did is exactly what it takes to get
apcupsd to work with cygwin installed.  There are
four major pitfalls:

1. The normal cygwin installation uses mount points
   and installs everything in a subdirectory of cygwin.
   This was not appropriate for apcupsd, and is not how
   I run my system -- I prefer my files to be visible
   in the root directory as on Unix.  If you use the
   standard apcupsd install, it removes all cygwin mount
   points. From what you wrote, you avoided this problem.

2. If you install on a cygwin system, you must ensure that
   /apcupsd/bin gets you to the apcupsd directory, so if you
   are using the standard cygwin suggestions, you must ensure
   that you place apcupsd into the cygwin directory as you did.

3. Finally, you must either delete the cygwin1.dll from the
   apcupsd bin directory or insure that you are always running
   the same cygwin distribution as apcupsd (currently 1.3.10)
   since two different cygwin1.dll programs will not co-exist.

4. If you do upgrade your cygwin system, be aware that my experience
   is that only about one out of every 3 of their releases is
   stable enough to run apcupsd. So upgrade with caution, and
   you may need to build apcupsd depending on what changes
   they made.

Thanks for pointing out that you got this cygwin configuration
to work. I'll try to get these notes + yours into the 
next manual for the next time someone wants to try 
running apcupsd with cygwin.  As Neil pointed out, it is
not evident that it will work, and though these notes should
be helpful, we probably won't officially support running apcupsd
AND cygwin unless you wish to be constrained to running on
the same version as we are (not always evident).

Best regards,

Kern


On Mon, 2002-07-01 at 18:29, James Garrison wrote:
> I didn't find details on installing apcupsd with an existing
> cygwin installation, but after looking over the install
> script I "guessed" that all I had to do was put the
> apcupsd directory under my cygwin root and run
> 
>       apcupsd /install
> 
> from the there.  Everything appears to be working correctly,
> including running apcupsd slaved to a Linux master.  Did I miss
> something or is it really that simple? Did I miss where this
> is documented?  If not, it definitely needs to be added to the doc.
> 
> Thanks for a great program.  This is what APC *should* be
> providing to its users, not the crappy stuff they currently have.
> 
======


Wish list:
- Look at using libgd-1.3 in place of gd for cgi.
  Perhaps a lib directory could be added to the build tree and a
  "-with-included-gd" configure switch could control the inclusion of the
  local libgd.  
- Fix confusion with UPSTYPE, ... 
- Add more commands (individual variables) to apcnetd
- Make apcaccess use the network code as an option.
- Eliminate rest of character command codes using new
  capabilities code in apcsetup.c (for setup stuff).
- Eliminate the rest of the printfs().
- Eliminate as many error_aborts as possible in making
  new events.
- STATUS file should be opened with open() rather
  than fopen(). Some small changes required. 
- Expand Last UPS Self Test field in cgi program
- Send events across network to slaves rather than 
  status values.
- Send configuration (ups type, ...) across network to
  slaves and ignore slave UPS configuration info.
- Create globals file and move more variables out
  of shared memory buffer.  Maybe even eliminate
  shared memory.
- Implement a new option or mode in apcupsd where when there
  is a power failure, apcupsd issues the system shutdown as
  usual, but it continues running. After a user defined time
  limit after the shutdown, apcupsd will tell the UPS to
  shut off the power.
  From: Zsolt Domokos [DomokosZ@esi.com]
             

Fixed but needs testing:
- Add Chris' schematic of the 940-0095A cable.
- add 127 and 128A cables to 3.9.8!   



Done:
- When USB is offline status indicates SLAVE
- Need to insure that the reports are done if they
  are requested more frequently than the poll period.
- Fix powerflute build problem.
- Win32 Threads
- Fix libwrap
- Change the default SERVERPORT and NETPORT 
- Add configuration for ports
- Add configuration for logfile
- Fix passing stack pointer to thread in apcnis.c !!!!!
- Master did not shutdown in TIMEOUT.
- Set appropriate permissions on files in /etc/apcupsd during
  make install.
- Finish the rpm spec file.
- Accumulate time on batteries and number of transfers
  to batteries. Perhaps save history in file so that the
  info can be recovered if apcupsd restarts.
- Remember date and time when apcupsd started.
- Allow IP addresses for masters and slaves.
- Add remaining time before TIMEOUT to STATUS output.
- Fix 4/8 byte problem reported by Tom Holroyd
- Fix zombies on BSD. Each exec() increments a counter.
- Fix the problem with DoS with the email files
  where the file can be linked to a system file.
- fix ChangeBatt problem in apcnet (line 389).
      > 1) Start master and slave apcupsd daemons
      > 2) Terminate the apcupsd daemon on the master
      > 3) Wait a little time
      > 4) Start the master apcupsd daemon
      > 5) Slave reports that UPS batteries have failed
      > 6) A zombie shell process appears on slave
  why is bad data being sent.
  Do nonblocking wait in main loop and decrement counter.
- Use links and .bat files instead of .pifs on Win32
- Add a KILLDELAY mode where after shutdown, apcupsd continues
  running, and then after a specified time issues
  the kill_power to the UPS.    
- Detect self tests
- SEGFAULT in kill_power()
- Buffer overflow in capabilities
- If UPS capabilities, only test those defined
- Fast Poll when on batteries.
- Improved Win32 shutdown -- guarantees shutdown, previous
  version could hang if dialogue not answered. Can now
  specify shutdown delay.
- Some files have large diff files because they
  have been reformatted to apcupsd 4.0 standards.
- I am in the process of integrating version 4.0
  code into this stream, so many of the changes are
  related to this activity.
- Modified code for handling 940-0095B cable. Hopefully,
  it will work now.
- Added the Caldera code that was submitted by John Pinner.
- Integrated NetBSD patches that I received from Devin Reade -- thanks.
- To correct a problem with zombies on BSD systems, I added
  a UPSINFO variable that is the count of children created
  by execute_command(). do_action() in apcaction.c was
  modified to check this variable, do a non-blocking wait,
  and decrement it if any children were found.  This should
  properly reap the zombies.
- Added additional debug information (strerror) to failed
  semaphore and shared memory system call errors in apcipc.c
- In apcnet.c, removed ChangeBatt from slave because it is
  apparently being set incorrectly on some BSD masters when
  apcupsd is restarted.
- Added an O_NDELAY to the serial port open() in apcserial.c
  to avoid infinite waits on some BSD systems. This required
  the addition of an fcntl() after the open to reset the
  blocking read(), which is needed in apcupsd.
- Removed an unwanted break in a switch in apcstatus.c that
  caused the status output for BackUPS Pros to be cut short.
- Added a HAVE_POWERFLUTE define and changed powerflute.c to
  use it. This prevents a lot of the errors seen on systems
  that don't have ncurses.
- configure.in, added HAVE_NETBSD_OS, HAVE_POWERFLUTE, and
  modified generation of makefiles to only configure the files
  in the recognized distribution.  Modified the automatic 
  make of the dependencies to use "make depend"
- Removed the call on the shell to execute a script file in
  apccontrol. This permits execution of any type of file, but
  it now requires that the file be executable.
- Reindent apclock.c apcstatus.c apclog.c apcevents.c
- Add TCP Wrappers -- fix problems pointed out by Neil,
  and implement code.
- Fix gethostbyname on Win32 (apparently this works).
- Fix apcaction.c to be a state machine,
  and to generate events.
- Make all events into event subroutines that can be
  called from anywhere -- including network code.
  Thus do_action() will be a very small loop detecting
  and sending events.


We have several electrical circuits in our computer room. So we have one master running on each circuit and the rest on a circuit are slaves. This way, we don't get messages from all PCs, just one per circuit. We can monitor each circuit individually now. Not only does APC's PowerChute Linux version not run on most of our machines (needs X) but you just can't customize it that way I have learned with apcupsd. Plus, powerchute likes to go out and find everything and I don't want that. Many of our machines are just servers and don't have X. They don't need it. 
Yes, fixing apcupsd so that it doesn't send out power loss messages
during the automatic self test is definitely on my list of things
to do, and I will make sure it is in the next release. Your vote
does count as much as everyone else's. In fact, you just gave me
an idea - it might be good to have an optional configuration directive
that delays the onbattery event for a given number of seconds, and
if the condition is cleared, the event would be dropped. This could
eliminate a lot of noise for small problems that are easily handled
by apcupsd.

This sounds perfect. I'm sure many people could use this feature.
Thanks,

Charles
- Use links and .bat files instead of .pifs on Win32
- Pass second argument to apccontrol indicating if
  we are master/slave and other info.
- Add multiple arguments to apccontrol


========================================
From: Alan W. Irwin 
To: apcupsd-devel@apcupsd.org
Subject: [Apcupsd-devel] Comparison of the official Debian unstable package for apcupsd-3.8.5 with my own
Date: 15 Feb 2002 12:30:05 -0800
I compared the official version with my unofficial patch to do the same thing,
and except for two files in my patch, I think the official patch is the same
or better.

The official patch completely ignores
apcupsd-3.8.5/distributions/debian/packageinfo and instead creates its own
apcupsd-3.8.5/debian directory.  The apcupsd team might consider adopting
the official debian patch (which has no impact outside the debian directory)
and dropping the packaginfo directory (which is misnamed, and which contains
white-space munged versions of a subset of the files in the official debian
directory).  I would recommend the official patch over my own because they
included some additional minor fixups to the files in the debian directory.

The only exceptions where I did a better job are the files named
packageinfo/undocumented and packageinfo/examples in my patch which should
replace debian/undocumented and debian/examples in the official Debian
patch. The file named "undocumented" documents executables which should have
a man page, but don't, and "examples" is a list of example files to install.
"examples" is seriously incomplete for the official debian patch.  For
example, it does not include safe.apccontrol so that file is not part of the
official Debian package, but it is part of mine.

To summarize, I just installed the official version for Debian unstable
apcupsd-3.8.5 and aside from some example and man page files which are
missing it works as well as can be expected for a BackUPS with 940-0023A cable
connected to the Master which in turn is connected to a slave (also on
UPS) via the LAN.  My patch should be put in the dustbin except for the
files named "undocumented" and "examples".

One thing I noticed relevant to documentation fixups is their example
apcupsd.conf specifically replaced the configuration parameter SERVERPORT
with NISPORT.  Assuming the Debian packager knows what he is doing, this means
such a transition has occurred in 3.8.5, but I cannot find it in the
documentation.  Also, if SERVERPORT is going to be replaced by NISPORT, I
suggest you also do the replacement in examples/apcupsd.slave.conf and
examples/apcupsd.master.conf for consistency.

Alan

email: irwin@beluga.phys.uvic.ca
phone: 250-727-2902     FAX: 250-721-7715
snail-mail:
Dr. Alan W. Irwin
Department of Physics and Astronomy,
University of Victoria, P.O. Box 3055,
Victoria, British Columbia, Canada, V8W 3P6
__________________________

Linux-powered astrophysics
__________________________



                                      From: Alan W. Irwin 
                                      Cc: Apcupsd-devel 
                                      Subject: Re: [Apcupsd-devel] Debian woody apcupsd-3.8.5 working so far in safe mode (was Cannot get Debian woody apcupsd-3.8.1.5 to actually shutdown the computer even though dumb UPS signalling seems to be w
                                      Date: 14 Feb 2002 20:13:44 -0800
                                      On 14 Feb 2002, Kern Sibbald wrote:

>
> 1). Yes, NETACCESS is not documented -- an oversight, but
>     it is in fact not used and we hope to remove it.
>     I've put it on my todo list -- thanks.

Note that examples/apcupsd.master.conf and examples/apcupsd.slave.conf have
this parameter (and perhaps other example configuration files as well?) so
it should be removed from these example files when you remove NETACCESS
altogether.

>
> 2.  I found this a bit surprising. So I looked into the
>     problem a bit more and found that there is a bit of
>     confusion -- perhaps in our manual as well. Basically,
>     it appears that the shutdown on both machines is done
>     immediately. What is delayed 30 seconds on the master
>     is the kill power request to the UPS.
>     In looking at the kill power code for 3.8.5, the master,
>     regardless of whether it is a Dumb or Smart UPS, waits
>     30 seconds before setting the kill power bit, then
>     after setting it, it waits an additional 10 seconds to
>     hold the bit on.  Clearly at least the documentation
>     could be improved on this. It is now on my todo list.
>
>     Modifying apccontrol is the best way to correct the situation.
>     You are right -- it does get overwritten on the next installation.
>     I'll put this on my todo list to see if we can find a solution.

Thanks.  While I am asking, I suppose I should ask for the Moon....;-)
Ideally, what I would like to see is a configurable wait (although 30
seconds is not bad) after the remote shutdown command is sent to the slaves
before the master starts its shutdown.  This is important when the slaves
(such as mine) depend on the Master to export their NFS mounted files
systems, for example.

>
>
> 3.  This is a general problem with installation. Basically the
>     installation is designed for a stand alone situation, so when
>     you installed the slave, it installed the instructions in your
>     halt script necessary to recall apcupsd at the end of the shutdown
>     to kill the power. This can be fixed either as you did or by
>     deleting the changes to the halt script. We've made improvements
>     in the installation process for 3.8.5, but it probably merits more
>     attention.

Thanks.

>
> Feature request:
> Unfortunately, it is impossible to implement what you ask for the
> 023A cable due to the physical limitations of the cable
> wiring. Here is a section from our manual on the subject:
>
>       This cable can only be used on simple signaling UPSes,
>       and apparently only provides the On Battery signal. As
>       a consequence, this cable is pretty much useless, and
>       we recommend that you find a better cable because all
>       APC UPSes support more than just On Battery.
>

Thanks for pointing me to that reference.  I will probably just grit my
teeth and live with the 23A limitations.


> If you have any Debian patches or changes for our 3.8.5 code that would
help us, please send them to us.

See attached.

Here are the instructions for building the debian woody package,
apcupsd_3.8.5-1_i386.deb.

Apply this patch to a clean 3.8.5 tree, then cd into the patched tree

cd apcupsd-3.8.5

and either

ln -s distributions/debian/packageinfo debian
or
mv distributions/debian/packageinfo debian
or
mv distributions/debian/packageinfo distributions/debian/debian

(I only tried the first of these, but I think the others would work as well.
I also could have put some variation of this as part of the patch, but that
makes for a larger patch, and I will leave it to the apcupsd team to decide
the best way to rename packageinfo to debian. The point is that the current
packageinfo/rules file *must* be accessible as debian/rules in order for the
debian build software to work.) Then build the package (stay in directory
apcupsd-3.8.5 to invoke this command, but look for the generated deb file in
directory above)

debuild -us -uc

As a first step, this command scans through the tree to find the debian/rules file
so that is why you must symlink or rename packageinfo above.

debuild worked without errors for me, (and also the installed package works
well on my two Debian Master and Slave systems). To install the package simply
cd .. ; dpkg --install apcupsd_3.8.5-1_i386.deb, and follow normal procedure
for configuring and testing apcupsd.

Despite my success in building and installing apcupsd_3.8.5-1_i386.deb, I
cannot guarantee any success for others since their situation may be
different.  However, I believe it is at least a good start to packaging
3.8.5 for Debian because I have taken the approach of making minimalist
changes to 3.8.5 guided by the current official Debian packaging. I have
added needed files to the debian (a.k.a. packageinfo) tree (and also removed
one unneeded one) and tweaked the contents of a few files (such as the
undocumented man pages and the examples).  However, the most important
change is white-space issues in the debian/rules file.  Whitespace issues
are important there since that is a makefile. Somehow the whitespace in
rules got badly munged for 3.8.5. Without my patch (which reverts to the
official Debian rules file with correct whitespace), that file is unusuable.

I will also be submitting my patch to Debian as part of a bug report.

Alan

email: irwin@beluga.phys.uvic.ca
phone: 250-727-2902     FAX: 250-721-7715
snail-mail:
Dr. Alan W. Irwin
Department of Physics and Astronomy,
University of Victoria, P.O. Box 3055,
Victoria, British Columbia, Canada, V8W 3P6
__________________________

Linux-powered astrophysics
__________________________


gzip-compressed file attachment (patch.debian.gz), "Patch file which allows Debian packaging of 3.8.5"
     
Documentation:
 
Munagala Ramanath 

I would add documentation improvements as A16 if you
have the bandwidth to do it. Specifically:

1. A separate section discussing master/slave setup,
   discussing for example the order in which the master
   and slaves should be activated, how often they
   communicate, who initiates the communication, what
   happens if the master goes down or some (or even _all_
   the slaves go down), etc.

2. (done)
   In the "Configure Options" section, add a note that
   many of these configuration options are equivalent
   to changing the corresponding option in the apcupsd.conf
   file. Similarly, add a note in the "Configuration Directives"
   section that some of these directives are set based on
   --with options given to the configure script.

3. (done)
   In the Solaris section, ask users to verify that they have
   either /usr/sbin (or /etc since /etc/shutdown is just a
   symbolic link to /usr/sbin/shutdown) before /usr/ucb in
   their path to avoid using the wrong shutdown program.

4. (done)
   In the Solaris section (this may be worth adding to the
   other systems as well) that discusses modifying /sbin/rc0
   add a note saying that if you want to manually reboot
   the machines you can skip this step (I prefer to manually
   reboot my machines after a powerfail because it is not
   unusual for power to fail and return a couple of times
   in rapid succession and I don't want to worry about the
   unpredictability of power shutting off during a reboot)

5. (done)
   Add a note in the "Solaris EEPROM Changes" section that
   recent versions of Solaris (7 & 8) appear to have removed
   this eeprom option and there seems to be no way to suppress
   the serial port probing during boot.

6. Add a section specifically devoted to setup and testing
   for dumb UPSes. I first tried cables 940-0024C and 940-1524C
   with a BackUPS 500 but was unable to make it work (when I
   pulled the power cord, the event was not detected by the
   demon). I couldn't tell if I was using the wrong cable or
   if something else was wrong. So I went out and bought a
   SmartUPS and this seems to work OK.

7. In the "Configuration Directives" section, it would be useful
   if for each parameter, the following is specified:
   -- what the values should be for master and slave (e.g. UPSCABLE
      should be "ether" for the slaves -- this is stated in the
      description of MASTER; it would be helpful to put it in the
      description of UPSCABLE).
   -- whether it is required or optional.
   -- what exactly "default value" means (e.g. the DEVICE option
      says the default is /dev/ttyS[0|1|2|3|4]; it is not clear
      how multiple values can be a "default" and also whether
      I can simply comment out this option to get the default or
      whether it just means the configure script will choose a default
      but this option is required.

8. (done)
   In the discussion of TIMEOUT, it says "The timeout for the master
   is always 30 seconds longer than slaves". It is not clear if this
   means slave_timeout = master_timeout - 30 or master_timeout =
   slave_timeout + 30, or something else.

From Carl:
I'm responding to Kern's recent note, in regard to Solaris issues:

>3. In the Solaris section, ask users to verify that they have
  either /usr/sbin (or /etc since /etc/shutdown is just a
  symbolic link to /usr/sbin/shutdown) before /usr/ucb in
  their path to avoid using the wrong shutdown program.

Would it make sense to directly call /usr/sbin/shutdown, and
ignore the /usr/ucb/shutdown script entirely? I have never
heard of anyone moving this script from where it is installed,
although that would be possible. In such a case, a note that
says: If you moved shutdown for some reason, be aware your
must also modify the apc scripts to reflect the new location.

Sun has stated a number of times that /usr/sbin/shutdown is
the recommended way to gracefully stop the system. Since this
file is a shell script, it can be easily modified, but again,
almost no one does this.

Directly calling the script would eliminate any confusion, but
would require extra effort if for some reason the user moved
the script somewhere else. Still, it's a simpler, more fool-
proof approach.

>4. In the Solaris section (this may be worth adding to the
  other systems as well) that discusses modifying /sbin/rc0
  add a note saying that if you want to manually reboot
  the machines you can skip this step (I prefer to manually
  reboot my machines after a powerfail because it is not
  unusual for power to fail and return a couple of times
  in rapid succession and I don't want to worry about the
  unpredictability of power shutting off during a reboot)

Yes, or give the option during the config, and run a script
of some kind to do the editing (or not, if the user chooses
to skip automated shutdown).

>5. Add a note in the "Solaris EEPROM Changes" section that
  recent versions of Solaris (7 & 8) appear to have removed
  this eeprom option and there seems to be no way to suppress
  the serial port probing during boot.

I'm not sure this is accurate. Solaris X86 still has this
option in Solaris 8 - I am running it as my primary machine
at home. Solaris Sparc never needed this option, as it did
not probe the serial ports during boot. Only the new Sun
'Sunblade' machines seem to need the option, and do not
have it. I've spoken to my friends at Sun, and am awaiting
a response. As of now, I do not know of a work-around for
the SunBlade systems.

But my Sun Ultra-80 at work runs fine, and does not have the
noprobe option. It just doesn't need it. As far as reports go,
only the Sunblade machines seem to have a problem.

Perhaps a note should be added that we cannot support the
Sunblade models at this time, and why. Sun also just added
a new line of rack servers, and they may also be sensitive
to this. But I have no reports yet, and do not have one of the
new Netra servers to test with.

I am going to write to one of our friends at APC, and see if
they are aware of the problem. They were recently certified as
a 'Solaris-Ready' hardware vendor. Perhaps they are working on
a solution with Sun already.

But there is still no problem with either X86 or the majority
of the Sparc systems out there, so there is also no cause for
panic about this.

What would be great would be a way to tell the UPS to ignore
the handshake probe for a few minutes after powerup. That
would get us past the problem, unless the user delayed turning
on the system after power returned.

Earlier email from Ram:
Thanks for your comments:

1. Yes, good point, I will create a second safe.apccontrol script
   for systems requiring printf | wall.  On my Linux system, 
   printf | wall sometimes prints nothing, which is why I changed
   it for this debug script.

   Thanks for pointing out the -a option on Solaris. I will add it
   to the Solaris file (this option does not appear to be available
   on other systems).

2. Hmm. Not too surprising given all the changes. I'll look at it.
   Thanks.

3. Thanks for the suggestion for the doc, I will add them shortly.
   Here is briefly what I will add.
   --- No, you can start the master/slaves in any order they will
       ultimately sync up. The "preferable" order is to bring the
       slave up first since it waits for the master to contact it.
       Note, I added a new output to the STATUS command some time
       ago. It is MASTERUPD which indicates the last time the
       slave was updated from the master. MASTERUPD appears only
       in slave configurations.
   --- Yes there is a default NETTIME. It is 60 seconds. NETPORT
       has no default, but if you don't modify the standard
acpupsd.conf.in
       file, it will be set. The value is system dependent, but
       generally 6666 (but it is 6544 on Debian by default, ...).
       The configured (possibly by default) NETPORT will be
displayed
       in the output of your ./configure
   --- When running as a netslave, the DEVICE is ignored. The
UPSCABLE
       should be set to "ether" (without quotes), and the UPSTYPE
should
       be set to the same type as the master.  In a future version,
I
       hope to fix this so that ALL information is pulled from the
       master. There is a new section of the 3.8.2 manual (rather
crude
       at the moment) called "Configuration Examples" which is
intended
       to help in this regard.

Thanks for your comments.

Best regards,

Kern

Munagala Ramanath wrote:
> 
> Hi,
> 
> A couple of minor points w.r.t. the Solaris version:
> 
> 1. The safe.apccontrol script uses "wall " but this usage is not
>     valid on Solaris; wall gets its input from a file or stdin. The
> apccontrol script
>     uses "printf  | wall" which works. Also, it may be better to use
>     "wall -a" because this will write to _all_ terminal windows rather than
> just
>     console windows (if the user does not have a console window, he doesn't
>     see the message).
> 2. The installed apcupsd script has an unused variable "sbindir=@sysbindir@"
> 
> For the master/slave mode, it will be useful to add answers to the following
> questions:
> 
> -- Does it matter if the master demon is started first or the slaves first ?
> -- Is there a default value for NETTIME and NETPORT or is it necessary
>    to specify these explicitly in the conf file ?
> -- If UPSCLASS is set to netslave, does it matter what UPSCABLE,
>    UPSTYPE and DEVICE are set to ?
> 
> Thanks for an excellent package!

Items done:
- Add 10 second delay in apccontrol before the killpower.
- Make pthreads the default.
- Check INSTALL path on Solaris.
- Save script files on install (mainsback,...) rather than overwriting
  them.
- Document need for 10 second delay to make USB killpower work.
- Make sure rpm for 3.10.6 doesn't install the manual
  in .../man8/man8/...
- Check what changes were made to the Mandrake spec file to make non-root
  rebuilds work.
- The USB chapter is out of date as supposedly refers to files
  that do not exist in the current release.
- Switch to using /dev/usb/hiddev[0-9] in place of 
  /dev/usb/hid/hiddev[0-9] in the next release.     
- Modify hid-ups.c to handle both forms.
- Extend apcupsd to handle [0-15].
- Generate events when slave makes/looses a connection.
  Already done, I think, but check it.
- Fix USB battery voltage scaling problem (factor of 
  10 to small).
- Document the -b option, and for some reason -b and --killpower
  cannot be used together.
- Figure out why make -j doesn't work.
- Look into libgd
# This is what I was talking about in my last mail.  If the makefile had
  a variable similar to apaches' "root", all those "install" lines could
  be replaced by a single "make install root=$RPM_BUILD_ROOT".  This
  also makes life a LOT easier if someone would like to write another
  spec-file later.
- Send list of USB programming problems to APC.
- Make make install so that it can work with rpm
apcupsd-3.14.10/doc/0000775000076400007640000000000011634011374012770 5ustar  adk0212adk0212apcupsd-3.14.10/doc/home-page/0000775000076400007640000000000011634011371014627 5ustar  adk0212adk0212apcupsd-3.14.10/doc/home-page/apcupsd.gif0000775000076400007640000002350407617552221016776 0ustar  adk0212adk0212GIF89aH@

SJj$eՆ]hpAIO)5soW|(/4Ty>uGYc7Kȵ [,@+KpF:A+
ZA[z>G&G\>Ks׶I/\Dr{8,Dd5\7t+"թahA/kFk&V[:r&n
1fd";E7%k[r4PicD#NyL4I5ٴVڳ@LщlZb~!R_z>p62LѫG̹OZ.c_GL7y#K9aZgyo?ܮʙ&ЩQNȼ
T MrXDRj
bK\"3}ӨG-s3~yH}ȪFGذ ab1ϵPW˄>P:X.&TZB
v
3CppZ#G52CΘ:(#AX0nyk"0}9`EHB1Q'uR8̀()%IwBL̾0N%-vHB0~CdAK(JLH:G1HyM3혗(͔4S!ܦ7pQxSPy`wP=
OX'?IЂR^2`<GJT@Oz^*$ѕ4P0@2yM ,2,D.꙽&'g6Á訏JU8FUq7
ƫ5";C`d)SL%ʁ-1eN0
x2[?bY\5пr3x =UV%,wf?hϒuz)'=[G0x]zڷ"MkcTQesRpBr„Fhq3`}`jiC$,׆]~ЛrY!H\ʀN"lq
|n1K+XDUYx>(H q/H<+#`@n)_QI,4D2;&9&e0+EJȬ؝
cS&4<,~7+@_
_Z+V/^8[R骞6{!jع٬qJ姛
S)TvJȥk$
L{T;8m{ʎJTYۼS!?XT•8vk۾)JC^Dy	xxyH7۵zO؛f]\OLizP*b
*SBTv(Q;p۹p41^PxJ̻۳$K@d-@$Qĺ)"*PK>];@$Ļٱ	|5`ZPpls̘2cǐp|$]yhS)*\\ƈZq>f5wExk0\k΢L)/p!
97
θSE̳ǚ.iPQ~¢^ em;8Pp[$#M{|M0(9f"^칗PpA!&=Pkǡ+kk+ͮ
MɖniŸn~H}‚rz\.R9~ʍx2Nfݨ
;>yj(M|+/?䱪[)-]BM}M?<쫰+,Y=ОOɆR:3ɁnZ3.;Ok~z2i_+ںjhڨJ
;-e©錩tc_!:0SYpڢY]Ke)^[XbjXpjC~!\doNb.y] ӟ쯣❸un80РA	,8p.\@a	:,P
W:.0%((pL=!;0%Nz3 
ӎ 춂&8102j:id1LJ(58XE> fjp@D&T20/1VCZo4hǦ3)j WH̭`wdH#Qu4-ٔ83 KXRL#
mZ93Rٌ6>Rv)JBm%r6-CgJ*U$\`Y=.,QP {:ku@"
R?fm_.QzAv}ՀFjW,@[b>@6	,PsJ35 !mFuMř@|l	NNDM pEubx+
p7
Ȇg1o@#qdD/-hd%x-l
d'=IP6yְҐ<*<+W< Z4q f`ByPlJJ$$m	*\63/9D0z?˥3o7-!$lxN.ק5S:41fH9]8
8xQ$p#,%=0$:)J^b835!
iFvՆ~
)XzST5e(5$.ImԧJcTW?+*T+P
TWjN#MwzV	<*bziL
PzQoP g%+H-yך&ccQ*$!ZbJr6Vd5ւɯ,=Xӳ8PzWdQlTݺ,);
Qt`c#tJ6Dp6q %JQ
DL
{Wna+R\&zjP+ @[=.^krξؖ\%0su("Eo׫eW8&4:5l!#%eKX 0GlӥF0ub7J	W1%@w+Y381PJ1)O
ՕIG	A&@*w63ҹʚiԶī@:=98ӱ":m3@-qb[b:dCOlߢ_%БPoZg`1~1F]ZZuJ>EujEczEiOZ&au}6ҤK?s3.:ī	./aT Q)+OK(|@#|B pdC34449^{@=z+>1{7x,-4DT2AnX7@ÀBCK9U,FcŹ2
sKEcd6rEEisc|FasA.>>`6	444{222!000dcc...g,,,***
ZYY"""VUU   NMMx


e``ahYY,@H*\ȰÇ#JHŋ3jȱǏ CIɓ(S\ɲ˗0cʜI͛(ː($	@h&X4ޢ@UbR1.ހ]؆,۷H2J1A0Pu:
Ij.O>})(6֋^ 3H
F*iLh
F52sC$̒
`Yp,5aԁԩW7OE3ڄJX@B*z7ӥS;pբWɜekN5FIVӥIS5E^DHEVL<(!)@2*[T$vǂ8y5Dx#oH ,ب4 %'I@ĠdTΓĠ"%xN*Ĉ2qPb"9"$4AH*14L; 1P
"H|Ж7=dRG(Ҍ=Fi:Jʣoh "|rK
c,$	"d#	T&c3$0
+4cgj%#:d**8H;y(32-CA8-dH4qO'B:
'ၺ()XB")]G6Cf 	-dr;2LU~!z좇 .qa8P,B؈BAMz!,4sMwhP,	8kÖL32V?b
3!zL3Vp
IC'@̗85=:	63#+ț=
M,pD0K"یL02M}I|C	3)/;ēg0R/F`y6lQIr-@@RVHByr&?Ɛ4
P^t[	3`\[hT6JaS=E&	Ђ
FH_N1LЄ+vl1bQl B6(\V0 $.0@;xF`
VB1pF<Z41p xtx#	ӀvF0]q&$0v8)	YZxK03@IC|C>!'xrL@3HVF	lbA<dPA1q
N8Ɉ8 ^R
R!+`HtPm0B8(ql@#9[/bd0,. !
.*%DAڌAp)X` dH)[=P=؂
`QdA
ܢ~P-%xɾVx.TY9[6UoBĂs A!W4w0	-zt?;b3 +V
HP> ,B	l5U:$(~oc=ht
#FQVaF<%iAusQ1u<75(TDz#~CN0$I!0}tPGw"p@F1@Fo"읆Љ.yܐ"(^tшNށ}P3Љ{0%0XNcXCNV :X:o$Mc}[]ڴ!686=ԝUA(<W@@с[OR!e(ȉA3A/.~#\
,yHRSI qLsl1q@(
܍~}CL6V>3`:g
D@(7LY"6XDbp0]ME&s{	ȄBOZ-nH,r7%@V9
kAF~DT@e/.@@A60Nsś*,tvov>1ª5<ҀZ@FbnC^{}M#:/ͯmc 
mSBZXW_Aw=$$&GGO(P 2%b0lR4@FR90R	00FA:	`H"G_T55(n`Cv0
x7J6=C
30	)p(͠Wra`p
2&G
0oyUF	dOpTd	ؐ!0.@Ad67
`%0`aZWY -!UذvIR%(o#lVM	H <3=`{B/ %s60	k	vV	Q $%3l6J>'9#d:aVc	2@TP
K
ZdpN@ zPuM`00-Tn'
 
3p:ɀ
y%qܠ HH 'P4D`]~@T
; 0Gu0
Pdxp	@
`@xI`KR`ic7BB|Ъ
0h#`3QX	
u~xCcP_q#})F	P
V
ݵ16B<=@C	
\$PҎH#aL#P'[6pC_;Љ098Ҕ
pk9Z
/t0BX=f/ΠP(q[=-b-s+0B@y<0;bR)TڂG p kN56׍Mg g۳`Q`XX
:
(P/FG0EEgE##U2$EGR	 _$P*V`
\JGB@
HP 4Pm0?r	SNTIPLFB@5r
¦ x+
*@o1 A8TO/Em[0-
wi:8;&ؤM'~/Z
H6Q5@)C$='%P#0x$
"CQpbBETFusskp7;$
sg{p
"qEr
.#
T0ǰx\+vMӃ~A41O~*%Os-q` -
F{@&}	6gp	À
 	$@PW`д{ 
ߠs(-vnPxjHt'}:*~V^6=]?+؀TOtSәYhդe-0*ms@.u`:r80U%iR[N:3wp0H`I8p-Z'Iԅ	zQ`FOP0&$"
 S\;[
@

7|@PB
h>0ΜS."$d(bߨ&>yk֬D-m[UrBHwN6A(Ay@̕N!rԵ<~$:t"Lؕ
AzQ`s\#Yto$1i&DT`*DV%XF
t.d"KbL$]@q^ܺm
 ,ƨ,*BlZ
 Mi1*öw! pTX- %I[ZT9
V7H&Y&/ˬBH|p
n
{q#w RR[jh(''2aadHHr	"i17!k("HL(Aع%p*B>ҧJ*	p!Lid*skH,xQT0
J%BPnpF9rȹ:F7
ق=Fyr8|()"!#B@IH|qSۢf!)WG/|ȍTXcaRBGV]i#bG(Ǟ|#>9#d}\
dKh*x.tO`4DI"
:n"TH%
Xb
*Nv)J&OEIB`a܂K?|P)i!91E9v"0RP"@H5:""=։x`w"JLTn:(82b\≷H%vFu8i.bҀps’ 1.B`Ff@t;
 Vyǐ?A8"u2AeY[ vr
0h8*VAYpA-h^t+(1ZX@1L!	'SD!
M-P2h4` DP"H9EZh.#'[ `
(7xNa`SZC
0A8P8#Z*C60^0]%BbHjhT!C=,^@bH.nW`
6PS 2&1XB֑|h	4ē
b@
V
cG%d ,`1
 =$C0E"
`&"T~r<`c8wb<2'tb%7FaȀt	C`!@)qXlQE(X
Ɇ(
q	RB31! :&x"" UvR|< La(
(РKxu3`
F^dX	1}X*@z#6k`Yxhb
HYgxd65K ^!r`tv14aB&j0F@.|l[PMLNXf`Nz̡@)J!l !!&a+xִĠDJhX-J~q:gpP
Q,Nu@^L&_Mn7y6XnЋB)hGe8CD(,a"b--f09e+d%4By88s1	|:@`$E,HAFpT%%lEJCf8 5Ĉ1 8*^
Xbÿ\Z.0A0-cb_0@%Ba3X	+4p$ /^0P!`Odzpr^.it!*TXa/$F`8;ߝFV
h!,n
@8F#(bѥJ
@4bA3aNʩp@ 	y Vw/t98c	oYm^h`	װBv)#pb8#as" B?6o2:=c~!A׹RxD7}e?{;Xo.~?|G~|7χ~?}W~}w?~Gտ~7
9l#:
Bʬd0@@@0ClhHs0Є!)D@S8028s)ФE@(sM(?9kP/=K'+aDX^(QX@[P'02ܫ
%Hd	5b'0%x`˂I(!hDH^؁APzPuzH0eCM@d0s?@|eJ#>G+a؁(j0!x@aBȃB؁!piHvHedf\h,Ej$9H:PQ{[3`Uj!q@X@x T@hINd.P;%A@^dh8[v8k1aƆB` XЁ5%/02:)T@FҰGqH9:Ȅ(^I0k 3U"<ψjhT	ȅ_8`DBHQFg|`	*60xM!{ԧ9pH	(:+?
`	ȔLɤI	hL	A0
@\F	[}KKsxl@MpxʬsHRbp9c2a؆!ЃxJqX뤔POHb10Sقx		1&G7%L()8\s,04h(8b`mcSM؋Tp0x_pqӔ1lP6LXFΤΕPIPcp؀gH+U/ qDP|H;W0xQpxa06hWP	TLD<`!0cl5eְ5\5.8Yۈkv6ʁRq\`zf@exsV)ڛ-Tαά
CR $-)XU({؁1c(_q/>yH؆,F{oC]epoziqJڬ&Ȅi"T q Wא
~Iם фD㠀Ѓ@	\#*r0S+KK&S8% ``8$XsXNҘU$Y5ZXY@?BD		rfI3FHr\qk؇`qoiq\Q>o`lQiMivo
=QVOJfSo\#Fh jig_
Er|<Z8#
"\hUI^H"ϔIڰU$7ްE&,#eV8d#4zPUSV]yG)4\_ d;%Ed$1MC

P}sH!ds;԰E>QɁ-,lařT,	lʎiLlA
Ml
a
++UtA#-A'$w
,ʈӥVIć(#@)8`3)Hs2˦L2B@\h Ё+8l~ $@D
M/"DqNѴFuq@B5Žh6)CNqJL ;f2R{NQj33+@AHG
u048zd LAtZW's2M14sV	pn+,B7"D5XbЬyEy`Q0d%fA}{أ0a	+4P3 xosyF A/tQ'-v{pAv&6PW}>Z	C
f`I%zTpcHMԇ6n1X#	43\^	: GdЅ1",
XB#C4&p 1}뜀=7kE
[A+j>MDֱ{3fU`CHsϚ| N0\@=[@2X|`9fl@Ё+T,	Ez.*'<#6V˄-0.@4<@D1#MJxDf
t`
0QAEEJv`
_fPq-,Ab/q'0Sx`o3p!
FwBf,dǏ#GD>UAFtuRsHWo	V'c1Nt!c-"jf(6l]UPw0F64M5?8<0!eD ;=Ȋ-I䁸=$:8lЫp@!BFtTa
rux+Ba!hB,2qqm	A,B3/C-$
9`4A A/@&dB<4.`&HA/@"a",C$A_1B	d)oC@ +k5K
I=́8,14d%A*P4 C=܃^A_e#B)Ā7+>h, 5AGC$
\<Z<xCJ܁:48`A)6b0+$,>QgT l#OC9bxA_M=4-¾l! ꨂxT/pAh	dLZ
Hh1q
%.@B"BB78^h4
>-C/H(H	l$C'L؂3
N2=n tA@A-87AMځ$*X@L2؝9d~"
e4VA].4<#\1A2!%/7=8I'X%5$rN,nd昀܀>W7o%pHxnP#"y
$V
̮$B0ځ:#9PBAy2..0Vhʂ2B-h$;$h8=oT+OOoR30g6o37w73883993::3;;3<dz<3=׳=3>>3??3@@4AA4B'B/4C7C?4DGDO4EWE_4FgFo4GwG4HH4II4JGt:Lp'd(Z4lM۴	؀Nt$0O4P475767L#(M3:R5QSQpC$M+
8UCVg'TU53tWCVy7 Sõ^^ 39u[MuOsC4ՃX$d,deg@2,6%:S΀'1q06":g>3X58@$lv0{˜e]w
dL0
ܮ5'l#P5q#G$c/-t$|gi(tS
l7ʎ:LnoCv$ Z@=(Cq 06`[v/Hx$px%vh' dx 0,ԃ	h;̝8#=x=#08C
y
lC<Aߡw,Bx@=<@" 3@ZCE:(:,:,G=%48z.S9bB%$€s2lB1oI(5`kǔ_2g[(1z1Dw߀%2$w4oA\"X)<
-FIB&4͐yg$"0 B16GW\	/B"LL:?C8AsUB<@%<';8;'D{%5I:t+h>Ŀ!/*#<0Ly8%L\_A
h)mABѧB$@dj_fB(:L܀2|HU'=S#nB
,$%9<̓
)<@cD3|W1dXB[<ԭG#4T)K6$7;e?G׻seP]H?l6iUSM&))4:̸7p,P;ٗ6Ɖ\!irH%d	!0MbV'V7<@ Ai Ӕ3kg'0[
:5dIA'5+GiM4DKL"TSE
L=Г§%NT
L1`.ѢU̢\MK`gQ{iJ	T*`]W9 Ş3	7n`Xު'.qPt'=*($X|-R$xva,8Ìu$=y&C2ق,
Mf"dMv(B(doCPFY@J17DOaP`x8UG ARTap u@{OMȰ`!P!v1+@-cHBHxbT?,!CI :ߠmYl4fDJbF	)uT@Z
ySXR b'F.(6.<k A1j &v`#ɷ_;0$[Y-΁4dIG&͗۾3Xl	#jeL>|8aM mRڀ.	BƐ”0BaqhY5{b	`:D1|Zd%CɰdM 䵖OR(JvqAdeocR܂QAi:`T;n;ةc}Nc(q'ҹ!jآ@mlcVDq.x<0fBmO*NB7IRT\q$a,/ A&{>X2!6bRy/F@:0`Cp*%8`vPܗ4/$#f0	Dl[ٯ(!3%̙<
78aAbްپCJ u+ZU +A;aN;;T1yn[E3sɻp#<)k_Y	zpLx`ʘfNY90k)H*nQ -HB
%!x2$Tp`:
8?`m2TL#sr5`z挃&Lv d%1(1b"4@B
0Yw^s
,-7hNx"ÊO:l#xT#A70&x@M0
l``@^!*jbi8@" P]":$"xU,Ϯ`K7w:Ps9 <{ah :Gt&!Î7 .Fv\A0@am`60BzefZbJU
y96@;H<`.4086@ƱZ
<+FA0 ~xM F5g`)1QJ1ЕH$, M\:0p@
0pP/{!#BQa:pš{A"3GF?-ʰJֵ;Bh
AA/LGiS$t"KYB
$@B) U
PFa1xGRD#@ q'uKV"҄"3¡LbDbl(ܪ7$
"3[2( -
'Ǩ^ã:
T"Ѓ9:wwYkD@Cmݐ(	saAGn NWϰ;R&@)Npp0@J؁4=8E'F#bU18#FmLj3/cxkJةO7K#WI5&ij:8S!Qx30Hu[XT2@D^ЋX7+8`	``Q
u<=d( 
l,#^`	SLG nV
pa$
J4F*&٠p4
CD1NRjyrfgʈ|o`# abZoȎv(e<@ևCnTH2gdA!΁zY&!甤@n0 '\O8*`D-T``t`Q>(DJHd.Ǔ!AaaAh"A !@DaݤP}艖
00kINOjA-uP8b*xkdP06PS84a Kua`	Ҁ|	a
d~ V`~`&4` 2 > zn	a\@^``GCfMDxaJ&x^ a`zb
f!nX)cd2s>zz&0ДH ߈)'cXbAv4a6/BBDrs'
؃'{jnEvh$^A.(!
"fnB{Pb1a*7M@AIi2A
H@C0A&Mx2zm$&oRX
` `	jVG +'ˑ8@`*
Pn@v8 >lalP@O h.
La
>!`LaO$JIaZ|eq}
awA#EYUyԇʺdaD#4P$N=
Y
8:.,KiskYD˾,60|@Lab@+
bab!L> LY!qz֡/TDGGJ2.IGdtڡGN=N"m|/ijHtC`R[9B.$6.t	|5ڠ"l6GcƄ
a	
~a& !GDT@@~f`8drFvyV`/•:6@TFb lHbV=_D>-\r*C.BpMtB`#rH=n#Pra!a'
(a
	@	X+dah~hSZ\Fj]@!
	AW,uO6&Ȫ-{b(ccBALj ma܁a9!aw!Ag!6i&:a,.
@ 
	!Jhx]#ʦ,L0FpJ(}*jX0l`Y)"s{i1o$|qS1<`
^A.짰z$
if"#-Ya9ǀc
AZ$?MSvc@!
BN
S4rXXIP0;<]k6`hrmhzBCB%ނvaLzsT4l@bA\ץQ2	M%3uoFЉ
Z^2#LD^"l (<:`[jj.kfZzv	!
@p@F
2']4A|]N2uNxZua	
<Fx1os>ZbƁ<@E0Xϸ!܀1B:at; ax!ԡP0~QLw[s,2r
8A^<?ŭhG

XbQcݭR
a2ZD%"/`exJ2Bc	!4vaX,z%JUj s72!GXTh t:z"|N&3^Sc&Y\J/'}b

[:U	9&+Z1ƍ'	4#Gq')7U瓷f%`)^J}9Xø-5֣sBZF%Ȃ!:&`%*%` .t@^>ErŲ(@XJT!VP(lO5-臏:TJ-JŖ1J(sf -:>>
<_G
Abo4Ma\=‚&ܻ7!
	${Bh#0kTc."!
$ӊ,4CD5V4"֑>c2PIkO}Blla$y@=rMFJX29"i%XcHF(Rd#Gy:\T(4U4OPFl#>4aZA31Jӌ`kdGPG*I$4`)E$ZQ:J,6rH\	lQCDnZsзёI6#BHЌ7
p! Pg 6̐$Ё
:FV\c0*>~G\qe3<	BC{B

Ϭ#	V'B2h`V]}U#3`0S5-5L)Ѝ/ha,H
YH!ɂxI@@
#saWOwCN\pL);х?\37r8	\ް-0D`s/
B+0O/,0Nr
MЋpQ+YEc•kHD)`8Il6B&"78+2#X*k%F/=FXx"
N *\iJZE BpB*\e
3xA`Ľ5j"D<ƀQd`x VL
UA.tQr(:O s9!
E X0Pr.NzA,Ft/ PQ(B,b!QhR-
(P,0&+;. #uã2A$Aؔ/ AXpc	݈8e"zdI(+!S(rHLX?I0*K	@َgH!Zi#\a!Xo|6ыX$ThCk,FgI9OW`Cψj"X\Fi)s 
^!\"F`С61J#
$c	\^TB^@=#0y*Ȅ(xdb`
wRJ8e9b8.	
+B:
,":(DL"ЊH̦8u ^@ AbC411-Cgow1A[4CR(t`E+&e.@	*:uhe@wD*zKb"	[,ÿL厈42Q*OgBIA
^*tE9al@=1OSj0FB
p
rF7{$DAO3LE*[	uh
\:|QQTrk=:QW560hbMXЍ,aKCU{Nl|!Df#e	['RAcw"vA.`KV"	QD<[@L	%5.[}X#׵5f/"s(d<@B 	4{AY<Ed@Yиpwi|=dЛ(iI,Z N귫poAxb{<[PP8jn!Z1@|9c fPJs\ \-  d#
FylNaM`#s$qŒ@L'Sd@FIE'FӅE,ʱ|J«;j]+[Ȅ	Fg[E:@F>D
^z㈴M1C@1Cgz?BF!1
$$8#	s`
"9.7\a `gaaC0P#;C	z0cC$$P:PpQr7
ˀ h:-;aY-"K<@$ 37 @B 7p
`c
`
0Ӱpo
CдaCw{AP)W")?InxT"ۧKF$
	0	 -	L0-.PT	j7 M	HpP|҈	X$p`pȰ#0!j	S`
k`J308D6|E"

!Fh`
;0	aZ090
pR{59]}S];XgXO`cPm
xpXy@c	J&Ӂ}	
XI ">0;`	f=`L	T2ԄÐO]Ҵ, h2b]`	ky@p28
Y
hog&qZ|j7u)Y<` rp0xހ2ϑb0PP#A1`03V
\ 4P`l0{@G
P
א
ՀE#0m0<2
HPy$mТ`
! z 
P;NpK< `	
`
F `i``
`
k8w{- 
-B`ϐyM@sRq 
	"`"{JPz R?gB!<@dO`
 	
: 0'{``r@6~`t!pQ
p	{Pդ`B`P{
]!P
kTx)&`e
<  E؝:
wip k	2	+ǝ1vbLЉ{
y5[2#N|@	Dp`n w0ipl0-@
I_TBETQ#;
*	k8/{[`r``	J@4jBRGbp
E 0
6K
	P@9
B9@2|0ЦA@h[$ mG5:!@t
Pj
0	R	-c01D3$4P`@%HPȡ3`|
аPD@	sx-TpPL)Uצo*DϐJ5*k]@@
(00[{
\<EZvCyD`C4Re}
 &#`v0uA~`w 	``]^sPxQ :Pc`p
` E0ø@hpsX@x;^}wL- #!PI
0kpS8')CZ!r& `a0M[pkŜP/ ^(׿)Ǧ.@b\4Oc L
iG̏`
*c7Gp	pM>
F#UѦ>p0
ذP@%P\t:;'00.FQ !8a.J`\|pg`C0$W1}s}E`HP
ӕ~"`	r0	0
GP
x2?
pO}vpP
PHRV&p	:`-@
3

hTgRi`#q	!PpQ(HDu7*fuE11rRHY!Ʒ4S0`0D\}`Nq}p`T]0
H
7&>,hb	Ӂ
`Mw#Ǎn`l0HH#7Pp[r&F
k?+}&FRWŌ$
i`	`Ikؖpp-p`

!z]%.=fp
֠`
-m85
P˶wWZ~up]$d
-Ɣ16.	Pm@T@/.zpc@6jwr=I@DVK`f_u1;A`
6::W#WvߦH#x#
ҁ%/x"
u@*O,P	?`N\ǝ,
$d
q4pG
9	CP@t!hV7L8;`ذa
,-*d1ݟ:ZPH:4
5Jʃ$^""²H+,Ap4r,t@~s
G2Z]@fjRQ-.Ĉi-@^Bz%*:HЪ.!T@!`Ǩ1ΪXm;ms&mK@TeԤE9hq!fOsybvӽ]@jAUѢѥp 'ZPr{{y;ba_dMD5A>R`w{A?=.e&?hgI#}jj	20 	[Ŷ($MĂNb{VX"pā''16	<f م,FAKq2`lFA.N@X^<&sȧ0brp8i=NȜPG#c@/2@A;|E-ah|G౎`a	D҂2$1PL>i78i\#ǀ!9MA="hH8|B20cTl=ƶ#rLEraF j30I%'6] 8!P!h$1, a3dQv+=O LX3cw!~C(6sC@6B6p?>%7)L!KX<ʉX@
*][>`sC8"x5 \e4WE'!hB
=iyH
Yك*Z 
}t	Ob5\TcP!
k$-i8>FVf	|5*G\@RY@0໢9bYE0Kw!qz>|,~&>9FƑX  #;LJ
0C"a`[{*&h %aȅ0*"T}đwwX$$3*j).n@D
t80r7^</z>a4	.0"a'g> Gu5AATya"@QpG<sh򫵁E=WYxJ
&; QƁwDl|
p@q@kj(õ} ^
Pڐ`	CX[aQ{j]o9 uCȹ/a/?8uspK9>x3S+^b88Ӽz8qjzZ'B';s*Jbs27+.%9B\F{'>Y3(**C-#.H{3yJx@77G;@#<;DB,:{ȃ;C/"2ED4D-2DLDMDNDODPEQER,ES

Apcupsd, a daemon for controlling APC UPSes





Apcupsd
General
Apcupsd Home
Site Visits
 
Documentation
Online Manual
PDF Manual
 
Downloads
All Files
 
Support
Email Lists
Support
Bug Reporting
 
SourceForge
Project Page
CVS

SourceForge.net Logo

    

Bug Reporting

Before reporting a bug, you should probably check the Source Forge tracking lists described below to see if the bug is already reported and if a patch exists.

To report a bug, send an email to the apcupsd-users at lists.sourceforge.net email list. The previous address was modified to prevent easy use by spammers. To use it, you must replace the at with an @ symbol.

I (Kern) get a number of "off-list" emails sent directly to me. Please always copy the appropriate list, if you do not copy the list, I may not answer, or I may answer by copying the list. If you really have something confidential, please clearly indicate it.

Information Needed

For us to respond to a bug report, we normally need the following as the minimum information:
  • Your operating system
  • The model and UPS cable you are using
  • The version of apcupsd you are using
  • A clear description of the problem
The first three of these items can be fulfilled by sending us a copy of your config.out file, which is in the main apcupsd source directory after you have done your ./configure.

In addition, we will sometimes need a copy of your apcupsd configuration file. If you think it is a configuration problem, please don't hesitate to send it preferably as an attachment.

apcupsd-3.14.10/doc/home-page/bugs.wml0000664000076400007640000000271010215662060016311 0ustar adk0212adk0212 #include "template.inc" name=bugs

Bug Reporting

Before reporting a bug, you should probably check the Source Forge tracking lists described below to see if the bug is already reported and if a patch exists.

To report a bug, send an email to the apcupsd-users at lists.sourceforge.net email list. The previous address was modified to prevent easy use by spammers. To use it, you must replace the at with an @ symbol.

I (Kern) get a number of "off-list" emails sent directly to me. Please always copy the appropriate list, if you do not copy the list, I may not answer, or I may answer by copying the list. If you really have something confidential, please clearly indicate it.

Information Needed

For us to respond to a bug report, we normally need the following as the minimum information:
  • Your operating system
  • The model and UPS cable you are using
  • The version of apcupsd you are using
  • A clear description of the problem
The first three of these items can be fulfilled by sending us a copy of your config.out file, which is in the main apcupsd source directory after you have done your ./configure.

In addition, we will sometimes need a copy of your apcupsd configuration file. If you think it is a configuration problem, please don't hesitate to send it preferably as an attachment. apcupsd-3.14.10/doc/home-page/dl.php0000775000076400007640000001366711302022222015744 0ustar adk0212adk0212 "Source Code", "win-binaries%20-%20Stable" => "Windows", "osx-binaries%20-%20Stable" => "MacOS X", "rpms%20-%20Stable" => "Linux RPMs (official)", "rpms-contrib-psheaffer" => "Linux RPMs (psheaffer)" ); $URL = 1; $CAT = 2; $VER = 3; $NAM = 4; $SIZ = 5; $DAT = 6; $DLS = 7; function getfiles() { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://sourceforge.net/projects/apcupsd/files"); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $res = curl_exec($ch); curl_close($ch); $res = strstr($res, "All Files"); $res = str_replace("\n", "", $res); $res = str_replace("\r", "", $res); // get list of all available files and their attributes $count = preg_match_all( // cat vers name "!href=\"(/projects/apcupsd/files/([^/]+)/([^/]+)/([^/]+)/download)\"" . // size date downloads ".*?([\d\.]+ [a-zA-Z]+).*?(.*?).*?(.*?)!", $res, $files, PREG_SET_ORDER); // remove duplicates (due to "latest files" list) $out = array_filter_unique( $files, create_function('$a,$b', 'return strcmp($a[1], $b[1]);')); return $out; } function array_filter_unique($array, $compare) { usort($array, $compare); for ($x = 0; $x < count($array) - 1; $x++) if (call_user_func($compare, $array[$x], $array[$x+1]) != 0) $out[] = $array[$x]; if (count($array)) $out[] = $array[count($array) - 1]; // last one is never a dupe return $out; } function versioncmp($a, $b) { // [0] = entire string, [1] = major, [2] = minor, [3] = rev for ($x = 1; $x < count($a); $x++) { if ($a[$x] < $b[$x]) return -1; if ($a[$x] > $b[$x]) return 1; } return 0; } function getversions(&$files) { global $VER; // assemble version strings into their own array foreach ($files as $file) $versions[] = $file[$VER]; // filter out versions not matching A.B.Cd format $versions = preg_grep("/^[0-9]+\.[0-9]+\.[0-9]+[a-z]?$/", $versions); // split string into array at '.' and prepend original string foreach ($versions as $version) { $tmp = explode(".", $version); $out[] = array_merge((array)$version, $tmp); } // remove identical versions $out = array_filter_unique($out, "versioncmp"); // create result array containing original strings for ($x = 0; $x < count($out); $x++) $out2[] = $out[$x][0]; // finally, return array in reverse order (most recent version first) return array_reverse($out2); } $files = getfiles(); $avail_versions = getversions($files); if ($version == "") $version = $avail_versions[0]; $version_ = strtr($version, ".", "_"); $notes = "http://apcupsd.cvs.sourceforge.net/viewvc/*checkout*/apcupsd/apcupsd/ReleaseNotes?pathrev=Release-$version_"; $chglog = "http://apcupsd.cvs.sourceforge.net/viewvc/*checkout*/apcupsd/apcupsd/ChangeLog?pathrev=Release-$version_"; $pubkey = "https://sourceforge.net/projects/apcupsd/files/apcupsd%20Public%20Key/Current%20Public%20Key/apcupsd.pub/download"; $rpmkey = "https://sourceforge.net/projects/apcupsd/files/apcupsd%20Public%20Key/Current%20Public%20Key/rpmkey-apcupsd-0.1-3.noarch.rpm/download"; echo "\n"; echo "Downloads for apcupsd $version\n"; echo "\n"; echo "

Downloads for apcupsd $version

\n"; echo "
\n"; echo "Other Versions:\n"; echo "\n"; echo "\n"; echo "
\n"; echo "

\n"; echo "Release Notes | \n"; echo "ChangeLog | \n"; echo "Public Key | \n"; echo "RPM Public Key\n"; echo "

\n"; $colors = array("#E8E8FF", "#B9B9FF"); foreach ($category_map as $category => $catname) { $color = 0; $header = false; foreach ($files as $file) { $isrpm = preg_match("/\.rpm$/", $file[$NAM]); $issig = preg_match("/\.sig$/", $file[$NAM]); $isrel = $file[$NAM] == "ReleaseNotes"; if (!$issig && !$isrel && $file[$VER] == $version && $file[$CAT] == $category) { // only output the table header if table won't be empty if (!$header) { $header = true; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; } echo "\n"; echo " \n"; if ($isrpm) echo " \n"; else echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; $color = ($color + 1) & 1; } } if ($header) echo "
$catname Signature Size Release Date  Downloads 
$file[$NAM]N/Asig$file[$SIZ]$file[$DAT]$file[$DLS]

\n"; } echo "\n"; echo "\n"; ?> apcupsd-3.14.10/doc/home-page/index.html0000664000076400007640000001755311616624404016646 0ustar adk0212adk0212 Apcupsd, a daemon for controlling APC UPSes

Apcupsd
General
Apcupsd Home
Site Visits
 
Documentation
Online Manual
PDF Manual
 
Downloads
All Files
 
Support
Email Lists
Support
Bug Reporting
 
SourceForge
Project Page
CVS

SourceForge.net Logo

    

Apcupsd a daemon for controlling APC UPSes

Apcupsd can be used for power mangement and controlling most of APC's UPS models on Unix and Windows machines. Apcupsd works with most of APC's Smart-UPS models as well as most simple signalling models such a Back-UPS, and BackUPS-Office. During a power failure, apcupsd will inform the users about the power failure and that a shutdown may occur. If power is not restored, a system shutdown will follow when the battery is exhausted, a timeout (seconds) expires, or runtime expires based on internal APC calculations determined by power consumption rates. Apcupsd is licensed under the GPL version 2.

Apcupsd Releases

Stable: 3.14.9 (22 July 2011) [ Source ] Windows ] [ OSX ]

Release 3.14.9 brings a number of new features including...
  • SNMP enhancements inclduing support for MGE and RFC1628 MIBs
  • Support for USB on 64-bit Windows platforms
Please see the ReleaseNotes for details.

Apcupsd 3.14.9 is the latest stable release, containing many bug fixes and new features over previous releases. Users of all previous versions are encouraged to upgrade.

New Features in the 3.14.x series:

  • USB support for new platforms: Windows, Mac OS X, Solaris 10
  • Native Windows port
  • Improved tray icon support on Win32 (monitor multiple remote instances)
  • Menubar monitoring application for Mac OS X (apcagent)
  • PowerChute Network Shutdown driver
  • Rewritten SNMP driver with no SNMP library dependencies
  • GAPCMON GUI monitoring tool
  • Unreliable MASTER/SLAVE networking mode is removed
  • New configuration directives to set paths at runtime
  • New configuration directive to set UPS polling interval (POLLTIME)
  • New Makefiles supporting dependencies and parallel build
  • Updated documentation
  • Support for the QNX operating system

Online Manual or a PDF Version of the Manual

If you want to learn a bit more about apcupsd, you can browse the manual online. If you have any corrections/comments to the manual, please send them to the apcupsd-users mailing list (see below). For bug reports and developer contact, please see below. If you want a pdf copy of the manual, you can find it here.

Bugs and Email Support

Please don't email me directly, it is much better to address bug reports and questions to the user's mailing list, to which you must be subscribed, otherwise your email regrettably goes down the bit bucket -- you can blame the spammers for that. See the Email Lists page for links and how to subscribe.

Release Notification and User's Email List

If you want to be notified by email when new releases are available, please sign up for the apcupsd-announce mailing list. This is easily accomplished by following the instructions at: http://lists.sourceforge.net/lists/subscribe/apcupsd-announce.

If you would like to receive the user's email, please visit the following site and follow the instructions: http://lists.sourceforge.net/lists/subscribe/apcupsd-users.

Apcupsd Network Information

To see my Linux/Windows APC UPSes running with apcupsd in real-time, just click here.

Other Software for Apcupsd

David Ranch has developed some very interesting graphing support for APC UPSes, which works with apcupsd. Using apcupsd's logging capabilities, David provides setup instructions and scripts to produce high quality, daily PDF graphs of all the important UPS power conditions. To learn more about this, please visit his site.

APC

If you want to know more about APC products for protecting your computer, you can find it at the APC Home Site.

Apcupsd Hosted on Source Forge

We have moved the release of source and binaries (downloads) to Source Forge for several reasons: 1. Lack of manpower to maintain several sites, 2. The excellent Open Software Development services offered by Source Forge. In addition to hosting all our new releases, the Source Forge site has a CVS repository where you can find the very latest development software. Please visit it and become familiar with how it works.

If you wish to get a copy of the latest CVS code, you can do so by doing:

  cvs -d:pserver:anonymous@apcupsd.cvs.sourceforge.net:/cvsroot/apcupsd login
(Press ENTER when prompted for a password)
  cvs -z3 -d:pserver:anonymous@apcupsd.cvs.sourceforge.net:/cvsroot/apcupsd co apcupsd

The above will put a copy of the current CVS into the directory named apcupsd (better make sure it does not exist before issuing the command).

Thereafter to get the latest code, simply:

  cd apcupsd
  cvs -z3 update -Pd
apcupsd-3.14.10/doc/home-page/index.wml0000664000076400007640000001406311616624404016472 0ustar adk0212adk0212 #include "template.inc" name=Apcupsd

Apcupsd a daemon for controlling APC UPSes

Apcupsd can be used for power mangement and controlling most of APC's UPS models on Unix and Windows machines. Apcupsd works with most of APC's Smart-UPS models as well as most simple signalling models such a Back-UPS, and BackUPS-Office. During a power failure, apcupsd will inform the users about the power failure and that a shutdown may occur. If power is not restored, a system shutdown will follow when the battery is exhausted, a timeout (seconds) expires, or runtime expires based on internal APC calculations determined by power consumption rates. Apcupsd is licensed under the GPL version 2.

Apcupsd Releases

Stable: 3.14.9 (22 July 2011) [ Source ] Windows ] [ OSX ]

Release 3.14.9 brings a number of new features including...
  • SNMP enhancements inclduing support for MGE and RFC1628 MIBs
  • Support for USB on 64-bit Windows platforms
Please see the ReleaseNotes for details.

Apcupsd 3.14.9 is the latest stable release, containing many bug fixes and new features over previous releases. Users of all previous versions are encouraged to upgrade.

New Features in the 3.14.x series:

  • USB support for new platforms: Windows, Mac OS X, Solaris 10
  • Native Windows port
  • Improved tray icon support on Win32 (monitor multiple remote instances)
  • Menubar monitoring application for Mac OS X (apcagent)
  • PowerChute Network Shutdown driver
  • Rewritten SNMP driver with no SNMP library dependencies
  • GAPCMON GUI monitoring tool
  • Unreliable MASTER/SLAVE networking mode is removed
  • New configuration directives to set paths at runtime
  • New configuration directive to set UPS polling interval (POLLTIME)
  • New Makefiles supporting dependencies and parallel build
  • Updated documentation
  • Support for the QNX operating system

Online Manual or a PDF Version of the Manual

If you want to learn a bit more about apcupsd, you can browse the manual online. If you have any corrections/comments to the manual, please send them to the apcupsd-users mailing list (see below). For bug reports and developer contact, please see below. If you want a pdf copy of the manual, you can find it here.

Bugs and Email Support

Please don't email me directly, it is much better to address bug reports and questions to the user's mailing list, to which you must be subscribed, otherwise your email regrettably goes down the bit bucket -- you can blame the spammers for that. See the Email Lists page for links and how to subscribe.

Release Notification and User's Email List

If you want to be notified by email when new releases are available, please sign up for the apcupsd-announce mailing list. This is easily accomplished by following the instructions at: http://lists.sourceforge.net/lists/subscribe/apcupsd-announce.

If you would like to receive the user's email, please visit the following site and follow the instructions: http://lists.sourceforge.net/lists/subscribe/apcupsd-users.

Apcupsd Network Information

To see my Linux/Windows APC UPSes running with apcupsd in real-time, just click here.

Other Software for Apcupsd

David Ranch has developed some very interesting graphing support for APC UPSes, which works with apcupsd. Using apcupsd's logging capabilities, David provides setup instructions and scripts to produce high quality, daily PDF graphs of all the important UPS power conditions. To learn more about this, please visit his site.

APC

If you want to know more about APC products for protecting your computer, you can find it at the APC Home Site.

Apcupsd Hosted on Source Forge

We have moved the release of source and binaries (downloads) to Source Forge for several reasons: 1. Lack of manpower to maintain several sites, 2. The excellent Open Software Development services offered by Source Forge. In addition to hosting all our new releases, the Source Forge site has a CVS repository where you can find the very latest development software. Please visit it and become familiar with how it works.

If you wish to get a copy of the latest CVS code, you can do so by doing:

  cvs -d:pserver:anonymous@apcupsd.cvs.sourceforge.net:/cvsroot/apcupsd login
(Press ENTER when prompted for a password)
  cvs -z3 -d:pserver:anonymous@apcupsd.cvs.sourceforge.net:/cvsroot/apcupsd co apcupsd

The above will put a copy of the current CVS into the directory named apcupsd (better make sure it does not exist before issuing the command).

Thereafter to get the latest code, simply:

  cd apcupsd
  cvs -z3 update -Pd
apcupsd-3.14.10/doc/home-page/license.html0000664000076400007640000000435511511357273017156 0ustar adk0212adk0212 Apcupsd, a daemon for controlling APC UPSes
Apcupsd
General
Apcupsd Home
Site Visits
 
Documentation
Online Manual
PDF Manual
 
Downloads
All Files
 
Support
Email Lists
Support
Bug Reporting
 
SourceForge
Project Page
CVS

SourceForge.net Logo

    

Apcupsd Copyright and License

All the apcupsd is released under the The vast bulk of the code is released under the GNU General Public License version 2. Most of this code is copyrighted by various different people. For details, please see the individual source files.

Portions may be copyrighted by other people (ATT, the Free Software Foundation, ...).

apcupsd-3.14.10/doc/home-page/license.wml0000664000076400007640000000063510200233670016772 0ustar adk0212adk0212 #include "template.inc" name=license

Apcupsd Copyright and License

All the apcupsd is released under the The vast bulk of the code is released under the GNU General Public License version 2. Most of this code is copyrighted by various different people. For details, please see the individual source files.

Portions may be copyrighted by other people (ATT, the Free Software Foundation, ...). apcupsd-3.14.10/doc/home-page/lists.html0000664000076400007640000001007411511357273016665 0ustar adk0212adk0212 Apcupsd, a daemon for controlling APC UPSes

Apcupsd
General
Apcupsd Home
Site Visits
 
Documentation
Online Manual
PDF Manual
 
Downloads
All Files
 
Support
Email Lists
Support
Bug Reporting
 
SourceForge
Project Page
CVS

SourceForge.net Logo

    

Email Lists

apcupsd has two email lists which are described below with links to subscribe, unsubscribe, or modify your account. You must be subscribed to send email to these lists.

apcupsd-announce

The apcupsd-announce list is a low volume list for those users who wish to be notified when there are important events (important bugs, new releases, ...). We recommend that all users subscribe to this list. Do so by following the instructions at http://lists.sourceforge.net/lists/listinfo/apcupsd-announce. The same link can be used to modify your preferences or unsubscribe as long as you have your password.

It is also possible to get email notification whenever a new package is released on SourceForge. This is accomplished by going to the Apcupsd SourceForge Project page and clicking on the little letter or mail icon under the heading Monitor in the row corresponding to the package you want to monitor.

apcupsd-users

The apcupsd-users list is the general forum to ask questions about Apcupsd or respond to questions from other users. The volume on this list is generally light, but can vary. All users are encouraged to subscribe and to participate. To elimate list SPAM, anyone wishing to send a message to this list must be subscribed, which you can do by following the instructions at http://lists.sourceforge.net/lists/listinfo/apcupsd-users The same link can be used to modify your preferences or unsubscribe as long as you have your password.

apcupsd-commits

The apcupsd-commits list is a READ-ONLY list to which you may subscribe to receive diffs of CVS commits. Please do not send emails to this list. You may subscribe by following the instructions at http://lists.sourceforge.net/lists/listinfo/apcupsd-commits The same link can be used to modify your preferences or unsubscribe as long as you have your password.
apcupsd-3.14.10/doc/home-page/lists.wml0000664000076400007640000000434010557501407016516 0ustar adk0212adk0212#include "template.inc" name=Apcupsd

Email Lists

apcupsd has two email lists which are described below with links to subscribe, unsubscribe, or modify your account. You must be subscribed to send email to these lists.

apcupsd-announce

The apcupsd-announce list is a low volume list for those users who wish to be notified when there are important events (important bugs, new releases, ...). We recommend that all users subscribe to this list. Do so by following the instructions at http://lists.sourceforge.net/lists/listinfo/apcupsd-announce. The same link can be used to modify your preferences or unsubscribe as long as you have your password.

It is also possible to get email notification whenever a new package is released on SourceForge. This is accomplished by going to the Apcupsd SourceForge Project page and clicking on the little letter or mail icon under the heading Monitor in the row corresponding to the package you want to monitor.

apcupsd-users

The apcupsd-users list is the general forum to ask questions about Apcupsd or respond to questions from other users. The volume on this list is generally light, but can vary. All users are encouraged to subscribe and to participate. To elimate list SPAM, anyone wishing to send a message to this list must be subscribed, which you can do by following the instructions at http://lists.sourceforge.net/lists/listinfo/apcupsd-users The same link can be used to modify your preferences or unsubscribe as long as you have your password.

apcupsd-commits

The apcupsd-commits list is a READ-ONLY list to which you may subscribe to receive diffs of CVS commits. Please do not send emails to this list. You may subscribe by following the instructions at http://lists.sourceforge.net/lists/listinfo/apcupsd-commits The same link can be used to modify your preferences or unsubscribe as long as you have your password. apcupsd-3.14.10/doc/home-page/mail16d.png0000664000076400007640000000116607617552225016614 0ustar adk0212adk0212PNG  IHDRtIME = pHYs B4IDATxc|рxT훷?~ۗ/_<=o޼ QxW.mڴϒb*u㎳oJJA** L{{& sTܽ{GOW߿SMLt Ƴx}𪰤r%`75565ڰa={ƒXyNDXçnOZkc#._9~đEg|ODEo޼5gά߿ׯ5U7nv8/ׯߙK98}m6%%E MmYYYYXd dd:sM7__ѝ@_N))URAA~/]֚U$eTl]ݼsNNvD\FGǮXږVN?~8~4(P#$ Ϝ9ᚑχD_3YIENDB`apcupsd-3.14.10/doc/home-page/menu.inc0000664000076400007640000000163611511357273016304 0ustar adk0212adk0212 General
Apcupsd Home
Site Visits
 
Documentation
Online Manual
PDF Manual
 
Downloads
All Files
 
Support
Email Lists
Support
Bug Reporting
 
SourceForge
Project Page
CVS
apcupsd-3.14.10/doc/home-page/phpinfo.php0000775000076400007640000000002411241276173017011 0ustar adk0212adk0212 apcupsd-3.14.10/doc/home-page/publishsite0000775000076400007640000000031511241276173017116 0ustar adk0212adk0212#!/bin/sh wmk echo "Copying files to site" sftp -b - adk0212,apcupsd@web.sourceforge.net <<-END cd /home/groups/a/ap/apcupsd/htdocs -rm * progress put *.html put *.gif put *.png put *.php END apcupsd-3.14.10/doc/home-page/support.html0000664000076400007640000001004011511357273017234 0ustar adk0212adk0212 Apcupsd, a daemon for controlling APC UPSes
Apcupsd
General
Apcupsd Home
Site Visits
 
Documentation
Online Manual
PDF Manual
 
Downloads
All Files
 
Support
Email Lists
Support
Bug Reporting
 
SourceForge
Project Page
CVS

SourceForge.net Logo

    

Support

Please keep in mind that we are not getting paid for this, and since the project is rather mature, there is not any active development, which means that activity and support on the list is rather light. Apcupsd is, however, being maintained, and it is our desire to see as many people using it as possible.

Read the Manual

Before sending a request for help, please at least try to read the manual. If it is obvious you have not tried to find the information in the manual, you won't have done your part of the work, and consequently, you may not get an answer to your request for help.

If you have a USB UPS, please see the following section of the manual before sending a request for help as it contains all the information we know about resolving USB problems.

Getting Help

If you send an email to the apcupsd-users (@) sourceforge.net email list, and your support request is well defined, most likely some kind user will help you. Regrettably, because of spam attacks, we have had to require you to be subscribed in order to send email to it.

Please see Information Needed below for what to include in your support request.

I (Kern) get a number of "off-list" emails sent directly to me. Please always copy the appropriate list, if you do not copy the list, I may not answer you, or I will answer by copying the list. If you really have something confidential, please clearly indicate it.

Information Needed

For us to respond to a support request, we normally need the following as the minimum information:
  • Your operating system
  • The version of apcupsd you are using
  • The model and UPS cable you are using
  • A clear description of the problem
The first three of these items can be fulfilled by sending us a copy of your config.out file, which is in the main apcupsd source directory after you have done your ./configure.

In addition, we will often need a copy of your apcupsd configuration file. If you think it is a configuration problem, please don't hesitate to send them preferably as an attachment.

apcupsd-3.14.10/doc/home-page/support.wml0000664000076400007640000000435110200233670017063 0ustar adk0212adk0212 #include "template.inc" name=support

Support

Please keep in mind that we are not getting paid for this, and since the project is rather mature, there is not any active development, which means that activity and support on the list is rather light. Apcupsd is, however, being maintained, and it is our desire to see as many people using it as possible.

Read the Manual

Before sending a request for help, please at least try to read the manual. If it is obvious you have not tried to find the information in the manual, you won't have done your part of the work, and consequently, you may not get an answer to your request for help.

If you have a USB UPS, please see the following section of the manual before sending a request for help as it contains all the information we know about resolving USB problems.

Getting Help

If you send an email to the apcupsd-users (@) sourceforge.net email list, and your support request is well defined, most likely some kind user will help you. Regrettably, because of spam attacks, we have had to require you to be subscribed in order to send email to it.

Please see Information Needed below for what to include in your support request.

I (Kern) get a number of "off-list" emails sent directly to me. Please always copy the appropriate list, if you do not copy the list, I may not answer you, or I will answer by copying the list. If you really have something confidential, please clearly indicate it.

Information Needed

For us to respond to a support request, we normally need the following as the minimum information:
  • Your operating system
  • The version of apcupsd you are using
  • The model and UPS cable you are using
  • A clear description of the problem
The first three of these items can be fulfilled by sending us a copy of your config.out file, which is in the main apcupsd source directory after you have done your ./configure.

In addition, we will often need a copy of your apcupsd configuration file. If you think it is a configuration problem, please don't hesitate to send them preferably as an attachment. apcupsd-3.14.10/doc/home-page/systems.html0000664000076400007640000000462511511357273017243 0ustar adk0212adk0212 Apcupsd, a daemon for controlling APC UPSes

Apcupsd
General
Apcupsd Home
Site Visits
 
Documentation
Online Manual
PDF Manual
 
Downloads
All Files
 
Support
Email Lists
Support
Bug Reporting
 
SourceForge
Project Page
CVS

SourceForge.net Logo

    

Supported Systems

apcupsd is designed to be able to run on any Posix system.

Supported Systems

apcupsd has been built and tested on:
  • RedHat
  • Solaris
  • FreeBSD
In addition, apcupsd has been ported to the following systems:
  • Alpha
  • Darwin
  • Debian
  • Engard
  • Gentoo
  • HP/UX
  • Mandrake
  • NetBSD
  • OpenBSD
  • Slackware
  • SuSE
  • Unifix
  • Win95/98/Me/XP/NT/2000
apcupsd-3.14.10/doc/home-page/systems.wml0000664000076400007640000000110410200233670017047 0ustar adk0212adk0212 #include "template.inc" name=bugs

Supported Systems

apcupsd is designed to be able to run on any Posix system.

Supported Systems

apcupsd has been built and tested on:
  • RedHat
  • Solaris
  • FreeBSD
In addition, apcupsd has been ported to the following systems:
  • Alpha
  • Darwin
  • Debian
  • Engard
  • Gentoo
  • HP/UX
  • Mandrake
  • NetBSD
  • OpenBSD
  • Slackware
  • SuSE
  • Unifix
  • Win95/98/Me/XP/NT/2000
apcupsd-3.14.10/doc/home-page/template.inc0000664000076400007640000000207011160551257017142 0ustar adk0212adk0212## ## #use wml::std::page #use wml::des::space #use wml::des::typography #use wml::std::box ##
Apcupsd
#include "menu.inc"

SourceForge.net Logo

     {#BODY#}
{#BODY#: apcupsd-3.14.10/doc/Makefile0000664000076400007640000000213011234607266014433 0ustar adk0212adk0212topdir:=.. SUBDIRS = include $(topdir)/autoconf/targets.mak all-targets: apcupsd.man.txt apcaccess.man.txt apctest.man.txt \ apccontrol.man.txt apcupsd.conf.man.txt apcupsd.man.txt: apcupsd.8 $(call MANIFY,$<,$@) apcaccess.man.txt: apcaccess.8 $(call MANIFY,$<,$@) apctest.man.txt: apctest.8 $(call MANIFY,$<,$@) apccontrol.man.txt: apccontrol.8 $(call MANIFY,$<,$@) apcupsd.conf.man.txt: apcupsd.conf.5 $(call MANIFY,$<,$@) all-install: install-man all-uninstall: uninstall-man install-man: $(call MKDIR,$(mandir)/man8) $(call INSTDATA,644,apcupsd.8,$(mandir)/man8/apcupsd.8) $(call INSTDATA,644,apcaccess.8,$(mandir)/man8/apcaccess.8) $(call INSTDATA,644,apctest.8,$(mandir)/man8/apctest.8) $(call INSTDATA,644,apccontrol.8,$(mandir)/man8/apccontrol.8) $(call MKDIR,$(mandir)/man5) $(call INSTDATA,644,apcupsd.conf.5,$(mandir)/man5/apcupsd.conf.5) uninstall-man: $(call UNINST,$(mandir)/man8/apcupsd.8) $(call UNINST,$(mandir)/man8/apcaccess.8) $(call UNINST,$(mandir)/man8/apctest.8) $(call UNINST,$(mandir)/man8/apccontrol.8) $(call UNINST,$(mandir)/man5/apcupsd.conf.5) apcupsd-3.14.10/doc/apcaccess.80000664000076400007640000002715411177051363015023 0ustar adk0212adk0212.\" manual page [] for apctest version 3.14.6 .Dd January 10, 2009 .Dt APCACCESS 8 .Os apcaccess v3.14.6 .Sh NAME .Nm apcaccess .Nd retrieve status information from apcupsd(8) .Sh SYNOPSIS .Nm [status [ [][:] ] ] .Sh DESCRIPTION .Nm is a program which prints out the complete status of most American Power Conversion Corp. (APC) UPSes provided you have the .Xr apcupsd 8 daemon installed, properly configured and running. It can access status information from any APC UPS attached to the localhost or attached to any computer on the network which is running apcuspd in NIS mode. .Pp The command line options are: .Bl -hang -width "" .It status An optional command, unless a hostname is also being specified. Shorthand for .Em status\& localhost:3551 . This produces a full printout of the available status information for the associated UPS. .It An optional hostname which may be a bare machine name, fully qualified domain name or IP address. .It : An optional port number where a hostname argument has been specified. The default is 3551, the official port number assigned by .Tn IANA for the apcupsd NIS server. .El .Pp .Nm uses apcupsd's inbuilt Network Information Server (NIS) -- no relation to Sun's NIS/YP service -- to obtain the current status information from the UPS on the local or remote computer. It is therefore necessary to have the following configuration directives: .Pp .Bl -item -compact .It NETSERVER on .It NISPORT 3551 .El .Pp in the .Pa /etc/apcupsd/apcupsd.conf configuration file so that the Network Information Server will be accessible. Firewall rules for appropriate network access may also be needed. .Sh STATUS REPORT FORMAT The status report output format is simple ASCII. Generally there is a single piece of information on each line of output. The content varies based on the model of UPS being used and, in some cases, the firmware version. .Sh EXAMPLES Set out below is a sample of the status output which may be generated for the specified UPS models. .Pp .Ss All models .Bl -hang -width "xxxxxxxx" -compact .It APC : version, number of records and number of bytes following .It DATE : Date and time of last update from UPS .It HOSTNAME : hostname of computer running apcupsd .It VERSION : apcupsd version number, date and operating system .It UPSNAME : UPS name from configuration file (dumb) or EEPROM (smart) .It CABLE : Cable type specified in the configuration file .It MODEL : UPS model derived from UPS information .It UPSMODE : Mode in which UPS is operating .It STARTTIME : Date and time apcupsd was started .It STATUS : UPS status (online, charging, on battery etc) .It MASTERUPD : Last time the master sent an update to the slave .It ENDAPC : Date and time of status information was written .El .Ss Smart-UPS and Matrix-UPS (Smart Signalling) .Bl -hang -width "xxxxxxxx"-compact .It LINEV : Current input line voltage .It LOADPCT : Percentage of UPS load capacity used as estimated by UPS .It BCHARGE : Current battery capacity charge percentage .It TIMELEFT : Remaining runtime left on battery as estimated by the UPS .It MBATTCHG : Min battery charge % (BCHARGE) required for system shutdown .It MINTIMEL : Min battery runtime (MINUTES) required for system shutdown .It MAXTIME : Max battery runtime (TIMEOUT) after which system is shutdown .It MAXLINEV : Maximum input line voltage since apcupsd started .It MINLINEV : Min (observed) input line voltage since apcupsd started .It OUTPUTV : Current UPS output voltage .It SENSE : Current UPS sensitivity setting for voltage fluctuations .It DWAKE : Time UPS waits after power off when the power is restored .It DSHUTD : Delay before UPS powers down after command received .It DLOWBATT : Low battery signal sent when this much runtime remains .It LOTRANS : Input line voltage below which UPS will switch to battery .It HITRANS : Input line voltage above which UPS will switch to battery .It RETPCT : Battery charge % required after power off to restore power .It ITEMP : UPS internal temperature in degrees Celcius .It ALARMDEL : Delay period before UPS starts sounding alarm .It BATTV : Current battery voltage .It LINEFREQ : Current line frequency in Hertz .It LASTXFER : Reason for last transfer to battery since apcupsd startup .It NUMXFERS : Number of transfers to battery since apcupsd startup .It XONBATT : Date, time of last transfer to battery since apcupsd startup .It TONBATT : Seconds currently on battery .It CUMONBATT : Cumulative seconds on battery since apcupsd startup .It XOFFBAT : Date, time of last transfer off battery since apcupsd startup .It SELFTEST : Date and time of last self test since apcupsd startup .It STESTI : Self-test interval .It STATFLAG : UPS status flag in hex .It DIPSW : Current UPS DIP switch settings .It REG1 : Fault register 1 in hex .It REG2 : Fault register 2 in hex .It REG3 : Fault register 3 in hex .It MANDATE : UPS date of manufacture .It SERIALNO : UPS serial number .It BATTDATE : Date battery last replaced (if set) .It NOMOUTV : Nominal output voltage to supply when on battery power .It NOMBATTV : Nominal battery voltage .It EXTBATTS : Number of external batteries (for XL models) .It BADBATTS : Number of bad external battery packs (for XL models) .It FIRMWARE : UPS firmware version .It APCMODEL : APC model information .El .Ss Newer Back-UPS Pro (Smart Signalling) .Bl -hang -width "xxxxxxxx"-compact .It LINEV : Current input line voltage .It LOADPCT : Percentage of UPS load capacity used .It MBATTCHG : Min battery charge % (BCHARGE) required for system shutdown .It MINTIMEL : Min battery runtime (MINUTES) required for system shutdown .It MAXTIME : Max battery runtime (TIMEOUT) after which system is shutdown .It MAXLINEV : Maximum input line voltage since apcupsd startup .It MINLINEV : Minimum input line voltage since apcupsd startup .It OUTPUTV : Current UPS output voltage .It BATTV : Current battery charge voltage .It STATFLAG : UPS status flag in hex .El .Ss Back-UPS RS 1500 (USB) .Bl -hang -width "xxxxxxxx"-compact .It LINEV : Current input line voltage .It LOADPCT : Percentage of UPS load capacity used .It BCHARGE : Current battery capacity charge percentage .It TIMELEFT : Remaining runtime left on battery as estimated by UPS .It MBATTCHG : Min battery charge % (BCHARGE) required for system shutdown .It MINTIMEL : Min battery runtime (MINUTES) required for system shutdown .It MAXTIME : Max battery runtime (TIMEOUT) after which system is shutdown .It *OUTPUTV : Current UPS output voltage .It *DWAKE : Time UPS waits after power off when the power is restored .It *DSHUTD : Delay before UPS powers down after command received .It LOTRANS : Input line voltage below which UPS will switch to battery .It HITRANS : Input line voltage above which UPS will switch to battery .It *RETPCT : Battery charge % required after power off to restore power .It *ITEMP : UPS internal temperature in degrees Celcius .It ALARMDEL : Delay period before UPS starts sounding alarm .It BATTV : Current battery voltage .It *LINEFREQ : Current line frequency in Hertz .It *LASTXFER : Reason for last transfer to battery since apcupsd startup .It NUMXFERS : Number of transfers to battery since apcupsd startup .It XONBATT : Date, time of last transfer to battery since apcupsd startup .It TONBATT : Seconds currently on battery .It CUMONBATT : Cumulative seconds on battery since apcupsd startup .It XOFFBAT : Date, time of last transfer off battery since apcupsd startup .It SELFTEST : Date and time of last self test since apcupsd startup .It STATFLAG : UPS status flag in hex .It MANDATE : UPS date of manufacture .It SERIALNO : UPS serial number .It BATTDATE : Date battery last replaced (if set) .It NOMBATTV : Nominal battery voltage .It FIRMWARE : UPS firmware version .It APCMODEL : APC model information .It * presence dependant on USB firmware version. .El .Ss Web/SNMP (AP9716) or PowerNet SNMP (AP9605) SmartSlot Card .Bl -hang -width "xxxxxxxx"-compact .It LINEV : Current input line voltage .It LOADPCT : Percentage of UPS load capacity used as estimated by UPS .It BCHARGE : Current battery capacity charge percentage .It TIMELEFT : Remaining runtime left on battery as estimated by UPS .It MBATTCHG : Min battery charge % (BCHARGE) required for system shutdown .It MINTIMEL : Min battery runtime (MINUTES) required for system shutdown .It MAXTIME : Max battery runtime (TIMEOUT) after which system is shutdown .It MAXLINEV : Maximum input line voltage since apcupsd startup .It MINLINEV : Minimum input line voltage since apcupsd startup .It OUTPUTV : UPS output voltage .It SENSE : Current UPS sensitivity setting for voltage fluctuations .It DWAKE : Time UPS waits after power off when the power is restored .It DSHUTD : Delay before UPS powers down after command received .It DLOWBATT : Low battery signal sent when this much runtime remains .It LOTRANS : Input line voltage below which UPS will switch to battery .It HITRANS : Input line voltage above which UPS will switch to battery .It RETPCT : Battery charge % required after power off to restore power .It ITEMP : UPS internal temperature in degrees Celcius .It ALARMDEL : Delay period before UPS starts sounding alarm .It LINEFREQ : Current line frequency in Hertz .It NUMXFERS : Number of transfers to battery since apcupsd startup .It TONBATT : Seconds currently on battery .It CUMONBATT : Cumulative seconds on battery since apcupsd startup .It XOFFBATT : Date, time of last transfer off battery since apcupsd startup .It STESTI : Self-test interval .It STATFLAG : UPS status flag in hex .It DIPSW : Current UPS DIP switch settings .It MANDATE : UPS date of manufacture .It SERIALNO : UPS serial number .It BATTDATE : Date battery last replaced (if set) .It NOMOUTV : Nominal output voltage to supply when on battery power .It NOMPOWER : Nominal power output in watts .It EXTBATTS : Number of external batteries (for XL models) .It BADBATTS : Number of bad external battery packs (for XL models) .It FIRMWARE : UPS firmware version .It APCMODEL : APC model information .El .Ss Share-UPS (AP9270) (Basic port) .Bl -hang -width "xxxxxxxx"-compact .It MBATTCHG : Min battery charge % (BCHARGE) required for system shutdown .It MINTIMEL : Min battery runtime (MINUTES) required for system shutdown .It MAXTIME : Max battery runtime (TIMEOUT) after which system is shutdown .It NUMXFERS : Number of transfers to battery since apcupsd startup .It TONBATT : Seconds currently on battery .It CUMONBATT : Cumulative seconds on battery since apcupsd startup .It XOFFBATT : Date, time of last transfer off battery since apcupsd startup .It STATFLAG : UPS status flag in hex .El .Ss UPS Environmental Monitoring SmartSlot Card (AP9612TH) .Bl -hang -width "xxxxxxxx"-compact .It HUMIDITY : Ambient humidity .It AMBTEMP : Ambient temperature .El .Ss Back-UPS Pro and Smart-UPS v/s (Smart Signalling) .Bl -hang -width "xxxxxxxx"-compact .It LINEFAIL : Input line voltage status. .It BATTSTAT : Battery status. .It LASTXFER : Last (observed) transfer to battery. .El .Ss Back-UPS and Net-UPS (Simple Signalling) .Bl -hang -width "xxxxxxxx"-compact .It LINEFAIL : Input line voltage status. .It BATTSTAT : Battery status. .It STATFLAG : UPS status flag in hex. .El .Sh FILES .Pa /etc/apcupsd/apcupsd.conf .Sh SEE ALSO .Xr apcupsd.conf 5 , .Xr apcupsd 8 . .Pp The HTML apcupsd manual installed on your system or available online at http://www.apcupsd.org/ .Sh AUTHORS .Ss This page .An Trevor Roydhouse .Ss Software .An Adam Kropelin (current Project Manager and Code Maintainer) .An Kern Sibbald (former Project Manager and Code Maintainer) .An Riccardo Facchetti (former Project Manager and Code Maintainer) .An Andre M. Hedrick (Project Founder and former Code Maintainer) .Ss Contributors An enormous number of users who have devoted their time and energy to this project -- thanks. apcupsd-3.14.10/doc/apccontrol.80000664000076400007640000002353511177051363015241 0ustar adk0212adk0212.\" manual page [] for apctest version 3.14.6 .Dd January 10, 2009 .Dt APCCONTROL 8 .Os apccontrol v3.14.6 .Sh NAME .Nm apccontrol .Nd apcupsd(8) event handler script .Sh SYNOPSIS .Nm { } .Sh DESCRIPTION When .Xr apcupsd 8 detects anomalies from the UPS being monitored, it triggers an event which usually results in one or more calls to the .Nm shell script. Each event causes .Nm to take a particular action. These actions default to sane behaviour for all the events that apcupsd is likely to encounter. However, you can change the behaviour of every single action. .Pp When apcupsd detects an event, it calls the .Nm script with the following four arguments: .Pp .Bl -hang -width "xxxxxxxxxx" .It event This is the event that occurred. Refer to the list of possible events below. .It ups-name This is the name of the UPS as specified in the .Pa /etc/apcupsd/apcupsd.conf configuration file - not the name in the EEPROM of a smart UPS. .It connected This is 1 if apcupsd is connected to the UPS via a serial or USB port. In the case of a slave machine where apcupsd is not directly connected to the UPS, this value will be 0. .It powered This is 1 if the computer on which apcupsd is running is powered by the UPS and 0 if not. This is not currently implemented and always defaults to 0. .El .Pp Events are sent to the system log and, optionally, to the temporary events file .Pa ( /etc/apcupsd/apcupsd.events ) , and they also generate a call to .Nm which in turn will call any scripts you have placed in the .Pa /etc/apcupsd directory. .Ss LIST OF EVENTS AND DEFAULT ACTIONS .Bl -hang -width "commfailure" .It annoyme apcupsd generates this event when a shutdown is scheduled, and the time specified by the ANNOYME configuration directive in the .Pa /etc/apcupsd/apcupsd.conf file has expired. .Pp Default action -- sends "Power problems please logoff." to .Xr wall 1 and then exits. .It battattach apcupsd generates this event when it detects that the UPS battery has been reconnected after a battdetach event. .Pp Default action: does nothing. .It battdetach apcupsd generates this event when it detects that the UPS battery has been disconnected. .Pp Default action: does nothing. .It changeme apcupsd generates this event when it detects that the utility power is on, but the battery is not functioning correctly. This is repeated every 9 hours. .Pp Default action -- sends "Emergency! UPS batteries have failed Change them NOW" to wall and then exits. .It commfailure apcupsd generates this event each time it loses communication with the monitored UPS. This event is not detected on simple signalling UPSes like the Back-UPS 650. .Pp Default action -- sends "Communications with UPS lost." to wall and then exits. .It commok apcupsd generates this event after a commfailure event when communication with the UPS is re-established. .Pp Default action -- sends "Communications with UPS restored." to wall and then exits. .It doreboot This event is deprecated and should not be used. .Pp Default action -- sends "Beginning Reboot Sequence" to wall and then calls .Xr shutdown 8 with the "-r now" command line arguments to reboot the computer. .It doshutdown apcupsd generates this event to shutdown the computer when the UPS is running on battery power and one of the limits (time, run, load) is reached. .Pp Default action -- sends "Beginning Shutdown Sequence" to wall and then calls .Xr shutdown 8 with the command line arguments "-h now" to shutdown the computer. .It emergency apcupsd generates this event when the UPS is on battery power, the battery is low and the utility power is on: a sure sign of battery failure! .Pp Default action -- sends "Emergency Shutdown. Possible UPS battery failure." to wall. Immediately after this, apcupsd generates a doshutdown event to shutdown the system. .It failing apcupsd generates this event when the UPS is running on batteries and the UPS sets the low battery signal indicating that battery power is nearly exhausted. After this event, apcupsd will immediately generate a doshutdown event. .Pp Default action -- sends "UPS battery power exhausted. Doing shutdown." to wall and then exits. .It killpower apcupsd does not normally generate this event. Instead, it is invoked directly from the system halt script as 'apccontrol killpower' because the killpower event needs to be performed as late in system shutdown as possible. .Pp Default action -- sends "UPS now committed to shut down" to wall, waits for 10 seconds and then issues the command "apcupsd --killpower" to put the UPS into hibernate mode and shut off power to the connected equipment. In the case of a smart UPS, the UPS will then wait for the expiry of any configured shutdown time delay specified by the SLEEP configuration directive. In hibernate mode, the UPS will restore utility power to the connected equipment subject to the values specified for the RETURNCHARGE and WAKEUP configuration directives. .It loadlimit apcupsd generates this event when the battery discharge limit specified by the BATTERYLEVEL configuration directive has been reached. .Pp Default action -- sends "UPS battery discharge limit reached. Doing shutdown" to wall and then exits. After this event, apcupsd will immediately generate a doshutdown event. .It mainsback apcupsd generates this event when the utility power returns after a powerout event. The doshutdown event may or may not have been generated depending on the parameters you have defined and the length of the power outage. Attempting cancellation of a doshutdown event should never be tried as it is very unlikely to succeed and will almost certainly leave your computer in an indeterminate state. .Pp Default action -- if the file .Pa /var/run/powerfail exists, sends "Continuing with shutdown." to wall and then exits. Otherwise, does nothing. .It onbattery apcupsd generates this event if a power failure has been detected and the UPS is still on battery power at the expiry of the delay specified by the ONBATTERYDELAY configuration directive. .Pp Default action -- sends "Power failure. Running on UPS batteries." to wall and then exits. .It offbattery apcupsd generates this event when the utility power returns if, and only if, the onbattery event has been generated. .Pp Default -- sends ""Power has returned..." to wall and then exits. .It powerout apcupsd generates this event as soon as apcupsd detects that the UPS has switched to battery power and it is not a self-test. .Pp Default action -- does nothing. .It remotedown apcupsd generates this event on a slave machine when it detects either (1) that the master has shutdown, or (2) that an onbattery event has occurred and communication with the master has been lost. .Pp Default action: sends "Remote Shutdown. Beginning Shutdown Sequence." to wall and exits. Immediately after this, apcupsd generates a doshutdown event to shutdown the system. .It runlimit apcupsd generates this event when the remaining runtime limit specified by the MINUTES configuration directive expires while the UPS is on battery power as the result of a utility power outage. The remaining runtime is internally calculated by the UPS and monitored by apcuspd. .Pp Default action -- sends "UPS battery runtime percent reached. Doing shutdown." to wall and then exits. After this event, apcupsd will immediately generate a doshutdown event. .It timeout apcupsd generates this event when the time specified by the TIMEOUT configuration directive expires while the UPS is on battery power as the result of a utility power outage. This configuration directive is not normally used with smart UPSes which would instead rely on the more reliable remaining runtime (MINUTES) or the battery level (BATTERYLEVEL) configuration directives. .Pp Default action -- send "UPS battery runtime limit exceeded. Doing shutdown." to wall and then exits. After this event, apcupsd will immediately generate a doshutdown event. .It startselftest apcupsd generates this event when it detects the start of a UPS self test. .Pp Default action: does nothing. .It endselftest apcupsd generates this event when it detects the end of a UPS self test. .Pp Default action: does nothing. .El .Ss CUSTOMISING EVENT ACTIONS Do .Em not modify .Nm directly as it will be overwritten the next time you upgrade to a new release of apcupsd. .Pp The recommended way to customise an event action is simply to create an executable program or script file with the same name as the event and put that file in the .Pa /etc/apcupsd directory. Now, when the selected event occurs, .Nm will execute your program or script. .Pp If you want .Nm to also execute its default action for the selected event, your program or script should exit with an exit status of 0 (zero). .Pp If you do .Em not want .Nm to also execute its default action for the selected event, your program or script must exit with an exit status of 99. Be aware that if you completely override the default action, you must ensure the proper shutdown of your computer if this is necessary. .Pp Some sample scripts (changeme, commfailure, commok, offbattery and onbattery) that email messages to root instead of broadcasting messages to all logged-in users may be found in .Pa /etc/apcupsd after an installation and also in the .Pa platforms/etc directory of the apcupsd source code. .Pp .Sh FILES .Pa /etc/apcupsd/apccontrol .Sh SEE ALSO .Xr wall 1 , .Xr apcupsd.conf 5 , .Xr apcupsd 8 , .Xr shutdown 8 . .Pp The HTML apcupsd manual installed on your system or available online at http://www.apcupsd.org/ .Sh AUTHORS .Ss This page .An Trevor Roydhouse .Ss Software .An Adam Kropelin (current Project Manager and Code Maintainer) .An Kern Sibbald (former Project Manager and Code Maintainer) .An Riccardo Facchetti (former Project Manager and Code Maintainer) .An Andre M. Hedrick (Project Founder and former Code Maintainer) .Ss Contributors An enormous number of users who have devoted their time and energy to this project -- thanks. apcupsd-3.14.10/doc/apctest.80000664000076400007640000002747511324361342014542 0ustar adk0212adk0212.\" manual page [] for apctest version 3.14.6 .Dd January 10, 2009 .Dt APCTEST 8 .Os apctest v3.14.6 .Sh NAME .Nm apctest .Nd apcupsd(8) test program .Sh SYNOPSIS .Nm .Sh DESCRIPTION .Nm is a program that enables the running of certain low-level tests to check the operation of the attached simple signalling American Power Conversion Corp (APC) UPS and to check that your .Xr apcupsd 8 configuration is correctly setup and can establish communication with the UPS. .Pp For an APC UPS operating in APC smart protocol mode, .Nm enables the reading and programming of the values of the UPS EEPROM configuration variables as well and the performing of a battery runtime calibration. It also provides a simple TTY chat mode which allows direct interaction with the UPS via the APC smart protocol. For details of this protocol and the available commands, refer to the detailed "APC Smart Protocol" section in the apcupsd manual. .Pp IMPORTANT: Before running .Nm .Pp .Bl -bullet .It Check that the UPSCABLE, UPSTYPE and DEVICE configuration directives in the .Xr apcupsd.conf 5 configuration file have been set appropriately; and .It Shutdown apcupsd if it is running. You cannot run both .Xr apcupsd and .Nm at the same time. .El .Pp When run, .Nm displays a menu of options which are different depending on whether the UPS is connected to a USB port or to a serial port. For a serial port connection, there are two different menus depending on whether the UPS is operating in APC smart protocol mode or simple signalling mode - this also depends on which cable is used to connect to the UPS. If a simple signalling cable is used to connect to a Smart-UPS, the UPS will only be able to operate in simple signalling mode. .Pp .Nm saves a transcript of the session to the file .Pa apctest.out in the directory from which the program was called. Its content is useful for debugging purposes. .Sh USB PORT When using a UPS connected to a USB port (eg Back-UPS RS 1500), the following menu options will appear: .Ss Option 1) Test kill UPS power Performs a power down of the UPS into hibernate mode. .Ss Option 2) Perform self-test Performs an immediate self-test (switches to battery power to do so). .Ss Option 3) Read last self-test result Displays the last self-test result. .Ss Option 4) View/Change battery date Displays the current battery replacement date and optionally allows you to change it - useful when the battery is replaced so that you can accurately keep track of its age. .Ss Option 5) View manufacturing date Displays the date the UPS was manufactured. .Ss Option 6) View/Change alarm behavior Sets the delay period before the UPS starts sounding its alarm when the utility power is lost. .Ss Option 7) View/Change sensitivity Changes how sensitive the UPS is to the utility power quality and voltage fluctuations - (H)igh, (M)edium or (L)ow. The higher the sensitivity, the faster the UPS will switch to battery power or activate SmartBoost/SmartTrim (features that avoid using battery power provided the under/over voltage is within 12% of nominal). This setting should normally be set to High unless the UPS switches to battery power frequently, in which case a less sensitive setting will preserve UPS batteries... if the connected equipment can tolerate the power quality. .Ss Option 8) View/Change low transfer voltage Sets the low voltage level at which the UPS switches to battery or activates SmartBoost. .Ss Option 9) View/Change high transfer voltage Sets the high voltage level at which the UPS switches to battery or activates SmartTrim. .Ss Option 10) Perform battery calibration This performs a battery runtime calibration. This can only be performed if your battery is charged to 100% of capacity. The runtime calibration discharges the UPS battery to approximately 25% of capacity. The exact percentage depends on the UPS model. .Pp The advantage of doing this calibration is that the UPS will recalibrate the remaining runtime counter that it maintains and therefore report a more accurate estimated runtime. As batteries age, they tend to hold less charge, so the UPS's internal runtime counter may not be accurate after several years. .Pp It is recommended that battery runtime calibration be performed annually. Performing it too often shortens the lifetime of the UPS batteries. .Ss Option 11) Test Alarm This option will cause the UPS alarm beeper to sound for several seconds. .Ss Option 12) View/Change self-test interval This option allows you to change the time interval between automatic UPS self-tests. .Ss Option Q) Quit Exits from the program. .Sh SERIAL PORT (SMART PROTOCOL MODE) When using a UPS operating in APC smart protocol mode (eg a Smart-UPS) the following menu options will appear: .Ss Option 1) Query the UPS for all known values Selecting this option probes the UPS for all EEPROM configuration variable values known to .Nm and displays them in rather raw format. This output can be useful for providing technical support if you are having problems with the behaviour of the UPS or .Xr apcupsd 8 . .Ss Option 2) Perform a Battery Runtime Calibration This performs a battery runtime calibration. This can only be performed if your battery is charged to 100% of capacity. The runtime calibration discharges the UPS battery to approximately 25% of capacity. The exact percentage depends on the UPS model. .Nm can optionally abort the calibration if it detects that the battery charge is below 10%. .Pp The advantage of doing this calibration is that the UPS will recalibrate the remaining runtime counter that it maintains and therefore report a more accurate estimated runtime. As batteries age, they tend to hold less charge, so the UPS's internal runtime counter may not be accurate after several years. .Pp It is recommended that battery runtime calibration be performed annually. Performing it too often shortens the lifetime of the UPS batteries. .Ss Option 3) Abort Battery Calibration This option aborts an in progress battery runtime calibration. .Pp .Ss Option 4) Monitor Battery Calibration progress Allows restarting of the monitoring of a battery runtime calibration. .Ss Option 5) Program EEPROM Allows the programming of the values of a Smart-UPS's EEPROM configuration variables. .Pp Choosing this option presents a sub-menu of programming options which are detailed below. .Bl -hang .It Option 1) Print EEPROM values .Pp Prints the value of all EEPROM configuration variables known to .Nm . .It Option 2) Change Battery date .Pp Changes the battery date - useful when the battery is replaced so that you can accurately keep track of its age. .It Option 3) Change UPS name .Pp Changes the UPS name - use no more than 8 characters to name the UPS. .It Option 4) Change sensitivity .Pp Changes how sensitive the UPS is to the utility power quality and voltage fluctuations - (H)igh, (M)edium or (L)ow. The higher the sensitivity, the faster the UPS will switch to battery power or activate SmartBoost/SmartTrim (features that avoid using battery power provided the under/over voltage is within 12% of nominal). This setting should normally be set to High unless the UPS switches to battery power frequently, in which case a less sensitive setting will preserve UPS batteries... if the connected equipment can tolerate the power quality. .It Option 5) Change alarm delay .Pp Changes the delay period before the UPS starts sounding its alarm when the utility power is lost. .It Option 6) Change low battery warning delay .Pp Changes the remaining runtime minutes at which the UPS will send the low battery signal. When the UPS internally calculates that the specified number of minutes remains before battery power will be exhausted, it sends the low battery warning. .It Option 7) Change wakeup delay .Pp Changes the delay before the UPS restores power to connected equipment when the utility power returns after shutting down in hibernate mode. .It Option 8) Change shutdown delay .Pp Changes the delay for which the UPS waits before shutting off power to the connected equipment after being commanded to power down in hibernate mode. .It Option 9) Change low transfer voltage .Pp Changes the low voltage level at which the UPS switches to battery or activates SmartBoost. .It Option 10) Change high transfer voltage .Pp Changes the high voltage level at which the UPS switches to battery or activates SmartTrim. .It Option 11) Change battery return threshold percent .Pp Changes the battery charge percentage required after power down in hibernate mode before to the UPS will restore power to connected equipment on the return of utility power. .It Option 12) Change output voltage when on batteries .Pp Changes the nominal voltage output when the UPS is running on battery power. .It Option 13) Change the self test interval .Pp Changes or disables the automatic self-test interval. .It Option 14) Set EEPROM with configuration file values .Pp This option allows the bulk programming of the EEPROM configuration variables from the values contained in the .Pa /etc/apcupsd.conf configuration file. Refer to the "APCTEST EEPROM CONFIGURATION DIRECTIVES" section of the man page for .Xr apcupsd.conf 5 .It Option 15) Quit .Pp This option exits back to the previous (main) menu. .El .Ss Option 6) Enter TTY mode communicating with UPS This option allows direct interaction with the attached UPS using the APC smart protocol commands. .Pp WARNING: Take special care what commands you enter because it is possible to cause the UPS to suddenly shutdown or, in the worst case, modify the UPS in such a way as to permanently disable it. Do NOT experiment with unknown or unsupported commands. Caveat Utilitor! .Ss Option 7) Quit Exits from the program. .Sh SERIAL PORT (SIMPLE SIGNALLING MODE) When using an APC UPS operating in simple signalling mode the following menu options will appear: .Ss Option 1) Test 1 - normal mode The test result depends on the model of UPS and type of cable being used. Refer to the "Using apctest on Serial-Line UPSses" section in the apcupsd manual for details. .Ss Option 2) Test 2 - no cable The test result depends on the model of UPS and type of cable being used. Refer to the "Using apctest on Serial-Line UPSses" section in the apcupsd manual for details. .Ss Option 3) Test 3 - no power The test result depends on the model of UPS and type of cable being used. Refer to the "Using apctest on Serial-Line UPSses" section in the apcupsd manual for details. .Ss Option 4) Test 4 - low battery (requires Test 3 first) The test result depends on the model of UPS and type of cable being used. Refer to the "Using apctest on Serial-Line UPSses" section in the apcupsd manual for details. .Ss Option 5) Test 5 - battery exhausted The test result depends on the model of UPS and type of cable being used. Refer to the "Using apctest on Serial-Line UPSses" section in the apcupsd manual for details. .Ss Option 6) Test 6 - kill UPS power The test result depends on the model of UPS and type of cable being used. Refer to the "Using apctest on Serial-Line UPSses" section in the apcupsd manual for details. .Ss Option 7) Test 7 - run tests 1 through 5 This option has .Nm guess which cable should be used with the attached UPS. .Ss Option 9) Quit Exits from the program. .Sh FILES .Pa /etc/apcupsd/apcupsd.conf default configuration file .Pp .Pa apctest.out transcript of the .Nm session .Sh SEE ALSO .Xr apcupsd.conf 5 , .Xr apcupsd 8 . .Pp The HTML apcupsd manual installed on your system or available online at http://www.apcupsd.org/ .Sh AUTHORS .Ss This page .An Trevor Roydhouse (current) .An Robert Huff .Ss Software .An Adam Kropelin (current Project Manager and Code Maintainer) .An Kern Sibbald (former Project Manager and Code Maintainer) .An Riccardo Facchetti (former Project Manager and Code Maintainer) .An Andre M. Hedrick (Project Founder and former Code Maintainer) .Ss Contributors An enormous number of users who have devoted their time and energy to this project -- thanks. apcupsd-3.14.10/doc/apcupsd.80000664000076400007640000001665711177051363014543 0ustar adk0212adk0212.\" manual page [] for apcupsd version 3.14.6 .Dd January 10, 2009 .Dt APCUPSD 8 .Os apcupsd v3.14.6 .Sh NAME .Nm apcupsd .Nd a daemon for controlling most APC UPSes .Sh SYNOPSIS .Nm .Op Fl b .Op Fl d Ar level | Fl -debug Ar level .Op Fl f Ar file | Fl -config-file Ar file .Op Fl P Ar file | Fl -pid-file Ar file .Op Fl p | -kill-on-powerfail | t | -term-on-powerfail .Op Fl R .Pp .Nm .Op Fl k | -killpower | -hibernate | o | -power-off .Pp .Nm .Op Fl h | -help .Pp .Nm .Op Fl V | -version .Pp .Sh DESCRIPTION .Pp The .Nm daemon controls the operation of most American Power Conversion Corp (APC) UPSes. During a power failure, .Nm informs users about the loss of utility power and that a shutdown may occur. If utility power is not restored, a system shutdown will follow when the battery is exhausted, a specified timeout expires, a specified battery charge percentage is reached, or a specified battery runtime (based on internal UPS calculations and determined by power consumption rates) expires. If the utility power is restored before one of the these shutdown conditions is met, .Nm will inform users of this and the shutdown will generally be cancelled. Refer to the Implementation Notes section below for situations in which the shutdown may not be cancelled. .Pp The meaning of the command line options is as follows: .Bl -tag -width Fl .It Fl b Run in the foreground, do not detach and become a daemon. .It Fl d Ar level Fl -debug Ar level Set debugging output level where level is a number greater than zero. .It Fl f Ar file Fl -config-file Ar file Load the specified configuration file. The default configuration file is .Pa /etc/apcupsd/apcupsd.conf . It must be changed when running more than one copy of .Nm on the same computer to control multiple UPSes. .It Fl k | Fl -killpower | -hibernate Power down the UPS in hibernate mode after a 10 second delay. This option is normally only used by .Nm itself to power down the UPS after a system shutdown has almost completed. In hibernate mode, the UPS will again supply power to the system when the utility power returns. .It Fl o | -power-off Power down UPS completely. The UPS will not supply power to the system when the utility power returns. .It Fl P Ar file Fl -pid-file Ar file Create the specified process ID file. The default is .Pa /var/run/apcupsd.pid . It must be changed when running more than one copy of .Nm on the same computer to control multiple UPSes. .It Fl p -kill-on-powerfail .Nm commands the UPS to power down in hibernate mode just before .Nm starts the system shutdown. This relies on the grace shutdown delay of a Smart-UPS being long enough to allow the system to shutdown completely before the UPS shuts off the power to the system and goes into hibernate mode. This shutdown grace delay is a programmable value stored in a Smart-UPS EEPROM which can be changed using .Xr apctest 8 . In hibernate mode, the UPS will again supply power to the system when the utility power returns. Refer to .Xr apcupsd.conf 5 for an alternative method using the KILLDELAY configuration directive and the only method available when using a Back-UPS or other UPS operating in simple signalling mode. .It Fl t -term-on-powerfail .Nm exits immediately when it issues the system shutdown command. This behaviour is useful for those systems where it is not possible to insert .Nm commands in a halt script to issue the killpower command. Without this option, .Nm will wait for the SIGTERM signal from the system shutdown process before exiting. .It Fl R Put a UPS which runs in smart signalling mode by default (eg a Smart-UPS) into simple signalling mode. .It Fl v -version Prints the .Nm version number and the program help. .It Fl h -help Prints the program help. .Pp .El The .Nm daemon supports a networking mode called Network Information Server (NIS) -- not related to Sun's NIS/YP -- in which the daemon serves status and event information to clients over a network. See the "Running The Network Information Server" section of the apcupsd manual for more information and configuration details on this mode. .Pp The .Nm daemon also supports a Smart-UPS in SNMP mode provided an APC Web/SNMP or APC PowerNet SNMP card is installed in the UPS's SmartSlot. For more information and configuration details on this mode, refer to the "Support for SNMP UPSes" section of the apcupsd manual. .Pp .Sh IMPLEMENTATION NOTES .Pp The shutdown is made by calls to the script .Pa /etc/apcupsd/apccontrol by the .Nm daemon. Consequently, no changes to .Pa /etc/inittab are necessary on Linux as there is no communication between the daemon and the init(1) process. Installation of the daemon modifies the halt script so that at the end of the shutdown process, the daemon will be re-executed to power off the UPS in hibernate mode. .Pp On some operating systems (eg FreeBSD) there is no halt script so apccontrol must be modified to cause the daemon to power off the UPS after a delay. Alternatives are to use the --kill-on-powerfail command on the .Nm command line or refer to .Xr apcupsd.conf 5 for details of the KILLDELAY configuration directive. .Pp .Sh CONFIGURATION It will almost certainly be necessary to customise the configuration information in the .Pa /etc/apcupsd/apcupsd.conf configuration file to suit your configuration and desired UPS behaviour. .Pp For information on the configuration directives and the format of the configuration file, refer to .Xr apcupsd.conf 5 . .Pp .Sh EVENTS .Pp .Nm generates events when certain conditions occur. These events are sent to the system log and, optionally, to the temporary events file .Pa ( /var/log/apcupsd.events ) . They also generate a call to the .Pa /etc/apcupsd/apccontrol script which in turn will call any custom scripts placed in the .Pa /etc/apcupsd directory which may override apccontrol's default behaviour. For details of the events and customising apccontrol's behaviour, refer to .Xr apccontrol 8 . .Pp .Sh DATA FILE FORMAT .Pp If the DATATIME configuration directive is set to non-zero, .Nm will log a data record at the interval defined by the DATATIME directive. This data record is in a format similar to the APC PowerChute software data file format. .Sh STATUS REPORT FORMAT The status report output format is simple ASCII. Generally there is a single piece of information on each line of output. The content varies based on the model of UPS being used and, in some cases, the firmware version. This status report is also optionally written the the .Pa /etc/apcupsd/apcupsd.status file. Refer to .Xr apcaccess 8 for full details of the status report output. .Sh FILES .Pa /etc/apcupsd/apcupsd.conf default configuration file .Pp .Pa /var/run/apcupsd.pid default process ID file .Pp .Pa /var/log/apcupsd.status optional status file .Pp .Pa /var/log/apcupsd.events default events file .Pp .Sh SEE ALSO .Pp .Xr apcupsd.conf 5 , .Xr apcaccess 8 , .Xr apccontrol 8 , .Xr apctest 8 . .Pp The HTML apcupsd manual installed on your system or available online at http://www.apcupsd.org/ .Pp .Sh AUTHORS .Pp .Ss This page .An Trevor Roydhouse (current) .An Andre M. Hedrick .An Christopher J. Reimer .Pp .Ss Software .An Adam Kropelin (current Project Manager and Code Maintainer) .An Kern Sibbald (former Project Manager and Code Maintainer) .An Riccardo Facchetti (former Project Manager and Code Maintainer) .An Andre M. Hedrick (Project Founder and former Code Maintainer) .Pp .Ss Contributors .Pp An enormous number of users who have devoted their time and energy to this project -- thanks. apcupsd-3.14.10/doc/apcupsd.conf.50000664000076400007640000003643611200132336015444 0ustar adk0212adk0212.\" manual page [] for apcupsd.conf version 3.14.6 .Pp .Dd January 10, 2009 .Dt APCUPSD.CONF 5 .Os apcupsd.conf v3.14.6 .Sh NAME .Nm apcupsd.conf .Nd apcupsd(8) configuration file .Sh DESCRIPTION .Nm is the configuration file for the .Xr apcupsd 8 program. The file is a plain ASCII text file which comprises a number of configuration directives which control how the apcupsd program behaves when controlling most American Power Conversion Corp (APC) UPSes. The configuration file is also used for the .Xr apctest 8 program when bulk programming the EEPROM in a Smart-UPS model. .Pp It will almost certainly be necessary to customise the information in the configuration file to suit your particular configuration and operating requirements. .Pp The configuration file directives are explained in the subsections below. .Pp .Ss GENERAL CONFIGURATION DIRECTIVES .Pp .Bl -hang -width "xxxxxxx" .It UPSNAME .Pp Specify a name for the UPS for log files, status reports etc. .It UPSCABLE [\& simple | smart | ether | usb | 940-0119A | 940-0127A | 940-0128A | 940-0020B | 940-0020C | 940-0023A | 940-0024B | 940-0024C | 940-1524C | 940-0024G | 940-0095A | 940-0095B | 940-0095C | MAM-04-02-2000 \&] .Pp The type of cable used to connect the UPS to the computer. .Pp .It UPSTYPE [\& dumb | apcsmart | net | usb | snmp | pcnet | test \&] .Pp The type of APC UPS that you have. .It DEVICE .Pp The name of the device used for communication between the UPS and the computer. For a USB UPS, you should leave the DEVICE directive blank and apcupsd will figure out where the device is located. .Pp .Bl -bullet -compact .It apcsmart : /dev/tty** (serial connection) .It usb : leave blank! (USB connection) .It net : hostname:port (NIS connection) .It snmp : hostname:port:vendor:community (SNMP connection) .It dumb : /dev/tty** (serial connection) .It pcnet : ipaddr:username:passphrase (AP9617 SmartSlot card) .El .Pp If you have problems, please see the apcupsd manual for more detailed information and comprehensive troubleshooting advice. .Pp .It POLLTIME .Pp The rate in seconds that the daemon polls the UPS for status. This rate is automatically set to 1 second when the UPS goes on battery and reset to the specified value when the utility power returns. This setting applies both to directly-attached UPSes and networked UPSes. A low setting will improve the daemon's responsiveness to certain events at the cost of higher CPU utilisation. The default of 60 is appropriate for most situations. .Pp .It LOCKFILE .Pp apcupsd creates a lockfile for the serial or USB port in the specified directory. It must be changed when running more than one copy of apcupsd on the same computer to control multiple UPSes. .It SCRIPTDIR .Pp Directory in which apccontrol and event scripts are located. Defaults to .Pa /usr/local/etc/apcupsd . It must be changed when running more than one copy of apcupsd on the same computer to control multiple UPSes. .It PWRFAILDIR .Pp Directory in which apcupsd writes the powerfail flag file created when apcupsd initiates a system shutdown. The directory is checked in halt scripts to determine if turning off the UPS output power is required. Defaults to .Pa /var/run . It must be changed when running more than one copy of apcupsd on the same computer to control multiple UPSes. .Pp .It NOLOGINDIR .Pp Directory in which apcupsd writes the nologin file which tells the OS to disallow new logins. Defaults to .Pa /var/run . It must be changed when running more than one copy of apcupsd on the same computer to control multiple UPSes. .El .Ss NIS CONFIGURATION DIRECTIVES .Pp .Bl -hang -width "xxxxxxx" .It NETSERVER [\& on | off \&] .Pp Turns the network information server (NIS) on or off. When on, apcupsd serves status and event information over the network. This information is also used by the web-based CGI monitoring programs. The default is set to on. .Pp .It NISIP .Pp Specifies the IP address of the network interface on which apcupsd will listen for incoming connections. The default value is 0.0.0.0 which means the NIS will listen for connections on all network interfaces. If the computer has more than one interface, you can specify the IP of a single interface to limit connections to that interface. Specifying the loopback address (127.0.0.1) will cause the NIS daemon to accept connections only from the local computer. .Pp .It NISPORT .Pp Specifies the port to be used by the NIS daemon. The default is 3551 which has been received from IANA as the official apcupsd networking port. It must be changed when running more than one copy of apcupsd on the same computer to control multiple UPSes. .Pp .It EVENTSFILE .Pp If you want NIS to provide the last 10 events via the network, you must specify a file where apcupsd will save these events. The default is: .Pa /var/log/apcupsd.events . apcupsd will save at most the last 50 events to this file. When more than 50 events are saved and a network request for the events arrives, apcupsd will truncate the file to the most recent 10 events. It must be changed when running more than one copy of apcupsd on the same computer to control multiple UPSes. .El .Ss LOGGING CONFIGURATION DIRECTIVES .Pp .Bl -hang -width "xxxxxxx" .It STATTIME .Pp Specifies the time interval between writes to the status file. If set to zero, the status file will not be written. The status file will disappear in a future apcupsd version as its functionality has been replaced by the Network Information Server and the .Xr apcaccess 8 program. .Pp .It STATFILE .Pp Specifies the file to be used when writing the status information. The default is .Pa /etc/apcupsd/apcupsd.status . It must be changed when running more than one copy of apcupsd on the same computer to control multiple UPSes. .Pp .It LOGSTATS [\& on | off \&] .Pp Activate log file. This generates a lot of output, so if you turn this on, be sure that the file defined in .Xr syslog.conf 5 for LOG_NOTICE is a named pipe. .Pp .It DATATIME .Pp Specifies the time interval between writes of the APC PowerChute software-like data information to the log file. .Pp .It FACILITY .Pp Change the system logging (syslog) facility. The default is daemon. This parameter can be useful if you wish to direct the apcupsd system logging information to other than your system default files. See .Xr syslog.conf 5 for details of other possible facilities and general system logging configuration. .Pp .El .Ss POWER FAILURE CONFIGURATION DIRECTIVES .Pp .Bl -hang -width "xxxxxxx" .It ONBATTERYDELAY .Pp The number of seconds from when a power failure is detected until apcupsd reacts with an onbattery event. .Pp .It BATTERYLEVEL .Pp apcupsd will shutdown the system during a power failure when the remaining battery charge falls below the specified percentage. The default is 5. .Pp .It MINUTES .Pp apcupsd will shutdown the system during a power failure when the remaining runtime on batteries as internally calculated by the UPS falls below the specified minutes. The default is 3. .Pp .It TIMEOUT .Pp After a power failure occurs, apcupsd will shutdown the system after the specified number of seconds have expired. For a Smart-UPS, this should normally be set to zero so that the shutdown time will be determined by the battery level or remaining runtime (see above). This command is, however, useful for a Back-UPS or other simple signalling UPS which does not report battery level or the remaining runtime. It is also useful for testing apcupsd because you can force a rapid shutdown by setting a small value (eg 60) and turning off the power to the UPS. .Pp TIMEOUT, BATTERYLEVEL, and MINUTES can all be set without problems. apcupsd will initiate a shutdown when the first of these conditions becomes valid. .Pp .It ANNOY .Pp Specifies the time in seconds between broadcast messages requesting logged in users to log off from the system. This timer starts only when the UPS is running on battery. The default is 300 seconds (5 minutes). .Pp .It ANNOYDELAY .Pp Specifies the delay time in seconds before broadcast messages requesting logged in users to log off from the system. This timer starts only after the UPS is running on battery power. This timer is reset when the power returns. The default is 60 seconds (ie the first request to log off occurs after 60 seconds on battery power). .Pp .It NOLOGON [\& disable | timeout | percent | minutes | always \&] .Pp Specifies when apcupsd should create the nologon file to prevent users from logging on to the system. .Pp "disable" prevents apcupsd from creating the nologin file. .Pp "timeout" specifies a specific wait time before apcupsd creates the nologin file. .Pp "percent" specifies the percentage of battery charge remaining before apcupsd creates the nologin file. .Pp "minutes" specifies the battery runtime remaining before apcupsd creates the nologin file. .Pp "always" specifies that apcupsd should create the nologin file immediately after a power failure occurs. .Pp This directive is important for allowing systems with BIG UPSes to run normally until the system administrator determines the need for dumping users. It also allows the system administrator to hold the "ANNOY" factor until the .Pa /etc/nologin file is created. .Pp .It KILLDELAY .Pp Specifies the number of seconds for which apcupsd will continue running after a shutdown has been requested. After the specified time, apcupsd will attempt to put the UPS into hibernate mode and kill the power to the computer. This is for use on operating systems where apcupsd cannot regain control after a shutdown (eg FreeBSD) to issue an apcupsd --killpower command. Setting the delay to 0 disables it. .El .Ss SHARE-UPS CONFIGURATION DIRECTIVES .Pp .Bl -hang -width "xxxxxxx" .It UPSCLASS [\& standalone | shareslave | sharemaster \&] .Pp The default is "standalone" and should be used for all computers powered by the UPS, with a direct connection to the UPS and where there are no other computers dependent on power from the UPS. This is the "normal" case. .Pp Use "shareslave" if you are using a Share-UPS interface expander and connected to the BASIC port (simple signalling). .Pp Use "sharemaster", if you are using a Share-UPS interface expander and connected to the ADVANCED port (smart signalling). .Pp .It UPSMODE [\& disable | share \&] .Pp Set to "disable" for normal standalone operation to indicate that you are disabling the Share-UPS interface expander support. .Pp Set to "share" for two to seven additional simple signalling ports on a Share-UPS interface expander. This code may not be fully tested in every new release. .El .Ss APCTEST EEPROM CONFIGURATION DIRECTIVES .Pp These directives have no effect on the operation of .Xr apcupsd 8 but are reserved for use by .Xr apctest 8 when bulk programming the values of the UPS EEPROM configuration variables in a Smart-UPS model. .Pp .Bl -hang -width "xxxxxxx" .It UPSNAME .Pp Name of UPS. Maximum of 8 characters. .Pp .It BATTDATE [\& mm/dd/yy | dd/mm/yy \&] .Pp Last battery replacement date. Maximum of 8 characters. .Pp .It SENSITIVITY [\& H | M | L \&] .Pp .Bl -item -nested -compact .It H : High (most sensitive setting) .It M : Medium .It L : Low (least sensitive setting) .El .It WAKEUP [\& 000 | 060 | 180 | 300 \&] .Pp The time delay in seconds that the UPS waits after the return of utility power before "waking up" and restoring power to the connected equipment. .Pp .It SLEEP [\& 020 | 180 | 300 | 600 \&] .Pp The time delay in seconds for which the UPS waits or "sleeps" after it receives a request to power off the connected system. .Pp .It LOTRANSFER .Pp Low line voltage causing transfer to battery power or activation of SmartBoost. Allowable values depend on the last letter of the firmware or APCMODEL. Typical values are: .Pp D 106 103 100 097 M 177 172 168 182 A 092 090 088 086 I 208 204 200 196 .Pp where D = domestic (USA), M = Canada, A = Asia and I = International. .Pp .It HITRANSFER .Pp High line voltage causing transfer to battery power or activation of SmartTrim. Allowable values depend on the last letter of the firmware or APCMODEL. Typical values are: .Pp D 127 130 133 136 M 229 234 239 224 A 108 110 112 114 I 253 257 261 265 .Pp where D = domestic (USA), M = Canada, A = Asia and I = International. .Pp .It RETURNCHARGE [\& 00 | 15 | 50 | 90 \&] .Pp Percentage of battery charge needed for the UPS to restore power to the connected equipment. .Pp .It BEEPSTATE [\& 0 | T | L | N \&] .Pp Alarm delay. .Pp .Bl -item -nested -compact .It 0 : Zero delay after power fails. .It T : When power fails plus 30 seconds. .It L : When low battery occurs. .It N : Never. .El .It LOWBATT .Pp Low battery warning occurs when the specified number of minutes remains before the UPS estimates battery power will be exhausted. There are four user-changeable settings: 2, 5, 7, or 10 minutes .Pp .It OUTPUTVOLTS .Pp UPS nominal output voltage when running on battery. Allowable values depend on the last letter of the firmware or APCMODEL. Typical values are: .Pp D 115 M 208 A 100 I 230 240 220 225 .Pp where D = domestic (USA), M = Canada, A = Asia and I = International. .Pp .It SELFTEST [\& 336 | 168 | ON | OFF \&] .Pp Self test interval in hours (336 = 2 weeks, 168 = 1 week, ON = at power on, OFF = never). .Pp .El .Sh EXAMPLES Note that in the following examples, the device names assume that you are using Linux. Device names for serial devices in *BSD and other operating systems will be different. .Pp .Ss Minimal USB Configuration for a USB UPS UPSCABLE usb UPSTYPE usb DEVICE LOCKFILE /var/lock UPSCLASS standalone UPSMODE disable .Pp Notice no device name is specified. .Xr apcupsd 8 will try all the well known USB ports. Only specify a specific USB device name if you know what you are doing. For detailed information on setting up a USB UPS, refer to the "USB Configuration" section of the apcupsd manual. .Ss Minimal Serial Configuration for a Smart UPS UPSCABLE smart UPSTYPE apcsmart DEVICE /dev/ttyS0 LOCKFILE /var/lock UPSCLASS standalone UPSMODE disable .Pp Normally there would be more configuration directives to completely customise your installation, but this example shows the minimum required. .Ss Minimal Serial Configuration for a Dumb UPS UPSCABLE UPSTYPE dumb DEVICE /dev/ttyS0 LOCKFILE /var/lock UPSCLASS standalone UPSMODE disable .Pp If your cable does not have low battery detection (eg such cables include the APC 940-0020B and 940-0023A), you will also need to define the TIMEOUT configuration directive to set the number of seconds on battery during a power failure after which apcupsd will do a system shutdown. .Pp Normally there would be more configuration directives to completely customise your installation, but this example shows the minimum required. .Pp .Sh FILES .Pa /etc/apcupsd/apcupsd.conf default configuration file .Pp .Sh SEE ALSO .Pp .Xr syslog.conf 5 , .Xr apcupsd 8 , .Xr apctest 8 . .Pp The HTML apcupsd manual installed on your system or available online at http://www.apcupsd.org/ .Sh AUTHORS .Pp .An Trevor Roydhouse (current) .An Andre M. Hedrick .An Christopher J. Reimer apcupsd-3.14.10/doc/images/0000775000076400007640000000000011634011371014232 5ustar adk0212adk0212apcupsd-3.14.10/doc/images/apcupsd-logo.png0000664000076400007640000001713610220346241017342 0ustar adk0212adk0212PNG  IHDRH@ x`PLTE SJj$eՆ]hpAIO)5soW|(/4Ty>uGYc7Kȵ r?,.Az@"a]5Pm!m| q)'FJt ~iGEHC0|[1/tg{_6! yPƣMy+Wm^fm?H)Ny獵e!{EO@ȫӾ$5OQǁD7}@'v 5vw|h^rpض `oI/M?R@1;I[:n1=|g˶+irmN '6 HG 5_v!vl|L$[ĭW33avQiT{=/Evgu '# ^?HWq~!mٲp&H/m- f[~ػ>H $})Hʾ$xER Bq˸:>Ij^PAj@ ER${ZN9> J?zHz)(Arf b)X,NڷrHzH:NYKy7%Hoج=wZtIiI)WH`kwԤڸ6V( =OGB0C\<˘E<,vH‚fI*2yO=-LCncGٵL =5(@z3Ed[| AH5MG׋-I/M܂Tlj%} ]0:lo2e'w58ݚt: m/|qPTA*tCrpɵ;6Ń䟟)e#Q!c)'LB-~O H, 5.$EF.S畷&tqV@ [R}.Diqc1!H-H14 R; @ 8z"&ڎRSl@a݂#5WIZs}^kA8!H@i6K*w<@7 =|]1՚YqZyD[\sjKơ(`gcj7BY}js]w@Oc0H zJcs@uXm8cAKӶ !KGhRGn"6JM= f5h-pĤAu™E %@&lv0亁}!Wk_mg'#(-2`PבP c5ې$i(^ G֏ħTxbht.~xѹ ۭM%/G0&G&AYn)0=iI<Ƙد?jOXΫNR(}6 tQdR 7iX]6TOm zH re߀X^[D$3(!ԕ4tdtf' HTuOG$0%q1Gr8Еˮ12&Y|1JA0fq} TptAB+ q[yD6r6fC83fONb֟kk9!85H9hSs!Gϵiq enfC Hͼc2-Hv6 M@JEm*X뺮$) [\`X)1ޕƐؿћ7!ɀ# W\ u^#ݲ zE_-/`?[łE{ ]"V[ sXe\K& =eP7 s0((QTj_o@%^ĶĀW[ǺuHv DDgBVr~DKuـU*JԘ[+XpkBTrܝ_4An@R?I 4 hvn etlȏЁ װڦem y*2z 92@G-T3tGHHP&Lw|D@$EV4v ,3Q3#y)lu> 4c,Yȅ+BAjHCUǁ Ϋ7Kр6r4Z*t4d¿1TOT}Yп-dY :W6\1G7UfR2"T)D#h!ӹOEƵo1ϫ #PUJΉQ4M/$q=)ոb[Ui^a)\G?Kך4U_;֝Vx.ʉGVF^v ICX'$Le0S鉦I+yeq#Svh/`— $|&!.\/L0_j6A9>H&++4cO(/}W Ueƒ,ClX9Yrε VZOAnU+|sWքҸe|ݠGStdA bn3rDپ@WdžHS|:K胄1QT9b,gOQ >y% Ey  Lo7T47(toK +R tu"|n"~7R?{LE# p82"?&li3dBYL @*^r'un+m0ВvC0\i%A:? C,aP ztn$a`YKkLN3Ėq'*DSUaDZ$ ` Ef紑- ]LPEHd'>H_za__Vݛx68'jAMoeoE0UKzm Oꠈy!HWS»ތMG_ȮdH'Ug”P]-a0E蔜 u.e@hl\s:cSpv"eu&GvsyjVW7A$Gku^|& VSϴwκ -{Z%gۛ Hh1 ] SB ьeN$  ~_#*Azt$AJw ]tyלs I| /;:)GD˭㫫cg8^2q]:>Y C:2dzAjxV4IdY:$=65W삕/ yvQ!ͫރĵ I;7$y qR1ݼH]P0p버/Gq[̵1s>©HCOCΊ1Mr\TRớ,FKRvHO ]+~Tiig$nݵ!I?}&߃JHB&pq-i  g72KjA"rd8RI Rg@x (!ubvcu;_҃R}A9m-( ʂܟ>^ W@6]n? K,/ˬ0.<&0ޔ@iE.)}l)OzF,P׮ 5IȜ*oA b$⍵:"ׅ EHF>0O6RȤ92e6v*Dwm" >3 Lfm5qy$iz>YgQص8 ]Q5f%u< =aE-TK ^h=P QG(H,چuJnTBj:=w^6 6D$p>nZ247ɫ"J3"18t$|^jHWI\L%ݎy $RXc]b338/Xr7V.5*wMlh\I7{?QhV_Ӊ%AcM7 IVI_OH*2r>c G0 NEkr0b|#)n#{KrTq}4߀to6=ڷ Yupy^Q,֮qu5f?v ֿ*5Hȉ=IA)=y.m%H^wېE4˃HSY"*}zsJ?oI-HmYNyQ4vŵehh'"Ϯ:[h4PH$^g4>,mi8ۃǘ҉}4P2= BByì"|qhӸ0-$V9PβYvxH.˼4ۍՁogc=fyL@B@HwGs$7SG?o摤ȃ\'컄%3Um__ vNoXɄ/W1ٸߝeh[ƀt]u}ʴzl!HWt\Vo4UZ F3A 5FhUyowɒjT-sakۺ#ɖAPfrIWuAIxl^dMn֊dhmCiF|xٔ͊)ڵ,{u&ہ.@jky5t\ÀM05 6k8Nڞ눧iz_\H)bVk׮JE."%/ˁ\*T!=æKLJQ)U􂈳Sr.ߏh,[IT6^B_ L8//0< }4b5 3hyyPwiիKMTZ4)>G:aR!HR/xl?L#`bE]8jLi wǓƏiD =<=k`BŃ$0鐬@ (NCl饌MxEM60ن-/-A֙9.71OM߯^tC4 qyZƀ#8,~w2-;V>Ⱦ_rRgGkM;0 #*2O#xy\oI]R ڡ/XRtKpHnmCqj_A(H_8Z.RhQTq#K UH,4~#L96jG~*>$L8\ڑzFM2W`õ>dD 4Mp%0R& + ,^isUN=1YR29,xdXۃDVME/XXN_ :]J,H۬M!;AQb] W$Q¡4i] ^DŽV*lIV2_x@fuLKYc˂ژuGt}42S0)"/QWbFۼ {R̹= R)eFM5)ؒrBǀFUicɘ!B&IXJW޾(R4<V%)`n.~K3j ˅jYSݡ51A^Ea'[ɐiEZ_b{4/ֽ]l@]<aKnPttSwEr([SLH o {H3*_@YJ WN$a@q6_:dC7<ٖ.p$u[aF^.7m8MQ )>q!-4vlVKbwN /00/=?Os ]<(}Rk&VTt&% Ĵł]<*ELl\Ƙ0#Ɇ!v[%ތp.Jt|6@I鋄YBP SpCLԯt :zJ#Gk6hر'E8b :pZ JxYr5wm? W,yM67cv7)~rb[1G7;EIM摢)gȨN4R29m./1Y@iaiᖅ$w7fG 罙}/flW͛,SBb•= Gn;$*{Zdaq#a=wd\Bnn%W'peTrydJ%]o,!:u'M{3a3H,z ioylsҡ/\ٲ=lNYaۿLnX.s4XX0ǭ7\ p1gƺ;c$kOiwj];+ eAN3F,F[-::,$R/łn}(des7ȿ( 1Ցs $ǟ +u5AZb=/q%n]9\Y7}~g\YIENDB`apcupsd-3.14.10/doc/images/apcupsd.png0000664000076400007640000001730010220346242016376 0ustar adk0212adk0212PNG  IHDRH@ x`PLTE SJj$eՆ]hpAIO)5soW|(/4Ty>uGYc7Kȵ 5 ^uv\_@{[ۜyoJnAaѫ6ѥ! >,:!Az@"aPMb(ٶꃐѶB> 8#n%ijmZZSQ)c=$.f+tg{BsH t.fz/^Pۼ;¿ @NA7p8vPK^nYeaIW}/H k$7 v3MJ\oN´c>)-G:ERK;|LDz~-HMvCeڕ4rt 6}'b#/ELo ;6wi>Pe Hi4(gK0;(HL@ڂ"n3:铑H-8z? \:|g˖3aIg HG A&X`Iw}dc<"-a2dތy {5 \_~A //g6;c<")n!e|:Ij^PA*HG˙lH9j9z{>8~7n45SQBdr b)X,vڷr0ZCu§[xF(AsfK퐔z ƻ)HZMMKmcpO N0oow,c\]n % CCd>mS0ͻ& kkG(l{I冇k}iEI䃤&~nA*6~ž`XJyq^7B⓻|~nMN<q[sRеE$׶`J;@7~^JRUDSG2 &G *Ұ lW>܂M % G}yHǩ)6 ¿nA‘{ګ In'9ƒnkh*@Fbi6K*w<@7 _2 dWLnf"xVV~g/"+KǜyCW\z0E!+&5lnnV:  K*))V]a! T-I 1o@8Bb8r ~`(50ՠt g6-L7ZIJv ¬C +/Z[S3T Q!v ! Gu$Xhc6dl%cJ6~Rт44YO E;OiQKjGq ~}=ۡɴ{crl2Cѓjkq+ Gy YqbO5N2Y 7iX]6 TOm zH re߀X^[D$3(!ԕ4tdtf' HTuOG:ȏ p +G]m 1cdFKōM)f9 mfq} TfFy]x'1ř1C(}rCE ]fweh\8tXy Eu A @K$ڜ 1QŘ㢺y^IskvNa#K iAdQd\0UU8P)I)@WӞ-\K)^~>b- HV( I{tJSe޻cyl[y颜xd?Z* զKD%??' d(sdL>GHO4`ܥH_y ,K+mQζ%xD~1&|z+JJNqke˴&`1Ap0XI^}By`Ml.'Aː7$ hY ٰ{-s@kA$R%V < +i܃tβlnPƣ)Q٠I1J9lRO ||+cDd$)B^}%AΌܘV(bu*UKMD$-jj}1 STb(A^IC"Cm^B A&xͺ͵enFḑ{3]B.Y eJ#Q}[uM%%{(Ɨj߻dDDG e$(biolÁD4adK+H_ȟQ&(~bJUHՈW+]]>s[n߀!d/˕V30gφjПףSu# {Z\cZUw&S>AVq%j n& I̗V(J6;naXe(D";Aҳ( `2nַZ㱙9Qlz/{;(Zk0LVxRE|w AGz36ArENJ]m#{g'<ȐNɫ΄)a0Z`Y)9Uf=t\ʀ$$Q\o(u&3D("=HˎL.ԬN؍ H`u|y~ ģr6{u;s3䚂؆}msuhThٳ*8L@FTfT-tu'dݨL8K7W9 &a4Yށti^s ~Eh-o"H7_ QrxXe""$󹗦LxmtNO{@gAr:$^@YIͧG )`e6T$.;*y{!$iGt$$0N*n]P[#NHH,&)](#Fm܂,qQJ&z9&\}=wtFQ]`5ל]a\xL`;<)Z )]RXSU)Y]7j6ȑIUނĢIn#& IS 0-r]Ȟ X$d$1a uzsL#\_lcGΨAJtv_**JOT&<4=Ҭq+G8 ]e~nR@m )4CհZ%՗ MSti(nD88]#P/9 [6kK<۵]eWIb@šưAf_R$i¯"ʲS(UiE:+=Az FQuN\#\7j>(RcR6-]UL6hd`/6K%#jS|A%< j+qs]#􆨻* ?^K~u#8N~vp;y1 I8L([m@t?fs+D=YCMRŃ2zMsKl#&>4]R$QU=ܞwm RG,f4X'sRĢm 0k]W$$q*H%ƩnJMqes1Pjђ$gݍR>&B yp[DiF8G$€N $\$USIXFUZ k-F`qy)]r[GWUJU4_EHٜ&E N - o`;9$`d>Z=T$0e%|A`N˻3@ޝZ`$G|~ kSX۝G ~Tq认whk <_6=ڻ Y$SQR:=HknԘ綃l,|?oQCCtۓ'V!ۆ(Hy[TȦJhG.ޜh틯x ˤEȶ,~Uqg<(ڲCu kW|s H4(FuwK@4Q4 N`AL DgcjD>Ojt(9ER?"tAU"uuR76_i:4Lp:FKo6[g{?-ԥlVG.-2- @$Ej D+ώH06n6W%ȃ\+컄%5U4Jv ombq3(;6ѸdVr:^eZ=rcmm:.m_4UZ3HBF2"wbFȁ*yy,I'Hi2dC6{b[w #^(< `cY.\t.( @LE]e*v zӑ/R3Y1X֮$ii]l@U 5Y^E`:0 +gLM@w:i8~جZ==iQKȻCjzr װJ$w_ڛaiץ{z_ݔVs TĥAKt+j݋檗WA"S:+AK4 H}XM} Z^j]ZRo,M gPxI@=L*1IjbJ0ut11]O?6\D-n&Id5A9tN7?26%7 f0?Z3rn<6}_wG_dB:7Rɔ.FWG\i?S43yLnQ4*lSKMTLӄ_<(y2\8X5^`('xU9QdI䰬amY5%`m&Nc_ 8}Y+#XH۬M!;AQb] W$Q¡4i] ^DŽV*lIV2_᯸AfuLKYc˂ژuGt}42S0)]N)tE,vaT8Kpͬoc |1ozafjyռ2+$̓Ks~3jZ,;|uݘbºl$7引7'–ŏgCںytʝQAq +d9;l$~N[Hm[lx_d[&*rAbr_ȵ3j^lV|@2g@Chۅ\>9n*N; ]l!_ԭuw޳H&vVܵ+ABA 4ysg 5j<с`!=M~)tN@wmF&,AmGy>H S97~ Br(j|QλFB_7)vX&莃Kü_E4Uvî̟oN?]k~g\>IENDB`apcupsd-3.14.10/doc/images/charging.png0000664000076400007640000000064011255525516016534 0ustar adk0212adk0212PNG  IHDRasRGBgAMA a cHRMz&u0`:pQ<tEXtSoftwarePaint.NET v3.36%IDAT8O}S0 C#d tI%۲,zC^ۧC1LEH)' ^eF+'C^ QHVd`n;ժ_tâ-%T vIENDB`apcupsd-3.14.10/doc/images/commlost.png0000664000076400007640000000067210541320253016600 0ustar adk0212adk0212PNG  IHDRabKGD pHYs  tIME *:GIDATx͑M+Da , 5K/0ݥ'#Dhi|) (5ea&j" 5:̝(:us_frB=pX}lSwq+rC)MPHeBtJ&,_m*NUEtHd}Lܺ+8vź=9yW^jYvr[.B 'ǰ BPF.e]SICJK )%V}} 2JӸފz ج.(o}6j [.H)[Y4M >0gt ~ σiIENDB`apcupsd-3.14.10/doc/images/main_configs.png0000664000076400007640000003261510220346331017400 0ustar adk0212adk0212PNG  IHDRepbKGD̿ pHYs  ~tIME 'X[ IDATxOHz߿~,9TKFX /j|\AXVMK ٛ { Ae'ˢ>lnF"dr>HkB.))qPjuT*U[zzAyhGz.Srf̟D>0;7 -ؐD2 _pgIOqx$4 QA/T e4]Zp"w<":B=Kđs)s9G$"@pԙ:~'c-C @L@@J $;"PPI"!#"I=\AMd2ݓ4] -X0}l:;7=p;TۙXj ICLǖ " TFus.ww.st,$" }l2yywD {RD$`_bջB?yzХ pOpV`#82쌈:+& G ;ŀ`$0D)p~dkcR.*\HhbIJeֈ9ě[`Ty֥xDjg"5ƃcTցQYFeu`TցQYFeu`TցQYFe)[u\~UKpuL:0*:0*1Fd>gT>@#M5F9 ˕`l;y'ɇ_DSGʛUJeڪGr륪zkl34m<`g pA!URs9}߆((/<AQu0}*?oc45DZ`z󐈂#{3zZ uΛvrXci{G]%oeNfOܸWOhYь--rDjADv%CƟŦgc>16n}2QWPO;#vQJI!O'D挭6ل,~"쨫Қb B=U/(N $ U^&avH$8 ##Xp "X H r$XCXH%(귙q!G𐼐d_JjW{@ogA}f}Ҝo0T>Ly$1wPCh-%pa*)APd nAATi] c"is դ.HeP+)AP c{yR aD/t:Vog8}[ؓ/W?_|~Rӏ_7Fu*n}3ok nWo71=;Yk[]/7cOG.ˋxzü"WkXZ3>s8zܙyoǶ+±6`TE>a&4?4qQJm`p?["pVC Qy1bgX2Zb cj5E4̣[Ycͷ{jC@BL(Y3]ط JvL@VzkՋ9v+Zg܎*a֢|+b\{)K袷oZXN;De)\xKOyU9.|;Z_ÖpeV(3>xHbRoͲgv+UcDbm<9CM-SvK_G{\'gr69~pDl%KZ~Yxgޯ@5-7 PEe* );nZQn~"Y&濋^^'re&3VB*lv]yn }c9S媝pnQ A`Q+ϱE.6`;YmVuc._g|j3iVȎq4GmQ9ۏu;x?g?/geL,`5VVim{_v`y:K^V>]$Czf}Ktm'ydK&I}~g"H[c0YnX rNݾEWeRVDP IRKң6k}N[ѸH֖TND޾%ޓ}g\"ٞy'm4\^W m}݇zܟLثr)ȫmKOQ..TuwL";I|Nٗ 0*&Y;Q6+ר|z1`TցQYFeu`TցQYFeB*t;]Ձ1t`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeupG*C[Tc/6cmo7U0ϖ_r'ZrŞ}kDtDF[N*|4!mvy6$ )}ܞ"|!t4S9#ԩ"lK7P\HvBTUCFDTdX4eǞkʸD ɕ2Q`Yыf#&I9ڮHHpAE+ĒC'Dj#"a{^(s9GL/H${hQ-D :"`/LrbU4J  \#s $l/ND$PP:=mF/ }]EK%A/clNqjX$TlWmL1`0g(ɥ4[`-Y>:0*:0*:xS~eEQЁQYFeu`TցQYFeu``>gT>@9^x۴ܩ1ʱr6Tc JÈ<`et*GD){gE'z4:7~s&ܪGtMy.^wzy4`7g!(yHDD.W$*ik^B? s&ǧ5|{=edpN8;Ƒ|jIGe[3TY )T P"BL,!ɛ~MRjo_! ~t( H:>{m9[l[`Qy[GK6-l{~k!sU;oJTǞa8*-Eݩl~D DFkZ'^۫b'fe4߬hm|9f. e;zbdYiihO2"*b J&Uc.2J@#) qȉATI{Gfx6!_36j&Ơ؂D!lO"&&IBՀ>C+e6`Dҁ#)12 .`AD. *iнE6`;n|f'jUW߃^; 3 arr"{Y"$M!' "ʅ-iKezt()H4N#~BW* Z~9cDxe )EQkGUFW"v7nTIyeQg\j U -m( ;L "\pG f W8ILܮ/#=pA*\I B]`˓=qmFIců>{jxv7?= rӟ~./>o|c\'7g~+&%}߈۳ίsޙVr9w>?|z{䲼?̋O>8,rf)5˫5cl/<1_5/[vE8PӪ'$F@.jcT Xb}pk_P. x!*o3|TlxZF+TbLmfy4c3 }p/82XejUf?JH JOw.[]c}D; x A֢r`ݺen=vt*Va֢|+bN70.!p!*/KLƒ_"L]ԆqZT/ԺejUz0Iz;#gv+UcDbm<9CM-SviΑM0(Pyzk g,^o8ƘbzLf䡹yGuRf(_?_8V1upo?\؊.;8"Ug ir3'@~0k% DΣ%[37gc$TΘX *呃d6#sB B0Uih@L݄ķ/IFjre):0* xNhԕkT>xKz0*:0*\/;rOs\sa05:0*:0*:0*:0*xGT֌1TPilTD$m ?ƃNj?5FyՔIqUPsfdwSE?դl5qtf68j0A\PHF2|QvmCl;׾^s+Sz4s3f9w:ź ,r7`>RDE.jvds&'7RgGC_WFb-T X5TՍ{ GKT9[zf@F6@1<"yɮqN:"$*KqW8HeCe]aEX4N.A\53^ʃj@+(:ظ +A*" h:иWOQݦ?Q<.0APd nDQӸ-wr. MqWPcc_K0 Feu`TցQYFeu`TցQYFeu`TցQYFeR;'}{:͝T1t`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeup%7&FSZ3X=Y4=R1\ ѸL.erѼj_$θ*WkgԴ'fe4߬zO53[%yM\>Q"RB Dɵ|A1~a@Լ簁< xm\/{ּg_%&b7;.j򀌦rc,N5[XEG\ȅSc].a əyد:0*:0*:0*:0*:0*MNt. gx#ޔ/r!Ơ7:0*:0*:0*`W x0\ ˗~:{AΏAOe?H`TցQYFerԂ|bUn/js@*=l1eVYQ1ysiP11"qK{ _?zj`$OJُwPb_v0DeaPIq+k92%tZ?Sd|R\!6)p߬JqK@5)&/.Z 9Tl%M(D (;^|WU㙚'Űz l8p "ag p۶CΈg?}X)XIDAT&0+ QChU[jck~pl܇ ~FdksʂAfW+*Y[TϢ /ʷ lN҇?he Th4N0Hl"_ hɖ*pT>gX hSX>!@DZ 섨8/b=λi:U&1i S~ʰ{/;ܪeA=)xŠYpDw3u~t PS* WH -1QZP.zv$x?GŽЄΙ?Kqaѓ X,":`AQxwT& MsΏR6TYAHjozw [9pR J?BPITp;&6:'ݳv{˭v*o'O͏POOF[Y3J8p!Ie /B^ N}z4F5/!yKyғDwU}{R7 _ I 0ih@LW^9ռN V߾oUam֙J/_6:~\y|Lk7o%Վ%"nܡ{͟L^̲o/ۛN=Bۻvڱhx3Љu~OUƼma^|;StֿjhieaeDT۷%BF (q$<"neQ5M"PLBtf*>|lN9aZ_ÖpFD-l6L|jmg'N{xws2cWRY`vuj6쒥X-G o߈+!b 2}MhT<84䗫\6t!J RV[C" 0Py1bgX2Zb cjNg7"n<]#g0V[5,U:F[ %$*%֢ZXUH.1^\ͼ^W S+k9z+ .ĹʌHGDt|mz*?[5,!RC>遫^rg/Wxŭn[,+SȟP5ɫ Pg;`DI3~zV @4CJb=`^{m_6ַ:c0ֈVx3m w`)QJ0.#6ϷGv-5֭+IGKay~/ '"RpEin ż3&c_{:ѽrߙ-'q}lwUY*g{ά8 Vqћ縏rRIqThƱG3l<;[`SKLђ- X f.Nίr 2A07nܷǷJL@/>u)T_|_V06F?+7|l} Mܙw4TOʝPYxe̾S8=Ue̽jUٲȘz*Cܑl.'>ί^Tĭn&#]o5nus5=uMYܳ5kkr*MU}|/];W[w!|'&}tM^ܽw5kr*CT|]GPy]+0h*WkOvS2 "i4.g]ǎ\h^5ey'yeYf h^ԫPI^ξݢ"h ʄu0-wЪ !JAR Nޑ [2km2`9S"{b7jWyZ ]vd΋L0R_T 2iZv|gǣyYcLk*Ok*Ok*Ok*Ok*Ok*Ok*Ohd1FpId~e]tƋ:^y`2]ʕ`l|Am}2T#SHHJS}6ST:7Lmws-^>WZꦉtM5Z۩+"/GlU |lzb4߬:i~}ӠT&]glǍG!6j4J5e!G,UzMIwRL tMmgl s {dm%|X^<9PR4*鬍9R$Dj @@\?E5 zH1;jϯHEBDk^\SmϾ|vVLվl8QYFeu:A#!8r b;4 {z~==:^:^:^:^:^ sO{NJJJJ-9.mrOLxvrz;^)ίJRz;^)d_B)ɻ4uwq>0}V9MT$mIˉb=t'$`7~ͯc>,ǔO9N!o>[sP_PsLI B &D?+k 6w $`FSRs<߷s f&,KA6Tުa틟6C1*N.4 :}"\ Xj` 씅-ӘsZW;-yQ^3Ăq2kz}3 @zz P eZ9^3)ץy]-PG&_wU,g9͂'H$q)}L90(k°F<Q[t.hCF:4Q;(.z,W2ePE rDYBxX jsV4LDi53)3!Edũ{lСwůxq=A@H11< )/I^ND R 1js%~e824Ȅm((ǬǨz{5+dTP`L5`Lчtan`L <bgqM6I2&2CLL{.T'_Թ~d{k5 ALtFY$JtOXX ~xyʱ\~I%XʼZZA&jo$V^i"Pxż1 qO_0 >ȅ0Z~>~r2c?d/$8L/cω$̯$+/#:.1 =ўIQXJ)7~H8z]ْ#in;GQbs7oH4_&să8KgF _`sc(Wpvʆny%K"{BXk09i&&e`x 2ʊZF,Zc/0ţ06L`2;ϪfƱ|ʑq+%c wuQDw`K"1 Ř9$?=_yW¤% _1?ȗIN)k^ |բǒ5M~ywůȲU;ὃCϲ);c&t ͺLz_B|=-2 cu~~9crS&`RU ^"Q1^ &)V9,)ƗCeSWNb9~eǯ V9 P^ u5VoBA{ٳ~)++p~t gZW2H N6is>eD5`)(YH _j QV. ϥ>eJH G#O4y*V吣M~EeLbIQuJMYGI.UŝYK;`9iGVŪ  <81ʄZu7ðdb%JpKFDܻa_+YU&p(R+l"၅i”4&f@3Jplt`0zi7',RX TU g~9zy~g(442Xi.q|L.!7B#!sdFNyz~i?/O/?~ɔ nqEN\@ ENt+l @SzIge$>ÜMy</߄[T*8d(K!T̅׊^?ͯtM~E;sj _5(k^Yn+rUi1_!ҦjڦWucpqKrU4i{_S{:G 0k~ڟI8Wq(UM N.hMoTES伃l3\\ ]DNAv)5WW%{Z^zv6ep A옘;{zqgᘖqFKJ$ljL8 {zE̿.D rpFuM۫.\6~F)rkS=i2~`c|[#$@!`Eq \IOe S; /V>Kϑ]S8[:qA9lh y.:kʎ^hh{_?eaKrZҋ6Ni a2^{pRM~i Q5-\QA%.(S_\&dVX +DtVM 뷎_AM̉ä$V!Z B/@:_\ #>ԍ.V z/U؅s-6-|GF!ij/d꤁ ΂_8q^1a'm^2 7`g2#fJ:KV B gU@/Ru_'-Q'*uSW_#Z+Ջ؂_xwA׳ܞ;OYSү_n0Q4&J S*Í'"8$H_9C9\]¡,LId ]+?X)hRz;O$h඄ <b⟺'*!xUk .OzVxx ('ՇI:2;K#b`D'0̯l ' K1A:'&dprIU ݏ{_ĂD 'z;~9ҁ_9LBKW1VٰE\@a:bʧS(n̩R:@(_ڤKΘC_ TA$aN_c{vs*7sM~NjUf[.e_$lKǜhSZSR'Tjy"BYn)m@KE_vd l]*oe*Q+P..zNJi07T|"}~|z{y2^|A?jsA?.;M9?Y% lI+Hx} H-1x#/ aů*huXS {z+x)^˚_+|hѪx\^78x 85^[xIϯ{6m5lvD9-P:݁ s!sGXx<^|nU x-;WDbs[? i2F#=Ƌ#.z$ZGuK & B7ϮK{DCVh.՛xmt.kPX"I3^#I.33(g&YeXG̈ /F xï7}sW_[xIY"F`e5y¯udoK=1mnx&ׇAx`r=/]kp m'5IoI1>`ċCv[Ï{zkxSo5V/bCp'^7G G3_c/UCѐTޜjͿ<ޜsm/9RۇGm PX֖}8yh9>\և/024 Zx5^ҐW֌DZ ZӠo0%/]d|c|/J [%2rA-m|/m`=C)5[FB]H}pC_b_x݋g#ug;u~Wǫxu:^?ǫk_^v:^Wǫxu:^Wix[xʙmY'$2Žވ'2ל'|7Ou.]D^Ot);>W9«x3ފ'*[Sׯ'Z5,K4X{≊W7E EDE)ȉvXx%^8=쇍Oq^x"7 2k0[sx"ևb밊-MDVezaP .y XOd`sͽ܉p'^],ERZE)h1,  5z/1De"_ulo'ZUYpoջw} F >d-MDp1ZܲӇT78HixZ,OtUL^{'2yڌ'z3íUꉶ'*?Lt^;'re;;u [x [x])QNבC-JTLBDlu4B ^;' CDG㢤lLu/D/poyvO>I|>DfQm DG+Z_)y<u<6J,{{>o|^8%*x9T.C느:^=DW'z-ȯWǫxu:^oëkkkk^=DxVxVxVxVxVxVxVxVxVxVxVxVxV/6pCh=IENDB`apcupsd-3.14.10/doc/images/onbatt.png0000664000076400007640000000062011255525516016237 0ustar adk0212adk0212PNG  IHDRasRGBgAMA a cHRMz&u0`:pQ<tEXtSoftwarePaint.NET v3.36%IDAT8OSI0 lhU8 qȍgk}Z?waƵ-%TŮ'Mg\ Aw=py|RřqAF$$`829YfvY;e/,˫A4UAIc${?d *dNPꟕ~ Z`;Tfw ƫ!r#!XwDnF ̳N+x]@!.ZNIENDB`apcupsd-3.14.10/doc/images/online.png0000664000076400007640000000066311255525516016243 0ustar adk0212adk0212PNG  IHDRasRGBgAMA a cHRMz&u0`:pQ<tEXtSoftwarePaint.NET v3.36% IDAT8OS $iG,1:d;!Dj%b}w6֔R)=>- лj>{>5tM%Aq f@GFjoGp)_ݸwxqd^*{-vP@#&:e=нF%g::JA%&!h)xVR~uXzNeJ*{Ot"|߅ӈhZ;&% ;3 'Vmi=IENDB`apcupsd-3.14.10/doc/images/status.png0000664000076400007640000001775710220346353016305 0ustar adk0212adk0212PNG  IHDRN|;KPLTE111ŦIDATxMq`ګloro m36~Z,?$R{LIQ,XWm8!pCԇS~ǘӫ/PQ]pjZ]pjZ]pjZ]pjZ]ЅMσ)V/9=l ^Uxԇԇԇԇ sهJbmH[rn0}Nt"979'y6/yu7{sLs*+#٘ћc8=7?do-fNCilfga^zrr} E-r")R1-rbߍ4EsZd>ז<_,X- 6GLYۑ2'6C7j=q_4|6W8=i'cD©`nB2&wZ8L}/!;[~N_vӏ6qby}/}d^R3p'r:ēr?.N u(9ۏOgקY8i~}*qv}:iPn޹5c$맜MfW '䞑)5iccm/^*%'PM;{d!S6d1gDGE# kfa}(r*(] -s ,]tR88RҭdIe1q)4PγoJv툓bfɹ<ӡyfT Ɂ{bnW): xh|i M9g9i=]-s/2,pr[yd+QΉܹg8eRO!^_7-p=sklgeN9S_݉}R|\pYsqWIY9㡂AsqkFO^laJT>[Ͻs8y d׊E+AX'+!?f8mx|\p\p\p\p\p\p\p\p\p\p\p\p\p\p\p\p\p\p\p܌ӫ܁V܋Rs˜pjZ]pjZ]pjZ]pjZ]pjZ]8U~BL]B%^7xgSSS~h6˿%צCnm2_{gȦ q 4z;a\Bֳ$4INIྷa+sb6'b39D!oCuNqZQ1++pDCQN ڌcVD< NG9I8:5-ؤk~[g?t9i+8M&q߷.&99/0pb^H y=ބȔ.Ir=W2f8i\ 8M'"V)a5q9=<'7IQÍt%>O}*3%>T8i8шK9>5ӄ֟SDŽsF$i}N>L|d| {N^i}a:[ft'rJ=I"dv)oB)NTRO\U^*c?Arm }.mdt; 6gO!ۛ8r(ڼ~S-N %N .4}mGT|VHRpo32d ?p:_d(溎>)^Of|FIJƁ&e'H|R3Ya4eXpShC}F)' ,Ɓ%:SNVR姙'9?*/O x~9Ym=t5ܧT..4đSFST;IUT!'d;^Q~?krz  ˒?{Si?:N}N"tSeg5$-t,نJ/m8pS?b|ίi)ԧBp>etL6g > pđSe~ЏXNg9Gf |*~98> 圆Ns$p'pąX,58iYNdc:X{3q271o:&eNF58[0i. xxgJp+kS&CzU礏`4R?EI̽OHNy/g`OdivgroB̽}eBϭt>={zN/:DTUn&}{Nzx'=n%;rJ )8k}[N4V Nk8SByqYp3Jg_9 qtfN6vNiܜa(No#VNs֨hөf#('SLa28SZlrJ8Qt8>eϯHa<3|fep=O7闋yB~N/888888^N| $.¨sYf&='&o|{''sUb p:ɇ7$4s_Ed_Kp)Uk4_}koT3UOLc}4oS=l ~a~ kӥ5׆#ߑSj`ENv qb.8888888˩4!M̭+}y~^Ӻ\kB\}(\(֏~,Ӈ82W$VImAd!i/X|qbM~ 19 P8]I5RFY5NLSIڑ ~)}3s <Nvi4ZӞO N1WCz88888%3NQS_Ϥ w'188]Sh\5O:D>?jkUne}אqm84G}Mw)'tO} &O)35NSTהק ֈ0?jkr8d>1yNkN8?*5YEF?KO\u N7'p'p'p'pNNNNN‰59 CњslI򖜮]e'9 #'kYǜN Ӝ.ʯA6ُ׸> 4`>ʜ 8D#N81eix.#sp:MkؘB\nCxGWO?pp [SX?t d59!3*,'sl|' %NrIś8(֥8=R(8l_ȍiTQgksc67s*b0KBr C;OfK`N楜pI|LqsqS0/q5^^T#`˸Vls5s4"v}~ 3Ii<:fuiCŠ's ܟOZ3}]G91uwtE4T'J¼ ȉ.D k9lX8Oa])TʜE\_ܷ{FK$'V>[v$/ɯ!קXwsz_Ή_t}z1srOOV}GNƘkpxD'gm0X'9388888}y*,("18b.T? BP|󟮬O4?q]?esF\p_?epq){Nt'ނP6'sYb'=Oԧ ^/p:iប͌Iuo|s N'9Sٺ>FcNn{s>';q'b_cYINaԌFQo= #N#Z):hOb/ٍ lKӦN2 ilӺ pr|qY?X|8^ 8n8|>O 2N[Foџ888\NNNNNz9Dvz}q4̜1M9vx;U /+m8~CsߔO}q%e' _N'l?)9I_9̜18'wJ쟝8-ϛ9cp^wOq}}SRqrks4oMq}Z>11mCT?"nܤDӏ(+mЯGpp N} N} N} N} N} N} N} N} N} N} N} N} N} N} N} N} N} N}qф܁V܋Rs˜pjZ]pjZ]pjZ]pjZ]pjZ]8 5?.pznR pCԇS>N} 'f- tS zvq*v kZD[N/FN.d[B Ԍ!ws5lV9T^\Hk'k 6p"<>R^^_ kՇvg`ӿh}r-dXS'38EWY뜴*ku]⅋p}ҽ#ʈ۸UYCԇS>N}8!pCԇS>N}8!pCԇS>N}8N zrfkӫG_i}˷/pjZ_Z8= J}Q27,en N{8y4Ӳ|??S>|M쿓Ԑgn/wqonŌx~?$sm :Z[2c]dل{Β_urqbN=Hrsj"'aٵ]Nڦ9Nf;'W&q-mbTRr_1{8ٜp}<6'9IZOR?o,޷j4zod ?bʦk+W__OK~:IMp9LIP#?qx}v'>Qv~)SzƜ> vwm"#8iyS Lx}vq/VFpdYOaԇԧ3't)2zgv-jO}:J}BW׬C<6]ק'ER2XޯljMlG1(WѮ SX6P38~-jw}:J} WdLF̵Pdj]f9Na,t>?>O6i8d2|hQۢvէ'tIG1ߤ9Yb{l3665#>z3#9[}TV>UO}>!ԧ>n'3~{?kOHmL2%vhSIo8zT;tSֹN%Ѹ)7&eu*K^.t}m9龱koSM?>mK~ciN ƩO8!pCԇS+^?AO7q7˵OS}swiw|S'2"֓wISXgX8l9l}P⅝?uɏgCUnpuY?8*Y?Q9QGp:ۜ?QIʵox{8U?Q/?yL&wwS:"ךmWoӧ Y!ijCȧև^z{WFԽ?xP5FJw~]wϽ?1lۋWSiSloEV܁N}8!pCԇS>N}8!pCԇS>N}h-pZCi=tCi=tCi=tCi=tCi=tsgE9A 8!pCԇS>N}8!pCԇS`-)QrIENDB`apcupsd-3.14.10/doc/images/thanks.png0000664000076400007640000003717610220346354016250 0ustar adk0212adk0212PNG  IHDRqVVPLTE~fffJJJeEBBBL9:::i666#2I0!"*:I.fᚚ&&& )^^_epVFbvvv""%NKN>nc 2]ZH`v5Jmu>;l@>AZ!!&D5*r0-N R1Lh>Z~":FFFf`1?>D1>V~&f\v,*z VB0B nJR0&GXP1?R2fhUN.TR'5=nUv e/{pv7Nr.D\PTx#1v VRrhV^ &S*:T" {04XXXl"":  =Lv"E (/Ba2?4o>*pIf<=FrR[>UP$1n ZNZD,X;2[X]:) &<)E~z.zt6,^2Ff2 t~.zi \3"FV fNn&j(*H'G&6P:Rx: r^ b2=]w*>Zr Y)2W3"*FjvR e> o9z* yT=2 v.>\V\Jd 82,!*J jVbT:=lR=>Z b(#&t#+G(0/2>&_=YCBFO"">Nf bYjv{v84F l& z*:%CCN|b5v"04Kj6%"&fF&Vh`rjBBC^. t*,L&*PPPN i>> ~ ~C;mFFvCJ{Bvvvj&:O>" !3FkD;^rb `6 r bKGDK ;2IDATx}}\T癶4B!|4'! 6EFe!n邱C'tP,]݂ӼkAe 0qN(1d7"ɀK`$k1/cg>pΙ3gs\9I!£: "M>mUz7| ӂ(Oc Q\$%%`KIuEͯ5cHr&gx S|G<\9!uŭ6.x>.ƉE^^q< R)2^(>~G~p#B[R2\ԡ}_W|L .bbQXOI.8ʕ["beW{)q²l5)7$K [ЬH$~+W0$ǃ!͛[P:pBTEC(~L$nI 9޿u'4[$i0n6UP'=@~_u@rM! }>&z?sD(͏ y6CE4k<V}^IHFq!|9l4_IJpj4 vzP*뒒BpS -Ȭ lP hL~z@[ЂMg.^<лW.YH-GGS^Q]-Rvu*i2lgQG!!L&ZKSR|g7|ŅnBCM*R&ܸH`L>AVKG4}7#!ؐLBqVp'1rurBsv.z/LQG>z't;FG[z1ᨆֵKn:5xZ|a^`:C& b L7K;@i\XY@|lh(PdYeb*>:NϦ̦1K{+yy/+1#SO WG \L~)cIKѬ~ :!=T)!-,u4a2n*,&q¿+WBTS{w39g_)kc؊'/@ܯRlq=}}) : AmY>D{Q/r!V=2۲ʯZm9NDtlWi0^=|q7L*8skB[ 9fS|<@q78KY,ŝ0*4nIqn. үH$(>VְqBL9v#v W1I).U|!p' hZ:gLN&[_-o$[u$Ge6 .:Ù"4")NE?ξ`='>XpU N!*~E1\,FE$ҨB&6Ȭ{u|h2iq8q8>8 YY}`??0iQ 6?U$Iwu~oKZWT0T.$,)-E^R_"K^zTqF]Fe|GnD jw()W #^^nQQtI 97|C}qsiϣ [DRJϋ}ˇ8!@ܢ&O?n)ɸ@aחv\v9Nmef(E_^rO/8ѻ=@6/^u0\8/G yssvn6pKXFdbEVk.?x96g3+vp\E y@\jJ|S.Jhao#U(B~^av2ν}Oq"~_%F-ϱIŻIdz})#2PR{JLdk}MJK !]oUI .t 6>.2}RqP8^i1O6qudLK{c!,7D(9Nqpj g`ae+CtxuZFOōܔUWV<ɉ(ϱ~JcJHCV&*g(??ņ\g?Z~*.h7DOڀR([ e_R3r'^.T3HAglFǁfhN}Mv,.lC$- |(`p~Q\qǁ8ULkg[$ccchf[/%3Sa>sRݒNB"9n";i%aIeXm{@WF_5NC~e;grmޖN> U}&,oa/6ɂP&*q iL9;ƈc2q}r gLxLNÌ^#l Q[_1qp_o)bWY YYVxFPF<,9Q!~O(KoM ]-J[wot^S9ui^7 QFXmm.~z x ٤o:}ի^u3d{5CY0t/5/ }3*5LgLV"ȱdpֈz'sPR18tW/8Q(Y_!H1ӳ|#Nr7bI̮Dq\qEbΌBoO_ĸ%#&ͳ2.8NAݑoBƣ(MITo"ďgC~ eFM)/כ&0Ѫ2Vj-C)d2.[^pCZm~~~ywYselʪyao/jXWܛjk}.:&7ׅBOk{-<;, cx̟} A7oF  1S1btD(=Y&&6r,zn X%Dž pirtMY r|:kJH[RR cx*ZSZԷ9T7p 9xSOKQPV[ tڴi跓y 4jW!ȇjv M78ӆ!P8>@׾=͕DdK!) t7 $+9558[à'~q?U')Br ~?Ĵ^L_ ^8%q?L`m >E'4/WxDo#S䀮 w(jOZMG\rW;H>,}YOjY!ON&ubP$(>gHTPcv] 5)ۺZ*Tv8~]u^:JKهv i|D/ cc٪lEqFX><Ù b6CQlk[Fd'&6d &`LB WLC}qp> 9Yr1a9騝d j琠?tCCT:P} 8TJ1tlܵr8BJ4oFl<wJu2(aVVPCݻwwڲc߾\@x(EqTkX/$x$*:9|&*-«O-[VwTRmkZrzδؕP涒~]UV괁7jȊrtg:"d= |N8gגAòS̀lJEMRA6=-S{?s4q $8kNx_EV/.vŭ2ZG_8KQQG 87SOc8sݩO>ڔ/Oygjj;*\ڇYm/N 6iĔ{͝ӄ_qyz10q %U)ٔ52򍦆7NqPxY9.(ӯ) ,]g#odB`S]0$* xB%KXU5|bEcaБK}'Q<2ˏ-y_#:j8jgp዗ &WJQ t<3|qPl&# .$S<݆WZ_׫{5"rzVrGx! T%DbzO-ZNj5G&):q5UXx rg2L&?]&S|?"gcj!nsr1KRvݻs9o'Igq7y:NpL۽"j)x*O0]q;v 7sEQvV[oA$ i1)D@U}Y%ݕ Vzs N"IZ^0Ƀ[Uψ?$gI,,y%%8XM".A\je'_m%\1(ֱSL|$S\r>CUd!*u<#Ei9i_E-Ĕ=6s604 ߓTs"-g,f)Ըm}sx y $D?'uG hI@-1&3D%Hq1 UѓARG?|)ye9oҥI *~E^O ̏su,!ap˂v@i$D*"w)w9 6hsBGp|JURo'fEqEpn9 077\Zqs0q_Grj +o r*1|(w'ݓ\"1mG+-qD|W&/$4ϏsvY3ꢀg\8 %l < TbD/f!r~B&z-9pPumD9> U,wqu[NC9rEqqb8IW(*G#1A9NQ*r>yi'mǥ8.{z?37qp\Upz xcHیtf)z>yyÏU^E$''hߐVހ[F[L*D H_qI ^rSSլ*gIUxDWa K @ȧ@b"Ў,TY,/LE" {we{[ =ɯ򕲘Wq-gkNXh8?Bt<9N Pj]&nb GONܛaHe"8y5QpXtvA%6g[#ӲKb ҡ+|Q0 G˹~Px\jR\p|^l1"P|Ga0^ZȁynE.Ø_c)Q?!:.nW*d'M!>^ck^>EzT㼯S«TWym~U‹¡)=N{84E>,^AǎUꢜB $O~W|jVsuYQV:*qvbx͛7-3;~[c+_eῠ}"{n_gBܠ!ċms݄ɯ\%~+Lγ\%kYyeVq!_ akJ0O_r/=GeqMڒK,:E4[CIsƕ t/ϻ|{<#Snq݁6hʹ:mf߽u/x:AF<}'Lf7_?_T4e{x79m%(eɐs~ΚUIxu꩕x]ɓiQXg~vdUqH8Q; pu~%_g4_M̯W`5Vt-T%o.+1=qײGbcȎ{姄8-Y$qūpB1Y9I^/e(5r0k''C6kN]8ľzyR "XS0lfɊNt+ӓMbO<_߷mKVt|>O@<Iưb9lVyIF f_*<Qp]ik_KTc%j_B!ߎAVà 9]@Q}Dt|W,j˔yUL%6fhhcvTLʾ24^-~2b 9tDvAhzq#;ǂF8!V`QK vuj }˟-a2.HQyHO׉ojqL';؏8Sq+++ѫY?KX'!9^~70 SkO`(\XR_FF܆6Κged*"#s`QY侠n T1nIDM9 L@'rC{1g&r FM 2fijG@\̓Q85j@Y.溡q=Tr=Og^'Z/B8ໜ? h(PRVɒUF7U7&"#Η晗1ɢR>M"fÄxW U_G'r?=vB}']9 |Ǒx kR[~uhn[߻p<,z`K1Sƫ *mj(tE+{bFo< Q< &_oK#HBѝ x奛, d'U]  o'Wisz\]zmyZF'O >ԶE۵mrxQmP1EAJΎ__6F?-8.[0%NBt3ǛyI hW==fYy>~=O;OD?;^eI@v q|eJ7quÕAw oQ|Ar\h_{fZ>eLV_ZRʸq0##Å7MTgJ^/Tg}ee:Az55oYr& } ;x{CFfsoʃШQy'~*6F.͛z팃oMwdA6y[Ÿ-:6L)W&^ody%' e_kbx2]/n#bIK?{ߐs^mlQmHMsKK\ų2R4ESjϭ{zNO`/kG<j(D!w`EEF#5 YO9}S(j{\!S6\h4hƛ7#s#{bRlږgjXȓU,Ka~p10^,_mB\:(U2/wcclȧ'"[@_gNawIOgeiS$Fڃ>_ j$bF|'V^-ٴ 0)wѫZ;֫}ua >j(os۶M}ZLaB+hϾT= ک0b76<|ïP7W&( {NU1&9C5[U8XL/U8e>w4}KG$WDuq ʏQ㙙ˆ[,%^rTW/[z ;^^}oaNJ*U)4q=!N|Q.~c!]L ʴ۷ک C bwa.nY~0\ȍ`Q'ćSr3`f>C> Tt䗛E@^;HL4|jsjjC| yd-gsP]~`dDTJF܃_ڸqyE`8JV6pn d쁩WIkc侥UrоȊb?SSn?g>/c Հ'AÇPoEgQ|+}?g>w]OJĈ?FOyÏChٱs£8xnSOfn{➻y}qߗMB}m ";O(q}';s|ǭ{˯q_p=8C~P8J^<Cٻ}>җ>x|K_}xm-xC`CzzލO~6M;ΐ.5nqX_ٻ?[%L}S|mG;8߹t|w>&8Nn;h]=XH? [< n%c_6N.C;;օ{8/xG ZH ޹7k!V@B(? 1g-rmIENDB`apcupsd-3.14.10/doc/images/wininstall6.png0000664000076400007640000001135610220346411017214 0ustar adk0212adk0212PNG  IHDRSPLTE{AJIDATxђ*9_صJO> DbcuF60ճ !v7]@w o+AP[읿STÍ:}'KBy@u exMKtTHWޕGqm~Tʦ:TҼP@*PdEOEE@U"_y UwgDzT+oJJuNu~?]j)Jڪ D@""\ """""""""""""nFv kk*О1nc'\@(zR”.0*K~樚TFX׫{?{rNەr*ԯ+aJڿ{tAT: )o|SJiYQ =d{ S ZҦ &&YPmh0yڳH@{V*(㝵fԅ@֡{_M@[C;([C(^u FfN졶P0kuTۭ-)nZy~oE]y@WʶhE&׊cyW6 ,4F lsE@Wh鴉tb'Q30^O_>P*{Oг ? I@7'$Lȿ(d#(~&8w< m:K>KTv6o[N@6ƹBoQ6x}}DyP>Ah7EPX(\6S q>Ƭ?^3%uDGn3 T=Z@t">`}/Sm:к@ovPA=u:|^RE(^˧T(*RuflP ,C+PzTvW*/Gx&S^Z-PTL6!AdM&-0?6T@*t<ֵP"F/WJ {'ֵ0j23лXj>=uo[*p:2bZyn un{!V~oЃVBV//c]y= o[%PB1PU f{(fжTz:PLg!W" 4O$ ywyz:g(7F7)P'g8~V{>qJV^:<0AM d&&Z=N)t; A8SKzGR׍F*<pqJ˭yZ4[4~‰mP"01JR8XQ&J=6lCݭ(qJbKpzɽ{̉=7h8%@4݃@ VDB BYm VlKW|" %Y(hdt*[R~>:ncrOXU m88Ħ.@Z(lE@21B.;1 .(yM)ZS&6OFzې. xb`} ^NŸɷwNPa.rmX*P)2|u p"p0}>%(,"Ӥb eEξ4@cPs@ \VeŅB]BI({KF@>4}J@Z]@j*\Lۇo]5M+"Ѕ:Kak],Ԟ;O ͹n yzԤZSifkߧ ==L@ ,"ęB/-UjIRꑷjZ&qd @@AzRCNznGr<*PL*U%Yաj:"/?E@s*C 㕊ɧt-{}w%l@EzNȫVD3h7&Sng@Shw*\`Mw^2.6Bmjzą[k^w%p)6}Jyn МO)j|ϽNtE@)Ej|I{I4F5S1Є{"ߘOI̴vuȽ4 >%9w`&oM@i3h=BqE-P\MPKsDRH|G44.א}J@G"gdr 1D_IԍP,B b\625$L?xt=(@''5iTO-2 zMtF5$L/_u8ہމCOC$$/&P8)pynf OU*P=Q\jNև_DYc?98/MP-͙zJ5G0/DiTWETe=#Ћye:9΃Te=2@3+:&-T Λh}OֵP[Lc2";| 4[j؅)UBtT34ܙxZsr}zJ@cqW% E`,Wd" Y(BqU7M7>$}yYcqXco nb#"7?cjG (,bڗ9LRw l74}_N&z\?}2XC=5}PoC IARO|Pqʝc飀:͘A=ОM@&EcաSON͉Լq@+Ϸ~ ,t`]Ϻczм AQLz 肞j:%v@'*lPFu=P}bZN7Lk4]f;_.aPARs+qQ>U<)9eИ]d}q DZb7\sii&}_k\+V}{%jv^5GP~m<3nEMkjT Ig-Tx@%3󫀪O As+<4]0Z>Cj@~I6'nЄ tQBӘ}h 4'-aO"mî:*zED[J ?SmocW@IEEEEǢW#ԝM㘻pi^'D@SZj0Ub1^"FQ0Mc.H}]*O5L >J@S-wh!*_@5_**hJ1P{fE >J@SZ:tj;')ѥ'"f IG hJd"""""g ~0G0gfP)h<Q41]76+n$:45]Im ߺnChK~+D7JѼ%3M5tyzTB?"`T\nChKщ}<] 5u) MZG*OP%"zE@E@}m-`#" 5s;t;s#֢#1uʅ5J@ h PaHC@e- n: 'VJ@v Ju(&Pjzro@uJZhV ^aF6L4oqF@I8""""""""""""]]gﰁ_VS8ҌIENDB`apcupsd-3.14.10/doc/manual/0000775000076400007640000000000011634011372014243 5ustar adk0212adk0212apcupsd-3.14.10/doc/manual/Makefile0000664000076400007640000000041311177411411015701 0ustar adk0212adk0212topdir:=../.. SUBDIRS = include $(topdir)/autoconf/targets.mak all-targets: manual.html manual.pdf # Force pdf to regenerate whenever HTML changes # HTML rule has all the dependency stuff manual.pdf: manual.html # Include dependencies -include $(DEPDIR)/manual.P apcupsd-3.14.10/doc/manual/apcupsd.png0000664000076400007640000001703211200437117016411 0ustar adk0212adk0212PNG  IHDRG@'#TsRGB`PLTE$e kGYc,;EW|AIO7K)5>u]hp (/4SsJjYTyqzCo }J_Co^/G{]ۜxA nK.UU>x9kL9Hc]dKQ~V(oGɆJt ~i 9*r̬r;$Q Kq)>uGLQ;:vք˸L{o/:f(= E1C Nv^ȕh1F `/4|s?Qkk%8$F:RKSWhp٘~7uU`:|.S]w"^OՖc}%#vhnS|0S.6H}I#HדqG[..8ؽYoqDjHc]^^at*ZwtG1g.xSRU?eC]tˇ)r pt1\r(0q8}!^ [ƽ R7Qq ? k Rqt{хSAd':xq Awča->l*ȝM `މ;p|`yt#lLwH=) _ $ڏx/xIsQ 팔m2DW:M]sT[ &Upst$ 8qF;ƒ7#.i$hV2,YWM>& kkim&mG }eu:t*=NRy!h/Q)f/"zGzm疣ƮV K#[%=K͕ KO&^G Gg] =Gm>pU)}EJRNZS~6(G2 ݚPuqzdEn}Wt#s(.>믨lZ-h=cqTA!봀Y"1һ:.; Sg88?9o9HHn8/Yoѻc G,E ڀкzˑ}^p=;'ȑ.n9e]9"ijnKɭ^V7ki9=LrV}4sHTڴFg#K}hu :(\bWAǣah r\π5РI9BJBb8u&DG#֩8N+y>ĨÚQIJx:YuYY^<<= Vn!}|}DZ`:$@Zb8()X}jNvkOzVDr6xO77;3+ulR鞣CѓJkq+ (>Șډ}$9&8'nH'OfWsDMUyrᎼѷIßG#Ip~:"bz9 d.L  Y֨8QM+?s,2* ? #q\ ]vUL,g"G)5afRptfm  kAۘ {,}rɃ h|#{$ 3ƪw8 ׊ac5gAtQ)GuK%r9RP`QLa+]k}t(1VCMojK:Nq)%[\`A)/ޕFؼ7pt{_^>cxGSj8[ S(j}Ά"^kȲhgYY^6to0Bz5[C8e׷zFh.+-G})Q9+G T}Ծd5o@l=G(|^c`8G9 -;?*"*=9k׳zh8H{k%ThOYw|J~ջHGe97 |_lgP :PW ulރ);J[sN?to BDt&hK+U!ķv۽.S6#={PeӚ1(8YfTFo L|PȖ{9+9^8CU9ƣP7Jt6r4W&1Hig*95oTOCL*C N,SŎ?†'%UQLCS1mitޓ,ӻhTU$Sy-C %Ӛ5b=R=GqlƎtseƻb8~l'xyt?WIPiː$ __' d(qo4>FGwԴ@ܥ^?yq,K#Lƽ3ץ¨8⁒#{b<䆸pDrVb |K8$PbP^}WMdd+kaT“CzlXE\gOZb+IT/A%~9GET q9i^/(Կ(lH0J1ҬFG2~A5h#Pko$m|B "}3#71y8j#&czDN{Í9 v(1 6&a e,\1cb&/%PUKG68z8PT>M/T@bL֯뵭W DQ9"޽6f6G)D"[ZF}2F`@y1G/P[)}5ʺR5&ƨ߁"(I%V=}$/0|^6ՍlkApy,_ amaŸ׈*.B i¬q8Ej(%Af+Ы rHSM!]~XXD\˚VxUfisaΉ`&b᠈{x cY e>l#x7';/ɇ΄xQ]+^9$1.ӂYO:2 Iė!֨1<=}}<΂$nSoSѝt#Py+8QϯثCpt}݀X̦zim[ڶu**&UOzjloyspp#Xj©9z8zїY4rݏ81IG.OA͙l['Ϗ8H GyQ(@H7yqdi*A8ɚ];zrt#(l8jIqGpH4q$,GǑw+Q:c#O/;(v{!$G HGAYFxj=]\K73`ʼ,{vjtv6EpVey5#Me5Gh$$e;8*}ht;TQӞ^ZM^ 6dGhZ+nvi9 1 hy F'f<娵Y ԅ9TZm=w1pr!ƂߍQ=#G6jlJXW)?2&%vԳk\BM bdpien9bѺhfUHWu!{WQѲYէ Pd7l3  Zk;Jw;z7,u|bg8bl+7h6CJB l9vPܕ la1-\*(7CzU|= Nl0,*ƈ{A#*rb'#w+ᆣzbZ^ "/@4MSIBшpNz҃䊀&5[|U ߌ"lib>E+Y`"΄K#"*wԏt XߐLarx9R  C*҆t_z1kOb7xnw~e1gnQz9I@9)kq([m8<'3]]]&90cEKüjۈq"|>ƷKMF kL~ 'EӾiGwX\r4S0P<E0 d=F"&5K acGjyZ`В=FրiI+3y!Jx"n1I{D^3e!E0u ] pAIb*ss(9ˆ:u\y)7~ѻ9%]560h\Bw>sϲĒMyoe;q&^\'bFЊpsoR*;X$|g mSj ~{j!(Q=X`ok3u9;bmwO8{Acv"m#ݠsg^#Ĥ#]p G8臯6 &"/d7Yzvﲫ}hV*/]ks(J>䨷8"TC׊-PH lk8@{ Xz qv}b ̲=G)@FY<N/}M#˚w" }8s4̛1Gb[zhsn~B=:ŦUI_ڽڑc8rYuh#~%1[̇E"j'I'0{غkJF~f}\g]ȨQ3\voޱDAtL wخ_hXg8z:>]=r3UfbJ󪼊 F໑R GDi:ڙ6uIU~%oZ[!muGȑ-C̜ 6Mv  3#0P?w"d v6r ]>_g3GdM\b6I7UG:l~:ਣU\b隱9xUM[b:~mUWy>K~BsT+#V]Jb@UӥUv.Cyj*+@rc,?x'-lzMo]}1E/8;qikMbD]s9zSzq@~[$JU'f~R* r7(IKMTZ(9]R2RxlwP44:@ycm6b* *mk?VkG ogt Ʒ&lf㷓 {m8'ڦ/C(snĵ 6p9'J;Ik#xPQ۶WZ8jtڂ@I?Sy4w8Z;}!B5,Ǯ. HO g{5S5WFs's~#>"(&RC.3ƍdE^$o?ՙ @:eY;9Ɯ].m>+3~W`ɔi?Uỏ";cw0s/4*JOl׍o^e/7(vgRV"KX檜(ObrXԽAmi5'`Y* <˰+_kiGؓkr!3Y/*=II] {~Pb$I‰o{,#t%yEis1;ļZs]FYWR&.⯬(FuEj6['*~)6'^4Z0ʂߏ)e&SM(XV4 4BVu6Bt;mQ%2kQKD~∣԰\oh L!ێ H6_$nܯ+,cfO ^/L@#JDIV0$Z l9Co OSK 풝Ѿw*ݽ1Bե*aV'8@ k7j~}RkևVTt&&2di-"*EYڰXf.#YK{4W|eZ{i#Q7Hʈg-Q V(n9O~3 rTjCk*]J_LKk6dة'DV9tfW:p\ZLuI z\;xĝa{stliJhܮfodºwA\XU9NQJst5l'ʋe[B#2R29m..MITY se!I(aQ6ƢVybBՏUlxalX3j^RAt;83LwKm.h5o~[n&r)9z.cz9g8'z x?Y]rI+qSc'p J)$um᦮[IruYv7/穘1"D;nq3io+lL#!9#mέwX8-r2t->f:L9Ԣ(wg<{|drl}(vJܵ(h:5/e'qm`/Z(ut XH`;t^ ?06s`{Qgwݓv9 GλFO 'Ŏu*zP88"js(~?W~%IENDB`apcupsd-3.14.10/doc/manual/cables.rst0000664000076400007640000007474711176431056016257 0ustar adk0212adk0212Cables ====== You can either use the cable that came with your UPS (the easiest if we support it) or you can make your own cable. We recommend that you obtain a supported cable directly from APC. If you already have an APC cable, you can determine what kind it is by examining the flat sides of the two connectors where you will find the cable number embossed into the plastic. It is generally on one side of the male connector. To make your own cable you must first know whether you have a UPS that speaks the apcsmart protocol or a "dumb" UPS that uses serial port line voltage signalling. If you have an smart UPS, and you build your own cable, build a Smart-Custom cable (see `Smart-Custom Cable for SmartUPSes`_). If you have a voltage-signalling or dumb UPS, build a Simple-Custom cable (see `Simple-Custom Voltage-Signalling Cable for "dumb" UPSes`_). If you have a BackUPS CS with a RJ45 connector, you can build your own Custom-RJ45 cable (see `Custom-RJ45 Smart Signalling Cable for BackUPS CS Models`_). Smart-Custom Cable for SmartUPSes --------------------------------- *You do not have this cable unless you built it yourself. The Smart-Custom cable is not an APC product.* :: SMART-CUSTOM CABLE Signal Computer UPS DB9F DB9M RxD 2 -------------------- 2 TxD Send TxD 3 -------------------- 1 RxD Receive GND 5 -------------------- 9 Ground When using this cable with apcupsd specify the following in apcupsd.conf: :: UPSCABLE smart UPSTYPE apcsmart DEVICE /dev/ttyS0 (or whatever your serial port is) If you have an OS that requires DCD or RTS to be set before you can receive input, you might try building the standard APC Smart 940-0024C cable listed below (see `940-0024C Cable Wiring`_). Simple-Custom Voltage-Signalling Cable for "dumb" UPSes ------------------------------------------------------- *You do not have this cable unless you built it yourself. The Simple-Custom cable is not an APC product.* For "dumb" UPSes using voltage signalling, if you are going to build your own cable, we recommend to make the cable designed by the apcupsd team as follows: :: SIMPLE-CUSTOM CABLE Signal Computer UPS DB9F 4.7K ohm DB9M DTR 4 --[####]--* DTR set to +5V by Apcupsd | CTS 8 ----------*--------- 5 Low Battery GND 5 -------------------- 4 Ground DCD 1 -------------------- 2 On Battery RTS 7 -------------------- 1 Kill UPS Power List of components one needs to make the Simple cable: #. One (1) male DB9 connector, use solder type connector only. #. One (1) female DB9/25F connector, use solder type connector only. #. One (1) 4.7K ohm 1/4 watt 5% resistor. #. rosin core solder. #. three (3) to five (5) feet of 22AWG multi-stranded four or more conductor cable. Assembly instructions: #. Solder the resistor into pin 4 of the female DB9 connector. #. Next bend the resistor so that it connects to pin 8 of the female DB9 connector. #. Pin 8 on the female connector is also wired to pin 5 on the male DB9 connector. Solder both ends. #. Solder the other pins, pin 5 on the female DB9 to pin 4 on the male connector; pin 1 on the female connector to pin 2 on the male connector; and pin 7 on the female connector to pin 1 on the male connector. #. Double check your work. We use the DTR (pin 4 on the female connector) as our +5 volts power for the circuit. It is used as the Vcc pull-up voltage for testing the outputs on any "UPS by APC" in voltage-signalling mode. This cable may not work on a BackUPS Pro if the default communications are in apcsmart mode. This cable is also valid for use on a ShareUPS BASIC Port. It is reported to work on SmartUPSes, however the Smart Cable described above is preferred. To have a better idea of what is going on inside apcupsd, for the SIMPLE cable apcupsd reads three signals and sets three: Reads: CD, which apcupsd uses for the On Battery signal when high. CTS, which apcupsd uses for the Battery Low signal when high. RxD (SR), which apcupsd uses for the Line Down signal when high. This signal isn't used for much. Sets: DTR, which apcupsd sets when it detects a power failure (generally 5 to 10 seconds after the CD signal goes high). It clears this signal if the CD signal subsequently goes low -- i.e. power is restored. TxD (ST), which apcupsd clears when it detects that the CD signal has gone low after having gone high - i.e. power is restored. RTS, which apcupsd sets for the killpower signal -- to cause the UPS to shut off the power. Please note that these actions apply only to the SIMPLE cable. The signals used on the other cables are different. Finally, here is another way of looking at the CUSTOM-SIMPLE cable: :: APCUPSD SIMPLE-CUSTOM CABLE Computer Side | Description of Cable | UPS Side DB9f | DB25f | | DB9m | DB25m 4 | 20 | DTR (5vcc) *below | n/c | 8 | 5 | CTS (low battery) *below | <- 5 | 7 2 | 3 | RxD (no line voltage) *below | <- 3 | 2 5 | 7 | Ground (Signal) | 4 | 20 1 | 8 | CD (on battery from UPS) | <- 2 | 3 7 | 4 | RTS (kill UPS power) | -> 1 | 8 n/c | 1 | Frame/Case Gnd (optional) | 9 | 22 Note: the <- and -> indicate the signal direction. When using this cable with apcupsd specify the following in apcupsd.conf: :: UPSCABLE simple UPSTYPE dumb DEVICE /dev/ttyS0 (or whatever your serial port is) Custom-RJ45 Smart Signalling Cable for BackUPS CS Models -------------------------------------------------------- If you have a BackUPS CS, you are probably either using it with the USB cable that is supplied or with the 940-0128A supplied by APC, which permits running the UPS in dumb mode. By building your own cable, you can now run the BackUPS CS models (and perhaps also the ES models) using smart signalling and have all the same information that is available as running it in USB mode. The jack in the UPS is actually a 10 pin RJ45. However, you can just as easily use a 8 pin RJ45 connector, which is more standard (ethernet TX, and ISDN connector). It is easy to construct the cable by cutting off one end of a standard RJ45-8 ethernet cable and wiring the other end (three wires) into a standard DB9F female serial port connector. Below, you will find a diagram for the CUSTOM-RJ45 cable: :: CUSTOM-RJ45 CABLE Signal Computer UPS UPS DB9F RJ45-8 RJ45-10 RxD 2 ---------------- 1 2 TxD Send TxD 3 ---------------- 7 8 RxD Receive GND 5 ---------------- 6 7 Ground FG Shield ---------------- 3 4 Frame Ground The RJ45-8 pins are: looking at the end of the connector: 8 7 6 5 4 3 2 1 ___________________ | . . . . . . . . | | | ------------------- |____| The RJ45-10 pins are: looking at the end of the connector: 10 9 8 7 6 5 4 3 2 1 _______________________ | . . . . . . . . . . | | | ----------------------- |____| For the serial port DB9F connector, the pin numbers are stamped in the plastic near each pin. In addition, there is a diagram near the end of this chapter. Note, one user, Martin, has found that if the shield is not connected to the Frame Ground in the above diagram (not in our original schematic), the UPS (a BackUPS CS 500 EI) will be unstable and likely to rapidly switch from power to batteries (i.e. chatter). When using this cable with apcupsd specify the following in apcupsd.conf: :: UPSCABLE smart UPSTYPE apcsmart DEVICE /dev/ttyS0 (or whatever your serial port is) The information for constructing this cable was discovered and transmitted to us by slither_man. Many thanks! Other APC Cables that apcupsd Supports -------------------------------------- apcupsd will also support the following off the shelf cables that are supplied by APC - 940-0020[B/C] Simple Signal Only, all models. - 940-0023A Simple Signal Only, all models. - 940-0119A Simple Signal Only, Back-UPS Office, and BackUPS ES. - 940-0024[B/C/G] Smart mode Only, SU and BKPro only. - 940-0095[A/B/C] PnP (Plug and Play), all models. - 940-1524C Smart mode Only - 940-0128A Simple Signal Only, Back-UPS CS in serial mode. - All USB cables such as 940-0127[A/B] Voltage Signalling Features Supported by Apcupsd for Various Cables ------------------------------------------------------------------- The following table shows the features supported by the current version of apcupsd for various cables running the UPS in voltage-signalling mode. ============= ========== =========== ========== ================== Cable Power Loss Low Battery Kill Power Cable Disconnected ============= ========== =========== ========== ================== 940-0020B Yes No Yes No 940-0020C Yes Yes Yes No 940-0023A Yes No No No 940-0119A Yes Yes Yes No 940-0127A Yes Yes Yes No 940-0128A Yes Yes Yes No 940-0095A/B/C Yes Yes Yes No simple Yes Yes Yes No ============= ========== =========== ========== ================== Voltage Signalling ------------------ Apparently, all APC voltage-signalling UPSes with DB9 serial ports have the same signals on the output pins of the UPS. The difference at the computer end is due to different cable configurations. Thus, by measuring the connectivity of a cable, one can determine how to program the UPS. The signals presented or accepted by the UPS on its DB9 connector using the numbering scheme listed above is: :: UPS Pin Signal meaning 1 <- Shutdown when set by computer for 1-5 seconds. 2 -> On battery power (this signal is normally low but goes high when the UPS switches to batteries). 3 -> Mains down (line fail) See Note 1 below. 5 -> Low battery. See Note 1 below. 6 -> Inverse of mains down signal. See Note 2 below. 7 <- Turn on/off power (only on advanced UPSes only) Note 1: these two lines are normally open, but close when the appropriate signal is triggered. In fact, they are open collector outputs which are rated for a maximum of +40VDC and 25 mA. Thus the 4.7K ohm resistor used in the Custom Simple cable works quite well. Note 2: the same as note 1 except that the line is normally closed, and opens when the line voltage fails. The Back-UPS Office 500 signals ------------------------------- The Back-UPS Office UPS has a telephone type jack as output, which looks like the following: :: Looking at the end of the connector: 6 5 4 3 2 1 _____________ | . . . . . . | | | | |----------| |__| It appears that the signals work as follows: :: UPS Signal meaning 1 (brown) <- Shutdown when set by computer for 1-5 seconds. 2 (black) -> On battery power 3 (blue) -> Low battery 4 (red) Signal ground 5 (yellow) <- Begin signalling on other pins 6 (none) none Analyses of APC Cables ---------------------- 940-0020B Cable Wiring ~~~~~~~~~~~~~~~~~~~~~~ :Supported Models: Simple Signaling such as BackUPS :Contributed by: Lazar M. Fleysher Although we do not know what the black box semiconductor contains, we believe that we understand its operation (many thanks to Lazar M. Fleysher for working this out). This cable can only be used on voltage-signalling UPSes, and provides the On Battery signal as well as kill UPS power. Most recent evidence (Lazar's analysis) indicates that this cable under the right conditions may provide the Low Battery signal. This is yet to be confirmed. *This diagram is for informational purposes and may not be complete. We don't recommend that use it to build you build one yourself.* :: APC Part# - 940-0020B Signal Computer UPS DB9F DB9M CTS 8 -------------------- 2 On Battery DTR 4 -------------------- 1 Kill power GND 5 ---------------*---- 4 Ground | --- *---- 9 Common DCD 1 ----|///|----------- 5 Low Battery |\\\| RTS 7 ----|///| (probably a --- semi-conductor) 940-0020C Cable Wiring ~~~~~~~~~~~~~~~~~~~~~~ :Supported Models: Simple Signaling such as BackUPS This cable can only be used on voltage-signalling UPSes, and provides the On Battery signal, the Low Battery signal as well as kill UPS power. You may specify ``UPSCABLE 940-0020C``. *This diagram is for informational purposes and may not be complete. We don't recommend that use it to build you build one yourself.* :: APC Part# - 940-0020C Signal Computer UPS DB9F DB9M CTS 8 -------------------- 2 On Battery DTR 4 -------------------- 1 Kill power GND 5 ---------------*---- 4 Ground | *---- 9 Common RTS 7 -----[ 93.5K ohm ]----- 5 Low Battery or semi-conductor 940-0023A Cable Wiring ~~~~~~~~~~~~~~~~~~~~~~ :Supported Models: Simple Signaling such as BackUPS This cable can only be used on voltage-signalling UPSes, and apparently only provides the On Battery signal. As a consequence, this cable is pretty much useless, and we recommend that you find a better cable because all APC UPSes support more than just On Battery. Please note that we are not sure the following diagram is correct. *This diagram is for informational purposes and may not be complete. We don't recommend that use it to build you build one yourself.* :: APC Part# - 940-0023A Signal Computer UPS DB9F DB9M DCD 1 -------------------- 2 On Battery 3.3K ohm TxD 3 --[####]-* | DTR 4 ---------* GND 5 ---------------*---- 4 Ground | *---- 9 Common 940-0024C Cable Wiring ~~~~~~~~~~~~~~~~~~~~~~ :Supported Models: SmartUPS (all models with DB9 serial port) If you wish to build the standard cable furnished by APC (940-0024C), use the following diagram. :: APC Part# - 940-0024C Signal Computer UPS DB9F DB9M RxD 2 -------------------- 2 TxD Send TxD 3 -------------------- 1 RxD Receive DCD 1 --* | DTR 4 --* GND 5 -------------------- 9 Ground RTS 7 --* | CTS 8 --* 940-0095A Cable Wiring ~~~~~~~~~~~~~~~~~~~~~~ :Supported Models: APC BackUPS Pro PNP :Contributed by: Chris Hanson cph at zurich.ai.mit.edu This is the definitive wiring diagram for the 940-0095A cable submitted by Chris Hanson, who disassembled the original cable, destroying it in the process. He then built one from his diagram and it works perfectly. :: APC Part# - 940-0095A UPS end Computer end ------- ------------ 47k 47k BATTERY-LOW (5) >----R1----*----R2----*----< DTR,DSR,CTS (4,6,8) | | | | | / E | |/ | B | *-------| 2N3906 PNP | |\ \ C | | *----< DCD (1) Low Batt | | R 4.7k 3 | 4.7k | SHUTDOWN (1) >----------*----R4----*----< TxD (3) | | 1N4148 *----K|---------< RTS (7) Shutdown POWER-FAIL (2) >--------------------------< RxD,RI (2,9) On Batt GROUND (4,9) >--------------------------< GND (5) Operation: - DTR is "cable power" and must be held at SPACE. DSR or CTS may be used as a loopback input to determine if the cable is plugged in. - DCD is the "battery low" signal to the computer. A SPACE on this line means the battery is low. This is signalled by BATTERY-LOW being pulled down (it is probably open circuit normally). Normally, the transistor is turned off, and DCD is held at the MARK voltage by TxD. When BATTERY-LOW is pulled down, the voltage divider R2/R1 biases the transistor so that it is turned on, causing DCD to be pulled up to the SPACE voltage. - TxD must be held at MARK; this is the default state when no data is being transmitted. This sets the default bias for both DCD and SHUTDOWN. If this line is an open circuit, then when BATTERY-LOW is signalled, SHUTDOWN will be automatically signalled; this would be true if the cable were plugged in to the UPS and not the computer, or if the computer were turned off. - RTS is the "shutdown" signal from the computer. A SPACE on this line tells the UPS to shut down. - RxD and RI are both the "power-fail" signals to the computer. A MARK on this line means the power has failed. - SPACE is a positive voltage, typically +12V. MARK is a negative voltage, typically -12V. Linux appears to translate SPACE to a 1 and MARK to a 0. 940-0095B Cable Wiring ~~~~~~~~~~~~~~~~~~~~~~ :Supported Models: Many simple-signaling (aka voltage signaling) models such as BackUPS *This diagram is for informational purposes and may not be complete. We don't recommend that use it to build you build one yourself.* :: APC Part# - 940-0095B Signal Computer UPS DB9F DB9M DTR 4 ----* CTS 8 ----| DSR 6 ----| DCD 1 ----* GND 5 ---------------*---- 4 Ground | *---- 9 Common RI 9 ----* | RxD 2 ----*--------------- 2 On Battery TxD 3 ----------[####]---- 1 Kill UPS Power 4.7K ohm 940-0119A Cable Wiring ~~~~~~~~~~~~~~~~~~~~~~ :Supported Models: Older BackUPS Office *This diagram is for informational purposes and may not be complete. We don't recommend that use it to build you build one yourself.* :: APC Part# - 940-0119A UPS Computer pins pins Signal Signal meaning 1 (brown) 4,6 DSR DTR <- Shutdown when set by computer for 1-5 seconds. 2 (black) 8,9 RI CTS -> On battery power 3 (blue) 1,2 CD RxD -> Low battery 4 (red) 5 Ground 5 (yellow) 7 RTS <- Begin signalling on other pins 6 (none) none Serial BackUPS ES Wiring ~~~~~~~~~~~~~~~~~~~~~~~~ :Supported Models: Older Serial BackUPS ES :Contributed by: William Stock The BackUPS ES has a straight through serial cable with no identification on the plugs. To make it work with apcupsd, specify the { UPSCABLE 940-0119A} and { UPSTYPE backups}. The equivalent of cable 940-0119A is done on a PCB inside the unit. :: computer ----------- BackUPS-ES ----------------- DB9-M DB-9F pin signal pin 4 DSR -> 4 --+ | diode resistor 6 DTR -> 6 --+---->|----/\/\/\---o kill power 1 DCD <- 1 --+ | 2 RxD <- 2 --+----------------+--o low battery | 7 RTS -> 7 --------+--/\/\/\--+ | +--/\/\/\--+ | 8 RI <- 8 --+----------------+--o on battery | 9 CTS <- 9 --+ 5 GND --- 5 ----------------------o ground 3 TxD 3 nc 940-0128A Cable Wiring ~~~~~~~~~~~~~~~~~~~~~~ :Supported Models: Older USB BackUPS ES and CS :Contributed by: Many, thanks to all for your help! Though these UPSes are USB UPSes, APC supplies a serial cable (typically with a green DB9 F connector) that has 940-0128A stamped into one side of the plastic serial port connector. The other end of the cable is a 10 pin RJ45 connector that plugs into the UPS (thanks to Dean Waldow for sending a cable!). Apcupsd version 3.8.5 and later supports this cable when specified as { UPSCABLE 940-0128A} and { UPSTYPE dumb}. However, running in this mode much of the information that would be available in USB mode is lost. In addition, when apcupsd attempts to instruct the UPS to kill the power, it begins cycling about 4 times a second between battery and line. The solution to the problem (thanks to Tom Suzda) is to unplug the UPS and while it is still chattering, press the power button (on the front of the unit) until the unit beeps and the chattering stops. After that the UPS should behave normally and power down 1-2 minutes after requested to do so. Thanks to all the people who have helped test this and have provided information on the cable wiring, our best guess for the cable schematic is the following: :: APC Part# - 940-0128A computer --------- Inside the Connector--------- UPS DB9-F | | RJ45 pin - signal | | Pin - Color | | 4 DSR ->|---+ | | | diode resistor | 6 DTR ->|---+---->|----/\/\/\---o kill power | 8 Orange | | 1 DCD <-|----+ | | | | 2 RxD <-|----+----------------+--o low battery| 3 Brown | | | 7 RTS ->|----------+--/\/\/\--+ | | | | | +--/\/\/\--+ | | | | 8 RI <-|----+----------------+--o on battery | 2 Black | | | 9 CTS <-|----+ | | signal | 5 GND --|-----------------------o ground | 7 Red | | 3 TxD | | | chassis | Chassis/GND |-----------------------o ground | 4 Black | | | Not connected | 1, 5, 6, 9, 10 -------------------------------------- The RJ45 pins are: looking at the end of the connector: 10 9 8 7 6 5 4 3 2 1 _______________________ | . . . . . . . . . . | | | ----------------------- |____| 940-0128D Cable Wiring ~~~~~~~~~~~~~~~~~~~~~~ :Supported Models: BackUPS XS1000(BX-1000), Possibly other USB models :Contributed by: Jan Babinski jbabinsk at pulsarbeacon dot com 940-0128D is functionally similar to the 940-0128A cable except for NC on (6) DTR and (2) RD on the computer side. Unverified: Try setting apcupsd to ``UPSTYPE dumb`` and ``UPSCABLE 940-0128A``. :: APC Part# - 940-0128D DB9(Computer) RJ45-10(UPS) (5) (1) ____________ ( o o o o o ) [ oooooooooo ] \ o o o o / [____________] (9) (6) (10) [_] (1) RI(9)<---+ | CTS(8)<---+--- E 2N2222(NPN) \|___ ____ /| B | | C | | | +---vvvv---+--[>|------<(2)OnBatt RTS(7)>---| 2k 1N5819 +---vvvv---+--[>|------<(3)LowBatt | | +--- C | \|___| /| B DCD(1)<------- E 2N2222(NPN) DTR(4)>-------------------------->(8)KillPwr GND(5)----------------------------(7)Signal GND (Shield)--------------------------(4)Chassis GND 940-0127B Cable Wiring ~~~~~~~~~~~~~~~~~~~~~~ :Supported Models: BackUPS XS1000(BX-1000), Possibly other USB models :Contributed by: Jan Babinski jbabinsk at pulsarbeacon dot com Standard USB cable for USB-capable models with 10-pin RJ45 connector. :: APC Part# - 940-0127B USB(Computer) RJ45-10(UPS) _________ ____________ | = = = = | [ oooooooooo ] |_________| [____________] (1) (4) (10) [_] (1) +5V(1)-----------(1)+5V DATA+(2)-----------(9)DATA+ DATA-(3)-----------(10)DATA- GND(4)-----------(7)Signal GND (Shield)-----------(4)Chassis GRND Win32 Implementation Restrictions for Simple UPSes -------------------------------------------------- Due to inadequacies in the Win32 API, it is not possible to set/clear/get all the serial port line signals. apcupsd can detect: CTS, DSR, RNG, and CD. It can set and clear: RTS and DTR. This imposes a few minor restrictions on the functionality of some of the cables. In particular, LineDown on the Custom Simple cable, and Low Battery on the 0023A cable are not implemented. Internal Apcupsd Actions for Simple Cables ------------------------------------------ :: This section describes how apcupsd 3.8.5 (March 2002) treats the serial port line signals for simple cables. apcaction.c: condition = power failure detected cable = CUSTOM_SIMPLE action = ioctl(TIOCMBIS, DTR) set DTR (enable power bit?) apcaction.c: condition = power back cable = CUSTOM_SIMPLE action = ioctl(TIOCMBIC, DTR) clear DTR (clear power bit) action = ioctl(TIOCMBIC, ST) clear ST (TxD) apcserial.c: condition = serial port initialization cable = 0095A, 0095B, 0095C action = ioctl(TIOMBIC, RTS) clear RTS (set PnP mode) cable = 0119A, 0127A, 0128A action = ioctl(TIOMBIC, DTR) clear DTR (killpower) action = ioctl(TIOMBIS, RTS) set RTS (ready to receive) apcserial.c: condition = save_dumb_status cable = CUSTOM_SIMPLE action = ioctl(TIOMBIC, DTR) clear DTR (power bit?) action = ioctl(TIOMBIC, RTS) clear RTS (killpower) cable = 0020B, 0020C, 0119A, 0127A, 0128A action = ioctl(TIOMBIC, DTR) clear DTR (killpower) cable = 0095A, 0095B, 0095C action = ioctl(TIOMBIC, RTS) clear RTS (killpower) action = ioctl(TIOMBIC, CD) clear DCD (low batt) action = ioctl(TIOMBIC, RTS) clear RTS (killpower) a second time! apcserial.c: condition = check_serial cable = CUSTOM_SIMPLE action = OnBatt = CD action = BattLow = CTS action = LineDown = SR cable = 0020B, 0020C, 0119A, 0127A, 0128A action = OnBatt = CTS action = BattLow = CD action = LineDown = 0 cable = 0023A action = Onbatt = CD action = BattLow = SR action = LineDown = 0 cable = 0095A, 0095B, 0095C action = OnBatt = RNG action = BattLow = CD action = LineDown = 0 apcserial.c condition = killpower cable = CUSTOM_SIMPLE, 0095A, 0095B, 0095C action = ioctl(TIOMCBIS, RTS) set RTS (kills power) action = ioctl(TIOMCBIS, ST) set TxD cable = 0020B, 020C, 0119A, 0127A, 0128A action = ioctl(TIOMCBIS, DTR) set DTR (kills power) apcupsd-3.14.10/doc/manual/charging.png0000664000076400007640000000030511175165131016534 0ustar adk0212adk0212PNG  IHDRRPLTEmmmmUmmUfeIDATx-M @w*<9˳c3B m X>@p:ȼD,Xtϐ)U؇$3ŗ\r-VQ,Ŵt%0F^IENDB`apcupsd-3.14.10/doc/manual/commlost.png0000664000076400007640000000067211175165131016616 0ustar adk0212adk0212PNG  IHDRabKGD pHYs  tIME *:GIDATx͑M+Da , 5K/0ݥ'#Dhi|) (5ea&j" 5:̝(:us_frB=pX}lSwq+rC)MPHeBtJ&,_m*NUEtHd}Lܺ+8vź=9yW^jYvr[.B 'ǰ BPF.e]SICJK )%V}} 2JӸފz ج.(o}6j [.H)[Y4M >0gt ~ σiIENDB`apcupsd-3.14.10/doc/manual/main_configs.png0000664000076400007640000003261511175165131017417 0ustar adk0212adk0212PNG  IHDRepbKGD̿ pHYs  ~tIME 'X[ IDATxOHz߿~,9TKFX /j|\AXVMK ٛ { Ae'ˢ>lnF"dr>HkB.))qPjuT*U[zzAyhGz.Srf̟D>0;7 -ؐD2 _pgIOqx$4 QA/T e4]Zp"w<":B=Kđs)s9G$"@pԙ:~'c-C @L@@J $;"PPI"!#"I=\AMd2ݓ4] -X0}l:;7=p;TۙXj ICLǖ " TFus.ww.st,$" }l2yywD {RD$`_bջB?yzХ pOpV`#82쌈:+& G ;ŀ`$0D)p~dkcR.*\HhbIJeֈ9ě[`Ty֥xDjg"5ƃcTցQYFeu`TցQYFeu`TցQYFe)[u\~UKpuL:0*:0*1Fd>gT>@#M5F9 ˕`l;y'ɇ_DSGʛUJeڪGr륪zkl34m<`g pA!URs9}߆((/<AQu0}*?oc45DZ`z󐈂#{3zZ uΛvrXci{G]%oeNfOܸWOhYь--rDjADv%CƟŦgc>16n}2QWPO;#vQJI!O'D挭6ل,~"쨫Қb B=U/(N $ U^&avH$8 ##Xp "X H r$XCXH%(귙q!G𐼐d_JjW{@ogA}f}Ҝo0T>Ly$1wPCh-%pa*)APd nAATi] c"is դ.HeP+)AP c{yR aD/t:Vog8}[ؓ/W?_|~Rӏ_7Fu*n}3ok nWo71=;Yk[]/7cOG.ˋxzü"WkXZ3>s8zܙyoǶ+±6`TE>a&4?4qQJm`p?["pVC Qy1bgX2Zb cj5E4̣[Ycͷ{jC@BL(Y3]ط JvL@VzkՋ9v+Zg܎*a֢|+b\{)K袷oZXN;De)\xKOyU9.|;Z_ÖpeV(3>xHbRoͲgv+UcDbm<9CM-SvK_G{\'gr69~pDl%KZ~Yxgޯ@5-7 PEe* );nZQn~"Y&濋^^'re&3VB*lv]yn }c9S媝pnQ A`Q+ϱE.6`;YmVuc._g|j3iVȎq4GmQ9ۏu;x?g?/geL,`5VVim{_v`y:K^V>]$Czf}Ktm'ydK&I}~g"H[c0YnX rNݾEWeRVDP IRKң6k}N[ѸH֖TND޾%ޓ}g\"ٞy'm4\^W m}݇zܟLثr)ȫmKOQ..TuwL";I|Nٗ 0*&Y;Q6+ר|z1`TցQYFeu`TցQYFeB*t;]Ձ1t`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeupG*C[Tc/6cmo7U0ϖ_r'ZrŞ}kDtDF[N*|4!mvy6$ )}ܞ"|!t4S9#ԩ"lK7P\HvBTUCFDTdX4eǞkʸD ɕ2Q`Yыf#&I9ڮHHpAE+ĒC'Dj#"a{^(s9GL/H${hQ-D :"`/LrbU4J  \#s $l/ND$PP:=mF/ }]EK%A/clNqjX$TlWmL1`0g(ɥ4[`-Y>:0*:0*:xS~eEQЁQYFeu`TցQYFeu``>gT>@9^x۴ܩ1ʱr6Tc JÈ<`et*GD){gE'z4:7~s&ܪGtMy.^wzy4`7g!(yHDD.W$*ik^B? s&ǧ5|{=edpN8;Ƒ|jIGe[3TY )T P"BL,!ɛ~MRjo_! ~t( H:>{m9[l[`Qy[GK6-l{~k!sU;oJTǞa8*-Eݩl~D DFkZ'^۫b'fe4߬hm|9f. e;zbdYiihO2"*b J&Uc.2J@#) qȉATI{Gfx6!_36j&Ơ؂D!lO"&&IBՀ>C+e6`Dҁ#)12 .`AD. *iнE6`;n|f'jUW߃^; 3 arr"{Y"$M!' "ʅ-iKezt()H4N#~BW* Z~9cDxe )EQkGUFW"v7nTIyeQg\j U -m( ;L "\pG f W8ILܮ/#=pA*\I B]`˓=qmFIců>{jxv7?= rӟ~./>o|c\'7g~+&%}߈۳ίsޙVr9w>?|z{䲼?̋O>8,rf)5˫5cl/<1_5/[vE8PӪ'$F@.jcT Xb}pk_P. x!*o3|TlxZF+TbLmfy4c3 }p/82XejUf?JH JOw.[]c}D; x A֢r`ݺen=vt*Va֢|+bN70.!p!*/KLƒ_"L]ԆqZT/ԺejUz0Iz;#gv+UcDbm<9CM-SviΑM0(Pyzk g,^o8ƘbzLf䡹yGuRf(_?_8V1upo?\؊.;8"Ug ir3'@~0k% DΣ%[37gc$TΘX *呃d6#sB B0Uih@L݄ķ/IFjre):0* xNhԕkT>xKz0*:0*\/;rOs\sa05:0*:0*:0*:0*xGT֌1TPilTD$m ?ƃNj?5FyՔIqUPsfdwSE?դl5qtf68j0A\PHF2|QvmCl;׾^s+Sz4s3f9w:ź ,r7`>RDE.jvds&'7RgGC_WFb-T X5TՍ{ GKT9[zf@F6@1<"yɮqN:"$*KqW8HeCe]aEX4N.A\53^ʃj@+(:ظ +A*" h:иWOQݦ?Q<.0APd nDQӸ-wr. MqWPcc_K0 Feu`TցQYFeu`TցQYFeu`TցQYFeR;'}{:͝T1t`TցQYFeu`TցQYFeu`TցQYFeu`TցQYFeup%7&FSZ3X=Y4=R1\ ѸL.erѼj_$θ*WkgԴ'fe4߬zO53[%yM\>Q"RB Dɵ|A1~a@Լ簁< xm\/{ּg_%&b7;.j򀌦rc,N5[XEG\ȅSc].a əyد:0*:0*:0*:0*:0*MNt. gx#ޔ/r!Ơ7:0*:0*:0*`W x0\ ˗~:{AΏAOe?H`TցQYFerԂ|bUn/js@*=l1eVYQ1ysiP11"qK{ _?zj`$OJُwPb_v0DeaPIq+k92%tZ?Sd|R\!6)p߬JqK@5)&/.Z 9Tl%M(D (;^|WU㙚'Űz l8p "ag p۶CΈg?}X)XIDAT&0+ QChU[jck~pl܇ ~FdksʂAfW+*Y[TϢ /ʷ lN҇?he Th4N0Hl"_ hɖ*pT>gX hSX>!@DZ 섨8/b=λi:U&1i S~ʰ{/;ܪeA=)xŠYpDw3u~t PS* WH -1QZP.zv$x?GŽЄΙ?Kqaѓ X,":`AQxwT& MsΏR6TYAHjozw [9pR J?BPITp;&6:'ݳv{˭v*o'O͏POOF[Y3J8p!Ie /B^ N}z4F5/!yKyғDwU}{R7 _ I 0ih@LW^9ռN V߾oUam֙J/_6:~\y|Lk7o%Վ%"nܡ{͟L^̲o/ۛN=Bۻvڱhx3Љu~OUƼma^|;StֿjhieaeDT۷%BF (q$<"neQ5M"PLBtf*>|lN9aZ_ÖpFD-l6L|jmg'N{xws2cWRY`vuj6쒥X-G o߈+!b 2}MhT<84䗫\6t!J RV[C" 0Py1bgX2Zb cjNg7"n<]#g0V[5,U:F[ %$*%֢ZXUH.1^\ͼ^W S+k9z+ .ĹʌHGDt|mz*?[5,!RC>遫^rg/Wxŭn[,+SȟP5ɫ Pg;`DI3~zV @4CJb=`^{m_6ַ:c0ֈVx3m w`)QJ0.#6ϷGv-5֭+IGKay~/ '"RpEin ż3&c_{:ѽrߙ-'q}lwUY*g{ά8 Vqћ縏rRIqThƱG3l<;[`SKLђ- X f.Nίr 2A07nܷǷJL@/>u)T_|_V06F?+7|l} Mܙw4TOʝPYxe̾S8=Ue̽jUٲȘz*Cܑl.'>ί^Tĭn&#]o5nus5=uMYܳ5kkr*MU}|/];W[w!|'&}tM^ܽw5kr*CT|]GPy]+0h*WkOvS2 "i4.g]ǎ\h^5ey'yeYf h^ԫPI^ξݢ"h ʄu0-wЪ !JAR Nޑ [2km2`9S"{b7jWyZ ]vd΋L0R_T 2iZv|gǣyYcLk*Ok*Ok*Ok*Ok*Ok*Ok*Ohd1FpId~e]tƋ:^y`2]ʕ`l|Am}2T#SHHJS}6ST:7Lmws-^>WZꦉtM5Z۩+"/GlU |lzb4߬:i~}ӠT&]glǍG!6j4J5e!G,UzMIwRL tMmgl s {dm%|X^<9PR4*鬍9R$Dj @@\?E5 zH1;jϯHEBDk^\SmϾ|vVLվl8QYFeu: APCUPSD User Manual
./apcupsd.png

APCUPSD User Manual

Adam Kropelin
Kern Sibbald

Apcupsd is a UPS control system that permits orderly shutdown of your computer in the event of a power failure.

July 22, 2011 23:47:50
This manual documents apcupsd version 3.14.x
Copyright © 2004-2009 Adam Kropelin
Copyright © 1999-2005 Kern Sibbald

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the name Apcupsd, the copyright notice, and this notice are preserved.

Apcupsd source code is released under the GNU General Public License version 2. Please see the file COPYING in the main source directory.

For more information on the project, please visit the main web site at http://www.apcupsd.com


Table of Contents


How To Use This Manual

This is the manual for apcupsd, a daemon for communicating with UPSes (Uninterruptible Power Supplies) made by American Power Conversion Corporation (APC). If you have an APC-made UPS, whether sold under the APC nameplate or OEMed (for example, the HP PowerTrust 2997A), and you want you get it working with a computer running Linux, Unix, or Windows, you are reading the right document.

This manual is divided into parts which increase in technical depth as they go. If you have just bought a state-of-the-art smart UPS with a USB or Ethernet interface, and you are running a current version of Red Hat or SUSE Linux, then apcupsd is very nearly plug-and-play and you will have to read only the Basic User's Guide.

If your operating system is older, or if you have an old-fashioned serial-line UPS, you'll have to read about serial installation (see Installation: Serial-Line UPSes). If you need more details about administration for unusual situations (such as a master/slave or multi-UPS setup) you'll need to read the sections on those topics as well. Finally, there are a number of technical reference sections which gives full details on things like configuration file directives and event-logging formats.

You should begin by reading the Quick Start (see Quick Start for Beginners) instructions.

Basic User's Guide

Quick Start for Beginners

apcupsd is a complex piece of software, but most of its complexities are meant for dealing with older hardware and operating systems. On current hardware and software getting it running should not be very complicated.

The following is a help guide to the steps needed to get apcupsd set up and running as painlessly as possible.

  1. Check to see if apcupsd supports your UPS and cable (see Supported UPSes and Cables).
  2. Check to see if apcupsd supports your operating system (see Supported Operating Systems).
  3. Plan your configuration type (see Choosing a Configuration Type). If you have just one UPS and one computer, this is easy. If you have more than one machine being served by the same UPS, or more than one UPS supplying power to computers that are on the same local network, you have more choices to make.
  4. Figure out if you have one of the easy setups. If you have a USB UPS, and a supported operating system and you want to use one UPS with one computer, that's an easy setup. APC supplies the cable needed to talk with that UPS along with the UPS. All you need to do is check that your USB subsystem is working (see USB Configuration); if so, you can go to the build and install step.
  5. If you have a UPS designed to communicate via SNMP over Ethernet, that is also a relatively easy installation. Details are provided in Support for SNMP UPSes.
  6. If you have a UPS that communicates via an RS232C serial interface and it is a SmartUPS, then things are relatively simple, otherwise, your life is about to get interesting.
    1. If you have a vendor-supplied cable, find out what cable type you have by looking on the flat ends of the cable for a number, such as 940-0020A, stamped in the plastic.
    2. If you don't have a vendor-supplied cable, or your type is not supported, you may have to build one yourself (see Cables). Here is hoping you are good with a soldering iron!
  7. Now you are ready to read the Building and Installing (see Building and Installing apcupsd) section of the manual and follow those directions. If you are installing from an RPM or some other form of binary package, this step will probably consist of executing a single command.
  8. Tweak your /etc/apcupsd/apcupsd.conf file as necessary. Often it will not be.
  9. Change the BIOS settings (see Arranging for Reboot on Power-Up) on your computer so that boots up every time it gets power. (This is not the default on most systems.)
  10. To verify that your UPS is communicating with your computer and will do the right thing when the power goes out, read and follow the instructions in the Testing (see Testing Apcupsd) section.
  11. If you run into problems, check the apcupsd users' email list archive for similar problems. This is an excellent resource with answers to all sorts of questions. See http://sourceforge.net/mailarchive/forum.php?forum_name=apcupsd-users.
  12. If you still need help, send a message to the apcupsd users' email list (apcupsd-users@lists.sourceforge.net) describing your problem, what version of apcupsd you are using, what operating system you are using, and anything else you think might be helpful.
  13. Read the manual section on Monitoring and Tuning your UPS.

Supported Operating Systems

apcupsd supports many UNIX-like operating systems as well as several variants of Windows. Due to lack of API standardization, USB support is not available on every platform. See Platform Support below for details.

In general it is recommended to obtain a prebuilt package for your platform. Given how apcupsd must integrate into the shutdown mechanism of the operating system and the rate at which such mechanisms are changed by vendors, the platform ports in the apcupsd tree may become out of date. In some cases, binary packages are provided by the apcupsd team (RedHat, Mandriva, SuSE, Windows, Mac OS X). For other platforms it is recommended to check your vendor's package repository and third party repositories for recent binary packages. Note that some vendors continue to distribute ancient versions of apcupsd with known defects. These packages should not be used.

Platform Support

LINUX

WINDOWS

  • Windows NT 4 [2] [4]
  • Windows 98/ME/2000 [2] [4]
  • Windows XP/Vista (including 64 bit) [1] [2]
  • Windows Server 2003/2008 (including 64 bit) [2]
  • Windows 7 [2]

OTHERS

[1]Platforms on which apcupsd is regularly developed and tested
[2]Platforms for which apcupsd team distributes binary packages
[3]Port included in apcupsd source tree but may be out of date, unmaintained, or broken.
[4]USB not supported

Supported UPSes and Cables

apcupsd supports nearly every APC brand UPS model in existence and enough different cable types to connect to all of them.

The UPSTYPE <keyword> field is the value you will put in your /etc/apcupsd/apcupsd.conf file to tell apcupsd what type of UPS you have. We'll describe the possible values here, because they're a good way to explain your UPS's single most important interface property: the kind of protocol it uses to talk with its computer.

apcsmart
An APCSmart UPS and its computer communicate through an RS232C serial connection. They use it as a character channel (2400bps, 8 data bits, 1 stop bit, no parity) and pass commands back and forth in a primitive language resembling modem-control codes. The different APC UPSes all use closely related firmware, so the language doesn't vary much (later versions add more commands). This class of UPS is in decline, rapidly being replaced in APC's product line by USB UPSes.
usb
A USB UPS speaks a universal well defined control language over a USB wire. Most of APC's lineup now uses this method as of late 2003, and it seems likely to completely take over in their low- and middle range. Other manufacturers (Belkin, Tripp-Lite, etc.) are moving the same way, though with a different control protocol for each manufacturer. As long as USB hardware can be mass-produced more cheaply than an Ethernet card, most UPSes are likely to go this design route. Please note that even if you have a USB UPS, if you use a serial cable with it (as can be supplied by APC), you will need to configure your UPS as apcsmart rather than usb.
net
This is the keyword to specify if you are using your UPS in Slave mode (i.e. the machine is not directly connected to the UPS, but to another machine which is), and it is connected to the Master via an ethernet connection. You must have apcupsd's Network Information Services NIS turned on for this mode to work.
snmp
SNMP UPSes communicate via an Ethernet NIC and firmware that speaks Simple Network Management Protocol.
dumb
A dumb or voltage-signaling UPS and its computer communicate through the control lines (not the data lines) on an RS232C serial connection. Not much can actually be conveyed this way other than an order to shut down. Voltage-signaling UPSes are obsolete; you are unlikely to encounter one other than as legacy hardware. If you have a choice, we recommend you avoid simple signalling UPSes.
pcnet
PCNET is an alternative for SNMP available on APC's AP9617 family of smart slot modules. The protocol is much simpler and potentially more secure than SNMP.

Choosing a Configuration Type

There are three major ways of running apcupsd on your system. The first is a standalone configuration where apcupsd controls a single UPS, which powers a single computer. This is the most common configuration. If you're working with just one machine and one UPS, skip the rest of this section.

Your choices become more interesting if you are running a small cluster or a big server farm. Under those circumstances, it may not be possible or even desirable to pair a UPS with every single machine. apcupsd supports some alternate arrangements.

The second type of configuration is the NIS (Network Information Server) server and client. In this configuration, where one UPS powers several computers, a copy of apcupsd running one one computer will act as a server while the other(s) will act as network clients which poll the server for information about the UPS. Note that "NIS" is not related to Sun's directory service also called "NIS" or "Yellow Pages".

The third configuration is where a single computer controls multiple UPSes. In this case, there are several instances of apcupsd on the same computer, each controlling a different UPS. One instance of apcupsd will run in standalone mode, and the other instance will normally run in network mode. This type of configuration may be appropriate for large server farms that use one dedicated machine for monitoring and diagnostics

Here is a diagram that summarizes the possibilities:

Configuration types

./main_configs.png

If you decide to set up one of these more complex configurations, see the dedicated section on that particular configuration.

USB Configuration

Apcupsd supports USB connections on all major operating systems: Linux, FreeBSD, OpenBSD, NetBSD, Windows, Solaris, and Mac OS X Darwin. If you plan to use a USB connection, please read the appropriate subsection in its entirety. You can skip this section if your UPS has a serial (RS232-C) or Ethernet interface or if you are not running one of the platforms listed above.

Linux USB Configuration

Known Linux USB Issues

Problem
Linux 2.4 series kernels older than 2.4.22 (RH 9, RHEL 3) do not bind the USB device to the proper driver. This is evidenced by /proc/bus/usb/devices listing the UPS correctly but it will have "driver=(none)" instead of "driver=(hid)". This affects RHEL3, among others.
Workaround
Upgrade linux kernel to 2.4.22 or higher. Alternately, you apply the linux-2.4.20-killpower.patch and linux-2.4.20-USB-reject.patch patches to your kernel and rebuild it. These patches can be found in the examples/ directory in the apcupsd source distribution.
Problem
Mandrake 10.0 and 10.1 systems with high security mode enabled (running kernel-secure kernel) use static device nodes but still assign USB minor numbers dynamically. This is evidenced by hiddev0: USB HID v1.10 Device [...] instead of hiddev96: ... in dmesg log.
Workaround
Boot standard kernel instead of kernel-secure or disable CONFIG_USB_DYNAMIC_MINORS and rebuild kernel-secure.
Problem
USB driver linux-usb.c fails to compile, reporting errors about HID_MAX_USAGES undefined. This is due to a defect in the linux kernel hiddev.h header file on 2.6.5 and higher kernels.
Workaround
Upgrade to apcupsd-3.10.14 or higher. These versions contain a workaround for the defect.
Problem
On some systems such as Slackware 10.0, no USB devices will show up (see the next section).
Workaround

Add the following to rc.local

mount -t usbdevfs none /proc/bus/usb
Problem
2.6 kernels use udev and some distributions to not configure it to automatically create /dev/usb/hiddev?? as they should, causing apcupsd to fail to locate the UPS.
Workaround

Edit the file /etc/udev/rules.d/50-udev.rules, and add the following:

KERNEL="hiddev*", NAME="usb/hiddev%n"

More details are provided in the following section ...

Verifying Device Detection and Driver

To make sure that your USB subsystem can see the UPS, just do this from a shell prompt:

cat /proc/bus/usb/devices

This information is updated by the kernel whenever a device is plugged in or unplugged, irrespective of whether apcupsd is running or not. It contains details on all the USB devices in your system including hubs (internal and external), input devices, and UPSes.

You should get some output back that includes something like this, featuring a BackUPS RS 1000:

T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=1.5 MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=051d ProdID=0002 Rev= 1.06
S:  Manufacturer=American Power Conversion
S:  Product=Back-UPS RS 1000 FW:7.g3 .D USB FW:g3
S:  SerialNumber=JB0308036505
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 24mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=hid

The important things to check for are the S: lines describing your UPS and and the I: line showing what driver is handling it. If on the I: line, Driver is listed as Driver=none then you do not have the HID driver loaded or the driver did not attach to the UPS. One common cause is having a Linux kernel older than 2.4.22 (such as a stock RedHat 9 or RHEL 3 kernel). If this is the case for your system, please upgrade to at least kernel version 2.4.22 and try again. If you are already running a 2.4.22 or higher kernel, please read further for instructions for other possible courses of action.

Here is another example, this time featuring a Back-UPS 350:

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=1.5 MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=051d ProdID=0002 Rev= 1.00
S:  Manufacturer=American Power Conversion
S:  Product=Back-UPS 350 FW: 5.2.I USB FW: c1
S:  SerialNumber=BB0115017954
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 30mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=hid
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl= 10ms

In general, if you see your UPS model in the S: field, which means Manufacturer=, Product=, and SerialNumber=, and you see Driver=hid in the I: field, you know the UPS has been recognized and is bound to the correct driver.

If your UPS doesn't appear in the list at all, check the obvious things: The UPS must be powered on, and a cable must be properly seated in both the data port of the UPS and one of your machine's USB ports. Many UPSes have phone ports to provide surge protection for phones or modems -- make sure you haven't plugged your USB cable into one of those rather than the data port (which will usually be near the top edge of the case.)

Also, ensure that the correct drivers are loaded. Under Linux-2.4.x, you can check this out easily by examining the /proc/bus/usb/drivers file. Here's how you can do that:

cat /proc/bus/usb/drivers

...and you should get:

        usbdevfs
        hub
96-111: hiddev
        hid

On Linux-2.6.x, make sure the sysfs filesystem is mounted on /sys and do:

ls -l /sys/bus/usb/drivers/

...where you should get:

total 0
drwxr-xr-x    2 root     root            0 May  1 18:55 hid
drwxr-xr-x    2 root     root            0 May  1 18:55 hiddev
drwxr-xr-x    2 root     root            0 May  1 18:55 hub
drwxr-xr-x    2 root     root            0 May  1 18:55 usb
drwxr-xr-x    2 root     root            0 May  1 18:55 usbfs

...or perhaps something like:

total 0
drwxr-xr-x  2 root root 0 Jan  6 15:27 hiddev
drwxr-xr-x  2 root root 0 Jan  6 15:28 hub
drwxr-xr-x  2 root root 0 Jan  6 15:28 usb
drwxr-xr-x  2 root root 0 Jan  6 15:27 usbfs
drwxr-xr-x  2 root root 0 Jan  6 15:28 usbhid

If your 2.6.x system does not have the /sys/bus/usb directory, either you do not have sysfs mounted on /sys or the USB module(s) have not been loaded. (Check /proc/mounts to make sure sysfs is mounted.)

A USB UPS needs all of these drivers -- the USB device filesystem, the USB hub, the Human Interface Device subsystem driver, and the Human Interface Device driver. If you are compiling your own kernel, you want to enable

CONFIG_USB
CONFIG_USB_HID
CONFIG_USB_HIDDEV
CONFIG_USB_DEVICEFS

...as well as at least one USB Host Controller Driver...

CONFIG_USB_UHCI_HCD (linux-2.6.x)
CONFIG_USB_OHCI_HCD (linux-2.6.x)
CONFIG_USB_UHCI     (linux-2.4.x)
CONFIG_USB_OHCI     (linux-2.4.x)

Device Nodes

Apcupsd accesses USB UPSes via the hiddev device nodes. Typically these are located in /dev/hiddevN, /dev/usb/hiddevN or /dev/usb/hiddev/hiddevN (where N is a digit 0 thru 9). Some distributions (some Debian releases, possibly others) do not provides these device nodes for you, so you will have to make them yourself. Check /dev, /dev/usb, and /dev/usb/hiddev and if you cannot find the hiddevN nodes, run (as root) the examples/make-hiddev script from the apcupsd source distribution.

Modern Linux distributions using the 2.6 kernel create device nodes dynamically on the fly as they are needed. It is basically a hotplug system, giving a lot more power to the user to determine what happens when a device is probed or opened. It is also a lot more complicated.

Some early 2.6 distributions (Fedora Core 3, for one) do not include hiddev rules in their default udev rule set. The bottom line for apcupsd on such a system is that if the hiddevN is not created when you plug in your UPS, apcupsd will terminate with an error. The solution to the problem is to add a rule to the udev rules file. On Fedora FC3, this file is found in /etc/udev/rules.d/50-udev.rules. Start by adding the following line:

BUS="usb", SYSFS{idVendor}="051d", NAME="usb/hiddev%n"

Note that this rule uses obsolete udev syntax and is specific to FC3 and other distributions of similar vintage.

Then either reboot your system, or unplug and replug your UPS and then restart apcupsd. At that point a /dev/usb/hiddevN node should appear and apcupsd should work fine.

If you have several UPSes or you just want to give your UPS a fixed name, you can use rules like the following:

KERNEL=="hiddev*", SYSFS{serial}=="JB0319033692", SYMLINK="ups0"
KERNEL=="hiddev*", SYSFS{serial}=="JB0320004845", SYMLINK="ups1"

Note that this rule uses modern udev syntax and is appropriate only for more recent distros such as RHEL4 and FC4.

Replace the serial number in quotes with the one that corresponds to your UPS. Then whenever you plug in your UPS a symlink called ups0, ups1, etc. will be created pointing to the correct hiddev node. This technique is highly recommended if you have more than one UPS connected to the same server since rearranging your USB cables or even upgrading the kernel can affect the order in which devices are detected and thus change which hiddev node corresponds to which UPS. If you use the symlink-by-serial-number approach the link will always point to the correct device node.

You can use...

udevinfo -a -p /sys/class/usb/hiddev0/

...to get more information on the fields that can be matched besides serial number.

An additional device-node-related problem is the use of dynamic minors. Some distributions, such as Mandrake 10, ship with a kernel having CONFIG_USB_DYNAMIC_MINORS turned on. This is not ideal for running with apcupsd, and the easiest solution is to turn CONFIG_USB_DYNAMIC_MINORS off and rebuild your kernel, or find a pre-built kernel with it off. For a kernel with CONFIG_USB_DYNAMIC_MINORS turned on to work with apcupsd, you must enable devfs. The following will tell you if devfs is enabled:

$ ps ax | grep devs

...which should give something like the following:

533 ?        S      0:00 devfsd /dev

What complicates the situation much more on Mandrake kernels is their security level since CONFIG_DYNAMIC_USB_MINORS is turned on, but on higher security levels devfs is turned off. The net result, is that in those situations hiddev is completely unusable so apcupsd will not work. So, in these cases, the choices are:

  1. Reduce the security level setting of the system (not sure if this is possible after the initial install).
  2. Custom build a high security kernel with devfs enabled and make sure devfs is mounted and devfsd is running.
  3. Custom build a high security kernel with dynamic minors disabled
  4. Use udev

Miscellaneous

If all these things check out and you still can't see the UPS, something is more seriously wrong than this manual can cover -- find expert help. If you are unable to list USB devices or drivers, you kernel may not be USB-capable and that needs to be fixed.

BSD USB Configuration

Known BSD USB Issues

Problem
FreeBSD lockups: Some users have experienced lockups (apcupsd stops responding) on FreeBSD systems.
Solution
Recent versions of Apcupsd have addressed this issue. Please upgrade to apcupsd-3.10.18 or higher.
Problem
FreeBSD kernel panics if USB cable is unplugged while apcupsd is running.
Solution
This is a kernel bug and is most easily worked around by not hot- unplugging the UPS while apcupsd is running. This issue may be fixed in recent FreeBSD kernels.

Platforms and Versions

The *BSD USB driver supports FreeBSD, OpenBSD and NetBSD. (Thanks go to the *BSD developers who kept a nearly identical interface across all three platforms.)

Kernel Configuration

Users of OpenBSD, NetBSD, and some versions of FreeBSD will need to rebuild the kernel in order to enable the ugen driver and disable the uhid driver. uhid is not sufficient for apcupsd at this time and we need to prevent it from grabbing the UPS device. You should make the following changes to your kernel config file:

FreeBSD (v5.4 and below, v6.0)
(you will not lose use of USB keyboard and mouse)
Disable: uhid
Enable: ugen
FreeBSD (v5.5, v6.1 and above)
(you will not lose use of USB keyboard and mouse)
Disable: (nothing)
Enable: ugen

This is the default configuration for a GENERIC kernel on many platforms so you most likely will not need to recompile.

NetBSD (v3.x and below)
(you will lose use of USB keyboard and mouse)
Disable: uhidev, ums, wsmouse, ukbd, wskbd, uhid
Enable: ugen
NetBSD (v4.0 and above)

You can use apcupsd on single USB port without disabling the USB keyboard and mouse on other ports, though all other devices will be disabled on the port you pick for your UPS.

First, decide which hub and port you wish to use. You can find out the hub and port numbers for any particular physical connector by plugging a USB device into it and looking at the messages printed by the kernel; you should messages something like this:

uxx0 at uhub0 port 1
uxx0: <some device name>

To use your APC UPS on this port, configure the kernel to prefer attachment of the ugen driver over other drivers on this hub and port only, by adding a line like this to your kernel config file:

ugen*   at uhub0 port 1 flags 1

(The "flags 1" forces the ugen to attach instead of anything else detected there.)

Configure and build that kernel as per the references below, and your UPS will now attach as a ugen device when plugged into that port.

Don't forget to 'cd /dev' and './MAKEDEV ugen1' (and 2 and so on) if you have more than one generic usb device on your system.

OpenBSD
(you will lose use of USB keyboard and mouse):
Disable: uhidev, ums, wsmouse, ukbd, wskbd, uhid
Enable: ugen

For detailed information on rebuilding your kernel, consult these references:

FreeBSD
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
NetBSD
http://www.netbsd.org/guide/en/chap-kernel.html
OpenBSD
http://www.openbsd.org/faq/faq5.html#Building

Verifying Device Detection and Driver

After building a properly configured kernel, reboot into that kernel and plug in your UPS USB cable. You should see a dmesg log message like the following:

ugen0: American Power Conversion Back-UPS RS 1500 FW:8.g6 .D USB FW:g6, rev 1.10/1.06, addr 2

Note that the ugen driver is called out. If you see uhid instead, it probably means you did not properly disable the uhid driver when you compiled your kernel or perhaps you're not running the new kernel.

You can also check with 'usbdevs -d' to get a list of USB devices recognized by the system as well as the drivers they are associated with. For example:

# usbdevs -d
addr 1: UHCI root hub, VIA
  uhub0
 addr 2: Back-UPS RS 1500 FW:8.g6 .D USB FW:g6, American Power Conversion
   ugen0

Device Nodes

Apcupsd communicates with the UPS through the USB generic device, ugen. You may or may not need to manually make ugen device nodes in /dev, depending on what OS you are using.

FreeBSD
No manual intervention needed. FreeBSD automatically creates the ugen nodes on demand.
NetBSD
By default, NetBSD only creates nodes for the first ugen device, ugen0. Check usbdevs -d to see which device your UPS was bound to and then create the appropriate node by running 'cd /dev ; ./MAKEDEV ugenN', where ugenN is the ugen device name shown by usbdevs. It is probably a good idea to create several sets of ugen nodes in case you add more USB devices.
OpenBSD
Similar to NetBSD, OpenBSD creates nodes for ugen0 and ugen1. Check usbdevs -d to see which device your UPS was bound to and then create the appropriate node by running 'cd /dev ; ./MAKEDEV ugenN', where ugenN is the ugen device name shown by usbdevs. It is probably a good idea to create several sets of ugen nodes in case you add more USB devices.

Windows USB Configuration

Platforms and Versions

Apcupsd supports USB UPSes on Windows XP and newer, including 64 bit systems.

USB Driver Installation

USB connected UPSes on Windows require a special driver. In most cases, this driver is automatically installed when you install Apcupsd. However in some cases you may need to install the driver manually. For detailed instructions, please see the install.txt file located in the driver folder of your Apcupsd install.

Verifying Device Detection and Driver

After installing Apcupsd (and the Apcupsd USB driver, if necessary), plug in your UPS USB cable and open the Windows Device Manager. You should see a American Power Conversion USB UPS (Apcupsd) listed under the Batteries section. If a device of that name does not appear, check that your UPS is powered on and that the USB cable is connected at both ends. Reinstall the driver as directed above if needed.

Solaris USB Configuration

Platforms and Versions

Apcupsd supports USB UPSes on Solaris 10 and higher. Both x86 and SPARC platforms are supported.

Building Apcupsd with USB

Some specific packages are necessary when building Apcupsd with USB support on Solaris. You must install the SUNWlibusb and SUNWlibusbugen packages BEFORE attempting to build Apcupsd. These packages can be found on the Solaris installation CDROMs and should be installed with the pkgadd utility.

You also should build using the gcc compiler and ccs make, not Sun's compiler. The appropriate make utility can be found in /usr/ccs/bin. gcc can be installed from packages included on the Solaris installation CDROMs.

Configure and build Apcupsd normally, as described in Building and Installing Apcupsd. Be sure to include the --enable-usb flag to configure.

After building, install Apcupsd as root using 'make install', then perform a reconfigure boot ('reboot -- -r'). During installation, Apcupsd will automatically configure your USB subsystem to attach APC USB devices to the ugen driver. This is a critical step and must be completed by a reconfigure boot. Note that the USB config changes will be reversed if you remove Apcupsd using 'make uninstall'.

Verifying Device Detection and Driver

After installing Apcupsd as described above and performing a reconfigure boot, plug in your UPS USB cable. You should see a series of dmesg log messages similar to the following:

Dec  5 17:50:50 sunblade usba: [ID 912658 kern.info] USB 1.10 device (usb51d,2) operating at low speed (USB 1.x) on USB 1.10 root hub: input@4, ugen0 at bus address 3
Dec  5 17:50:50 sunblade usba: [ID 349649 kern.info]    American Power Conversion Smart-UPS 1000 FW:600.1.D USB FW:1.2 AS0127232356
Dec  5 17:50:50 sunblade genunix: [ID 936769 kern.info] ugen0 is /pci@1f,0/usb@c,3/input@4
Dec  5 17:50:50 sunblade genunix: [ID 408114 kern.info] /pci@1f,0/usb@c,3/input@4 (ugen0) online

Note that the ugen driver is called out. If you do not see any dmesg entries related to your UPS, ensure that it is turned on and that the USB cable is connected at both ends. Also verify that you installed Apcupsd as root using the 'make install' command and that you performed a reconfigure boot afterward.

Device Nodes

Apcupsd communicates with the UPS through the USB generic device, ugen. The reconfigure boot performed after Apcupsd installation will ensure the correct device nodes are created. Once your UPS has been recognized in dmesg as shown above, you can check /dev/usb to see if the device nodes have appeared:

[user@sunblade /]$ ls /dev/usb/51d.2/*
cntrl0      cntrl0stat  devstat     if0in1      if0in1stat

(51d.2 is the vendor/product id for APC UPSes.)

Mac OS X (Darwin) USB Configuration

Platforms and Versions

Apcupsd supports USB UPSes on Mac OS X (Darwin) 10.4.x and higher. Both Intel and PowerPC platforms are supported.

Building Apcupsd with USB

Some specific packages are necessary when building Apcupsd with USB support on Darwin. You must install libusb-0.1.12 which can be obtained from MacPorts (http://www.macports.org) (formerly DarwinPorts) or Fink (http://fink.sourceforge.net) or downloaded and built by hand (http://www.libusb.org). You must not use libusb-1.x or higher (apcupsd does not support the new 1.0 APIs) nor any version earlier than 0.1.12 (earlier versions have a bug that apcupsd triggers). Generally that means you must use exactly 0.1.12. Note that Apcupsd is sensitive to the install location of libusb, so beware if you change it from the default.

Apcupsd should be built using gcc, preferably from the XCode development tools. Currently the maintainer is using gcc-4.0.1 from XCode 2.4. Other versions of gcc from other sources may also work.

Configure and build Apcupsd normally, as described in Building and Installing Apcupsd. Be sure to include the --enable-usb flag to configure.

After building, install Apcupsd as root using 'make install' and then reboot. During installation, Apcupsd will automatically install a simple dummy kext driver designed to prevent Apple's monitoring software from taking over the UPS. It is necessary to reboot in order to activate the kext. Note that this kext will be automatically removed if you uninstall Apcupsd using 'make uninstall', allowing Apple's monitoring tool to once again access the UPS.

Verifying Device Detection and Driver

After installing Apcupsd as described above and rebooting, plug in your UPS USB cable. You should notice that Darwin does NOT display the battery monitor tool in the menu bar. You can also check Apple Menu -> About This Mac -> More Info... -> USB to ensure that your UPS appears in the list of USB devices.

Building and Installing apcupsd

In general it is recommended to obtain a prebuilt binary package for your platform. Given how apcupsd must integrate into the shutdown mechanism of the operating system and the rate at which such mechanisms are changed by vendors, the platform ports in the apcupsd tree may become out of date. In some cases, binary packages are provided by the apcupsd team (RedHat, Mandriva, SuSE, Windows, Mac OS X). For other platforms it is recommended to check your vendor's package repository and third party repositories for recent binary packages before resorting to building apcupsd from scratch. Note that some vendors continue to distribute ancient versions of apcupsd with known defects. These packages should not be used.

Installation from Binary Packages

RPMS

For systems based on RPM packages, such as Red Hat and SuSE, apcupsd is available in binary RPM format. This is the simplest way to install. If you have no previous version of apcupsd on your machine and are creating a standalone configuration, simply install the RPM with a normal 'rpm -ihv' command. You're done, and can now skip the rest of this chapter and go straight to tweaking your run-time configuration file. (see After Installation)

If you have a previous installation, you can upgrade with a normal 'rpm -Uhv', but this may not upgrade the halt script. It may be better to do the upgrade as a remove 'rpm -e' followed by a fresh install 'rpm -ihv'.

After installation of the binary RPM, please verify carefully that /etc/rc.d/init.d/halt was properly updated and contains new script lines flagged with ***APCUPSD***.

Since there is no standard location for cgi-bin, the rpm will place the binary CGI programs in the directory /etc/apcupsd/cgi. To actually use them, you must copy or move them to your actual cgi-bin directory, which on many systems is located in /home/httpd/cgi-bin.

Microsoft Windows

The Windows version of apcupsd is distributed as a simple double-click installer. Installation is very simple and straight-forward: Simply double-click the installer executable and follow the instructions. See The Windows Version of apcupsd for further details.

Installation from Source

Installation from source might have to be be done different ways depending on what system you are running. The basic procedure involves getting a source distribution, running the configuration, rebuilding, and installing.

For building the system, we suggest that you run the configure and make processes as your normal UNIX user ID. The 'make install' must be run as root. But if your normal ID has an environment setup for using the C compiler, it's simpler to do that than to set up root to have the correct environment.

apcupsd requires gcc and g++ compilers as well as GNU make. Other compilers or BSD make will not work. GNU make is sometimes installed as gmake. The configure script will check for this and will inform you of what command to use to invoke GNU make.

The basic installation from a tar source file is rather simple:

  1. Unpack the source code from its tar archive.
  2. Go into the directory containing the source code.
  3. Run './configure' (with appropriate options as described below)
  4. 'make' or 'gmake'' as instructed by configure
  5. 'su' (i.e. become root)
  6. Stop any running instance of apcupsd. The command to do this will look like 'system-dependent-path/apcupsd stop'
  7. uninstall any old apcupsd This is important since the default install locations may have changed.
  8. 'make install' or 'gmake install'
  9. edit your /etc/apcupsd/apcupsd.conf file if necessary
  10. ensure that your halt script is properly updated
  11. Start the new apcupsd with: 'system-dependent-path/apcupsd start'

If all goes well, the './configure' will correctly determine which operating system you are running and configure the source code appropriately. configure currently recognizes the systems listed below in the Operating System Specifics section of this chapter and adapts the configuration appropriately. Check that the configuration report printed at the end of the configure process corresponds to your choice of directories, options, and that it has correctly detected your operating system. If not, redo the configure with the appropriate options until your configuration is correct.

Please note that a number of the configure options preset apcupsd.conf directive values in an attempt to automatically adapt apcupsd as best possible to your system. You can change the values in apcupsd.conf at a later time without redoing the configuration process by simply editing the apcupsd.conf file.

Other configuration options can be used to set up the installation of HTML documentation and optional modules, notably the CGI interface that enables the UPS state to be queried via the Web. You will find a complete reference later in this chapter.

In general, you will probably want to supply a more elaborate configure statement to ensure that the modules you want are built and that everything is placed into the correct directories.

On Red Hat, a fairly typical configuration command would look like the following:

CFLAGS="-g -O2" LDFLAGS="-g" ./configure \
  --enable-usb \
  --with-upstype=usb \
  --with-upscable=usb \
  --prefix=/usr \
  --sbindir=/sbin \
  --with-cgi-bin=/var/www/cgi-bin \
  --enable-cgi \
  --with-css-dir=/var/www/docs/css \
  --with-log-dir=/etc/apcupsd

By default, 'make install' will install the executable files in /sbin, the manuals in /usr/man, and the configuration and script files in /etc/apcupsd. In addition, if your system is recognized, certain files such as the startup script and the system halt script will be placed in appropriate system directories (usually subdirectories of /etc/rc.d).

Verifying a Source Installation

There are a number of things that you can do to check if the installation (make install) went well. The fist is to check where the system has installed apcupsd using 'which' and 'whereis'. On my Red Hat system, you should get the following (lines preceded with a $ indicate what you type):

$ which apcupsd
/sbin/apcupsd
$ whereis apcupsd
apcupsd: /sbin/apcupsd /etc/apcupsd /etc/apcupsd.conf
/etc/apcupsd.status /usr/man/man8/apcupsd.8.gz
/usr/man/man8/apcupsd.8

If you find an apcupsd in /usr/sbin, /usr/local/sbin, /usr/lib, or another such directory, it is probably a piece of an old version of apcupsd that you can delete. If you are in doubt, delete it, then rerun the 'make install' to ensure that you haven't deleted anything needed by the new apcupsd. Please note that the files specified above assume the default installation locations.

As a final check that the 'make install' went well, you should check your halt script (in /etc/rc.d on SUSE systems, and in /etc/rc.d/init.d on Red Hat systems) to see that the appropriate lines have been inserted in the correct place. Modification of the halt script is important so that at the end of the shutdown procedure, apcupsd will be called again to command the UPS to turn off the power. This should only be done in a power failure situation as indicated by the presence of the /etc/powerfail file, and is necessary if you want your machine to automatically be restarted when the power returns. On a Red Hat system, the lines containing the # ***apcupsd*** should be inserted just before the final halt command:

# Remount read only anything that's left mounted.
#echo "Remounting remaining filesystems (if any) readonly"
mount | awk '/ext2/ { print $3 }' | while read line; do
    mount -n -o ro,remount $line
done

# See if this is a powerfail situation.                               # ***apcupsd***
if [ -f /etc/apcupsd/powerfail ]; then                                # ***apcupsd***
   echo                                                               # ***apcupsd***
   echo "APCUPSD will now power off the UPS"                          # ***apcupsd***
   echo                                                               # ***apcupsd***
   /etc/apcupsd/apccontrol killpower                                  # ***apcupsd***
   echo                                                               # ***apcupsd***
   echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd***
   echo "Otherwise, the UPS may cut the power during the reboot!!!"   # ***apcupsd***
   echo                                                               # ***apcupsd***
fi                                                                    # ***apcupsd***

# Now halt or reboot.
echo "$message"
if [ -f /fastboot ]; then
 echo "On the next boot fsck will be skipped."
elif [ -f /forcefsck ]; then
 echo "On the next boot fsck will be forced."
fi

The purpose of modifying the system halt files is so that apcupsd will be recalled after the system is in a stable state. At that point, apcupsd will instruct the UPS to shut off the power. This is necessary if you wish your system to automatically reboot when the mains power is restored. If you prefer to manually reboot your system, you can skip this final system dependent installation step by specifying the disable-install-distdir option on the './configure' command (see below for more details).

The above pertains to Red Hat systems only. There are significant differences in the procedures on each system, as well as the location of the halt script. Also, the information that is inserted in your halt script varies from system to system. Other systems such as Solaris require you the make the changes manually, which has the advantage that you won't have any unpleasant surprises in your halt script should things go wrong. Please consult the specific system dependent README files for more details.

Please note that if you install from RPMs for a slave machine, you will need to remove the changes that the RPM install script made (similar to what is noted above) to the halt script. This is because on a slave machine there is no connection to the UPS, so there is no need to attempt to power off the UPS. That will be done by the master.

Configure Options

All the available configure options can be printed by entering:

./configure --help

When specifying options for './configure', if in doubt, don't put anything, since normally the configuration process will determine the proper settings for your system. The advantage of these options is that it permits you to customize your version of apcupsd. If you save the './configure' command that you use to create apcupsd, you can quickly reset the same customization in the next version of apcupsd by simply re-using the same command.

The following command line options are available for configure to customize your installation.

--prefix=path This defines the directory for the non-executable files such as the manuals. The default is /usr.
--sbindir=path This defines the directory for the executable files such as apcupsd. The default is /sbin. You may be tempted to place the executable files in /usr/sbin or /usr/local/sbin. Please use caution here as these directories may be unmounted during a shutdown and thus may prevent the halt script from calling apcupsd to turn off the UPS power. Though your data will be protected, in this case, your system will probably not be automatically rebooted when the power returns
--enable-cgi This enables the building of the CGI programs that permit Web browser access to apcupsd data. This option is not necessary for the proper execution of apcupsd.
--with-cgi-bin=path
 The with-cgi-bin configuration option allows you to define the directory where the CGI programs will be installed. The default is /etc/apcupsd, which is probably not what you want.
--with-css-dir=path
 This option allows you to specify where you want apcupsd to put the Cascading Style Sheet that goes with the multimoncss.cgi CGI program.
--enable-apcsmart
 Turns on generation of the APC Smart driver (default).
--enable-dumb Turns on generation of the dumb signalling driver code (default).
--enable-usb Turns on generation of the USB driver code. By default this is disabled.
--enable-net Turns on generation of the NIS network driver for slaves. For each slave, this is the only driver needed. This driver works by reading the information from the the configured master using the NIS (Network Information Services) interface.
--enable-snmp Turns on generation of the SNMP driver. This driver accesses the UPS over the network using SNMP. This is compatible only with UPSes equipped with an SNMP or Web/SNMP management card. By default this is enabled.
--enable-net-snmp
 Turns on generation of the obsolete NET-SNMP driver. This driver was the precursor to the current snmp driver and is now obsolete. It is available as a fallback if the new driver cannot be used for some reason. By default this is disabled.
--enable-pcnet Turns on generation of the PCNET (PowerChute Network Shutdown) driver. This driver accesses the UPS over the network using APC's custom protocol. This driver can be used as an alternative to SNMP for UPSes equipped with a modern Web/SNMP management card.
--enable-test This turns on a test driver that is used only for debugging. By default it is disabled.
--enable-gapcmon
 This option enables building the GTK GUI front-end for apcupsd. Building this package requires numerous GNOME libraries. The default is disabled.
--enable-apcagent
 This option enables building the apcagent menubar application on Mac OS X platforms. The default is disabled.
--with-libwrap=path, --with-libwrap
 This option when enabled causes apcupsd to be built with the TCP WRAPPER library for enhanced security. In most cases, the path is optional since configure will determine where the libraries are on most systems.
--with-nologin=path
 This option allows you to specify where apcupsd will create the nologin file when logins are prohibited. The default is /etc
--with-pid-dir=path
 This option allows you to specify where apcupsd will create the process id (PID) file to prevent multiple copies from running. The default is system dependent but usually /var/run.
--with-log-dir=path
 This option allows you to specify where apcupsd will create the EVENTS and STATUS log files. The default is /etc/apcupsd. This option simply sets the default of the appropriate path in the apcupsd.conf file, which can be changed at any later time.
--with-lock-dir=path
 This option allows you to specify where apcupsd will create the serial port lock file. The default is system-dependent but usually /var/lock. This option simply sets the appropriate path in the apcupsd.conf file, which can be changed at any later time.
--with-pwrfail-dir=path
 This option allows you to specify where apcupsd will create the powerfail file when a power failure occurs. The default is system dependent but usually /etc.
--with-serial-dev=device-name
 This option allows you to specify where apcupsd will look for the serial device that talks to the UPS. The default is system dependent, but often /dev/ttyS0. This option simply sets the appropriate device name in the apcupsd.conf file, which can be changed at any later time.
--with-nis-port=port
 This option allows you to specify what port apcupsd will use for the Network Information Server (the CGI programs). The default is system dependent but usually 3551 because that port has been officially assigned to apcupsd by the IANA. This option simply sets the appropriate port in the apcupsd.conf file, which can be changed at any later time.
--with-nisip=ip-address
 This option allows you to specify the value that will be placed on then NISIP directive in the configuration file. The default is 0.0.0.0. No checking is done on the value entered, so you must ensure that it is a valid IP address.
--with-net-port=port
 This option allows you to specify what port apcupsd will use for Master and Slave communications. The default is system dependent but usually 6666. This option simply sets the appropriate port in the apcupsd.conf file, which can be changed at any later time.
--with-upstype=type
 This option allows you to specify the type of UPS that will be connected to your computer. The default is: smartups. This option simply sets the appropriate UPS type in the apcupsd.conf file, which can be changed at any later time.
--with-upscable=cable
 This option allows you to specify what cable you are using to connect to the UPS. The default is: smart. This option simply sets the appropriate UPS cable in the apcupsd.conf file, which can be changed at any later time.
--disable-install-distdir
 This option modifies the apcupsd Makefiles disable installation of the distribution (platform) directory. Generally, this used to do a full installation of apcupsd except the final modification of the operating system files (normally /etc/rc.d/halt, etc.). This is useful if your operating system is not directly supported by apcupsd or if you want to run two copies of apcupsd on the same system. This option can also be used by those of you who prefer to manually reboot your system after a power failure or who do not want to modify your system halt files.

Compilers and Options

Some systems require unusual options for compilation or linking that the './configure' script does not know about. You can specify initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this:

CFLAGS="-O2 -Wall" LDFLAGS= ./configure

Or on systems that have the env program, you can do it like this:

env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure

Or for example on the Sun Solaris system, you can use:

setenv CFLAGS -O2
setenv LDFLAGS -O
./configure

You can get a listing of all available options by doing:

./configure --help

or simply see the previous section of this manual.

Operating System Specifics

With the exception of Linux SUSE and Linux Red Hat systems used by the developers, we rely on users to help create installation scripts and instructions as well as to test that apcupsd runs correctly on their system. As you can imagine, most of these people are system administrators rather than developers so they are very busy and don't always have time to test the latest releases. With that in mind, we believe that you will find that a lot of very valuable work has been already done to make your installation much easier (and probably totally automatic).

Below, you will find a list of operating systems for which we have received installation files:

Debian

This port is complete and is being used by several users. Since Debian build and install procedures are somewhat particular, we have put the extra Debian information into the following two subdirectories: platforms/debian/examples and platforms/debian/packageinfo

You can also find the official Debian packages on the Debian site at:

FreeBSD

This port is complete and is being used by several users.

You will need to install and use GNU make (aka gmake) instead of the BSD make supplied with the system.

On the FreeBSD OS, there is no known way for a user program to get control when all the disks are synced. This is needed for apcupsd to be able to issue the killpower command to the UPS so that the UPS shuts off the power. To accomplish the same thing on FreeBSD systems, make sure you have a SmartUPS and that your UPS shutdown grace period is set sufficiently long so that you system will power down (usually 2 minutes), the use the --kill-on-powerfail option on the apcupsd command line.

HPUX

Status of this port is unknown.

NetBSD

You will need to install and use GNU make (aka gmake) instead of the BSD make supplied with the system.

Mac OS X Darwin

On OS X (Darwin), apcupsd can be built with configure defaults. The USB driver can be enabled, as per the directions on Mac OS X (Darwin) USB Configuration Apcupsd may be usable on OS X with a smart serial device, but certainly does work as a NIS client or using a USB interface.

The startup information will be installed in /Library/StartupItems/apcupsd which is part of darwin's SystemStartup.

OpenBSD

You will need to install and use GNU make (aka gmake) instead of the BSD make supplied with the system.

Ensure that you read the distributions/openbsd/README file before running apcupsd. There are some critical differences in how the OpenBSD implementation operates when the UPS batteries are exhausted. Failure to take this into account may result in the system not being fully halted when power is lost.

Red Hat Systems

Red Hat systems are fully supported, and by following the standard installation instructions given above, you should experience few or no problems.

Slackware

Slackware systems are fully supported, and by following the standard installation instructions given above, you should experience few or no problems.

SUSE

SUSE systems are fully supported, and by following the standard installation instructions given above, you should experience few or no problems.

Sun Solaris

Please read this before attempting to compile or install the beta software. It contains important information that will make your efforts easier.

Before running './configure', please be sure that you do not have /usr/ucb on your path. This may cause the configure to choose the wrong shutdown program. If configure detects that /usr/usb is on your path, it will print a warning message. Please follow the advice to avoid shutdown problems.

Your normal UNIX user ID must own the source tree directories, and you must have the normal development tools in your path. This includes make, the compiler, the M4 preprocessor, the linker, and ar or ranlib. If the user you are logged in as can compile and link a C program from a source file, then you have all the required tools available.

You will want to install the executables in a directory that remains mounted during the shutdown. Solaris will unmount almost everything except the root directories. Since the ability to power the UPS off requires access to the executable programs, they need to be in a directory that will never be unmounted. And since they should also be in a directory that normal users cannot get into, /sbin is the default. However, please be aware that if you want to follow Sun's filesystem conventions you would use the following:

./configure \
   --prefix=/opt/apcupsd \
   --sbindir=/etc/opt/apcupsd/sbin \
   --sysconfdir=/etc/opt/apcupsd \
   --with-cgi-bin=/opt/apcupsd/cgi-bin

The way to setup the /sbin directory as the executables directory is to pass configure the --sbindir=/sbin option. No other arguments should be required, and your setup and platform should be detected automatically by configure.

Once you have run configure, you will need to do a 'gmake'. Once the make has completed with no errors, you must su to root to complete the install. After the su, you may not have a path to the make program anymore. In that case, you should do the 'gmake install' step as:

gmake install

Once the install completes, you must edit the /sbin/rc0 script as detailed below, then exit from the su'ed shell.

In order to support unattended operation and shutdown during a power failure, it's important that the UPS remove power after the shutdown completes. This allows the unattended UPS to reboot the system when power returns by re-powering the system. Of course, you need autoboot enabled for your system to do this, but all Solaris systems have this by default. If you have disabled this on your system, please re-enable it.

To get the UPS to remove power from the system at the correct time during shutdown, i.e., after the disks have done their final sync, we need to modify a system script. This script is /sbin/rc0.

We do not have access to every version of Solaris, but we believe this file will be almost identical on every version. Please let us know if this is not true.

At the very end of the /sbin/rc0 script, you should find lines just like the following:

# unmount file systems. /usr, /var and /var/adm are not unmounted by umountall
# because they are mounted by rcS (for single user mode) rather than
# mountall.
# If this is changed, mountall, umountall and rcS should also change.
/sbin/umountall
/sbin/umount /var/adm >/dev/null 2>\&1
/sbin/umount /var >/dev/null 2>\&1
/sbin/umount /usr >/dev/null 2>\&1

echo 'The system is down.'

We need to insert the following lines just before the last 'echo':

#see if this is a powerfail situation
if [ -f /etc/apcupsd/powerfail ]; then
        echo
        echo "APCUPSD will power off the UPS"
        echo
        /etc/apcupsd/apccontrol killpower
        echo
        echo "Please ensure that the UPS has powered off before rebooting"
        echo "Otherwise, the UPS may cut the power during the reboot!!!"
        echo
fi

We have included these lines in a file called rc0.solaris in the distributions/sun subdirectory of the source tree. You can cut and paste them into the /sbin/rc0 file at the correct place, or yank and put them using vi or any other editor. Note that you must be root to edit this file.

You must be absolutely sure you have them in the right place. If your /sbin/rc0 file does not look like the lines shown above, do not modify the file. Instead, email a copy of the file to the maintainers, and we will attempt to figure out what you should do. If you mess up this file, the system will not shut down cleanly, and you could lose data. Don't take the chance.

You will then need to make the normal changes to the /etc/apcupsd/apcupsd.conf file. This file contains the configuration settings for the package. It is important that you set the values to match your UPS model and cable type, and the serial port that you have attached the UPS to. People have used both /dev/ttya and /dev/ttyb with no problems. You should be sure that logins are disabled on the port you are going to use, otherwise you will not be able to communicate with the UPS. If you are not sure that logins are disabled for the port, run the 'admintool' program as root, and disable the port. The 'admintool' program is a GUI administration program, and required that you are running CDE, OpenWindows, or another XWindows program such as KDE.

Solaris probes the serial ports during boot, and during this process, it toggles some handshaking lines used by dumb UPSes. As a result, particularly for simple signalling "dumb" UPSes it seems to kick it into a mode that makes the UPS think it's either in a calibration run, or some self-test mode. Since at this point we are really not communicating with the UPS, it's pretty hard to tell what happened. But it's easy to prevent this, and you should. Disconnect the UPS, and boot the system. When you get to a login prompt, log in as root. Type the following command:

eeprom com1-noprobe=true

or

eeprom com2-noprobe=true

depending on which com port your UPS is attached to. Then sync and shutdown the system normally, reattach the UPS, and reboot. This should solve the problem. However, we have some reports that recent versions of Solaris (7 & 8) appear to have removed this eeprom option and there seems to be no way to suppress the serial port probing during boot.

At this point, you should have a complete installation. The daemon will load automatically at the next boot. Watch for any error messages during boot, and check the event logs in /etc/apcupsd. If everything looks OK, you can try testing the package by removing power from the UPS. NOTE! if you have a voltage-signalling UPS, please run the first power tests with your computer plugged into the wall rather than into the UPS. This is because dumb serial-port UPSes have a tendency to power off if your configuration or cable are not correct.

As a user, your input is very helpful in solving problems with the package, and providing suggestions and future directions for the development of the package. We are striving to provide a useful package that works across all platforms, and welcome your feedback.

Unknown System

During the './configure', if apcupsd does not find one of the systems for which it has specific installation programs, it will set the Operating System to unknown and will use the incomplete installation scripts that are in platforms/unknown. You will be on your own, or you can ask the developers list (apcupsd-users@lists.sourceforge.net) for installation instructions. This directory also contains a hint file for Linux From Scratch, which could be helpful for other systems as well.

Windows Systems

Appropriate scripts (actually Windows batch files) are included with the Apcupsd Win32 installer package.

After Installation

Checking Your Configuration File

Once you have installed apcupsd, either from a binary package or by building from source, your next step should be to inspect your /etc/apcupsd/apcupsd.conf file to make sure it is valid.

You can read the complete reference on configuration directives (Configuration Directive Reference), but if you are setting up a normal standalone configuration you should only need to check (and possibly fix) the first three items listed below.

Your UPSTYPE should be the UPS's protocol type: dumb, apcsmart, usb, net, pcnet, or snmp. Your UPSCABLE should be the type of cable you are using.

DEVICE should be set to the path of the device node (usually in /dev) to use to communicate with the UPS. This is used primarily for serial port connections. If you have a USB device, it is better not to specify a DEVICE directive by leaving it black or commenting it out. Apcupsd will automatically search for your device in the standard places. If you specify a DEVICE, it should be the name of the device that apcupsd is to use to communicate with the UPS.

If the first time you execute apcupsd, you get a message to the effect that the Apcupsd USB driver is missing, it means that you most likely forgot to put --enable-usb on your './configure' command line.

The Configuration Examples chapter of this manual provides the essential characteristics of each main type of configuration file. After those elements are correct, apcupsd should run, and then it is only a matter of customization of your setup.

Arranging for Reboot on Power-Up

The final consideration for a automatic reboot after a full power down is to ensure that your computer will automatically reboot when the power is restored.

This is not the normal behavior of most computers as shipped from the factory. Normally after the power is cut and restored, you must explicitly press a button for the power to actually be turned on. You can test your computer by powering it down; shutting off the power (pull the plug); then plugging the cord back in. If your computer immediately starts up, good. There is nothing more to do.

If your computer does not start up, manually turn on the power (by pressing the power on button) and enter your computer's SETUP program (often by pressing DEL during the power up sequence; sometimes by pressing F10). You must then find and change the appropriate configuration parameter to permit instant power on.

Normally, this is located under the BOOT menu item, and will be called something such as Restore on AC/Power Loss or Full-On. The exact words will vary according to the ROM BIOS provider. Generally you will have three options: Last State, Power On, and Power Off. Although Last State should normally work, we recommend setting your computers to Power On. This means that whenever the power is applied they are on. The only way to shut them off is to pull the plug or to have a special program that powers them off (/sbin/poweroff on Linux systems).

If after making all the changes suggested above, you cannot get your computer to automatically reboot, you might examine your halt script (/etc/rc.d/init.d/halt in the case of Red Hat Linux) and see if the final line that performs the halt or reboot contains the -p option for powering down the computer. It should not with the logic used by apcupsd, but if it does, the -p option could cause your computer to power off while the UPS is still suppling power (i.e. before the UPS kills the power). Depending on the setting of your BIOS, it may prevent your computer from restarting when the power returns. As already mentioned, this should not apply, but in case of problems it is worth a try.

Making sure apcupsd Is Running

The simplest way to invoke apcupsd is from the command line by entering:

/sbin/apcupsd

To do so, you must be root. However, normally, you will want apcupsd started automatically when your system boots. On some systems with installation support (e.g. SUSE and Red Hat), the installation procedure will create a script file that you will be automatically invoked when your system reboots. On other systems, you will have to invoke apcupsd from your rc.local script.

On Red Hat systems, this script file that automatically invokes apcupsd on system start and stops is /etc/rc.d/init.d/apcupsd

To start apcupsd manually (as you will probably do immediately following the installation), enter the following:

/etc/rc.d/init.d/apcupsd start

To understand how this file is automatically invoked at system startup and shutdown, see the man pages for chkconfig(8).

On SUSE systems, the script file that automatically invokes apcupsd on system start and stops is /etc/rc.d/apcupsd.

To start apcupsd manually (as you will probably do immediately following the installation), enter the following:

/etc/rc.d/apcupsd start

Normally, when properly installed, apcupsd will be started and stopped automatically by your system. Unfortunately, the details are different for each system. Below, we give the commands for selected systems. Alternatively, there are simple stopapcupsd and startapcupsd scripts in the examples directory, or you can modify one of the scripts in the distributions directory to meet your needs.

To stop apcupsd you can do the following:

On Red Hat systems:

/etc/rc.d/init.d/apcupsd stop

On SUSE systems:

/etc/rc.d/apcupsd stop

Please see the Testing Apcupsd chapter for more details on insuring that apcupsd is running properly.

Configuration Examples

A Simple USB Configuration

If you have a USB UPS, the essential elements of your apcupsd.conf file should look like the following:

## apcupsd.conf v1.1 ##
UPSCABLE usb
UPSTYPE usb
DEVICE
LOCKFILE /var/lock
UPSCLASS standalone
UPSMODE disable

Notice that we have not specified a device. In doing so, apcupsd will try all the well known USB ports. We strongly recommend you use this (empty device address) form unless you have a good reason to do otherwise.

Please use the explicit specifications of a device only if you know exactly what you are doing. In general, it is much easier to let apcupsd find the device itself.

Please see USB Configuration for detailed help on setting up your system to work with a USB UPS.

A Simple Configuration for a Serial SmartUPS

If you have a Smart UPS using the serial cable supplied by APC, or you build a CUSTOM SMART cable outlined in the cables chapter, a very simple configuration file would look like the following:

## apcupsd.conf v1.1 ##
UPSCABLE smart
UPSTYPE smartups
DEVICE /dev/ttyS0
LOCKFILE /var/lock
UPSCLASS standalone
UPSMODE disable

Normally you would have many more configuration directives to completely customize your installation, but this example shows you the minimum required.

A Simple Configuration for a Simple Signaling or Dumb

If you have a simple signaling or dumb UPS such as a BackUPS, you will need to know exactly what cable you have and specify it on the UPSCABLE directive. Please see the list of UPSes versus cables in the beginning of this document for more information. The cable number is normally stamped in the plastic at one end of the cable. If you specify the wrong cable, it is very likely that at the first power failure, your computer will be immediately shutdown. This is an unfortunate consequence of the dumb signaling mode. To avoid this, first replace /etc/apcupsd/apccontrol with safe.apccontrol found in the examples directory, then test until everything works correctly. Once you have the correct cable, be sure to remember to reinstall the correct apccontrol file and test that your computer is correctly shutdown during a power failure.

## apcupsd.conf v1.1 ##
UPSCABLE (number of cable you have)
UPSTYPE dumb
DEVICE /dev/ttyS0
LOCKFILE /var/lock
UPSCLASS standalone
UPSMODE disable

If your cable does not have low battery detection, as is the case with some older models, you will also need to define TIMEOUT nnn where you set nn to be the number of seconds on a power failure after which a shutdown is effected.

Normally you would have many more configuration directives to completely customize your installation, but this example shows you the minimum required.

NIS Server/Client Configuration Using the Net Driver

NIS (Network Information Server) mode allows for communication between instances of apcupsd running on different hosts. Only one of those hosts, the server, needs to talk to the UPS directly. The others, clients, obtain information about the state of the UPS by querying the server. NIS is not related to Sun's NIS/YP services.

NIS clients and servers require that apcupsd be compiled with the Net Driver --enable-net. This is typically enabled by default.

The NIS server is connected to the UPS and should be configured exactly as a standalone configuration, but with NETSERVER on. In all other respects, the server should be configured in standalone mode. You may also set the NIS server specific options NISIP to restrict which IP address of the server which apcupsd listens on. The default, 0.0.0.0, means to list on all of the server host's IP addresses; NISPORT (default 3551) to set which TCP port the server listens on; and EVENTSFILE and EVENTSFILEMAX to provide information about the last few events to clients. You may also need to modify your firewall rules on the server's host to allow traffic to the NISPORT.

For the NIS client computer, you will have a configuration that looks something like what follows. What is important is that you get the information from an UPSCABLE ether with UPSTYPE net over the network and you must specify the address of a NIS server using DEVICE. The client apcupsd will then poll the NIS server specified in DEVICE every POLLTIME seconds (formerly NETTIME).

## apcupsd.conf v1.1 ##
UPSCABLE ether
UPSTYPE net
LOCKFILE /var/lock
DEVICE server-network-address:3551
UPSCLASS standalone
UPSMODE disable
POLLTIME 10

The DEVICE is set to server-address:port, where server-address is the fully qualified domain name or IP address of the apcupsd NIS server, and port is the NISPORT that the server is listening on. The default is 3551, but older versions of apcupsd used port 7000.

If you set POLLTIME too large, your client may not see the change in state of the NIS server before the server has shutdown. Normally, you have at least 30 seconds of grace time between the time the NIS server decides to shutdown and the time it no longer responds. Your slave must poll during this interval.

Any client run using the Net driver will shutdown when its own timers expire or when the NIS server shuts down, whichever occurs first. This means that if you want the slave to shutdown before the server, you need only set BATTERYLEVEL, MINUTES or TIMEOUT on the client for a faster shutdown than the values defined on the NIS server. This can often be useful if the slave is less important than the master and you wish to reduce battery power consumption so that the master can remain up longer during a power outage.

NIS clients work principally by reading the STATFLAG record that is sent by the NIS server (present in the output of apcaccess). The low 16 bits are the standard APC status flag, and the upper 16 bits represent the internal state of apcupsd, so the slave can see when the power fails and know when to shutdown.

It would be possible to have a client also work as a server, but that would increase the delay of information getting from the UPS to the secondary client.

Differences between NIS Client/Server and the old (now removed) Master/Slave modes

The difference between the NIS mode and the removed master/slave mode is that the NIS server has no explicit knowledge of the slaves. The NIS server makes its information available via the net (NIS), and the NIS slaves read it. When the NIS server is going to shutdown, it makes the information available to any NIS slave that polls it, but the NIS server does not explicitly call each NIS slave as is the case in the Master/Slave networking described several sections above.

Think of the difference as push (Master/Slave) vs. pull (NIS-based). In the case of M/S, the master makes all the shutdown decisions and notifies the slaves when they are to shut down or when some other interesting event happens. The slaves just do whatever the master says, whenever the master says to. On the other hand, with the NIS-based network config you basically "publish" the UPS status from one server and then your clients view that status and make their own decisions.

PowerChute Network Shutdown Driver (PCNET)

As of 3.14, Apcupsd supports the PowerChute Network Shutdown protocol. This is an alternative to SNMP for use with APC's AP9617 family of network smartslot modules. Note that the older AP9606 modules do not support PCNET.

To enable PCNET support, configure with the --enable-pcnet flag. This is typically enabled by default.

The required apcupsd.conf settings are straightforward:

## apcupsd.conf v1.1 ##
UPSCABLE ether
UPSTYPE pcnet
LOCKFILE /var/lock
DEVICE ipaddr:user:passphrase
UPSCLASS standalone
UPSMODE disable

The DEVICE setting specifies the IP address of the UPS as well as the username and authentication passphrase to use. Note that the username and passphrase are not the Web/SNMP login credentials. They are separate settings. The default username on a new card is "apc" and the default passphrase is "admin user phrase". To change the passphrase, log in to the Web UI and go to the UPS tab, then to PowerChute -> Configuration. (This assumes firmware v3.3.1. Other versions may place the setting elsewhere.) The password must be a minimum of 15 characters long. The web UI will silently ignore shorter passwords and does not give an error message. There is no apparent way to change the username.

Note that you may leave DEVICE blank and Apcupsd will accept information from any PCNET UPS on the network, however it will be very insecure since an attacker could easily send packets crafted to cause your server to shut down. Using the ipaddr, user, and passphrase will prevent this behavior.

You may need to take steps to ensure networking stays active during your OS's shutdown sequence in order for the PCNET driver to power off the UPS (the so-called "killpower" operation). On a Linux distro, you can use commands such as...

chkconfig --level 0 network on
chkconfig --level 0 iptables on

...to make sure networking stays up.

Testing Apcupsd

The following testing procedures apply for the most part to SmartUPSes, whether USB or serial. If you have a dumb voltage-signalling UPS, your testing procedures will be somewhat different, and you should see the section on Testing Serial UPSes (see Testing Serial-Line UPSes).

Process-Status Test

After you start apcupsd, execute the following command:

ps fax

or the equivalent for your system. You should see something similar to the following output.

632 ?        S      0:00 /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf
841 ?        S      0:00  \_ /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf
842 ?        S      0:00      \_ /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf

This indicates that apcupsd is up and running and has started the two standard threads in addition to the main thread.

If you see only one instance of apcupsd running, don't worry about it as this is normal on most non-Linux systems, and on Linux 2.6.x kernels.

If you do not find that apcupsd is in the above list, the most likely problem is a configuration file glitch. If no messages were printed, you should check your system log (normally /var/log/messages) where you will find one or messages indicating the nature of the problem.

Logging Test

Once you have established that the proper processes are running, do a tail of the system log file, normally /var/log/messages:

tail /var/log/messages

You should see output that looks similar to the following:

Dec 5 17:01:05 matou apcupsd[5917]: apcupsd 3.7.2 startup succeeded

These messages should also appear in the temporary file (/etc/apcupsd/apcupsd.events) if you are using the default configuration file. If you have installed the RPM, they will probably be in /var/log/apcupsd.events.

apcaccess Test

This test consists of running apcaccess to see if apcupsd is properly updating its internal variables. Please note that you must enable the apcupsd Network Information Server in your configuration file for apcaccess to work. This is done by setting:

NETSERVER on
NISPORT 3551

in your apcupsd.conf file.

To run the apcaccess test, use the following command:

apcaccess status

Depending on the type of UPS you have, you will get slightly different output, but an example For a Smart-UPS is as follows:

APC      : 001,048,1088
DATE     : Fri Dec 03 16:49:24 EST 1999
HOSTNAME : daughter
RELEASE  : 3.7.2
CABLE    : APC Cable 940-0024C
MODEL    : APC Smart-UPS 600
UPSMODE  : Stand Alone
UPSNAME  : SU600
LINEV    : 122.1 Volts
MAXLINEV : 123.3 Volts
MINLINEV : 122.1 Volts
LINEFREQ : 60.0 Hz
OUTPUTV  : 122.1 Volts
LOADPCT  :  32.7 Percent Load Capacity
BATTV    : 26.6 Volts
BCHARGE  : 095.0 Percent
MBATTCHG : 15 Percent
TIMELEFT :  19.0 Minutes
MINTIMEL : 3 Minutes
SENSE    : Medium
DWAKE    : 000 Seconds
DSHUTD   : 020 Seconds
LOTRANS  : 106.0 Volts
HITRANS  : 129.0 Volts
RETPCT   : 010.0 Percent
STATFLAG : 0x08 Status Flag
STATUS   : ONLINE
ITEMP    : 34.6 C Internal
ALARMDEL : Low Battery
LASTXFER : Unacceptable Utility Voltage Change
SELFTEST : NO
STESTI   : 336
DLOWBATT : 05 Minutes
DIPSW    : 0x00 Dip Switch
REG1     : N/A
REG2     : N/A
REG3     : 0x00 Register 3
MANDATE  : 03/30/95
SERIALNO : 13035861
BATTDATE : 05/05/98
NOMOUTV  : 115.0
NOMBATTV :  24.0
HUMIDITY : N/A
AMBTEMP  : N/A
EXTBATTS : N/A
BADBATTS : N/A
FIRMWARE : N/A
APCMODEL : 6TD
END APC  : Fri Dec 03 16:49:25 EST 1999

For a simple signaling or dumb UPS such as BackUPS, your output will be very minimal as follows:

APC      : 001,012,0319
DATE     : Mon Feb 18 09:11:50 CST 2002
RELEASE  : 3.8.5
UPSNAME  : UPS_IDEN
CABLE    : APC Cable 940-0128A
MODEL    : BackUPS
UPSMODE  : Stand Alone
STARTTIME: Mon Feb 18 09:11:45 CST 2002
LINEFAIL : OK
BATTSTAT : OK
STATFLAG : 0x008 Status Flag
END APC  : Mon Feb 18 09:15:01 CST 2002

If you see the above output, it is a good sign that apcupsd is working. Assuming that the output looks reasonable, check the following variables:

LINEV
This is the line voltage and it should be a value that is appropriate for your equipment. In the USA, it is typically about 120 Volts while in Europe, it is about 220 Volts.
BATTV
Unless you have additional battery packs, this should be near 24 Volts plus or minus 5 Volts.
STATUS
This is the status of the UPS and it should normally be ONLINE.

A very disturbing tendance is for some of the newer (Mar 2004) RS and ES UPSes to have no Voltage information. This is an annoying bug, but not serious. On the other hand, some of those UPSes now have no battery charge information BCHARGE. If BCHARGE is zero in your listing and you are running a Smart or a USB UPS, then you will have to set the BATTERYLEVEL directive in your apcupsd.conf file to -1.

If you see a message to the effect of:

APCACCESS FATAL ERROR in apcaccess.c at line 336
tcp_open: cannot connect to server localhost on port 3551.

It means that you have probably not enabled the Network Information Server in your configuration file for apcaccess to work. This is done by setting NETSERVER and NISPORT in your apcupsd.conf file as shown above.

Communications Test

At this point, you should ensure that apcupsd is handling the connection to the UPS correctly. This test assumes you have a UPS that speaks apcsmart protocol, over either USB or a serial port. If you have an old-style voltage-signaling UPS, please skip to the next section (Simulated Power Fail Test).

When apcupsd detects a problem, it generates an EVENT, which consists of sending a message to the system log then invoking the apccontrol script (normally in /etc/acpupsd/apccontrol) to handle the event.

In order to create an event, remove the serial port plug from the back of your computer or from the back of the UPS. Within 6 seconds, apcupsd should detect the lack of serial port communications and broadcast a wall message indicating that the serial port communications was lost:

Warning communications lost with UPS lost.

At the same time, it sends the same message to the system log and to the temporary EVENTS file (/etc/apcupsd/apcupsd.events).

Plug the serial port plug back into your computer, and within about 12 seconds, apcupsd should reestablish communications and broadcast and log the following message:

Communications with UPS restored.

If these messages are logged but not broadcast, either you have your mesg permission set to no (see 'man wall' or 'man mesg'), or there is a problem with apccontrol. If you are running a window manager such as GNOME and don't have a console window open, you may not receive the wall messages. However, you should find them in your system log file (normally /var/log/messages) and in the temporary EVENTS file, /etc/apcupsd/apcupsd.events. For example, to observe these events in the temporary EVENTS file, you might do a

tail -f /etc/apcupsd/apcupsd.events

Note, if you have installed from the RPM, the proper events file may be /var/log/apcupsd.events. You can find the actual filename by checking your apcupsd.conf file before running the test.

If you do not observe these messages, you should correct this problem before proceeding with additional tests.

Simulated Power Fail Test

At this point, you should verify that in the event of a power fail apcupsd properly calls apccontrol. This test is appropriate for all models of UPSes (smart or dumb).

To avoid the possibility that apcupsd might shut down your system, locate where apccontrol resides on your system (normally, /etc/apcupsd/apccontrol. Move this script to another location e.g. apccontrol.save and replace it with the script found in examples/safe.apccontrol. When that is done, ensure that your UPS battery is fully charged and that you have at least 5 minutes of remaining runtime on the batteries. This can be done by examining the values of the BATTCHG and TIMELEFT variables in the printout of 'apcaccess status'.

Athough this should not be necessary, as an extra precaution, you can shutdown your machine, remove the plug from the UPS you are testing, and plug your machine into another UPS or directly into the wall. Doing so, will ensure that the UPS doesn't cut the power to your machine at a bad time. Remember at the end of the testing to plug your machine back into the UPS.

You can also minimize the risk from an unexpected shutdown by using a journaling filesystem such as Linux's EXT3. All modern disk drives park themselves safely when they power down, rather than ploughing up oxide on your disk's recording surface. Thus, unexpected power less has to hit very narrow timing windows in order to trash an EXT3 transaction.

To begin the test, pull the power plug from the UPS. The first time that you do this, psychologically it won't be easy, but after you have pulled the plug a few times, you may even come to enjoy it. If all goes well, apcupsd should detect the power failure and print several warning messages. The first should appear after 5 to 6 seconds and read:

Warning power loss detected.

Then generally 6 seconds later, apcupsd is sure that it isn't a transient effect, so it sends:

Power failure. Running on UPS batteries.

After a few more seconds (total around 15 seconds), plug the power cord back in and ensure that apcupsd is aware that the power has returned. It should print:

Power has returned...

If you do not observe the above messages, please correct the situation before proceeding. The most likely cause of problems are:

  • apcupsd doesn't recognize the power failure because the configuration directives are not correct. E.g. wrong cable.
  • The file /etc/apcupsd/apccontrol doesn't exist or is not marked as executable.

System Shutdown Test

This is an intermediate test that you can do, for all UPS models before doing the Full Power Down Test. First modify the /etc/apcupsd/apccontrol file so that in the killpower case, the line that re-executes apcupsd with the --killpower option is commented out. The original line probably looks something like:

${APCUPSD} --killpower

when it is commented out, it looks like:

#${APCUPSD} --killpower

Now when you pull the power plug, and either the timer expires or the batteries are exhausted (see the next section for more details), the system should be fully shutdown.

After performing this test, please be sure to restore /etc/apcupsd/apccontrol to its previous state.

Full Power Down Test

To complete the testing, you should do a power fail shutdown of your system. This test is applicable to all UPS models. Please do a backup of your system or take other precautions before attempting this to avoid the possibility of lost data due to a problem (I have been through this at least 10 times and never once had problems, but we all know that someday something will go wrong).

Before proceeding, please ensure that your halt script or the equivalent has been properly updated by the install process to contain the logic to call apcupsd --killpower or apccontrol killpower when it detects a power failure situation (the presence of a /etc/powerfail file). See the Building and Installing apcupsd section of this manual, or the README files for additional details about the halt modifications necessary.

When you are ready to do the test, either simply pull the plug and wait for the batteries to become exhausted, or set the TIMEOUT configuration directive to something like 60 so that the system will shutdown before the batteries are exhausted. We recommend doing the full shutdown without using TIMEOUT to correctly simulate a real power failure, but the choice is yours (I did it once here, but now use TIMEOUT 30).

If all goes well, your system should be shutdown before the batteries are completely exhausted and the UPS should be powered off by apcupsd. Please be aware that if you do the full power down, you must ensure that your UPS is totally powered off. Otherwise, it may have been given the command to power off, but due to a long grace period it is still waiting. If you were to reboot your computer during the grace period, the UPS could then suddenly turn off the power (this happened to me). To avoid this problem, always wait for your UPS to power itself off, or power if off manually before restarting your computer. On my system, the UPS is configured as at the factory to have a 180 second grace period before shutting off the power. During this type of testing, 180 seconds seems like an eternity, so please take care to either wait or manually power off your UPS. To determine what grace period is programmed into your UPS EEPROM, run 'apcaccess eprom' and look at the "Shutdown grace delay".

If you experienced so problems with the above testing procedures, or if you are porting apcupsd to another system, or you are simply curious, you may want to know exactly what is going on during the shutdown process. If so, please see the Shutdown Sequence section of this manual.

apctest

apctest is a program that allows you to talk directly to your UPS and run certain low-level tests, display all know values from the UPS's EEPROM, perform a battery runtime calibration, program the EEPROM (serial connection only), and enter in TTY mode with the UPS. Here we describe how to use it for a SmartUPS. The menus and options for USB and simple signaling UPSes are different but mostly self-explanatory.

Shutdown apcupsd if it is running. Make sure your /etc/apcupsd/apcupsd.conf file has UPSTYPE apcsmart and UPSCABLE has one of the smart cables that are supported.

Run apctest by invoking it with no arguments.

It will read your installed apcupsd.conf configuration (so it knows where to find the UPS) and then it will present you with the following output:

2003-07-07 11:19:21 apctest 3.10.6 (07 July 2003) redhat
Checking configuration ...
Attached to driver: apcsmart
sharenet.type = DISABLE
cable.type = CUSTOM_SMART

You are using a SMART cable type, so I'm entering SMART test mode
mode.type = SMART
Setting up serial port ...
Creating serial port lock file ...
Hello, this is the apcupsd Cable Test program.
This part of apctest is for testing Smart UPSes.
Please select the function you want to perform.

1) Query the UPS for all known values
2) Perform a Battery Runtime Calibration
3) Abort Battery Calibration
4) Monitor Battery Calibration progress
5) Program EEPROM
6) Enter TTY mode communicating with UPS
7) Quit

Select function number: 1

Item 1 will probe the UPS for all values known to apcupsd and present them in rather raw format. This output can be useful for providing technical support if you are having problems with your UPS.

Item 2 will perform a Battery Runtime Calibration. This test will only be performed if your battery is 100% charged. Running the test will cause the batteries to be discharged to approximately 30% of capacity. The exact number depends on the UPS model. In any case, apctest will abort the test if it detects that the battery charge is 20% or less.

The advantage of doing this test is that the UPS will be able to recalibrate the remaining runtime counter that it maintains in its firmware. As your batteries age, they tend to hold less of a charge, so the runtime calibration may not be accurate after several years.

We recommend that perform a Battery Calibration about once a year. You should not perform this calibration too often since discharging the batteries tends to shorten their lifespan.

Item 3 can be used to abort a Battery Calibration in progress, if you some how became disconnected.

Item 4 can be used to restart the monitoring of a Battery Calibration if you should some how become disconnected during the test.

Item 5 is used to program the EEPROM. Please see the Configuration Directives Used to Set the UPS EEPROM chapter of this manual for the details.

Item 6 will initiate a direct communication between your terminal and the UPS, at which point you can enter raw UPS commands. Please be aware that you should be careful what commands you enter because you can cause your UPS to suddenly shutdown, or you can modify the EEPROM in a way to disable your UPS. The details of the raw Smart mode UPS commands can be found in the APC Smart Protocol chapter of this manual.

Item 7 will terminate apctest.

Monitoring and Tuning your UPS

After you have verified that your UPS is working correctly, you will probably want to query the state of its health occasionally. The tools apcupsd gives you to do this include one command-line utility (apcaccess) and a GUI you can use through a Web browser. You can also use apctest to tune some parameters of the UPS itself.

apcaccess

apcaccess is a program (normally found in /sbin/apcaccess) that permits you to print out the complete status of your UPS.

apcaccess will use the Network Information Server to obtain the necessary information. You can specify a second optional argument to apcaccess in the form of host:port where the :port is optional. The default is localhost:3551. Please note that in versions prior to 3.10.6, the default NIS port was 7000, so if you are mixing versions, you will need to take a lot of care to ensure that all components are using the same port.

To enable the apcupsd Network Information Server, which is normally the default, you set:

NETSERVER on
NISPORT 3551

in your apcupsd.conf file.

The full form of the apcaccess command is:

apcaccess status localhost:3551

where only apcaccess status should normally be needed. localhost may be replaced by any machine name, fully qualified domain name, or IP address, which means that apcaccess can access any UPS on the network running the Network Information Server.

The status command line option of apcaccess will produce a full printout of all the STATUS variables used by apcupsd. This can be very helpful for checking the condition of your UPS and to know whether or not apcupsd is properly connected to it.

Please note that if you invoke apcaccess within the first 30 seconds of launching apcupsd, you will likely get an error message such as:

APCACCESS FATAL ERROR in apcaccess.c at line 336
tcp_open: cannot connect to server localhost on port 3551.

This is because apcupsd is still in the process of initializing the UPS. The solution is to wait at least 30 seconds after starting apcupsd before launching apcaccess.

For a SmartUPS 1000 apcaccess will emit the following output:

DATE     : Fri Dec 03 12:34:26 CET 1999
HOSTNAME : matou
RELEASE  : 3.7.0-beta-1
CABLE    : Custom Cable Smart
MODEL    : SMART-UPS 1000
UPSMODE  : Stand Alone
UPSNAME  : UPS_IDEN
LINEV    : 232.7 Volts
MAXLINEV : 236.6 Volts
MINLINEV : 231.4 Volts
LINEFREQ : 50.0 Hz
OUTPUTV  : 232.7 Volts
LOADPCT  :  11.4 Percent Load Capacity
BATTV    : 27.7 Volts
BCHARGE  : 100.0 Percent
MBATTCHG : 5 Percent
TIMELEFT : 112.0 Minutes
MINTIMEL : 3 Minutes
SENSE    : Low
DWAKE    : 060 Seconds
DSHUTD   : 180 Seconds
LOTRANS  : 204.0 Volts
HITRANS  : 253.0 Volts
RETPCT   : 050.0 Percent
STATFLAG : 0x08 Status Flag
STATUS   : ONLINE
ITEMP    : 29.2 C Internal
ALARMDEL : Low Battery
LASTXFER : U command or Self Test
SELFTEST : NO
STESTI   : 336
DLOWBATT : 02 Minutes
DIPSW    : 0x00 Dip Switch
REG1     : 0x00 Register 1
REG2     : 0x00 Register 2
REG3     : 0x00 Register 3
MANDATE  : 01/05/99
SERIALNO : GS9902009459
BATTDATE : 01/05/99
NOMOUTV  : 230.0
NOMBATTV :  24.0
HUMIDITY : N/A
AMBTEMP  : N/A
EXTBATTS : 0
BADBATTS : N/A
FIRMWARE : 60.11.I
APCMODEL : IWI
END APC  : Fri Dec 03 12:34:33 CET 1999

For the various smaller, cheaper APC USB UPSes, such as the CS, ES, ..., you will get much of the information that is presented above, but not all of it. For example, you will not get MAXLINEV, MINLINEV, LINEFREQ, ... and in particular, the LOADPCT will be zero when you are running on mains. LOADPCT will display when the UPS is on batteries. You must remember that the non-SmartUPSes are much simpler (and less expensive) and therefore produce less information.

Apcupsd Notification and Events

When a major event is generated within apcupsd, control is passed to the script apccontrol normally found in /etc/apcupsd/apccontrol. The event name, and a number of other important parameters are passed to the script.

The major function of the apccontrol script is to perform a shutdown of the system (as well as the killpower operation). In addition, another major task for this script is to notify you by email when certain events such as powerfail occur.

Since apccontrol is a script, you can customize it to your own needs using any text editor. To do so, you must have a minimal knowledge of Unix shell programming. In addition, another feature is that you can write your own scripts that will be automatically called by apccontrol before any of its own code is executed. Details of the events and how to program them are contained in the Advanced topics section entitled Customizing Event Handling.

apcupsd Network Monitoring (CGI) Programs

There are four CGI programs (multimon.cgi, upsstats.cgi, upsfstats.cgi, and upsimage.cgi). To have them properly installed, you must run the './configure' command with --enable-cgi and you should specify an installation directory with --with-cgi-bin= or load them manually. The default directory for installation of the CGI programs is /etc/apcupsd, which is not really where you want them if you are going to use them. Normally, they should go in the cgi-bin of your Web server.

Once built and loaded, they will give you the status of your UPS or UPSes via a web browser.

Normally only multimon.cgi is directly invoked by the user. However, it is possible to directly invoke upsstats.cgi and upsfstats.cgi. upsimage.cgi should never be directly invoked as it is used by upsstats.cgi to produce the bar charts.

Setting up and Testing the CGI Programs

Before using multimon and the other CGI programs, first ensure that apcupsd is configured to run the Network Information Server. This is done by setting NETSERVER on in /etc/apcupsd/apcupsd.conf. This switch is on by default.

Next you must edit the hosts file /etc/apcupsd/hosts.conf and at the end, add the name of the hosts you want to monitor and a label string for them. For example:

MONITOR matou "Server"
MONITOR polymatou "Backup server"
MONITOR deuter  "Disk server"

matou, polymatou, and deuter are the network names of the three machines currently running apcupsd. Please note that the network names may either be IP addresses or fully qualified domain names. The network name (or IP address) may optionally be followed by :port, where the port is the NIS port address you wish to use. This is useful if you are running multiple copies of apcupsd on the same system or if you are running in a mixed vendor environment where the NIS port assignments differ. An example could be the following:

MONITOR matou "Server"
MONITOR polymatou "Backup server"
MONITOR deuter  "Disk server"
MONITOR polymatou:7001 "APC USB UPS"

where the USB copy of apcupsd has been configured to use port 7001 by modifying apcupsd.conf. Note, the default NIS port is 3551 on most platforms.

To test multimon.cgi, you can execute it as non-root directly from the source cgi build directory. To do so, enter at a shell prompt:

./multimon.cgi

If everything is set up correctly, it will print a bunch of HTML with the values of the machines that you have put in the hosts.conf file. It should look something like the following (note, only a small portion of the output is reproduced here):

Content-type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
     "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD><TITLE>Multimon: UPS Status Page</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<TABLE BGCOLOR="#50A0A0" ALIGN=CENTER>
<TR><TD>
<TABLE CELLPADDING=5>
<TR>
<TH COLSPAN=10 BGCOLOR="#60B0B0">
<FONT SIZE="+2">APCUPSD UPS Network Monitor</FONT>
<BR>Sun Jan 16 12:07:27 CET 2000</TH>
</TR>
<TR BGCOLOR="#60B0B0">
<TH COLSPAN=1>System</TH>
<TH COLSPAN=1>Model</TH>
<TH COLSPAN=1>Status</TH>
...

If you do not get similar output, check the permissions of the /etc/apcupsd directory and of those of /etc/apcupsd/hosts.conf to ensure that your web server can access it. At many sites, the Apache server is not running as root, so you must be careful to ensure that that /etc/apcupsd/hosts.conf and /etc/apcupsd/multimon.conf are world readable.

To invoke multimon in your Web browser, enter:

http://your-site/cgi-bin/multimon.cgi

You should get something similar to the screen shot shown below.

If you wish additional control over the colors, type faces, and sizes of the multimon output, you may simply edit the apcupsd.css file to specify the styles you prefer.

Using the CGI Programs on Windows

The CGI programs compiled for Windows are included in the Windows package starting with apcupsd-3.14.7.

The CGI programs included with the Windows package are intended to be run on Windows. If your web server is running on Linux or another operating system, you will need to obtain binary packages for that platform (or build them from source) instead. The windows build of the CGI programs has been tested with the Apache web server for Win32. They should also work with MS Internet Information Server (IIS).

To use the programs, copy the contents of the cgi/ directory from your apcupsd installation directory to the cgi-bin/ directory of your web server. Consult your web server's documentation for how to enable CGI programs to be executed. Sometimes special security settings are required.

Configure the hosts.conf file as described above. The programs expect to find the hosts.conf file and the apcupsd.css file in the directory \apcupsd\etc\apcupsd on the same drive letter as the web server's cgi-bin directory. If you installed apcupsd into C:\apcupsd (the default) and your web server's cgi-bin/ directory is also located on the C: drive, no further changes are necessary. If you installed apcupsd into a different directory or your web server cgi-bin is on another drive, you will need to relocate hosts.conf and apcupsd.css from the apcupsd install location to \apcupsd\etc\apcupsd on the appropriate drive.

multimon.cgi

This program monitors multiple UPSes at the same time. A typical output of multimon.cgi as displayed in your Web browser might look like the following:

./multimon.png

The machines monitored as well as the values and their column headings are all configurable (see /etc/apcupsd/hosts.conf and /etc/apcupsd/multimon.conf)

upsstats.cgi

By clicking on the system name in the multimon.cgi display, you will invoke upsstats.cgi for the specified system, which will produce a bar graph display of three of the monitored values. For example,

./status.png

You can display different bar graphs by selecting different variables from the drop down menus at the top of each of the three bar graphs.

As with multimon, if you have your local host configured in the /etc/apcupsd/hosts.conf file, you can execute it from a Unix shell from the source cgi directory as follows:

./upsstats.cgi

As with multimon, quite a few lines of html should then be displayed.

upsfstatus.cgi

If you would like to see all of the STATUS variables available over the network, click on the Data field of the desired system, and your browser will display something like the following:

APC      : 001,048,1109
DATE     : Thu Dec 02 17:27:21 CET 1999
HOSTNAME : matou.sibbald.com
RELEASE  : 3.7.0-beta-1
CABLE    : Custom Cable Smart
MODEL    : SMART-UPS 1000
UPSMODE  : Stand Alone
UPSNAME  : UPS_IDEN
LINEV    : 223.6 Volts
MAXLINEV : 224.9 Volts
MINLINEV : 222.3 Volts
LINEFREQ : 50.0 Hz
OUTPUTV  : 223.6 Volts
LOADPCT  :   6.2 Percent Load Capacity
BATTV    : 27.9 Volts
BCHARGE  : 100.0 Percent
MBATTCHG : 5 Percent
TIMELEFT : 167.0 Minutes
MINTIMEL : 3 Minutes
SENSE    : High
DWAKE    : 060 Seconds
DSHUTD   : 020 Seconds
LOTRANS  : 196.0 Volts
HITRANS  : 253.0 Volts
RETPCT   : 050.0 Percent
STATFLAG : 0x08 Status Flag
STATUS   : ONLINE
ITEMP    : 35.1 C Internal
ALARMDEL : Low Battery
LASTXFER : U command or Self Test
SELFTEST : NO
STESTI   : 336
DLOWBATT : 02 Minutes
DIPSW    : 0x00 Dip Switch
REG1     : 0x00 Register 1
REG2     : 0x00 Register 2
REG3     : 0x00 Register 3
MANDATE  : 01/11/99
SERIALNO : GS9903001147
BATTDATE : 01/11/99
NOMOUTV  : 230.0
NOMBATTV :  24.0
HUMIDITY : N/A
AMBTEMP  : N/A
EXTBATTS : 0
BADBATTS : N/A
FIRMWARE : 60.11.I
APCMODEL : IWI
END APC  : Thu Dec 02 17:27:25 CET 1999

You should get pretty much the same output mixed in with html if you execute upsfstats.cgi directly from a Unix shell in the cgi subdirectory as explained above for upsstats.cgi and multimon.cgi.

A Tip from Carl Erhorn for Sun Systems:

It is possible to run the CGI code to monitor your UPS using the answerbook HTTP server that runs on Solaris. As long as your server has the Answerbook2 web server installed and running, you can insert the cgi scripts into the cgi directory of the web server, and access the cgi using something like:

http://hostname:8888/cgi/multimon.cgi

CGI Credits

Many thanks go to Russell Kroll rkroll@exploits.org who wrote the CGI programs to work with his UPS Monitoring system named Network UPS Tools (NUT). Thanks also to Jonathan Benson jbenson@technologist.com for initially adapting the upsstatus.cgi program to work with apcupsd.

We have enhanced the bar graph program and hope that our changes can be useful to the original author in his project.

Security Issues:

  • apcupsd runs as root.
  • If you have NETSERVER ON in your apcupsd.conf file (which is the default), be aware that anyone on the network can read the status of your UPS. This may or may not pose a problem. If you don't consider this information privileged, as is the case for many, there is little risk. In addition, if you have a perimeter firewall or NATting router with typical settings only users on your local network access to your UPS information. You may also restrict access using using firewall settings (see below) or TCP Wrappers (see below).

Firewall Settings

If you are running apcupsd as an NIS server, you will need to ensure that the clients can reach it by opening up NISPORT (default: TCP 3551) on any firewall running on the server. You may wish to configure your firewall(s) to only allow connections from your local network or specifically from the masters, slaves, and servers as needed.

TCP Wrappers

If your operating system does not support a host based firewall (a firewall running on the local machine) then you may try to get some of the functionality of such a firewall with TCP Wrappers. As of apcupsd version 3.8.2, TCP Wrappers are implemented if you turn them on when configuring ./configure --with-libwrap. With this code enabled, you may control who may access your apcupsd via TCP connections (the Network Information Server). This control is done by modifying the file: /etc/hosts.allow. This code is implemented but untested. If you use it, please send us some feedback.

Configuring Your EEPROM

If you have a SmartUPS, there are depending on the UPS at least 12 different values stored in the EEPROM that determine how the UPS reacts to various conditions such as high line voltage, low line voltage, power down grace periods, etc.

In general, for the moment, we do not recommend that you change your EEPROM values unless absolutely necessary. There have been several reported cases of problems setting the Low Transfer Voltage. Consequently, if at all possible, do not attempt to change this value.

Using apctest to Configure Your EEPROM

To make the EEPROM changes with apctest you must first stop the apcupsd daemon. After apcupsd is stopped you may invoke apctest (as root).

We recommend that you change the EEPROM as little as is absolutely necessary since it is a somewhat delicate process that has occasionally produced problems (i.e. improper EEPROM values are displayed after the update).

apctest will present a menu of options which are generally self-explanatory. Note that USB connections will show a difference set of options than smart serial connections.

Maintaining Your UPS Batteries

Battery Technology

Sealed Lead Acid (SLA) batteries, otherwise known as Valve Regulated Lead Acid (VRLA) batteries, were originally known as "dry batteries". When first introduced in the 1950s, they used a gel electrolyte. The otherwise free acid was immobilised with a fine silica powder and formed a gel substance.

In the 1970s the technology moved to Absorbed Glass Mat (AGM) where the separators between the lead plates are made of highly porous micro-fine glass fibres which absorb and immobilise the acid and prevent it from spilling. A crack or hole in the casing of a VRLA battery using AGM technology will not result in a measurable electrolyte spill. Spill containment with VRLA batteries is therefore not meaningful or appropriate.

AGM has became the preferred VRLA technology for use in standby or float applications and is used in UPSes in the telecommunications, power, and many other mission critical industries where the power supply must not be interrupted. APC UPSes use VRLA batteries. VRLA batteries are designed to recombine hydrogen and oxygen and emit only extremely small amounts of hydrogen under normal operating conditions. Normal room ventilation is sufficient to remove any hydrogen, so special ventilation is not required.

Battery Life

Most brand name UPS batteries should last 3-5 years. Some APC Back-UPS models may have a shorter battery life expectancy. Refer to the user's manual of your APC Back-UPS to determine the exact battery life expectancy or contact APC Technical Support.

Below are some APC guidelines for ensuring optimum battery life expectancy:

  1. Make sure that you keep your APC UPS in a cool, dry location with plenty of ventilation. Ideally, the temperature where your UPS is kept should not exceed 75 Deg F (24 Deg C). Also, for ventilation purposes, leave roughly one to two inches on each side for proper airflow.
  2. The optimum operating temperature for a lead acid battery is 25 Deg C (77 Deg F). Elevated temperature reduces longevity. As a guideline, every 8 Deg C (15 Deg F) rise in temperature will cut the battery life in half. A battery which would last for 6 years at 25 Deg C (77 Deg F), will only be good for 3 years if operated at 33 Deg C (95 Deg F). Keep in mind that the battery temperature inside your UPS will always be warmer than the ambient temperature of the location where the UPS is installed.
  3. Only perform runtime calibrations on your UPS one or two times a year, if necessary. Some of our customers want to check their systems to verify that their runtime is sufficient. However, consistently performing these calibrations can significantly decrease the life expectancy of your battery.
  4. Do not store batteries for extended periods of time. New batteries can be stored for 6 to 12 months from date of purchase. After this period, the battery should be used or it will lose a great deal of its charge. It is not advisable to store batteries that have already been in use.
  5. Do not exceed 80 percent of a UPS unit's rated capacity due to the reduction in run time. When you increase your load, your runtime decreases. In the event of a utility power failure, a UPS loaded to full capacity will drain and discharge it's battery quickly and will decrease the life expectancy.

The Smart-UPS detects line voltage distortions such as spikes, notches, dips, and swells, as well as distortions caused by operation with inexpensive fuel-powered generators. By default, the UPS reacts to distortions by transferring to on-battery operation to protect the equipment that you are plugging into the UPS. Where power quality is poor, the UPS may frequently transfer to on-battery operation. Battery longevity and service life of the UPS may be conserved by reducing the sensitivity of the UPS, as long as your equipment can operate normally under the conditions detailed below. Any type of voltage disturbance includes; High/Low/No RMS Voltage, Total Harmonic Distortion(THD), Change in Voltage over Time(dv/dt), Frequency (Hz) out of tolerance.

High Sensitivity Mode
In the event of any type of voltage disturbance, the UPS will transfer to battery power and watch the AC line until it can transfer back to line. The transfer time in this mode depends on how far the line voltage deviates from the sinewave reference.
Medium Sensitivity Mode
In the event of a RMS voltage-out-of-tolerance(High/Low/No) and RMS-rate-of-change disturbances(dv/dt) in the line voltage, the UPS will transfer to battery power and watch the AC line until it can transfer back to line. In this mode the transfer times are longer but still within acceptable limits to insure the continuity of a computer's operation.
Low Sensitivity Mode
In the event of a RMS voltage-out-of-tolerance disturbances(High/Low/No) in the line voltage, the UPS will transfer to battery power and watch the AC line until it can transfer back to line. In this mode the transfer times are longer but still within acceptable limits to insure the continuity of a computer's operation.

To change the sensitivity of the UPS, press the small, white "sensitivity" button on the rear of the UPS. Use a pointed object (such as a pen) to do so. The default setting is "high"; press the button once to set the sensitivity to "medium", and press it again to set it to "low"; pressing it a third time will set it back to "high". The sensitivity setting change will take effect immediately. The green LED next to the button is a sensitivity setting indicator - brightly lit is "high" sensitivity, dimly lit is "medium", and off is "low" sensitivity.

Flashing Battery Charge Graph LEDs

The battery charge graph LEDs on the front panel of a Smart-UPS will flash in unison when the UPS is operating online and the runtime remaining (calculated by the Smart-UPS microprocessor) is less than two minutes more than the low battery signal warning time (minimum of two minutes).

This would usually indicate that you need to either decrease the load or install new batteries. If the batteries are new, then you need to perform a runtime calibration (see below).

At a pinch, you could also decrease the low battery warning time. There are four possible settings: 2, 5, 7, or 10 minutes.

Battery Replacement

If you own your UPS for long enough, you will inevitably need to replace the UPS battery or battery cartridge. An APC battery cartridge comprises two batteries physically stuck together with double-sided tape and wired in series.

After the decision to replace the batteries, you will face another decision almost immediately: whether to purchase genuine APC replacement batteries or not. There are pros and cons to purchasing genuine replacement APC batteries.

APC Battery Pros

  • APC batteries are supported by APC
  • APC batteries come with all the necessary hardware
  • APC batteries come as pre-made cartridges
  • APC batteries will physically fit your UPS

APC Battery Cons

  • APC batteries cost up to 4 times the cost of third party batteries

There are also pros and cons to purchasing third party batteries.

Third Party Battery Pros

  • A third party battery may cost up to 1/4 the price of APC batteries
  • A third party battery may have a higher capacity for the same physical size

Third Party Battery Cons

  • You will need to recycle your battery hardware (cables, connectors etc)
  • You will need to create your own battery cartridges (with double-sided tape)
  • You will need to ensure the third party battery is the right physical size
  • You will need to ensure the third party battery is the right capacity
  • Use of a third party battery will void APC's Equipment Protection Policy
  • Use of a third party battery may void UL, CSA, VDE, and other safety certifications (according to APC)

If you do decide to use third party replacement batteries, please do not choose the cheapest available generic SLA batteries. These batteries will, almost without exception, not last as long as brand name batteries and will need replacing within 12-18 months instead of 3-5 years. Even when using brand name replacement batteries, make sure that you choose the UPS version (aka "standby") which may cost slightly more, but which will last significantly longer in typical UPS usage (long periods of standby punctuated with infrequent deep discharges).

The brands of battery found in genuine APC battery cartridges have included: Panasonic and B&B Battery (aka Best & Best Battery and BB Battery). Yuasa (aka Genesis) is also a recommended brand, albeit a bit on the pricey side.

Note: When substituting a third party battery with a higher capacity than the original, make sure that it still physically fits in the UPS casing. If the battery does not fit, do not be tempted to install it "externally". The UPS may not be able to charge it in a timely manner and/or it may damage the UPS charging circuitry without appropriate modifications which are generally beyond an end user's capability.

Battery Installation

Although you can do a hot swap of your batteries while the computer and any other connected equipment is running, it may not be very satisfactory because the UPS will not always detect that the batteries have been swapped and apcupsd will continue to report "Low Battery".

There are several ways to correct this situation:

1. If you have a "smart" UPS model, you can force a self-test to make the UPS notice that the battery has been replaced.

2. If after a self-test, the UPS does not detect that the battery has been replaced, you can use apctest to do a soft battery runtime calibration. For details of doing this, refer to the "Soft" Runtime Calibration section below.

3. If after the soft battery runtime recalibration, the UPS does not detect that the battery has been replaced, you will need to do a manual battery runtime calibration. For details of doing this, refer to the "Manual" Runtime Calibration section below.

"Soft" Runtime Calibration

A runtime calibration causes the UPS to recalculate its available runtime capacity based on its current load.

Caution: a runtime calibration will deeply discharge the UPS batteries, which can leave a UPS temporarily unable to support its equipment if a utility power failure occurs. Frequent calibrations reduce the life of batteries. APC recommends performing a runtime calibration only annually, semiannually, or whenever the load on the UPS is increased.

In order to perform a "soft" runtime calibration it is necessary to wait for the UPS to recharge its batteries to 100% capacity. Once this has been done, you can then initiate a runtime calibration through apctest.

APC Documentation Notes:

1. In order for the calibration to be accurate, the output load has to be more than 40% (some APC documentation recommends at least 30%). Also, it is advisable not to increase or reduce the load when the UPS is calibrating its run time.

2. Under no circumstances should the UPS be turned off during a run time calibration procedure! Once initiated, the calibration must be allowed to run until completion.

3. The run time calibration procedure is not necessary nor advisable for a new UPS. Only old UPSes with batteries that are not subject to discharge for long periods of time should be allowed to perform a run time calibration.

4. Matrix-UPS and Smart-UPS recalculate the runtime-related parameters every time the UPS goes on battery.

When doing a runtime calibration with "older" batteries, APC Technical Support recommend doing a complete discharge and recharge first.

If you have "dumb" UPS (aka simple signalling) like a Back-UPS, then your only option is to do a manual runtime calibration.

"Manual" Runtime Calibration

Most of the information in this section is taken from APC's website. Any non-APC additions have been inserted in square brackets.

For a "smart" or "smart signalling" Back-UPS Pro or Smart-UPS:

Perform a Runtime Calibration. This is a manual procedure and should not be confused with the runtime calibration performed through PowerChute plus [or apctest]. The batteries inside of the Smart-UPS are controlled by a microprocessor within the UPS. Sometimes it is necessary to reset this microprocessor, especially after the installation of new batteries. Stop the PowerChute plus [or apcupsd] software from running and disconnect the serial cable. There must be at least a 30% load attached to the UPS during this procedure, but the process will cause the UPS to shut off and cut power to its outlets. Therefore, attach a non-critical load to the UPS and then force the UPS on battery by disconnecting it from utility power [suggest not disconnecting, but simply turning off utility power thereby preserving earthing]. Allow the unit to run on battery until it turns off completely. Make sure a 30% load is present! Plug the UPS back into the wall outlet [switch utility power back on] and allow it to recharge (it will recharge more quickly turned off and with no load present). Once the unit has recharged, the "runtime remaining" calculation should be more accurate. Remember that if the unit is an older model, then the runtime will not improve significantly.

Background:

An APC Smart-UPS has a microprocessor which calculates runtime primarily based on the load attached to the UPS and on its battery capacity. On the right side of the front display panel there is a vertical graph of five LEDs. Each LED is an indication of battery charge in increments of twenty percent: 20, 40, 60, 80, 100% (bottom to top). For example, if the battery charge is 99%, then only four of the five LEDs are illuminated.

To ensure that an operating system receives a graceful shutdown when using PowerChute plus or a SmartSlot accessory, an alert is generated by the Smart-UPS indicating that the UPS has reached a low battery condition. The alert is audible (rapid beeping), visual (flashing battery LED or LEDs), and readable through the graphical interface of PowerChute plus software (or a native UPS shutdown program within a particular operating system.) In order to calculate this "low battery condition," all Smart-UPS products have a preconfigured low battery signal warning time of two minutes (this is the factory default setting). There are a total of four user-changeable settings: 2, 5, 7, or 10 minutes. If the low battery signal warning time is set for 2 minutes, then the alerts will activate simultaneously two minutes prior to shutdown. Similarly, if the total runtime for a particular UPS is 30 minutes with a low battery signal warning time set at 10 minutes, then the UPS will run on battery for 20 minutes before the low battery alert begins.

Total runtime is primarily based on two factors, battery capacity and UPS load. UPS load and runtime on battery are inversely proportional: as load increases, battery runtime decreases and vice versa. When utility power is lost, the UPS begins discharging the battery in order to support the attached load. Once power returns, the Smart-UPS will automatically begin to recharge its battery.

For a Matrix UPS:

It is unnecessary to subject a battery bank to an excessively long calibration. Remove battery packs or increase the load (space heaters are good dummy loads) to obtain a reasonable time length for the calibration (under an hour if possible).

At the start of a calibration, the Matrix microprocessor saves the Estimated Run Time displayed.

The unit will then go to battery power until the capacity is 25%. After this run time has been completed, the original Estimated Run Time is compared with the actual run time. It will then increase or decrease this value to correspond to the new run time achieved. If, at any time during the discharge, one of the following rules is violated the calibration will be aborted or corrupted:

  1. Battery capacity must be 100% at start of calibration (all packs must indicated as float).
  2. Initial "Estimated Run Time" must not exceed 128 minutes (remove battery packs if necessary).
  3. Load must be above 25%.
  4. Load must not fluctuate more than ± 5%.
  5. The UPS must be allowed to run down to 25% battery capacity. PowerChute [or apcupsd] and Accessories must be removed since they can abort the calibration prematurely.

For a "dumb" or "simple signalling" UPS (eg a Back-UPS):

This could be done if you have changed your equipment load or battery. Stop the PowerChute [or apcupsd] software from running; disconnect the serial cable between the computer and UPS. Next unplug the UPS from the wall [suggest not disconnecting but simply turning off the utility power thereby preserving the earthing] and let it run on battery until it reaches low battery. Once it reaches low battery plug it back into the wall outlet [turn the utility power back on] and let it recharge. Recharge time can take up to 4 hours.

Resetting the UPS Battery Constant

In some cases none of the battery runtime calibration methods result in the UPS reporting a reasonably correct battery runtime. It has been speculated that this is because the battery constant value has drifted so far from normal that the microprocessor in the UPS cannot correct it.

The good news is that if you are located in the USA, all you have to do is contact APC Technical Support and they will send you a serial port dongle which plugs into the serial port of your UPS and reprograms the battery constant value for you to the correct value.

The bad news is that for many users outside the USA, this service does not appear to be available. It is, however, recommended that you first try contacting APC Technical Support to verify the correct battery constant value. The APC representatives in the Support Forum on the APC website are also very helpful in this regard.

If all else fails, the information below is for you.

WARNING: Only the values for the Smart-UPS 700 model SU700 and Smart-UPS 1400 model SU1400, both with international firmware (and therefore international voltage), have been verified. YOU, gentle reader, USE THIS INFORMATION AT YOUR OWN RISK in the full knowledge that you may render your UPS inoperable and perhaps irreparable, and you will have no-one to blame but yourself. Caveat Utilitor!

The battery constant is the hex number in the column labelled "0", presumably for register 0, in the following table:

UPS Model         4  5  6  0    Hex   Firmware
SU250               EE F8 B1
SU400               EE F8 9F    E1
SU600               EA F4 9F    E5
SU900               F3 FC 9F    ED
SU1250              EE FA 9F    F5
SU2000              F1 F9 9F    FD
SU450,700        28 F2 FA 96 07,RM=47  52.11.I
SU450XL,700XL    28 EE F8 9F 700XL=27   51.9.I
SU1000,INET      35 EF F9 A0    0B     60.11.I
SU1000XL         34 EE FC 9A    2B      61.9.I
SU1400           35 EE FC 9A           70.11.I
SU1400RM         28 ED FA 89
SU1400R2IBX135   08 B4 10 A3
SU1400RMXLI3U    45 F6 F4 80            73.x.I
SU1400RMXLI3U    20 F3 FD 81            73.x.I
SU2200I          35 EE FB AF           90.14.I
SU2200XL,3000    35 EE FB AF 3000=17   90.14.I
SU3000RMXLI3Ublk 35 F3 F4 AF    77     93.14.I
SU5000I white    20 F2 FA 91    1F    110.14.I
SU1400XL,XLI,RM  45 F6 E4 80
SU420I           25 95 09 85    16      21.7.I
SU420SI          0E 95 0A 8C
SU620I           29 99 0B 8A    1A
BP420SI          0E 95 0A 8C    06      11.2.I
BP650SI          10 97 0C 91    0A      12.3.I
Power Stack 250  0C 95 0F B2            26.5.I
Power Stack 450  0D 96 10 99    36      26.5.I
SC250RMI1U       0C 95 0F B3    32     735.a.1
SC420I           0E 95 OA 8C    16     725.1.I
SC620I           10 97 OB 99    1A     726.x.I
SC1000I          08 95 10 94    8A     737.x.I
SC1500I          07 95 14 8F    1E     738.x.I
SU1000XL         17 EE F9 D5
MATRIX 3000,5000    E9 F5 B0
SU700RMI2U       07 B1 0D 92    8A     152.4.I
SU1000RMI2U      08 B5 0D C7    8E     157.3.I
SU1400RMI2U      08 B4 10 A3    92     162.3.I
SUA1000I         07 B5 13 BC    0A    652.12.I
SUA1000XLI       0B BD 0F 7F    4A    681.13.I
SUA750XLI        0A B9 0C 86    46     630.3.I
SUA750I          04 B6 14 82    06    651.12.I
SUA750RMI2U      07 B1 0D 82    86    619.12.I
SUA1500I         09 B9 13 A1    0E 601/653.x.I
SUA1500RMI2U     08 B4 10 A1    8E     617.3.I
SUA2200I         08 B8 12 B3    26    654.12.I
SUA2200RMI2U     09 BC 11 81    A6     665.4.I
SUA2200XLI       0A B7 0F 7F    66     690.x.I
SUA3000RMI2U     04 B9 0E 70    AA     666.4.I
SUA3000RMXLI3U   0A B6 0E 89    xx     xxx.x.x
SUOL1000I        06 B6 1B A6
SUOL2000XL       0D BD 14 75    52     416.5.I
SURT1000XLI      0A BB 19 A8    4E     411.x.I
SURT3000XLI      06 B6 0F CC    56     450.2.I
SURT5000XLI      05 BA 15 86    5A    451.13.W
SURT7500XLI      03 BB 20 97    63
SURT10000XLI     06 B8 19 AB          476.12.W
SUM1500RMXLI2U   03 B7 0D A5    62     716.3.I
SUM3000RMXLI2U   03 B7 0D A5    6A     715.3.I
BP500AVR                        26      17.1.I

The instructions for resetting the battery constant are as follows:

  1. Shutdown the apcupsd daemon;
  2. Run apctest;
  3. Choose option 6 to enter terminal mode;
  4. Enter Y (UPS should respond SM);
  5. Enter 1 (one, not el; wait 4 seconds);
  6. Enter 1 (one, not el; UPS should respond PROG);
  7. Enter 0 (zero, not oh; UPS should respond with current constant);
  8. Write down the existing value so that if something goes wrong, you can at least put it back to that value;
  9. Enter + (plus) or - (minus) to increment/decrement the value;
  10. Enter R to reprogram constant value (UPS should respond Bye);
  11. Enter Y (UPS should respond SM);
  12. Enter 0 (zero, not oh; UPS should respond with the new constant);
  13. Enter Esc to exit terminal mode;
  14. Choose option 7 to exit apctest.

Frequently-Asked Questions

See the bugs section of this document for a list of known bugs and solutions.

Question:

Why all the craziness with custom serial cables?

Answer:

It was nothing more nor less than a form of customer control. For a long time APC wanted to keep other people from talking to its UPSes so it could lock out potential competition for its PowerChute software. Scrambling the leads on its serial cables was a cheap way to accomplish this -- in fact, they tended to be wired so that if you tried a straight-through cable, opening a serial link to the UPS would be interpreted as a shutdown command!

(Hardware companies often think like this -- they lock up interfaces by instinct, cornering a small market rather than growing a bigger one. It's fundamentally stupid and self-defeating, but it's the kind of stupid that tends to sound good at an executive meeting.)

Question:

What UPS brands does apcupsd support?

Answer:

Currently apcupsd supports only APC UPSes. However, some companies such as Hewlett Packard put their own brand name on APC manufactured UPSes. Thus even if you do not have an APC branded UPS, it may work with apcupsd. You will need to know the corresponding APC model number. apcupsd supports all the popular APC models. See the installation and configurations sections of this document for more details.

Question:

Does apcupsd support Windows?

Answer:

Yes.

Question:

I don't have a cable, which one should I build?

Answer:

First you must know if you have an apcsmart UPS or a voltage-signalling UPS. If you have a apcsmart UPS, we recommend building a Custom Smart cable. (see Smart-Custom Cable for SmartUPSes) If you have a voltage-signaling UPS, we recommend that you build a Custom Simple cable. (see Simple-Custom Voltage-Signalling Cable for "dumb" UPSes)

Question:

How much CPU resources does apcupsd use?

Answer:

Depending on your CPU speed, you may see more or less of the CPU consumed by apcupsd. On a 400MHz Unix system, the CPU usage should fall well below 0.1%. On slower systems, the percentage will increase proportionally to the decrease in the CPU speed. On a 400Mhz Win98 machine, the CPU usage will be on the order of 0.5-1.0%. This is higher than for Unix systems. However, compared to the 30% CPU usage by APC's PowerChute (the version on the CDROM shipped with my UPS), apcupsd's 0.5-1.0% is very modest.

Question:

What language is apcupsd written in?

Answer:

It is written in C and C++.

Question:

To test apcupsd, I unplugged the UPS to simulate a power outage. After the machine went into the shutdown process I plugged the UPS back into the commercial power source. This caused the shutdown process to hang after the daemon tried to shut-off the ups. Have you run into this problem, and if so do you have a remedy?

Answer:

Normally, once the shutdown process has begun, we cannot stop it -- how do you stop a shutdown that has killed off half of the daemons running on your system? Most likely you will be left with an unusable system. In addition, when apcupsd is re-executed in the halt script after the disks are synced, it tries to shut off the UPS power, but the UPS will generally refuse to do so if the AC power is on. Since we cannot be 100% sure whether or not the UPS will shut off the power, we don't attempt to reboot the system if we detect that the power is back as it might then get caught by a delayed power off (at least for Smart UPSes).

Question:

After running apcupsd for a while, I get the following error: "Serial communications with UPS lost." What is the problem?

Answer:

We use standard Unix serial port read() and write() calls so once a connection is made, we generally have few problems. However, there have been reports that APC's SNMP Management Card can cause serial port problems. If you have such a card, we suggest that you remove it and see if the problem goes away. It is also possible that some other process such as a getty is reading the serial port.

Question:

I get the following error:

Starting apcupsd power management.
Mar 20 21:19:40 box apcupsd[297]: apcupsd FATAL ERROR in apcserial.c at line 83.
Cannot open UPS tty /dev/cua01: No such file or directory.

What is the problem?

Answer:

The two most likely causes of your problem are: 1. You have the wrong serial port device name in the apcupsd.conf file. 2. The device name is not defined on your system. Suggestions for proceeding:For the first item, check what your serial port device should be named. You might be able to find the name with an:

ls /dev

Normally there will be hundreds or even thousands of names that print. If that doesn't produce anything useful, you can try step 2. Perhaps your device is not defined. To get more information on your devices try 'man MAKEDEV' or 'find / -name MAKEDEV'. It is often located in /dev/MAKEDEV. Looking at the documentation may tell you what the correct name is, or at least allow you to create the device.

Question:

How do I ensure that the slaves shutdown before the master?

Answer:

Slaves make their shutdown decision independently from the master. Therefore you can use the TIMEOUT, MINUTES, and BATTERYLEVEL settings in the slaves' apcupsd.conf to configure them to shut down before the master.

Question:

How do I ensure that my database server is correctly shutdown?

Answer:

You simply add whatever commands are necessary in the appropriate case statements in /etc/apcupsd/apccontrol, which is a standard script file that is called to actually do the shutdown. Alternatively, you can add your own script file that will be called before doing the commands in apccontrol. Your script file must have the same name as the appropriate case statement in apccontrol; it must be executable; and it must be in the same directory as apccontrol.

Customizing Event Handling

When apcupsd detects anomalies from your UPS device, it will make some decisions that usually result in one or more calls to the script located in /etc/apcupsd/apccontrol. The apccontrol file is a shell script that acts on the first argument that apcupsd passes to it. These actions are set up by default to sane behavior for all situations apcupsd is likely to detect from the UPS. However, you can change the apccontrol behavior for every single action.

To customize, so create a file with the same name as the action, which is passed as a command line argument. Put your script in the /etc/apcupsd directory.

These events are sent to the system log, optionally sent to the temporary events file (/etc/apcupsd/apcupsd.events), and they also generate a call to /etc/apcupsd/apccontrol which in turn will call any scripts you have placed in the /etc/apcupsd directory.

Normally, /etc/apcupsd/apccontrol is called only by apcupsd. Consequently, you should not invoke it directly. However, it is important to understand how it functions, and in some cases, you may want to change the messages that it prints using wall. We recommend that you do so by writing your own script to be invoked by apccontrol rather than by modifying apccontrol directly. This makes it easier for you to upgrade to the next version of apcupsd

In other case, you may want to write your own shell scripts that will be invoked by apccontrol. For example, when a power fail occurs, you may want to send an email message to root.

To write your own routine for the powerout action, you create shell script named powerout and put it in the lib directory (normally /etc/apcupsd). When the powerout action is invoked by apcupsd, apccontrol will first give control to your script. If you want apccontrol to continue with the default action, simply exit your script with an exit status of zero. If you do not want apccontrol to continue with the default action, your script should exit with the special exit code of 99. However, in this case, please be aware that you must ensure proper shutdown of your machine if necessary.

Some sample scripts (onbattery and mainsback) that email power failure messages can be found in /etc/apcupsd after an install or in the platforms/etc directory of the source code.

apccontrol Command Line Options

When apcupsd detects an event, it calls the apccontrol script with four arguments as:

apccontrol event ups-name connected powered

where:

event
is the event that occurred and it may be any one of the values described in the next section.
ups-name
is the name of the UPS as specified in the configuration file (not the name in the EEPROM).
connected
is 1 if apcupsd is connected to the UPS via a serial port (or a USB port). In most configurations, this will be the case. In the case of a Slave machine where apcupsd is not directly connected to the UPS, this value will be 0.
powered
is 1 if the computer on which apcupsd is running is powered by the UPS and 0 if not. At the moment, this value is unimplemented and always 0.

The following event names are supported:

annoyme

When a shutdown is scheduled, and the time specified on the ANNOYME directive in the apcupsd.conf file expires, this event is generated.

Default: wall a message

changeme

When apcupsd detects that the mains are on, but the battery is not functioning correctly, this event is generated. It is repeated every x hours.

Default: wall a message

commfailure

This event is generated each time the communications line with the computer is severed. This event is not detected on dumb signaling UPSes.

Default: wall a message

commok

After a commfailure event is issued, when the communications to the computer is re-established, this event will be generated.

Default: wall a message

doreboot

This event is depreciated and should not be used.

Default: Shuts down the system using shutdown -h or similar

doshutdown

When the UPS is running on batteries and one of the limits expires (time, run, load), this event is generated to cause the machine to shutdown.

Default: Shuts down the system using shutdown -h or similar

emergency

Called for an emergency system shutdown. (What triggers such a shutdown is unclear...) After completing this event, apcupsd will immediately initiate a doshutdown event.

Default: wall a message

failing

This event is generated when the UPS is running on batteries and the battery power is exhausted. The event following this one will be a shutdown.

Default: wall a message

loadlimit

This event is generated when the battery charge is below the low limit specified in the apcupsd.conf file. After completing this event, apcupsd will immediately initiate a doshutdown event.

Default: wall a message

powerout

This event is generated immediately when apcupsd detects that the UPS has switched to batteries. It may be due to a short powerfailure, an automatic selftest of the UPS, or a longer powerfailure.

Default: wall a message

onbattery

This event is generated 5 or 6 seconds after an initial powerfailure is detected. It means that apcupsd definitely considers the UPS to be on batteries. The onset of this event can be delayed by the ONBATTERYDELAY apcupsd.conf configuration directive.

Default: wall a message

offbattery

This event is generated when the mains return only if the onbattery event has been generated.

Default: wall a message

mainsback

This event is generated when the mains power returns after a powerout condition. The shutdown event may or may not have been generated depending on the parameters you have defined and the length of the power outage.

Default: nothing

remotedown

This event is generated on a slave machine when it detects either that the master has shutdown, or that a onbattery situation exists and the communications line has been severed.

Default: wall a message

runlimit

This event is generated when the MINUTES value defined in the apcupsd.conf file expires while in a power fail condition. The MINUTES is the remaining runtime as internally calculated by the UPS and monitored by apcupsd. After completing this event, apcupsd will immediately initiate a doshutdown event.

Default: wall a message

timeout

This event is generated when the TIMEOUT value defined in the apcupsd.conf file expires while in a power fail condition. It indicates that the total time in a power failure has been exceeded and the machine should be shutdown. After completing this event, apcupsd will immediately initiate a doshutdown event.

Default: wall a message

startselftest

This event is generated when apcupsd detects a self test by the UPS. Normally due to the 6 second onbattery delay default time, self test events are not detected.

Default: nothing

endselftest

This event is generated when the end of a self test is detected.

Default: nothing

battdetach

This event is generated when apcupsd detects that the UPS battery has been disconnected.

Default: nothing

battattach

This event is generated when apcupsd detects that the UPS battery has been reconnected after a battdetach event.

Default: nothing

Controlling Multiple UPSes on one Machine

The following discussion does not apply to Windows servers. Apcupsd on Windows is limited to a single instance and cannot support monitoring multiple UPSes.

If you have multiple UPSes in use, you may wish to consolidate the monitoring of all of these UPSes onto a single machine, which we shall call the "UPS server". Generally one of the UPSes is powering the "UPS server" itself (and possibly other machines as well). The remaining UPSes are powering additional machines.

Apcupsd can work quite well in this environment by running one instance of apcupsd on the UPS server for each UPS to be controlled. That is, you install a single copy of apcupsd but launch it multiple times using different configuration files and scripts. (Older versions of apcupsd required you to actually compile the daemon multiple times with different configure options. This is no longer required, as all necessary adjustments can be made in apcupsd.conf.)

Additionally, you will run one instance of apcupsd on each of the machines you wish to be shut down. You will configure each of these apcupsd's to use the 'net' driver to read UPS status from the proper instance of apcupsd on the UPS server. See NIS Server/Client Configuration Using the Net Driver for more information on the 'net' driver and setting up net clients.

Multiple UPS Example

There are many ways one could set up multiple apcupsd instances. Here I will present the way I have used with great success on Red Hat Linux.

I have two apcupsd.conf files (this is for a 2 UPS setup, easily expandable to N):

[adk0212@mail apcupsd]$ ls -l /etc/apcupsd/*.conf
-rw-r--r-- 1 root root 11799 Aug  3 08:39 /etc/apcupsd/apcupsd.ups0.conf
-rw-r--r-- 1 root root 11822 Aug 25 14:31 /etc/apcupsd/apcupsd.ups1.conf

In my case, ups0 is the UPS powering the UPS server running the multiple apcupsd instances, so only ups0 should initiate a shutdown of the local machine. The differences between the confs are minor since both UPSes are USB (although that is not a requirement; mixing cable types works fine too):

[adk0212@mail apcupsd]$ diff -u apcupsd.ups0.conf apcupsd.ups1.conf
--- apcupsd.ups0.conf   2007-08-03 08:39:26.000000000 -0400
+++ apcupsd.ups1.conf   2007-08-25 14:31:17.000000000 -0400
-UPSNAME ups0
+UPSNAME ups1
-DEVICE /dev/ups0
+DEVICE /dev/ups1
-SCRIPTDIR /etc/apcupsd
+SCRIPTDIR /etc/apcupsd/null
-PWRFAILDIR /etc/apcupsd
+PWRFAILDIR /etc/apcupsd/null
-NOLOGINDIR /etc
+NOLOGINDIR /etc/apcupsd/null
-ANNOY 300
+ANNOY 0
-NISPORT 3551
+NISPORT 3552
-EVENTSFILE /var/log/apcupsd.events
+EVENTSFILE /var/log/apcupsd.2.events

The important difference to note is that ups1 has its SCRIPTDIR, PWRFAILDIR, and NOLOGINDIR set to a special "null" directory that I have created. This directory contains a copy of the event handling scripts modified to avoid shutting down the local machine. (Details below). Also the UPSes are given different EVENTSFILE and NISPORT settings. Plus I disable the "annoy" feature on ups1. Since the state of that UPS does not impact local users, there's no reason to annoy them.

I have the following files in the special "null" directory:

[adk0212@mail apcupsd]$ ls -l /etc/apcupsd/null
total 32
-rwxr--r-- 1 root root 4176 Aug  3 08:24 apccontrol
-rwxr-xr-x 1 root root  475 Aug  3 08:28 changeme
-rwxr-xr-x 1 root root  502 Aug  3 08:28 commfailure
-rwxr-xr-x 1 root root  503 Aug  3 08:28 commok
-rwxr--r-- 1 root root    8 Aug  3 08:22 doshutdown
-rwxr-xr-x 1 root root  470 Aug  3 08:27 offbattery
-rwxr-xr-x 1 root root  435 Aug  3 08:27 onbattery

The important change here is the addition of a 'doshutdown' script which overrides apccontrol's shutdown action:

[adk0212@mail null]$ cat /etc/apcupsd/null/doshutdown
exit 99

The "exit 99" tells apccontrol to skip its normal processing for that event. apccontrol itself is unchanged; it is a direct copy of the original. The other scripts are also direct copies and have simply been modified to generate status email from NISPORT 3552 instead of 3551.

I also have a custom init.d start/stop script to manage multiple instances. The start, stop, and status handlers are modified to iterate over all /etc/apcupsd/apcupsd.*.conf files. This is derived from the standard apcupsd redhat rc script:

#! /bin/sh
#
# apcupsd      This shell script takes care of starting and stopping
#              the apcupsd UPS monitoring daemon.
#
# chkconfig: 2345 60 99
# description: apcupsd monitors power and takes action if necessary
#

if test -f /etc/whitebox-release ; then
   f=/etc/whitebox-release
else
   f=/etc/redhat-release
fi
if test `cat $f | grep release |\
     cut -f 3 -d ' '`x = "Enterprise"x ; then
   DISTVER="Enterprise "`cat $f | grep release |\
     cut -f 6 -d ' '`
else
   DISTVER=`cat /etc/redhat-release | grep release |\
     cut -f 5 -d ' '`
fi

# Source function library
. /etc/rc.d/init.d/functions

case "$1" in
    start)
       rm -f /etc/apcupsd/powerfail
       rm -f /etc/nologin
       for conf in /etc/apcupsd/apcupsd.*.conf ; do
          inst=`basename $conf`
          echo -n "Starting UPS monitoring ($inst):"
          daemon /sbin/apcupsd -f $conf -P /var/run/apcupsd-$inst.pid
          RETVAL=$?
          echo
          [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apcupsd-$inst
       done
       ;;
    stop)
       for conf in /etc/apcupsd/apcupsd.*.conf ; do
          inst=`basename $conf`
          echo -n "Shutting down UPS monitoring ($inst):"
          killproc -p /var/run/apcupsd-$inst.pid apcupsd
          echo
          rm -f /var/run/apcupsd-$inst.pid
          rm -f /var/lock/subsys/apcupsd-$inst
       done
       ;;
    restart|force-reload)
       $0 stop
       sleep 15
       $0 start
       ;;
    reload)
       echo "$0: reload not implemented"
       exit 3
       ;;
    status)
       for conf in /etc/apcupsd/apcupsd.*.conf ; do
          inst=`basename $conf`
          status -p /var/run/apcupsd-$inst.pid apcupsd-$inst
          RETVAL=$?
          if [ $RETVAL -eq 0 ]
          then
             NISPORT=`grep ^NISPORT < $conf | sed -e "s/NISPORT *\([0-9]\)/\1/"`
             /sbin/apcaccess status localhost:$NISPORT | egrep "(STATUS)|(UPSNAME)"
          fi
       done
       ;;
    *)
       echo "Usage: $0 {start|stop|restart|status}"
       exit 1
       ;;
esac
exit 0

That's about all there is to it. There are still some rough edges to clean up, but overall this is a lot easier with apcupsd 3.14.x than it used to be.

Support for SNMP UPSes

To run apcupsd with a SNMP UPS, you need the following things:

  • An SNMP UPS, for example a Web/SNMP (AP9716) or PowerNet SNMP (AP9605) card installed into the SmartSlot. Apcupsd also has support for some non-APC SNMP UPSes using RFC1628 or MGE MIBs, however the majority of the information in this section is for APC UPSes.

Planning and Setup for SNMP Wiring

SNMP packet requests are relayed to the UPS from monitoring APCUPSD servers over Ethernet via a switch, hub, or router. Protecting these Ethernet devices with UPS supplied power is necessary to ensure reliable SNMP communication during power failures. Servers may fail to shutdown quietly during power failures if SNMP communication is lost.

Planning and Setup for SNMP Configuration

To establish communication to the UPS SNMP card installed in the UPS, the SNMP card will need the following:

  • Assign SNMP card IP Address
  • Set SNMP card General Parameters
  • Set SNMP card Shutdown Parameters
  • Set SNMP card Event Trap Receivers (apcupsd-3.12.0 and later)

Assign SNMP Card IP Address

The following instructions come from the APC knowledge base:

The Network Management Card (AP9617, AP9618, AP9619) must be
configured with network settings before it can communicate on the
network. Once the cards have been configured with an IP address,
Subnet Mask, and Default Gateway the cards can be access, managed,
and controlled from other computers on the network.

There are two ways to configure the Network Management Card (NMC)
with its initial settings: the (windows) Wizard and Address
Resolution Protocol (ARP).

1. The wizard in included on the CD that comes with the card. The
wizard must run on a Windows operating system. You can configure
the card using the wizard over the network via FTP. If using the
wizard please note, the un-configured NMC must be on the same
subnet as the computer running the wizard.

2. Address resolution protocol (arp) can also be used to configure
the NMC. The MAC Address of the NMC is needed for this method of
configuration. The MAC address is located on the quality assurance
slip that is shipped with the NMC, and is also located on the white
sticker on the NMC itself. From a computer on the same subnet as
the un-configured NMC, follow the instructions:

Open up a command prompt and type the following (replacing
<IPaddress> and <MacAddress> with the actual values):

arp -s <IPaddress> <MacAddress>

Next, use Ping with a size of 113 bytes to assign the IP address
defined by the ARP command.


-  Linux command format: ping <IPaddress> -s 113

-  Windows command format: ping <IPaddress> -l 113

Set SNMP card General Parameters

After the SNMP Network Management Card is configured with an IP address, the SNMP Card is ready for general configuration. This is accomplished by telneting to the SNMP Card.

~$ telnet <IPaddress>

Login using "apc" for both the username and password and the following menu will display:

*******************************************************************************
American Power Conversion               Network Management Card AOS      v2.6.4
(c) Copyright 2004 All Rights Reserved  Smart-UPS & Matrix-UPS APP       v2.6.1
-------------------------------------------------------------------------------
Name      :                                       Date : 07/03/2006
Contact   :                                   Time : 04:43:33
Location  :                                   User : Administrator
Up Time   : 0 Days 01 Hours 57 Minutes                Stat : P+ N+ A+

Smart-UPS 1000 named  : On Line, No Alarms Present

------- Control Console -------------------------------------------------------

     1- Device Manager
     2- Network
     3- System
     4- Logout

     <ESC>- Main Menu, <ENTER>- Refresh, <CTRL-L>- Event Log
>
*******************************************************************************

Select Option 2 for Network. Next select Option 1 for TCP/IP settings.

At this point the following settings will be to be specified:

  • Verify System IP: <IPaddress>
  • Specify Subnet Mask: i.e. "225.225.225.0"
  • Specify Default Gateway
  • Specify Host Name
  • Specify Domain Name

Specifying these parameters will complete the General Parameters setup. Additionally the SNMP Network Management Card can now be connected to from a web browser for monitoring and additional configuration.

Set SNMP card Shutdown Parameters

There are two shutdown parameters that must be set in the SNMP card to ensure that connected servers shutdown quietly. These parameters can be set via the telnet terminal or the web browser interface.

  • Shutdown Delay (sec)
  • Return Battery Capacity (%)

One of the draw-backs of SNMP communication to the UPS is that the Stand-alone or Primary server must issue the power down command to the UPS early in server halt procedure. This server must issue an early command to the SNMP UPS to power down before its ethernet service is halted. This creates a potential problem where the UPS may kill power to any connected servers before these affected servers' halt scripts complete a successful shutdown.

The SNMP Shutdown Delay parameter is used to delay the UPS from killing power to its load by a prescribed period of seconds. The delay should be long enough to ensure that the Stand-alone or Primary server has enough time to successfully halt. The prescribed time should at least be 180 seconds. Any additional computers connected to the SNMP UPS must not be configured to issue the command to initiate UPS power down. These servers can be thought of as secondary stand-alone server. The APCUPSD daemons of secondary servers should be configured to initiate server halt a prescribed period of time before the Primary server issues the UPS power down command.

The Return on Battery Capacity is useful during intermittent sequential power failures. This parameter insures that the UPS will not restore power to its loads until it has recharged it battery to a prescribed percentage. This parameter should be set to a value greater than value that the APCUPSD daemons configured "BATTERYLEVEL" shutdown of any connected servers. This will ensure that when the UPS restores power, any additional power failures will successfully re-trigger a server shutdown.

Configure Event Trap Receivers

(Requires apcupsd-3.12.0 and later)

By default, APCUPSD will poll the SNMP UPS card once per minute. In this case, server notification of UPS alarms could potentially be delayed one minute. Event trap catching mitigates this shortcoming. Any UPS alarms are instantly sent to prescribe servers connected SNMP UPS. These servers are referred to as Event Trap Receivers. The SNMP UPS card can be configure to send event traps to a maximum of four receivers that will "catch" these events.

Event trap receivers IP address can be set using a telnet terminal or web browser interface.

Also, be aware that servers configured to be Event Trap Receivers should have static IP set. Severs obtaining IPs from DHCP server will not catch instantaneous Events if the IP address changes from the address set in the SNMP UPS.

Connecting APCUPSD to a SNMP UPS

The previous sections describe configuration of the actual SNMP card. The remaining sections describe configuration of the APCUPSD to communicate using SNMP Protocol.

To enable the SNMP support it is enough to configure the correct device in your apcupsd.conf configuration file. The directive needed for this configuration is:

DEVICE <host>:<port>:<vendor>:<community>

...where the directive is made by four parts. All but the first may be omitted completely or left empty to accept the default.

  • host: IP address or DNS hostname of the UPS (required)

  • port: Remote SNMP port (optional, default: 161)

  • vendor: The type of SNMP MIB available on the UPS (optional, default: autodetect). Allowable choices for vendor are:

    • APC : APC PowerNet MIB, used on most APC brand UPSes
    • RFC : RFC1628 MIB, used by some non-APC UPSes
    • MGE : MGE MIB, used by many MGE brand UPSes
    • blank : Autodetect

    Append "_NOTRAP" to the vendor name to disable SNMP trap catching (ex: "APC_NOTRAP"). See SNMP Trap Catching.

  • community: The read-write community string, usually "private". You can specify a read-only community string, usually "public", if you do not require killpower support. If the community string is omitted, apcupsd will attempt to autotedect by trying "private" and "public". (optional, default: autodetect).

A NIS Server/Client (Master/Slave) configuration with multiple servers is still applicable. However, an alternative configuration is possible with an SNMP enabled UPS. In this arrangement, all connected servers will be configured as a standalone server. Each will independently communicate to the UPS. One (primary) server will be chosen to manage the task of commanding the UPS to power down. All remaining (secondary) servers will be configured to quietly power down before the primary server issues the UPS power down command.

Building with SNMP support

Follow the instructions in Building and Installing apcupsd, being sure to include the following options (in addition to any others you need) on the './configure' line:

./configure --enable-snmp

SNMP Trap Catching

apcupsd-3.11.14 introduces support for SNMP trap catching. Previous versions polled the UPS status once per minute, leading to significant delays before UPS state changes were recognized. With SNMP trap handling, apcupsd monitors the SNMP trap port and will re-poll the UPS whenever a trap is received. This happens, for example, when the UPS switches on or off battery.

In order for this feature to work, you must configure your UPS to deliver traps to the server running apcupsd. This is generally done by connecting to your SNMP card via a web browser or telnet connection. You will need to enter your server's IP address as a trap receiver and make sure trap delivery is enabled.

Trap catching can lead to problems if you are already running another SNMP trap daemon on your server. Only one daemon can listen to the trap port, so whichever one is started first will succeed and the others will fail. Apcupsd will fall back to polling behavior if it is unable to open the trap port. You can also forcibly disable trap catching by appending _NOTRAP to your vendor string in the apcupsd.conf DEVICE directive.

Known Problems

Currently (as of 3.10.0) the code to power off the UPS needs special configuration. The killpower command for SNMP UPSes can not be issued during shutdown as typically at some time during shutdown operations the network stack is stopped. To overcome this problem it is needed to modify the /etc/rc.d/apcupsd system control script to tell apcupsd to issue the power down command (killpower) to the UPS immediately before apcupsd initiates the system shutdown. For this reason it is paramount to set your UPS grace time to a value greater than 120 seconds to allow for clean shutdown operations before the UPS removes the power from its plugs. To enable correct shutdown operation during powerdown do the following:

  • Connect to your Web/SNMP card using your favorite web browser, go to the UPS configuration menu and change the "Shutdown Delay" parameter to 180 seconds or more, depending on how much time your system shutdown requires to umount all the filesystems.
  • Option 1 (non-windows) Edit the server halt script. Relocate the ups_kill_power() function higher in the shutdown sequence, primarily before the command to bring down the ethernet service. This is the preferred method for shutting down the UPS. The UPS will power down after the prescribed "Shut Down Delay" time (in seconds) has elapsed.
  • Option 2 Change /etc/rc.d/apcupsd script adding the --kill-on-powerfail to the apcupsd invocation. This method is not preferred because the UPS is commanded to power down without delay. This creates the potential for UPS powering down before the server calling for UPS power down completes its shutdown. However, in the case of Microsoft Windows OS, this is the only method available for powering down the UPS.
  • Restart your apcupsd

With this setup your UPS operations should be safe.

apcupsd System Logging

The apcupsd philosophy is that all logging should be done through the syslog facility (see: 'man syslog') This is now implemented with the exceptions that STATUS logging, for compatibility with prior versions is still done to a file, and EVENTS logging can be directed to a temporary file so that it can be reported by the network information server.

Logging Types

apcupsd splits its logging into four separate types called:

  1. DEBUG
  2. DATA
  3. STATUS
  4. EVENTS

Debug logging consists of debug messages. Normally these are turned on only by developers, and currently there exist very few of these debug messages.

Data Logging

This feature is somewhat outdated and not often used.

Data logging consists of periodically logging important data concerning the operation of the UPS. For the definitive definition of the format, see log_data() in apcreports.c. The format varies according to the UPS model and the information available from the UPS.

For UPS models, NBKPRO, SMART, SHARESMART, and MATRIX, the output is written in a format very similar to what PowerChute writes. That is:

MinLineVoltage, MaxLineVoltage, OutputVoltage, BatteryVoltage, LineFrequency, LoadPercent, UPSTemperature, AmbientTemperature, Humidity, LineVoltage, BatteryCharge, toggle

Any value that is not supported by your UPS such as AmbientTemperature and Humidity will be blank or possibly as 0.0. In any case the commas before and after that field will still be output. The toggle value alternates from 0 to 1 on each line. This was added at user request so that no two adjacent samples are identical.

An actual example from the log file is:

Nov  2 12:43:05 matou apcupsd[23439]: 224.9,227.5,226.2,27.74,50.00,100.0,30.6,,,226.2,50.0,1

Status Logging

Status logging consists of logging all available information known about your UPS as a series of ASCII records. This information is also made available by the apcupsd network information server.

For more details on STATUS logging, see the apcupsd Status Logging section for details.

EVENTS Logging

Events logging consists of logging events as they happen. For example, successful startup, power fail, battery failure, system shutdown, ...

See the Customizing Event Handling section for more details.

Implementation Details

In order to ensure that the data logged to syslog() can be directed to different files, I have assigned syslog() levels to each of our four types of data as follows:

  1. DEBUG logging has level LOG_DEBUG
  2. DATA logging has level LOG_INFO
  3. STATUS logging has level LOG_NOTICE
  4. EVENTS logging has levels LOG_WARNING, LOG_ERR, LOG_CRIT, and LOG_ALERT

It should be noted that more work needs to be done on the precise definitions of each of the levels for EVENTS logging. Currently, it is roughly broken down as follows:

LOG_WARNING general information such as startup, etc.

LOG_ERR an error condition detected, e.g. communications problem with the UPS.

LOG_CRIT a serious problem has occurred such as power failure, running on UPS batteries, ...

LOG_ALERT a condition that needs immediate attention such as pending system shutdown, ...

The default Facility for syslog() logging is DAEMON, although this can be changed with the FACILITY directive in apcupsd.conf. In the following example, we should the facility as local0.

More work needs to be done to the code to ensure that it corresponds to the above levels.

As a practical example of how to setup your syslog() to use the new logging feature, suppose you wish to direct all DATA logging to a file named /var/log/apcupsd.data, all EVENTS to the standard /var/log/messages file (to be mixed with other system messages), and at the same time send all EVENTS to /var/log/apcupsd.events, and finally, you want to send all STATUS logging to the named pipe /var/log/apcupsd.status

First as root, you create the named pipe:

mkfifo /var/log/apcupsd.status

Change its permissions as necessary or use the -m option to set them when creating the pipe.

Then you modify your /etc/syslog.conf file to direct the appropriate levels of messages where you want them. To accomplish the above, my syslog.conf file looks like:

# exclude all apcupsd info by default
*.info;local0.none                    /var/log/messages

# Everything for apcupsd goes here
local0.info;local0.!notice             /var/log/apcupsd.data
local0.notice;local0.!warn            |/var/log/apcupsd.status
local0.warn                            /var/log/apcupsd.events
local0.warn                            /var/log/messages

The Windows Version of apcupsd

The Windows version of apcupsd has been tested on Win95, Win98, WinMe, WinNT, WinXP, and Win2000 systems. This version of apcupsd has been built to run natively on Windows (no Cygwin or other emulation layer needed). Even though the Win32 version of apcupsd is a port that relies on many Unix features, it is just the same a true Windows program. When running, it is perfectly integrated with Windows and displays its icon in the system icon tray, and provides a system tray menu to obtain additional information on how apcupsd is running (status and events dialog boxes).

Once installed apcupsd normally runs as a system service. This means that it is immediately started by the operating system when the system is booted, and runs in the background even if there is no user logged into the system.

Installing Apcupsd on Windows

Normally, you will install the Windows version of apcupsd from the binaries. Starting with version 3.11.15, the Windows binaries are distributed with a full GUI installer driven by NSIS, the Nullsoft Scriptable Install System (http://nsis.sourceforge.net).

Installation is very simple and straight-forward: Simply double-click the installer executable and follow the instructions.

Configuring Apcupsd on Windows

If you are installing Apcupsd for the first time, the installer will give you an opportunity to edit the apcupsd.conf configuration file to contain the values appropriate for your site. (Subsequent installations will maintain your existing apcupsd.conf, so you need not edit it again unless there are new features or syntax changes that must be accounted for.)

The default configuration calls for a USB connected UPS. This is the most common connection for modern UPSes, especially those used with Windows computers. All other apcupsd drivers are available (apcsmart, dumb, net, snmp, pcnet) and can be used simply by editing the configuration file UPSCABLE, UPSTYPE, and DEVICE settings as described elsewhere in this manual.

Note that on Windows, serial ports are specified using COM1, COM2, etc. notation instead of the UNIX-style /dev/tty* notation.

Note also if you are using WinNT or Win2000, the operating system may probe the serial port attempting to attach a serial mouse. This will cause apcupsd to be unable to communicate with the serial port. If this happens, or out of precaution, you can edit the c:\\boot.ini file. Find the line that looks something like the following:

multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation Version 4.00"

and add the following to the end of the line: /NoSerialMice:COM1 (or COM2 depending on what you want to use). The new line should look similar to...

multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation Version 4.00" /NoSerialMice:COM1

...where the only thing you have changed is to append to the end of the line. This addition will prevent the operating system from interfering with apcupsd

Starting Apcupsd on Windows

The installer will give you an opportunity start the Apcupsd service immediately. If you choose to start it manually, you may do so by selecting the "Start Apcupsd" link from the Start->Programs->Apcupsd folder.

On Windows NT/2000/XP, you may alternatively go to the Control Panel, open the Services folder, select Apcupsd UPS Server, and then click on the Start button as shown below:

./wininstall6.png

If the Services dialog reports a problem, it is normally because your DEVICE statement does not contain the correct serial port name.

You probably should also click on the Startup... button to ensure that the correct defaults are set. The dialogue box that appears should have Startup Type set to Automatic* and **Logon should be set to System Account. If these values are not set correctly by default, please change them otherwise apcupsd will not work.

For WinXP and Win2K systems, the dialogs are a bit different from those shown here for WinNT, but he concept is the same. You get to the Services dialog by clicking on: Control Panel -> Administrative Tools -> Component Services. The apcupsd service should appear in the right hand window when you click on Services (Local) in the left hand menu window.

That should complete the installation process. When the system tray icon turns from a question mark image4 into a plug image5, right click on it and a menu will appear. Select the Events item, and the Events dialogue box should appear. There should be no error messages. By right clicking again on the system tray plug and selecting the Status item, you can verify that all the values for your UPS are correct.

When the UPS switches to the battery, the battery icon image6 will appear in the system tray. While the UPS is online, if the battery is not at least 99% charged, the plug icon will become a plug with a lightning bolt in the middle image7 to indicate that the battery is charging.

Apctray

Starting with version 3.14.2, the tray icon is provided by a separate program called 'apctray'. This cleanly separates the user interface from the daemon (service) and is required for tray icon support on Windows Vista. Note that if you close or disable the tray icon this does not stop or disable the apcupsd service which will continue to monitor the UPS and shutdown the computer when appropriate. To stop or disable the service, use the service control panel.

apctray has the capability of monitoring multiple apcupsd instances using apcupsd's Network Information Server (NIS). It will create a new icon for each instance being monitored. By default, apctray monitors the local apcupsd (localhost on port 3551). To add additional monitors, you can right-click an existing icon and choose "Add Monitor". To remove a monitor, right-click its icon and choose "Remove Monitor". To change thr settings for an existing monitor (ip address, port, refresh rate), right-click its icon and choose "Configure...".

apctray can be installed standalone (without apcupsd) if you wish to use it only to monitor remote apcupsd instances. This can be convenient for keeping an eye on a room full of UPSes from your desktop. Download and run the normal apcupsd installer and simply uncheck all components except apctray. Then add as many monitors as you wish as described above.

Testing Apcupsd on Windows

It would be hard to overemphasize the need to do a full testing of your installation of apcupsd as there are a number of reasons why it may not behave properly in a real power failure situation.

Please read the Testing Apcupsd section of this document for general instructions on testing the Win32 version. However, on Win32 systems, there is no Unix system log file, so if something goes wrong, look in the file c:\apcupsd\etc\apcupsd\apcupsd.events where apcupsd normally logs its events, and you will generally find more detailed information on why the program is not working. The most common cause of problems is either improper configuration of the cable type, or an incorrect address for the serial port. Additionally, check the application event log, if you're running a platform that supports it such as Windows 2000 or XP.

Upgrading

An upgrade may be accomplished by uninstalling the old version (using the Add/Remove Programs Control Panel or clicking the "Uninstall Apcupsd" link from Start -> Programs -> Apcupsd. Near the end of the uninstall you will be prompted about removing configuration and event files. You should answer "No" in order to preserve your existing apcupsd.conf file.

After the uninstall completes you may install the new version of Apcupsd as described above. If you preserved your existing apcupsd.conf file, the new apcupsd.conf will be installed as apcupsd.conf.new.

Post-Installation

After installing apcupsd and before running it, you should check the contents of the config file c:\apcupsd\etc\apcupsd\apcupsd.conf. You will probably need to change your UPSCABLE directive, your UPSTYPE and possibly your DEVICE directives. Please refer to the configuration section of this manual for more details.

Problem Areas

On some Windows systems, the domain resolution does not seem to work if you have not configured a DNS server in the Network section of the Control Panel. This problem should be apparent only when running a slave configuration. In this case, when you specify the name of the master in your apcupsd.conf file, apcupsd will be unable to resolve the name to a valid IP address. To circumvent this problem, simply enter the address as an IP address rather than a hostname, or alternatively, ensure that you have a valid DNS server configured on your system.

On WinNT, WinXP, and Win2K systems, you can examine the System Applications log to which apcupsd writes Windows error messages during startup.

Regardless of which Windows system you are running, apcupsd logs most error messages to c:\apcupsd\etc\apcupsd\apcupsd.events. This type error messages such as configuration file not found, etc are written to this file. Note that on some systems (WinXP, possibly others) Apcupsd is unable to write to this file when running as a service.

Email Notification of Events

It is possible to receive email notification of apcupsd events using some simple Visual Basic scripts contributed by Ed Dondlinger <edondlinger@thepylegroup.com>. The scripts are automatically installed in the etc/apcupsd directory of your apcupsd installation but are disabled by default. To enable them, first open them in a text editor such as Notepad and edit the USER VARIABLES section to set your email preferences including address, server information, etc. Then rename the script files without the *.example suffix. Scripts are supplied for onbattery, offbattery, and commfailure events. You can copy the scripts to other filenames and modify the email body text to respond to other events as described in Customizing Event Handling.

Killpower under Windows

If your batteries become exhausted during a power failure and you want your machine to automatically reboot when the power comes back, it is useful to implement the killpower feature of the UPS where apcupsd sends the UPS the command to shut off the power. In doing so, the power will be cut to your PC and if your BIOS is properly setup, the machine will automatically reboot when the power comes back. This is important for servers.

This feature is implemented on Unix systems by first requesting a system shutdown. As a part of the shutdown, apcupsd is terminated by the system, but the shutdown process executes a script where apcupsd is recalled after the disks are synced and the machine is idle. Apcupsd then requests the UPS to shut off the power (killpower).

Unfortunately on Windows, there is no such shutdown script that we are aware of and no way for apcupsd to get control after the machine is idled. If this feature is important to you, it is possible to do it by telling apcupsd to immediately issue the killpower command after issuing the shutdown request. The danger in doing so is that if the machine is not sufficiently idled when the killpower takes place, the disks will need to be rescanned (and there is a possibility of lost data however small). Generally, UPSes have a shutdown grace period which gives sufficient time for the OS to shutdown before the power is cut.

To implement this feature, you need to add the -p option to the apcupsd command line that is executed by the system. Currently the procedure is manual. You do so by editing the registry and changing the line:

c:\apcupsd\apcupsd.exe /service

found under the key:

HKEY_LOCAL_MACHINE Software\Microsoft\Windows\CurrentVersion\RunServices

to

c:\apcupsd\apcupsd.exe /service -p

If you have a Smart UPS, you can configure the kill power grace period, and you might want to set it to 3 minutes. If you have a dumb UPS, there is no grace period and you should not use this procedure. If you have a Back-UPS CS or ES, these UPSes generally have a fixed grace period of 2 minutes, which is probably sufficient.

Power Down During Shutdown

Our philosophy is to shutdown a computer but not to power it down itself (as opposed to having the UPS cut the power as described above). That is we prefer to idle a computer but leave it running. This has the advantage that in a power fail situation, if the killpower function described above does not work, the computer will continue to draw down the batteries and the UPS will hopefully shutoff before the power is restore thus permitting an automatic reboot.

Nevertheless some people prefer to do a full power down. To do so, you might want to get a copy of PsShutdown, which does have a power down option. You can find it and a lot more useful software at: http://www.sysinternals.com/ntw2k/freeware/pstools.shtml. To use their shutdown program rather than the apcupsd supplied version, you simply edit:

c:\apcupsd\etc\apcupsd\apccontrol

with any text editor and change our calls to shutdown to psshutdown.

Command Line Options Specific to the Windows Version

These options are not normally seen or used by the user, and are documented here only for information purposes. At the current time, to change the default options, you must either manually run apcupsd or you must manually edit the system registry and modify the appropriate entries.

In order to avoid option clashes between the options necessary for apcupsd to run on Windows and the standard apcupsd options, all Windows specific options are signaled with a forward slash character (/), while as usual, the standard apcupsd options are signaled with a minus (-), or a minus minus (--). All the standard apcupsd options can be used on the Windows version. In addition, the following Windows only options are implemented:

/service Start apcupsd as a service
/run Run the apcupsd application
/install Install apcupsd as a service in the system registry
/remove Uninstall apcupsd from the system registry
/about Show the apcupsd about dialogue box
/kill Stop any running apcupsd
/help Show the apcupsd help dialogue box

It is important to note that under normal circumstances the user should never need to use these options as they are normally handled by the system automatically once apcupsd is installed. However, you may note these options in some of the .pif files that have been created for your use.

Installation: Serial-Line UPSes

Overview of Serial-Interface UPSes

If you have a UPS that communicates via serial port, you need to do two things before you can even think about configuring the software. First, you need to figure out whether it's a dumb (voltage-signalling) UPS or speaks the apcsmart protocol. Second, if you have an interface cable from APC, you need to figure out what kind it is. If you don't have such a cable, you need to build one. A straight-through serial cable won't work.

According to Bill Marr the Belkin F5U109, also sold as F5U409 also works with apcupsd for kernel versions 2.4.25 or higher and kernels 2.6.1 and higher. These newer kernels are needed to have the patch that makes the mct_u232 (Magic Control Technology) module and other adapters work with RS-232 devices that do not assert the CTS signal.

Connecting a Serial-Line UPS to a USB Port

By using a special adaptor, you can connect your serial-line UPS to a USB port. If you would like to free up your serial port and connect your existing serial port UPS to a USB port, it is possible if you have one of the later kernels. You simply get a serial to USB adapter that is supported by the kernel, plug it in and make one minor change to your apcupsd.conf file and away you go. (Kern adds: Thanks to Joe Acosta for pointing this out to me.)

The device that Joe Acosta and Kern are using is IOgear GUC232A USB 2 serial adapter. Bill Marr informs us that it also works with a Back-UPS Pro 650 and the 940-0095B cable.

At Kern's site, running Red Hat 7.1 with kernel 2.4.9-12, he simply changed his /etc/apcupsd/apcupsd.conf configuration line to be:

DEVICE /dev/ttyUSB0

Depending on whether or not you have hotplug working, you may need to explicitly load the kernel modules usbserial and pl2303. In Kern's case, this was not necessary.

Testing Serial-Line UPSes

If you have a serial-line UPS, there are some tests you should run before the general ones described in the Testing Apcupsd section.

To test your computer's connection with a serial-line UPS, you first need to establish that the serial line is functioning, and then that the UPS is responding to commands. This can be a bit tricky, especially with a dumb voltage-signalling interface, because it is completely quiescent when there are no commands being passed, and the command repertoire doesn't include any self-tests.

Because it is easy to configure a serial cable incorrectly in such a way as to cause premature shutdowns of the UPS power, we strongly recommend, especially for voltage- signaling (dumb) UPSes, that you do most of the initial testing with your computer plugged into the wall rather than your UPS. Thus if the UPS power is suddenly shut off, your computer will continue to run. We also recommend using safe-apccontrol as described below, until you are sure that the signaling is correct.

Also note that if you launch the execution of apcupsd while your voltage-signaling UPS is on battery power, it is very likely that your UPS will immediately shut off the power. This is due to the initialization of the serial port line signals, which often looks to the UPS like a shutdown command.

Finally, double-check the state of your cabling and UPS indicator lights frequently during testing. For voltage-signaling UPSes, apcupsd is not currently able to detect whether or not the serial cable is connected. In addition, some simple signaling UPSes with certain cable combinations are not able to detect the low battery condition. For more details please see Voltage Signalling Features Supported by Apcupsd for Various Cables.

Establishing Serial Port Connection

Once you have compiled, installed, and invoked apcupsd, you should wait to allow apcupsd to configure itself and establish contact with the UPS.

If you see a message similar to the following about 30 seconds after starting apcupsd...

apcupsd FATAL ERROR in apcserial.c at line 156
PANIC! Cannot communicate with UPS via serial port.

it means that apcupsd tried for about 30 seconds to establish contact with the UPS via the serial port, but was unable to do so. Before continuing, you must correct this problem. Some of the possible sources of the problem are:

  • You have not configured the correct serial port name on the DEVICE directive in your apcupsd configuration file.
  • The serial port that you have chosen has logins enabled. You must disable logins on that port, otherwise, the system prevents apcupsd from using it. Normally, the file /etc/inittab specifies the ports for which a getty process is started (on Sun machines, the serial port program equivalent to getty is called ttymon). You must disable this for the port that you wish to use.
  • Make sure you are doing your testing as root otherwise, you may have permissions problems accessing the serial port.
  • You may have cabling problems, either with an incorrect cable, or the incorrect cable specification directive in the configuration file.
  • You may have a problem with the /etc/apcupsd/acpupsd.conf file. For example, check that you have specified the correct type of UPS and the correct networking directives. For more details, see the After Installation section.
  • If you have a SmartUPS 5000 RM 15U or similar model, that comes with a "Web/SNMP management card" in one of the "Smart Slots", this card may interfere with the serial port operation. If you are having problems, please remove this card and try again. Supposedly V3.0 of the card firmware has been corrected to properly release the serial port.
  • Ensure that you have no other programs that are using the serial port. One user reported that he had problems because the serial port mouse (gpm) was using the same port as apcupsd. This causes intermittent seemingly random problems.
  • Try connecting your UPS to another machine. If it works, then you probably have a bad serial port card. As unlikely as this may sound, at least two of our users have had to replace bad serial port cards.
  • Try doing an 'lsof /dev/ttyS0' where you replace the /dev/ttyS0 with your serial port name. If you get no output, the port is free (or there is no physical port). If you get output, then another program is using the port, and you should see which one.
  • Try doing a 'dmesg | grep tty'. This may show you if a program has grabbed the port. (Thanks to Joe Acosta for the suggestion.)
  • If all else fails, make sure your system is configured for serial port support.

The first thing to do is to look at your log file, usually /var/log/messages because apcupsd writes more detailed information to the log file whenever there is an error.

If you have a UPS that uses apcsmart protocol, you can manually test the serial communications with the UPS by starting a serial port communications program (such as minicom, tip, or cu) with the settings 2400 8N1 (2400 baud, 8 data bits, no parity, 1 stop bit). Be extremely careful what you send to your UPS as certain characters may cause it to power down or may even cause damage to the UPS. Try sending an upper case Y to the UPS (without a return at the end). It should respond with SM. If this is not the case, review the possible problems listed above. If you fat finger the Y and enter y instead, no cause for alarm, you will simply get the APC copyright notice.

Once you are sure that serial port communications is working, proceed to the next test.

Once you have established serial communications

Once you have established that apcupsd can talk to the UPS over the serial part, go do the series of functional tests described in the main Testing section (see Testing Apcupsd).

Troubleshooting Serial Line communications

The most frequently encountered problem with voltage-signalling UPSes (e.g. BackUPS 650) is that you have incorrectly specified which cable is being used. All cables furnished by APC have the cable number stamped on the side of the computer connector end of the cable. Using this number with apcupsd will normally work fine. If you do not know what cable you have, you can use the apctest program to determine the type of the cable.

For simple signaling UPSes, you should not use simple in the cable specification (i.e. UPSCABLE simple) unless you have made the cable yourself according to the wiring diagram given in the cables chapter of this manual.

Bizarre Intermittent Behavior:

In one case, a user reported that he received random incorrect values from the UPS in the status output. It turned out that gpm, the mouse control program for command windows, was using the serial port without using the standard Unix locking mechanism. As a consequence, both apcupsd and gpm were reading the serial port. Please ensure that if you are running gpm that it is not configured with a serial port mouse on the same serial port.

Cables

You can either use the cable that came with your UPS (the easiest if we support it) or you can make your own cable. We recommend that you obtain a supported cable directly from APC.

If you already have an APC cable, you can determine what kind it is by examining the flat sides of the two connectors where you will find the cable number embossed into the plastic. It is generally on one side of the male connector.

To make your own cable you must first know whether you have a UPS that speaks the apcsmart protocol or a "dumb" UPS that uses serial port line voltage signalling.

If you have an smart UPS, and you build your own cable, build a Smart-Custom cable (see Smart-Custom Cable for SmartUPSes). If you have a voltage-signalling or dumb UPS, build a Simple-Custom cable (see Simple-Custom Voltage-Signalling Cable for "dumb" UPSes). If you have a BackUPS CS with a RJ45 connector, you can build your own Custom-RJ45 cable (see Custom-RJ45 Smart Signalling Cable for BackUPS CS Models).

Smart-Custom Cable for SmartUPSes

You do not have this cable unless you built it yourself. The Smart-Custom cable is not an APC product.

  SMART-CUSTOM CABLE

Signal Computer                  UPS
       DB9F                     DB9M
 RxD    2   --------------------  2  TxD  Send
 TxD    3   --------------------  1  RxD  Receive
 GND    5   --------------------  9  Ground

When using this cable with apcupsd specify the following in apcupsd.conf:

UPSCABLE smart
UPSTYPE apcsmart
DEVICE /dev/ttyS0 (or whatever your serial port is)

If you have an OS that requires DCD or RTS to be set before you can receive input, you might try building the standard APC Smart 940-0024C cable listed below (see 940-0024C Cable Wiring).

Simple-Custom Voltage-Signalling Cable for "dumb" UPSes

You do not have this cable unless you built it yourself. The Simple-Custom cable is not an APC product.

For "dumb" UPSes using voltage signalling, if you are going to build your own cable, we recommend to make the cable designed by the apcupsd team as follows:

       SIMPLE-CUSTOM CABLE

Signal Computer                  UPS
       DB9F   4.7K ohm          DB9M
 DTR    4   --[####]--*              DTR set to +5V by Apcupsd
                      |
 CTS    8   ----------*---------  5  Low Battery
 GND    5   --------------------  4  Ground
 DCD    1   --------------------  2  On Battery
 RTS    7   --------------------  1  Kill UPS Power

List of components one needs to make the Simple cable:

  1. One (1) male DB9 connector, use solder type connector only.
  2. One (1) female DB9/25F connector, use solder type connector only.
  3. One (1) 4.7K ohm 1/4 watt 5% resistor.
  4. rosin core solder.
  5. three (3) to five (5) feet of 22AWG multi-stranded four or more conductor cable.

Assembly instructions:

  1. Solder the resistor into pin 4 of the female DB9 connector.
  2. Next bend the resistor so that it connects to pin 8 of the female DB9 connector.
  3. Pin 8 on the female connector is also wired to pin 5 on the male DB9 connector. Solder both ends.
  4. Solder the other pins, pin 5 on the female DB9 to pin 4 on the male connector; pin 1 on the female connector to pin 2 on the male connector; and pin 7 on the female connector to pin 1 on the male connector.
  5. Double check your work.

We use the DTR (pin 4 on the female connector) as our +5 volts power for the circuit. It is used as the Vcc pull-up voltage for testing the outputs on any "UPS by APC" in voltage-signalling mode. This cable may not work on a BackUPS Pro if the default communications are in apcsmart mode. This cable is also valid for use on a ShareUPS BASIC Port. It is reported to work on SmartUPSes, however the Smart Cable described above is preferred.

To have a better idea of what is going on inside apcupsd, for the SIMPLE cable apcupsd reads three signals and sets three:

Reads:

CD, which apcupsd uses for the On Battery signal when high.

CTS, which apcupsd uses for the Battery Low signal when high.

RxD (SR), which apcupsd uses for the Line Down
signal when high. This signal isn't used for much.
Sets:
DTR, which apcupsd sets when it detects a power failure (generally
5 to 10 seconds after the CD signal goes high). It clears this signal if the CD signal subsequently goes low -- i.e. power is restored.
TxD (ST), which apcupsd clears when it detects that the CD signal
has gone low after having gone high - i.e. power is restored.
RTS, which apcupsd sets for the killpower signal -- to cause the UPS
to shut off the power.

Please note that these actions apply only to the SIMPLE cable. The signals used on the other cables are different.

Finally, here is another way of looking at the CUSTOM-SIMPLE cable:

APCUPSD SIMPLE-CUSTOM CABLE

Computer Side  |  Description of Cable           |     UPS Side
DB9f  |  DB25f |                                 |   DB9m  | DB25m
4     |   20   |  DTR (5vcc)             *below  |    n/c  |
8     |    5   |  CTS (low battery)      *below  | <-  5   |   7
2     |    3   |  RxD (no line voltage)  *below  | <-  3   |   2
5     |    7   |  Ground (Signal)                |     4   |  20
1     |    8   |  CD (on battery from UPS)       | <-  2   |   3
7     |    4   |  RTS (kill UPS power)           | ->  1   |   8
n/c   |    1   |  Frame/Case Gnd (optional)      |     9   |  22

Note: the <- and -> indicate the signal direction.

When using this cable with apcupsd specify the following in apcupsd.conf:

UPSCABLE simple
UPSTYPE dumb
DEVICE /dev/ttyS0 (or whatever your serial port is)

Custom-RJ45 Smart Signalling Cable for BackUPS CS Models

If you have a BackUPS CS, you are probably either using it with the USB cable that is supplied or with the 940-0128A supplied by APC, which permits running the UPS in dumb mode. By building your own cable, you can now run the BackUPS CS models (and perhaps also the ES models) using smart signalling and have all the same information that is available as running it in USB mode.

The jack in the UPS is actually a 10 pin RJ45. However, you can just as easily use a 8 pin RJ45 connector, which is more standard (ethernet TX, and ISDN connector). It is easy to construct the cable by cutting off one end of a standard RJ45-8 ethernet cable and wiring the other end (three wires) into a standard DB9F female serial port connector.

Below, you will find a diagram for the CUSTOM-RJ45 cable:

  CUSTOM-RJ45 CABLE

Signal Computer              UPS     UPS
       DB9F                 RJ45-8  RJ45-10
 RxD    2   ----------------  1      2     TxD  Send
 TxD    3   ----------------  7      8     RxD  Receive
 GND    5   ----------------  6      7     Ground
 FG  Shield ----------------  3      4     Frame Ground

The RJ45-8 pins are: looking at the end of the connector:

 8 7 6 5 4 3 2 1
___________________
| . . . . . . . . |
|                 |
-------------------
       |____|

The RJ45-10  pins are: looking at the end of the connector:

10 9 8 7 6 5 4 3 2 1
_______________________
| . . . . . . . . . . |
|                     |
-----------------------
       |____|

For the serial port DB9F connector, the pin numbers are stamped in the plastic near each pin. In addition, there is a diagram near the end of this chapter.

Note, one user, Martin, has found that if the shield is not connected to the Frame Ground in the above diagram (not in our original schematic), the UPS (a BackUPS CS 500 EI) will be unstable and likely to rapidly switch from power to batteries (i.e. chatter).

When using this cable with apcupsd specify the following in apcupsd.conf:

UPSCABLE smart
UPSTYPE apcsmart
DEVICE /dev/ttyS0 (or whatever your serial port is)

The information for constructing this cable was discovered and transmitted to us by slither_man. Many thanks!

Other APC Cables that apcupsd Supports

apcupsd will also support the following off the shelf cables that are supplied by APC

  • 940-0020[B/C] Simple Signal Only, all models.
  • 940-0023A Simple Signal Only, all models.
  • 940-0119A Simple Signal Only, Back-UPS Office, and BackUPS ES.
  • 940-0024[B/C/G] Smart mode Only, SU and BKPro only.
  • 940-0095[A/B/C] PnP (Plug and Play), all models.
  • 940-1524C Smart mode Only
  • 940-0128A Simple Signal Only, Back-UPS CS in serial mode.
  • All USB cables such as 940-0127[A/B]

Voltage Signalling Features Supported by Apcupsd for Various Cables

The following table shows the features supported by the current version of apcupsd for various cables running the UPS in voltage-signalling mode.

Cable Power Loss Low Battery Kill Power Cable Disconnected
940-0020B Yes No Yes No
940-0020C Yes Yes Yes No
940-0023A Yes No No No
940-0119A Yes Yes Yes No
940-0127A Yes Yes Yes No
940-0128A Yes Yes Yes No
940-0095A/B/C Yes Yes Yes No
simple Yes Yes Yes No

Voltage Signalling

Apparently, all APC voltage-signalling UPSes with DB9 serial ports have the same signals on the output pins of the UPS. The difference at the computer end is due to different cable configurations. Thus, by measuring the connectivity of a cable, one can determine how to program the UPS.

The signals presented or accepted by the UPS on its DB9 connector using the numbering scheme listed above is:

UPS Pin         Signal meaning
 1     <-     Shutdown when set by computer for 1-5 seconds.
 2     ->     On battery power (this signal is normally low but
                   goes high when the UPS switches to batteries).
 3     ->     Mains down (line fail) See Note 1 below.
 5     ->     Low battery. See Note 1 below.
 6     ->     Inverse of mains down signal. See Note 2 below.
 7     <-     Turn on/off power (only on advanced UPSes only)

 Note 1: these two lines are normally open, but close when the
     appropriate signal is triggered. In fact, they are open collector
     outputs which are rated for a maximum of +40VDC and 25 mA. Thus
     the 4.7K ohm resistor used in the Custom Simple cable works
     quite well.

 Note 2: the same as note 1 except that the line is normally closed,
     and opens when the line voltage fails.

The Back-UPS Office 500 signals

The Back-UPS Office UPS has a telephone type jack as output, which looks like the following:

Looking at the end of the connector:

   6 5 4 3 2 1
  _____________
 | . . . . . . |
 |             |
 |  |----------|
 |__|

It appears that the signals work as follows:

  UPS            Signal meaning
1 (brown)    <-   Shutdown when set by computer for 1-5 seconds.
2 (black)    ->   On battery power
3 (blue)     ->   Low battery
4 (red)           Signal ground
5 (yellow)   <-   Begin signalling on other pins
6 (none)          none

Analyses of APC Cables

940-0020B Cable Wiring

Supported Models:Simple Signaling such as BackUPS
Contributed by:Lazar M. Fleysher

Although we do not know what the black box semiconductor contains, we believe that we understand its operation (many thanks to Lazar M. Fleysher for working this out).

This cable can only be used on voltage-signalling UPSes, and provides the On Battery signal as well as kill UPS power. Most recent evidence (Lazar's analysis) indicates that this cable under the right conditions may provide the Low Battery signal. This is yet to be confirmed.

This diagram is for informational purposes and may not be complete. We don't recommend that use it to build you build one yourself.

APC Part# - 940-0020B

Signal Computer                  UPS
       DB9F                     DB9M
 CTS    8   --------------------  2  On Battery
 DTR    4   --------------------  1  Kill power
 GND    5   ---------------*----  4  Ground
                           |
                ---        *----  9  Common
 DCD    1  ----|///|-----------   5  Low Battery
               |\\\|
 RTS    7  ----|///| (probably a
                ---   semi-conductor)

940-0020C Cable Wiring

Supported Models:Simple Signaling such as BackUPS

This cable can only be used on voltage-signalling UPSes, and provides the On Battery signal, the Low Battery signal as well as kill UPS power. You may specify UPSCABLE 940-0020C.

This diagram is for informational purposes and may not be complete. We don't recommend that use it to build you build one yourself.

APC Part# - 940-0020C

Signal Computer                  UPS
       DB9F                     DB9M
 CTS    8   --------------------  2  On Battery
 DTR    4   --------------------  1  Kill power
 GND    5   ---------------*----  4  Ground
                           |
                           *----  9  Common
 RTS    7 -----[ 93.5K ohm ]----- 5  Low Battery
               or semi-conductor

940-0023A Cable Wiring

Supported Models:Simple Signaling such as BackUPS

This cable can only be used on voltage-signalling UPSes, and apparently only provides the On Battery signal. As a consequence, this cable is pretty much useless, and we recommend that you find a better cable because all APC UPSes support more than just On Battery. Please note that we are not sure the following diagram is correct.

This diagram is for informational purposes and may not be complete. We don't recommend that use it to build you build one yourself.

APC Part# - 940-0023A

Signal Computer                  UPS
       DB9F                     DB9M
 DCD    1   --------------------  2  On Battery

              3.3K ohm
 TxD    3   --[####]-*
                     |
 DTR    4   ---------*
 GND    5   ---------------*----  4  Ground
                           |
                           *----  9  Common

940-0024C Cable Wiring

Supported Models:SmartUPS (all models with DB9 serial port)

If you wish to build the standard cable furnished by APC (940-0024C), use the following diagram.

APC Part# - 940-0024C

Signal Computer                  UPS
       DB9F                     DB9M
 RxD    2   --------------------  2  TxD  Send
 TxD    3   --------------------  1  RxD  Receive
 DCD    1   --*
              |
 DTR    4   --*
 GND    5   --------------------  9  Ground
 RTS    7   --*
              |
 CTS    8   --*

940-0095A Cable Wiring

Supported Models:APC BackUPS Pro PNP
Contributed by:Chris Hanson cph at zurich.ai.mit.edu

This is the definitive wiring diagram for the 940-0095A cable submitted by Chris Hanson, who disassembled the original cable, destroying it in the process. He then built one from his diagram and it works perfectly.

APC Part# - 940-0095A

UPS end                                      Computer end
-------                                      ------------
                  47k        47k
BATTERY-LOW (5) >----R1----*----R2----*----< DTR,DSR,CTS (4,6,8)
                         |          |
                         |          |
                         |         /  E
                         |       |/
                         |    B  |
                         *-------|  2N3906 PNP
                                 |
                                 |\
                                   \  C
                                    |
                                    |
                                    *----< DCD (1)     Low Batt
                                    |
                                    |
                                    R 4.7k
                                    3
                                    |
                             4.7k   |
SHUTDOWN (1)    >----------*----R4----*----< TxD (3)
                         |
                         |  1N4148
                         *----K|---------< RTS (7)      Shutdown

POWER-FAIL (2)  >--------------------------< RxD,RI (2,9) On Batt

GROUND (4,9)    >--------------------------< GND (5)

Operation:

  • DTR is "cable power" and must be held at SPACE. DSR or CTS may be used as a loopback input to determine if the cable is plugged in.

  • DCD is the "battery low" signal to the computer. A SPACE on this line means the battery is low. This is signalled by BATTERY-LOW being pulled down (it is probably open circuit normally).

    Normally, the transistor is turned off, and DCD is held at the MARK voltage by TxD. When BATTERY-LOW is pulled down, the voltage divider R2/R1 biases the transistor so that it is turned on, causing DCD to be pulled up to the SPACE voltage.

  • TxD must be held at MARK; this is the default state when no data is being transmitted. This sets the default bias for both DCD and SHUTDOWN. If this line is an open circuit, then when BATTERY-LOW is signalled, SHUTDOWN will be automatically signalled; this would be true if the cable were plugged in to the UPS and not the computer, or if the computer were turned off.

  • RTS is the "shutdown" signal from the computer. A SPACE on this line tells the UPS to shut down.

  • RxD and RI are both the "power-fail" signals to the computer. A MARK on this line means the power has failed.

  • SPACE is a positive voltage, typically +12V. MARK is a negative voltage, typically -12V. Linux appears to translate SPACE to a 1 and MARK to a 0.

940-0095B Cable Wiring

Supported Models:Many simple-signaling (aka voltage signaling) models such as BackUPS

This diagram is for informational purposes and may not be complete. We don't recommend that use it to build you build one yourself.

APC Part# - 940-0095B

Signal Computer                  UPS
       DB9F                     DB9M
 DTR    4   ----*
 CTS    8   ----|
 DSR    6   ----|
 DCD    1   ----*
 GND    5   ---------------*----  4  Ground
                           |
                           *----  9  Common
 RI     9   ----*
                |
 RxD    2   ----*---------------  2  On Battery
 TxD    3   ----------[####]----  1  Kill UPS Power
                      4.7K ohm

940-0119A Cable Wiring

Supported Models:Older BackUPS Office

This diagram is for informational purposes and may not be complete. We don't recommend that use it to build you build one yourself.

APC Part# - 940-0119A

  UPS      Computer
  pins     pins      Signal             Signal meaning
1 (brown)    4,6      DSR DTR     <-   Shutdown when set by computer for 1-5 seconds.
2 (black)    8,9      RI  CTS     ->   On battery power
3 (blue)     1,2      CD  RxD     ->   Low battery
4 (red)       5       Ground
5 (yellow)    7       RTS         <-   Begin signalling on other pins
6 (none)     none

Serial BackUPS ES Wiring

Supported Models:Older Serial BackUPS ES
Contributed by:William Stock

The BackUPS ES has a straight through serial cable with no identification on the plugs. To make it work with apcupsd, specify the { UPSCABLE 940-0119A} and { UPSTYPE backups}. The equivalent of cable 940-0119A is done on a PCB inside the unit.

computer           ----------- BackUPS-ES -----------------
DB9-M              DB-9F
pin    signal      pin

 4      DSR   ->    4 --+
                        |  diode   resistor
 6      DTR   ->    6 --+---->|----/\/\/\---o kill power

 1      DCD   <-    1 --+
                        |
 2      RxD   <-    2 --+----------------+--o low battery
                                         |
 7      RTS   ->    7 --------+--/\/\/\--+
                              |
                              +--/\/\/\--+
                                         |
 8      RI    <-    8 --+----------------+--o on battery
                        |
 9      CTS   <-    9 --+

 5      GND   ---   5 ----------------------o ground

 3      TxD         3 nc

940-0128A Cable Wiring

Supported Models:Older USB BackUPS ES and CS
Contributed by:Many, thanks to all for your help!

Though these UPSes are USB UPSes, APC supplies a serial cable (typically with a green DB9 F connector) that has 940-0128A stamped into one side of the plastic serial port connector. The other end of the cable is a 10 pin RJ45 connector that plugs into the UPS (thanks to Dean Waldow for sending a cable!). Apcupsd version 3.8.5 and later supports this cable when specified as { UPSCABLE 940-0128A} and { UPSTYPE dumb}. However, running in this mode much of the information that would be available in USB mode is lost. In addition, when apcupsd attempts to instruct the UPS to kill the power, it begins cycling about 4 times a second between battery and line. The solution to the problem (thanks to Tom Suzda) is to unplug the UPS and while it is still chattering, press the power button (on the front of the unit) until the unit beeps and the chattering stops. After that the UPS should behave normally and power down 1-2 minutes after requested to do so.

Thanks to all the people who have helped test this and have provided information on the cable wiring, our best guess for the cable schematic is the following:

APC Part# - 940-0128A

computer      --------- Inside the Connector---------  UPS
DB9-F         |                                     |  RJ45
pin - signal  |                                     |  Pin - Color
              |                                     |
 4     DSR  ->|---+                                 |
              |   |  diode   resistor               |
 6     DTR  ->|---+---->|----/\/\/\---o kill power  |  8  Orange
              |                                     |
 1     DCD  <-|----+                                |
              |    |                                |
 2     RxD  <-|----+----------------+--o low battery|  3  Brown
              |                     |               |
 7     RTS  ->|----------+--/\/\/\--+               |
              |          |                          |
              |          +--/\/\/\--+               |
              |                     |               |
 8     RI   <-|----+----------------+--o on battery |  2  Black
              |    |                                |
 9     CTS  <-|----+                                |
              |                         signal      |
 5     GND  --|-----------------------o ground      |  7  Red
              |                                     |
 3     TxD    |                                     |
              |                         chassis     |
 Chassis/GND  |-----------------------o ground      |  4  Black
              |                                     |
              |          Not connected              |  1, 5, 6, 9, 10
              --------------------------------------

The RJ45 pins are: looking at the end of the connector:

10 9 8 7 6 5 4 3 2 1
_______________________
| . . . . . . . . . . |
|                     |
-----------------------
       |____|

940-0128D Cable Wiring

Supported Models:BackUPS XS1000(BX-1000), Possibly other USB models
Contributed by:Jan Babinski jbabinsk at pulsarbeacon dot com

940-0128D is functionally similar to the 940-0128A cable except for NC on (6) DTR and (2) RD on the computer side.

Unverified: Try setting apcupsd to UPSTYPE dumb and UPSCABLE 940-0128A.

APC Part# - 940-0128D

DB9(Computer)               RJ45-10(UPS)

 (5)     (1)                 ____________
( o o o o o )               [ oooooooooo ]
 \ o o o o /                [____________]
  (9)   (6)                 (10)  [_]  (1)


 RI(9)<---+
          |
CTS(8)<---+--- E   2N2222(NPN)
                \|___
           ____ /| B |
          |    C     |
          |          |
          +---vvvv---+--[>|------<(2)OnBatt
RTS(7)>---|    2k      1N5819
          +---vvvv---+--[>|------<(3)LowBatt
          |          |
          +--- C     |
                \|___|
                /| B
DCD(1)<------- E    2N2222(NPN)

DTR(4)>-------------------------->(8)KillPwr

GND(5)----------------------------(7)Signal GND
(Shield)--------------------------(4)Chassis GND

940-0127B Cable Wiring

Supported Models:BackUPS XS1000(BX-1000), Possibly other USB models
Contributed by:Jan Babinski jbabinsk at pulsarbeacon dot com

Standard USB cable for USB-capable models with 10-pin RJ45 connector.

APC Part# - 940-0127B

USB(Computer)      RJ45-10(UPS)
 _________          ____________
| = = = = |        [ oooooooooo ]
|_________|        [____________]
 (1)   (4)         (10)  [_]  (1)

  +5V(1)-----------(1)+5V
DATA+(2)-----------(9)DATA+
DATA-(3)-----------(10)DATA-
  GND(4)-----------(7)Signal GND
(Shield)-----------(4)Chassis GRND

Win32 Implementation Restrictions for Simple UPSes

Due to inadequacies in the Win32 API, it is not possible to set/clear/get all the serial port line signals. apcupsd can detect: CTS, DSR, RNG, and CD. It can set and clear: RTS and DTR.

This imposes a few minor restrictions on the functionality of some of the cables. In particular, LineDown on the Custom Simple cable, and Low Battery on the 0023A cable are not implemented.

Internal Apcupsd Actions for Simple Cables

This section describes how apcupsd 3.8.5 (March 2002)
treats the serial port line signals for simple cables.

apcaction.c:
 condition = power failure detected
 cable = CUSTOM_SIMPLE
 action = ioctl(TIOCMBIS, DTR)      set DTR (enable power bit?)

apcaction.c:
 condition = power back
 cable = CUSTOM_SIMPLE
 action = ioctl(TIOCMBIC, DTR)      clear DTR (clear power bit)
 action = ioctl(TIOCMBIC, ST)       clear ST (TxD)

apcserial.c:
 condition = serial port initialization
 cable = 0095A, 0095B, 0095C
 action = ioctl(TIOMBIC, RTS)       clear RTS (set PnP mode)

 cable = 0119A, 0127A, 0128A
 action = ioctl(TIOMBIC, DTR)       clear DTR (killpower)
 action = ioctl(TIOMBIS, RTS)       set   RTS (ready to receive)

apcserial.c:
 condition = save_dumb_status
 cable = CUSTOM_SIMPLE
 action = ioctl(TIOMBIC, DTR)       clear DTR (power bit?)
 action = ioctl(TIOMBIC, RTS)       clear RTS (killpower)

 cable = 0020B, 0020C, 0119A, 0127A, 0128A
 action = ioctl(TIOMBIC, DTR)       clear DTR (killpower)

 cable = 0095A, 0095B, 0095C
 action = ioctl(TIOMBIC, RTS)       clear RTS (killpower)
 action = ioctl(TIOMBIC, CD)        clear DCD (low batt)
 action = ioctl(TIOMBIC, RTS)       clear RTS (killpower) a second time!

apcserial.c:
 condition = check_serial

 cable = CUSTOM_SIMPLE
 action = OnBatt = CD
 action = BattLow = CTS
 action = LineDown = SR

 cable = 0020B, 0020C, 0119A, 0127A, 0128A
 action = OnBatt = CTS
 action = BattLow = CD
 action = LineDown = 0

 cable = 0023A
 action = Onbatt = CD
 action = BattLow = SR
 action = LineDown = 0

 cable = 0095A, 0095B, 0095C
 action = OnBatt = RNG
 action = BattLow = CD
 action = LineDown = 0


apcserial.c
 condition = killpower

 cable = CUSTOM_SIMPLE, 0095A, 0095B, 0095C
 action = ioctl(TIOMCBIS, RTS)      set RTS (kills power)
 action = ioctl(TIOMCBIS, ST)       set TxD

 cable = 0020B, 020C, 0119A, 0127A, 0128A
 action = ioctl(TIOMCBIS, DTR)      set DTR (kills power)

Recalibrating the UPS Runtime

Note: In a future release of apcupsd this procedure will be replaced by a daemon operation that can be performed on all types of UPS.

This section does not apply to voltage-signalling or dumb UPSes such as the older BackUPS models.

Smart UPSes internally compute the remaining runtime, and apcupsd uses the value supplied by the UPS. As the batteries age (after say two or three years), the runtime computation may no longer be accurate since the batteries no longer hold the same charge. As a consequence, in the event of a power failure, the UPS and thus apcupsd can report a runtime of 5 minutes remaining when in fact only one minute remains. This can lead to a shutdown before you might expect it, because regardless of the runtime remaining that is reported, the UPS will always correctly detect low batteries and report it, thus causing apcupsd to correctly shutdown your computer.

If you wish to have the UPS recalibrate the remaining runtime calculations, you can do so manually as the current version of apcupsd does not support this feature. To do so,

  • Shutdown apcupsd
  • contact your UPS directly using some terminal program such as minicom, tip, or cu with the settings 2400 8N1 (2400 baud, 8 bits, no parity, 1 stop bit). Be extremely careful what you send to your UPS as certain characters may cause it to power down or may even cause damage to the UPS. Try sending an upper case Y to the UPS (without a return at the end). It should respond with SM. If this is not the case, read the chapter on testing. If you fat finger the Y and enter y instead, no cause for alarm, you will simply get the APC copyright notice.
  • when you are sure you are properly connected send an upper case D (no cr). This will put the UPS into calibration mode, and it will drain the battery down to 25% capacity (35% for a Matrix) at which point it will go back on the mains. In doing so, it will recompute the runtime calibration.
  • If you wish to abort the calibration, enter a second D command.
  • When you are done, restart apcupsd.

In principle, you should be able to do this with the computer powered by the UPS, but if you wish to be completely safe, you should plug your computer into the wall prior to performing the runtime calibration. In that case, you will need to artificially load the UPS with light bulbs or other means. You should supply a load of about 30 to 35% but not more than 50%. You can determine the load by looking at the output of the apcaccess status command while apcupsd is running.

You should not run the recalibration command more than once or twice per year as discharging these kinds of batteries tends to shorten their life span.

Configuration Directive Reference

Configuration directives in /etc/apcupsd/apcupsd.conf control the behavior of the apcupsd daemon. For most installations it is only necessary to set a handful of general directives. The rest can be left at their defaults unless you have an exotic configuration.

General Configuration Directives

In general, each of these directives is required (except that the DEVICE directive is ignored for UPSCABLE ether and not required for UPSCABLE usb).

UPSTYPE driver
The name of a driver. Should be one of dumb, apcsmart, net, usb, pcnet, snmp, or test. This describes your interface type. The UPSTYPE directive can be defined during installation by using the --with-upstype= option of the configure program.
UPSCABLE cable

Defines the type of cable connecting the UPS to your computer.

Possible generic choices for <cable> are:
simple, smart, ether, usb
Or a specific cable model number may be used:
940-0119A, 940-0127A, 940-0128A, 940-0020B, 940-0020C, 940-0023A, 940-0024B, 940-0024C, 940-1524C, 940-0024G, 940-0095A, 940-0095B, 940-0095C, M-04-02-2000

The --with-upscable= option of configure can be used to set a default for this directive during the your build.

DEVICE device

Specify which device is used for UPS communications. For serial ports, it is usually something like /dev/ttyS0. For USB ports, you may leave the name of the device blank (no specification) and apcupsd will automatically search the standard locations for the UPS.

Normally, the configure program will set an appropriate default value. You may also specify the --with-serial-dev= option of the configure program to set this directive at build time.

If you have specified UPSTYPE net, then the device name to be specified consists of hostname:port where the hostname is the fully qualified name or IP address of the host (NIS server) and the port (optional) is the port to use to contact the server.

If you specified UPSTYPE snmp, then the device name becomes hostname:vendor:community. Please see the Support for SNMP UPSes chapter in this manual for more details.

POLLTIME time in seconds
The interval, in seconds, at which apcupsd polls the UPS for status. This rate is automatically set to 1 second if the UPS goes on batteries and reset to your specified value when the mains power returns. This setting applies both to directly-attached UPSes (UPSTYPE apcsmart, usb, dumb) and networked UPSes (UPSTYPE net, snmp). Lowering this setting will improve apcupsd's responsiveness to certain events at the cost of higher CPU utilization. The default of 60 is appropriate for most situations. This directive was formerly known as NETTIME.
LOCKFILE path to lockfile
This option tells apcupsd where to create a lockfile for the USB or serial port in the specified directory. This is important to keep two programs from reading or writing the port at the same time. Please note that although the directive name is LOCKFILE, you are actually specifying the lock file path. apcupsd automatically appends the name of the device when creating the file. On most systems, this directive is automatically set by the ./configure program. You may also explicitly set it during the build process by using the --with-lock-dir= option of the configure program.

Configuration Directives Used by the Network Information Server

None of these directives are required for proper operation of apcupsd.

NETSERVER [on | off]
This configuration directive turns the network information server on or off. If it is on, apcupsd will spawn a child process that serves STATUS and EVENTS information over the network. This information is currently used by the Web-based CGI programs. The default is on. This option is required to be turned on for net clients and apcaccess to function.
NISIP IP-address
This directive specifies the IP address of the network interface on which the NIS server will listen for incoming connections. Default value is 0.0.0.0 which means the NIS will listen for connections on all network interfaces. If your machine has more than one interface, you can specify the IP of a single interface to limit connections to only that interface. Furthermore, you can specify the loopback address (127.0.0.1) to accept connections only from the local machine. You may also use the --with-nisip= option of the configure program to set this directive during the build.
NISPORT port
This configuration directive specifies the port to be used by the apcupsd Network Information Server. The default is platform dependent, but typically 3551, which we have received from IANA as the official apcupsd networking port. This value should only be changed if it conflicts with an existing service in use on your network or if you are running multiple instances of apcupsd on the same machine.
EVENTSFILE filename

If you want the apcupsd network information server to provide the last 10 events via the network, you must specify a file where apcupsd will save these events. The default is: /etc/apcupsd/apcupsd.events. Currently, apcupsd will save at most the last 50 events. Periodically (once an hour by default), apcupsd will check the size of this file. When more than 50 events are recorded, apcupsd will truncate the file to the most recent 10 events. Consequently this file will not grow indefinitely. Although we do not recommend it, you may change these values by editing apcevents.c and changing the appropriate defines. Be aware that if you set these values to very large numbers, apcupsd may make excessive memory demands on the system during the data access and file truncation operations.

This filename may also be specified at build time by using the --with-log-dir= option of the configure program.

Configuration Directives used during Power Failures

In general, none of these directives are required. However, if you have a voltage-signalling (dumb) UPS with a cable that does not support the Low Battery signal, you must set the TIMEOUT directive to force a shutdown.

BATTERYLEVEL percent of battery
If BATTERYLEVEL is specified, during a power failure, apcupsd will halt the system when the remaining battery charge falls below the specified percentage. The default is 5 percent. This directive is ignored for dumb (voltage-signalling) UPSes. To totally disable this counter, set BATTERYLEVEL -1 in your apcupsd.conf file.
MINUTES battery runtime in minutes
If MINUTES is specified, during a power failure, apcupsd will shutdown the system when the remaining runtime on batteries as internally calculated by the UPS falls below the time specified. The default is 3. This directive is ignored for dumb (voltage-signalling) UPSes. It should be noted that some UPSes report an incorrect value for remaining runtime when the battery is fully charged. This can be checked by examining the TIMELEFT value as printed in the output of an 'apcaccess status' command. If the value is zero or otherwise unreasonable, your UPS is probably broken. In this case, we recommend that you disable this timer by setting MINUTES -1 in your apcupsd.conf file.
TIMEOUT time in seconds
After a power failure, apcupsd will halt the system when TIMEOUT seconds have expired. A value of zero disables this timer. Normally for all Smart UPS models and dumb UPSes with cables that support low battery detection, this should be zero so that the shutdown time will be determined by the battery level and/or remaining runtime (see above) or in the case of a voltage-signalling UPS, when the battery is exhausted. This command is required for dumb UPSes that do not provide a battery exhausted signal (only testing can determine this point). For more information, see the Testing Apcupsd section of this manual. This timer can also be useful if you want some slave machines to shutdown before other machines to conserve battery power. It is also useful for testing apcupsd because you can force a rapid shutdown by setting a small value (e.g. 60) and pulling the plug to the UPS.

TIMEOUT, BATTERYLEVEL, and MINUTES can be set together without problems. apcupsd will react to the first case or test that is valid. Normally SmartUPS users will set TIMEOUT to zero so that the system is shutdown depending on the percentage battery charge remaining (BATTERYLEVEL) or the remaining battery runtime (MINUTES).

ANNOY time in seconds

Specify the time in seconds between messages requesting logged in users to get off the system during a power failure. This timer starts only when the UPS is running on batteries. The default is 300 seconds (5 minutes). apcupsd sends the annoy messages by invoking the apccontrol script with the annoyme argument. The default is to send a wall message on Unix systems and a popup message in Windows.

The value of ANNOYDELAY must be greater than the value of ANNOY in order to receive annoy messages (this doesn't make sense, and means that the default values do not generate annoy messages: KES).

Note that if NOLOGON  disable is set, the annoy messages will also be disabled.

ANNOYDELAY time in seconds
Specify delay time in seconds before apcupsd begins requesting logged in users to get off the system during a power failure. This timer starts only after the UPS is running on batteries. This timer is reset when the power returns. The default is 60 seconds. Thus, the first warning to log off the system occurs after 60 seconds on batteries, assuming that NOLOGON is not set to disable.
NOLOGON disable | timeout | percent | minutes | always

Specifies when apcupsd should prevent user logins

The type specified allows you define the point when apcupsd will create the 'nologin' file and thus when user logins are prohibited. Once the 'nologin' file is created, normal users are prevented from logging in. Control of when this file is created is important for allowing systems with big UPSes to run as normally until the system administrator determines the need for preventing user logins. The feature also allows the system administrator to hold the "ANNOY" factor until the 'nologin' file is created. The default is always disable if no NOLOGON directive is specified.

The 'nologin' file will be created in the directory specified by the NOLOGINDIR directive described below.

As far as I can tell, the only useful types are disable and always since the difference in the time when the logout warning is given and shutdown occurs for the other types is very short (KES).

disable prevents apcupsd from creating the nologin file. Consequently, any user can login during a power failure condition. Also, the ANNOY feature is disabled so users will not be warned to logoff the system.

timeout specifies that apcupsd should prohibit logins after the UPS is on batteries for 90% of the time specified on the TIMEOUT configuration directive. Note! Normally you don't want to specify a TIMEOUT value, so this option is probably not too useful (KES).

percent specifies that apcupsd should prohibit logins when the remaining battery charge percentage reaches 110% or less than the value specified on the BATTERYLEVEL configuration directive. Thus if the BATTERYLEVEL is specified as 15, apcupsd will prohibit logins when the battery charge drops below 16% (15% X 110% = 16%).

minutes specifies that apcupsd should prohibit logins when the remaining runtime in minutes reaches 110% or less than the value specified on the MINUTES configuration directive. Thus if MINUTES is set to 3, apcupsd will prohibit logins when the remaining runtime is less than 3 minutes (3 X 110% = 3).

always causes apcupsd to immediately prohibit logins when a power failure occurs. This will also enable the ANNOY feature.

NOLOGINDIR path to nologin dir

This directive configures the directory into which apcupsd will write the nologin file, as described above for the NOLOGON directive.

Normally, the configure program will set an appropriate default value for your platform, often /etc. You may also specify the --with-nologdir= option of the configure program to change the default at compile time.

KILLDELAY time in seconds
If KILLDELAY is set, apcupsd will continue running after a shutdown has been requested, and after the specified time in seconds, apcupsd will attempt to shut off the UPS the power. This directive should normally be disabled by setting the value to zero, but on some systems such as Win32 systems apcupsd cannot regain control after a shutdown to force the UPS to shut off the power. In this case, with proper consideration for the timing, the KILLDELAY directive can be useful. Please be aware, if you cause apcupsd to kill the power to your computer too early, the system and the disks may not have been properly prepared. In addition, apcupsd must continue running after the shutdown is requested, and on Unix systems, this is not normally the case as the system will terminate all processes during the shutdown.
SCRIPTDIR path to apccontrol dir

This option configures the directory in which apccontrol and other event scripts are located.

Normally, the configure program will set an appropriate default value for your platform, often /etc/apcupsd.

PWRFAILDIR path to powerfail dir

When apcupsd shuts down your system, it creates a temporary "flag file" which is used by the operating system halt scripts to know if this shutdown is due to a power failure. This directive configures which directory the flag file will be written into. The chosen directory must be writable by the user apcupsd is running as (normally root) and must not be cleared or unmounted early in the shutdown sequence.

Normally, the configure program will set an appropriate default value for your platform, often /etc/apcupsd. You may also specify the --with-pwrfaildir= option of the configure program to change the default at compile time.

Configuration Directives used to Control System Logging

STATTIME time in seconds
This directive supplies the time interval in seconds between writes to the STATUS file. If set to zero, the STATUS file will not be written. Please note that in a future version of apcupsd the STATUS file code will disappear since its functionality has been replaced by the Network Information Server and by apcaccess status, as a consequence, it is normally disabled by setting it to zero.
STATFILE file
This directive specifies the file to be used when writing the STATUS information. The default is /etc/apcupsd/apcupsd.status.
DATATIME time in seconds
This directives supplies the time interval in seconds between writes of PowerChute-like data information to the log file. See the DATA Logging section of this manual for additional details.
FACILITY log-facility
The FACILITY directive can be used to change the system logging class or facility. The default is DAEMON. This parameter can be useful if you wish to direct the apcupsd system logging information to other than your system default files. See the apcupsd System Logging section of this manual for additional details.

Configuration Directives for Sharing a UPS

The following directives apply to sharing an UPS using a ShareUPS hardware module. Most users will not use this mode.

UPSCLASS standalone | shareslave | sharemaster

The default is standalone and should be used for all machines powered by the UPS and having a serial port or other direct connection to the UPS. This is the normal case.

Use shareslave if and only if you are using a ShareUPS and connected to a BASIC Port with Simple Signal. This code is not fully tested.

Use sharemaster, if and only if you are using a ShareUPS and connected to the ADVANCED Port Smart Signal control. This code is not fully tested.

UPSMODE disable | share

For normal standalone operations, you will set UPSMODE disable to indicate that you are disabling the ShareUPS support.

Use share for two or seven additional simple signal ports on a SmartAccessories(tm) (internal/external box) for SmartUPSes. The share and sharenet code is not fully tested.

Configuration Directives Used to Set the UPS EEPROM

These directives have no effect on the operation of apcupsd but are reserved for use by apctest when bulk programming the values of the UPS EEPROM configuration variables in a Smart-UPS model.

UPSNAME <string>

Name of UPS. Maximum of 8 characters.

BATTDATE [ mm/dd/yy | dd/mm/yy ]

Last battery replacement date. Maximum of 8 characters.

SENSITIVITY [ H | M | L ]

H : High (most sensitive setting) M : Medium L : Low (least sensitive setting)

WAKEUP [ 000 | 060 | 180 | 300 ]

The time delay in seconds that the UPS waits after the return of utility power before "waking up" and restoring power to the connected equipment.

SLEEP [ 020 | 180 | 300 | 600 ]

The time delay in seconds for which the UPS waits or "sleeps" after it receives a request to power off the connected system.

LOTRANSFER <voltage>

Low line voltage causing transfer to battery power or activation of SmartBoost. Allowable values depend on the last letter of the firmware or APCMODEL. Typical values are:

D  106  103  100  097
M  177  172  168  182
A  092  090  088  086
I  208  204  200  196

where D = domestic (USA), M = Canada, A = Asia and I = International.

HITRANSFER <voltage>

High line voltage causing transfer to battery power or activation of SmartTrim. Allowable values depend on the last letter of the firmware or APCMODEL. Typical values are:

D  127  130  133  136
M  229  234  239  224
A  108  110  112  114
I  253  257  261  265

where D = domestic (USA), M = Canada, A = Asia and I = International.

RETURNCHARGE [ 00 | 15 | 50 | 90 ]

Percentage of battery charge needed for the UPS to restore power to the connected equipment.

BEEPSTATE [ 0 | T | L | N ]

Alarm delay.

0 : Zero delay after power fails.
T : When power fails plus 30 seconds.
L : When low battery occurs.
N : Never.

LOWBATT <minutes>

Low battery warning occurs when the specified number of minutes remains before the UPS estimates battery power will be exhausted. There are four user-changeable settings: 2, 5, 7, or 10 minutes

OUTPUTVOLTS <voltage>

UPS nominal output voltage when running on battery. Allowable values depend on the last letter of the firmware or APCMODEL. Typical values are:

D  115
M  208
A  100
I  230  240  220  225

where D = domestic (USA), M = Canada, A = Asia and I = International.

SELFTEST [ 336 | 168 | ON | OFF ]

Self test interval in hours (336 = 2 weeks, 168 = 1 week, ON = at power on, OFF = never).

apcupsd Status Logging

There is a good deal of information available about the UPS and apcupsd's status. This document describes the format of that information. Normally you will get at it via apcaccess, but there are other ways as well.

Status report format

STATUS output is in ASCII format with a single data value or piece of information on each line output. Because not all UPSes supply the same information, the output varies based on the type of UPS that you are using. In general, if the information is not available for your UPS, the line will be missing entirely or the data portion of the output record will contain an N/A indicating that the information is not available.

Status logging consists of periodically logging ALL available information concerning the UPS. Since the volume of data is rather large (over 1000 bytes per status), the STATUS data is not automatically sent to the system log file. Instead, it is written as a series of data records in a specific file (normally /etc/apcupsd/apcupsd.status).

After each write, the file is rewound so that the size of the file remains constant. The STATUS file is kept for backward compatibility and will be eliminated in a future version of apcupsd. The preferred method for obtaining this information is from apcaccess or by using the CGI interface (see apcupsd Network Monitoring (CGI) Programs).

To make reading the status data reliable via a named pipe, the first record written contains a version number, the number of records that follow the first record, and the total number of bytes in those subsequent records. An actual example of such a status file (/etc/apcupsd/apcupsd.status) is shown below.

Consequently, the first record always consists of 24 bytes (23 characters followed by a newline). This record starts with APC and as indicated in the example is followed by 37 records consisting of 906 bytes. The last record begins with END APC and contains the date and time matching the DATE record.

When this data is written to a file, it is written as two records, the first record, and all the other records together. In reading the file, it can be either be read a record at a time, or in one big read.

When this data is written to syslog(), it is written a record at a time. The first record is the first 24 bytes. By having the number of records and the size in the first record, the complete status can be reliably reassembled.

Status Report Example

An example of output from a BackUPS RS 1500 follows:

APC      : 001,037,0906
DATE     : Sun Apr 26 17:22:22 EDT 2009
HOSTNAME : mail.kroptech.com
VERSION  : 3.14.2 (10 September 2007) redhat
UPSNAME  : ups0
CABLE    : USB Cable
MODEL    : Back-UPS RS 1500
UPSMODE  : Stand Alone
STARTTIME: Sun Apr 26 10:22:46 EDT 2009
STATUS   : ONLINE
LINEV    : 123.0 Volts
LOADPCT  :  24.0 Percent Load Capacity
BCHARGE  : 100.0 Percent
TIMELEFT : 144.5 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
SENSE    : Medium
LOTRANS  : 097.0 Volts
HITRANS  : 138.0 Volts
ALARMDEL : Always
BATTV    : 26.8 Volts
LASTXFER : Low line voltage
NUMXFERS : 0
TONBATT  : 0 seconds
CUMONBATT: 0 seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x07000008 Status Flag
MANDATE  : 2003-05-08
SERIALNO : JB0319033692
BATTDATE : 2001-09-25
NOMINV   : 120
NOMBATTV :  24.0
FIRMWARE : 8.g6 .D USB FW:g6
APCMODEL : Back-UPS RS 1500
END APC  : Sun Apr 26 17:22:32 EDT 2009

Status Report Fields

The meaning of the above variables are:

APC
Header record indicating the STATUS format revision level, the number of records that follow the APC statement, and the number of bytes that follow the record.
DATE
The date and time that the information was last obtained from the UPS.
HOSTNAME
The name of the machine that collected the UPS data.
UPSNAME
The name of the UPS as stored in the EEPROM or in the UPSNAME directive in the configuration file.
VERSION
The apcupsd release number, build date, and platform.
CABLE
The cable as specified in the configuration file (UPSCABLE).
MODEL
The UPS model as derived from information from the UPS.
UPSMODE
The mode in which apcupsd is operating as specified in the configuration file (UPSMODE)
STARTTIME
The time/date that apcupsd was started.
STATUS
The current status of the UPS (ONLINE, CHARGING, ONBATT, etc.)
LINEV
The current line voltage as returned by the UPS.
LOADPCT
The percentage of load capacity as estimated by the UPS.
BCHARGE
The percentage charge on the batteries.
TIMELEFT
The remaining runtime left on batteries as estimated by the UPS.
MBATTCHG
If the battery charge percentage (BCHARGE) drops below this value, apcupsd will shutdown your system. Value is set in the configuration file (BATTERYLEVEL)
MINTIMEL
apcupsd will shutdown your system if the remaining runtime equals or is below this point. Value is set in the configuration file (MINUTES)
MAXTIME
apcupsd will shutdown your system if the time on batteries exceeds this value. A value of zero disables the feature. Value is set in the configuration file (TIMEOUT)
MAXLINEV
The maximum line voltage since the UPS was started, as reported by the UPS
MINLINEV
The minimum line voltage since the UPS was started, as returned by the UPS
OUTPUTV
The voltage the UPS is supplying to your equipment
SENSE
The sensitivity level of the UPS to line voltage fluctuations.
DWAKE
The amount of time the UPS will wait before restoring power to your equipment after a power off condition when the power is restored.
DSHUTD
The grace delay that the UPS gives after receiving a power down command from apcupsd before it powers off your equipment.
DLOWBATT
The remaining runtime below which the UPS sends the low battery signal. At this point apcupsd will force an immediate emergency shutdown.
LOTRANS
The line voltage below which the UPS will switch to batteries.
HITRANS
The line voltage above which the UPS will switch to batteries.
RETPCT
The percentage charge that the batteries must have after a power off condition before the UPS will restore power to your equipment.
ITEMP
Internal UPS temperature as supplied by the UPS.
ALARMDEL
The delay period for the UPS alarm.
BATTV
Battery voltage as supplied by the UPS.
LINEFREQ
Line frequency in hertz as given by the UPS.
LASTXFER
The reason for the last transfer to batteries.
NUMXFERS
The number of transfers to batteries since apcupsd startup.
XONBATT
Time and date of last transfer to batteries, or N/A.
TONBATT
Time in seconds currently on batteries, or 0.
CUMONBATT
Total (cumulative) time on batteries in seconds since apcupsd startup.
XOFFBATT
Time and date of last transfer from batteries, or N/A.
SELFTEST

The results of the last self test, and may have the following values:

  • OK: self test indicates good battery
  • BT: self test failed due to insufficient battery capacity
  • NG: self test failed due to overload
  • NO: No results (i.e. no self test performed in the last 5 minutes)
STESTI
The interval in hours between automatic self tests.
STATFLAG
Status flag. English version is given by STATUS.
DIPSW
The current dip switch settings on UPSes that have them.
REG1
The value from the UPS fault register 1.
REG2
The value from the UPS fault register 2.
REG3
The value from the UPS fault register 3.
MANDATE
The date the UPS was manufactured.
SERIALNO
The UPS serial number.
BATTDATE
The date that batteries were last replaced.
NOMOUTV
The output voltage that the UPS will attempt to supply when on battery power.
NOMINV
The input voltage that the UPS is configured to expect.
NOMBATTV
The nominal battery voltage.
NOMPOWER
The maximum power in Watts that the UPS is designed to supply.
HUMIDITY
The humidity as measured by the UPS.
AMBTEMP
The ambient temperature as measured by the UPS.
EXTBATTS
The number of external batteries as defined by the user. A correct number here helps the UPS compute the remaining runtime more accurately.
BADBATTS
The number of bad battery packs.
FIRMWARE
The firmware revision number as reported by the UPS.
APCMODEL
The old APC model identification code.
END APC
The time and date that the STATUS record was written.

Logging the STATUS Information

If specified in the configuration file, the STATUS data will also be written to the system log file. Please note, that it would not normally be wise to write this data to a normal system log file as there is no mechanism in syslog() to rewind the file and hence the log file would quickly become enormous. However, in two cases, it can be very useful to use syslog() to write this information.

The first case is to set up your syslog.conf file so that the data is written to a named pipe. In this case, normally not more than about 8192 bytes of data will be kept before it is discarded by the system.

The second case is to setup your syslog.conf file so that the status data is sent to another machine, which presumably then writes it to a named pipe. Consequently, with this mechanism, provides a simple means of networking apcupsd STATUS information.

Although we mention system logging of STATUS information, we strongly recommend that you use apcaccess or the CGI interface to get this information.

The Shutdown Sequence and its Discontents

Shutdown Sequence

If you experienced so problems with the testing procedures, or if you are porting apcupsd to another system, or you are simply curious, you may want to know exactly what is going on during the shutdown process.

The shutdown sequence is as follows:

  • apcupsd detects that there is a power problem and it calls /etc/apcupsd/apccontrol powerout. By default this event does nothing, but it can be overridden to notify users, etc.

  • After the configured ONBATTERYDELAY, apcupsd calls /etc/apcupsd/apccontrol onbattery, which normally sends a message to all users informing them that the UPS is on batteries.

  • When one of the conditions listed below occurs, apcupsd issues a shutdown command by calling /etc/apcupsd/apccontrol doshutdown, which should perform a shutdown of your system using the system shutdown(8) command. You can modify the behavior as described in Customizing Event Handling.

    The conditions that trigger the shutdown can be any of the following:

    • Running time on batteries have expired (TIMEOUT)
    • The battery runtime remaining is below the configured value (BATTERYLEVEL)
    • The estimated remaining runtime is below the configured value (MINUTES)
    • The UPS signals that the batteries are exhausted.

    A shutdown could also be initiated if apcupsd detects that the batteries are no longer functioning correctly. This case, though very unusual, can happen at any time even if there is proper mains voltage, and /etc/apcupsd/apccontrol emergency is called.

    Just before initiating any shutdown through the apccontrol script, apcupsd will create the file /etc/apcupsd/powerfail. This file will be used later in the shutdown sequence to recall apcupsd after syncing of the disks to initiate a power off of the UPS.

    If the /etc/nologin file has not already been created, it will normally be created during the shutdown sequence to prevent additional users from logging in (see the NOLOGIN configuration directive).

    Even though apcupsd has requested the system to perform a shutdown, it continues running.

  • When the system signals apcupsd to do exit, it does so. This is part of the normal system shutdown (at least on Unix and Linux systems) and the exact time that apcupsd receives the termination signal depends on how the shutdown links (usually in /etc/rc.d) are set.

    Note that on Windows NT systems, apcupsd apparently continues to run as a Service even though the machine is "shutdown".

  • During the shutdown of the system after apcupsd has been forced to exit, one of the last things done by the system shutdown is to call the halt script, which is usually in /etc/rc.d/halt or /etc/rc.d/init.d/halt, or possibly in /sbin/init.d/rc.0 depending on your system. If apcupsd was properly installed, this standard halt script was modified to include a bit of new logic just before the final halt of the system. It first tests if the file /etc/apcupsd/powerfail exists, and if it does, it executes /etc/apcupsd/apccontrol killpower. It is this last step that will cause apcupsd to be re-executed with the --killpower option on the command line. This option tells apcupsd to inform the UPS to kill the power.

This final step is important if you want to ensure that your system will automatically reboot when the power comes back on. The actual code used on the Red Hat version is:

# See if this is a powerfail situation.                              # ***apcupsd***
if [ -f /etc/apcupsd/powerfail ]; then                               # ***apcupsd***
  echo                                                               # ***apcupsd***
  echo "APCUPSD will now power off the UPS"                          # ***apcupsd***
  echo                                                               # ***apcupsd***
  /etc/apcupsd/apccontrol killpower                                  # ***apcupsd***
  echo                                                               # ***apcupsd***
  echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd***
  echo "Otherwise, the UPS may cut the power during the reboot!!!"   # ***apcupsd***
  echo                                                               # ***apcupsd***
fi                                                                   # ***apcupsd***

The above code must be inserted as late as possible in the halt script. On many systems, such as Red Hat, all the disk drives were unmounted, then remounted read-only, thus permitting access to the /etc files and the apcupsd executable. If your system does not explicitly remount the disks, you must remount them in read-only mode in the code that you add. Examples of code fragments that do this can be found in the distributions/suse subdirectory of the source.

If you are not able to insert the above code in your halt script because there is no halt script, or because your halt script calls the init program as some Unix systems do, you can either just forget about powering off the UPS, which means that your machine will not automatically reboot after a power failure, or there is yet another alternative, though not at all as satisfying as inserting code in the halt script.

Only if you cannot insert the appropriate code in the halt script, when you start apcupsd, normally from the /etc/rc.d/init.d/apcupsd script, use the --kill-on-powerfail option. This will cause apcupsd to program the UPS to shutoff the power just before it (apcupsd) does the system shutdown. Please note that this is not the most ideal solution. Read on to understand why.

A very important consideration is that you must set the EEPROM in your UPS so that it waits a sufficient time for the system to halt before it shuts off the UPS power.

When using a USB connection, apcupsd automatically sets this value to 60 seconds. When using a serial connection to a SmartUPS, you must configure the value in the UPS EEPROM by hand using apctest.

Shutdown Problems

Obviously if your halt script is not properly modified, apcupsd will not be able to shut off the power to the UPS, and if the power returns before the batteries are exhausted your system will not automatically reboot. In any case, your machine should have been cleanly shut down.

Master/Slave Shutdown

In master/slave configurations, however, the master cannot be 100 percent sure that the slaves have all shutdown before it performs the power off. To avoid this situation, be sure to configure any slaves (clients) to shut down before the master by setting different TIMEOUT, BATTERYLEVEL, or MINUTES parameters in the config file.

Also, on a slave machine, you do not want to use the modified halt script since it will recall apcupsd, which will detect that it is a slave (i.e. no connection to the UPS) and will complain that it cannot do the killpower. This situation is not harmful just annoying and possibly confusing.

One possible problem during shutdown can be caused by remnants of old versions. Please be sure to delete or rename all prior versions (/usr/local/sbin/apcupsd or /sbin/powersc).

Startup

Normally, apcupsd is automatically started when your system is rebooted. This normally occurs because the startup script apcupsd is linked into the appropriate places in /etc/rc.d. On most Linux systems, there is a program called chkconfig(8) that will automatically link the startup script. This program is invoked by the make install scripts, or it is explicitly done for those systems that do not have chkconfig(8). If this is not the case, you can either link it in appropriately yourself or explicitly call it from your rc.local file. The appropriate manual way to startup apcupsd is by executing:

<path>/apcupsd start

where path is normally /etc/rc.d or /etc/rc.d/init.d depending on your system. Using this script is important so that any files remaining around after a power failure are removed. Likewise, shutting down apcupsd should be done with the same script:

<path>/apcupsd stop

Windows Considerations

Please see the Killpower under Windows chapter of this manual for considerations pertaining to shutdown and killpower on Windows.

APC smart protocol

The APC UPS protocol was originally analyzed by Pavel Korensky with additions from Andre H. Hendrick beginning in 1995, and we want to give credit for good, hard work, where credit is due. After having said that, you will see that Steven Freed built much of the original apcupsd information file.

The start of this chapter of the apcupsd manual in HTML format was pulled from the Network UPS Tools (NUT) site (http://www.networkupstools.org/protocols/apcsmart.html). It has been an invaluable tool in improving apcupsd, and I consider it the Bible of APC UPS programming. In the course of using it, I have added information gleaned from apcupsd and information graciously supplied by APC.

Description

Here's the information on the elusive APC smart signaling protocol used by their higher end units (Back-UPS Pro, Smart-UPS, Matrix-UPS, etc). What you see here has been collected from a variety of sources. Some people analyzed the chatter between PowerChute and their hardware. Others sent various characters to the UPS and figured out what the results meant.

RS-232 differences

Normal 9 pin serial connections have TxD on 3 and RxD on 2. APC's smart serial ports put TxD on pin 1 and RxD on pin 2. This means you go nowhere if you use a normal straight through serial cable. In fact, you might even power down the load if you plug one of those cables in. This is due to the odd routing of pins - DTR and RTS from the PC usually wind up driving the on/off line. So, when you open the port, they go high and *poof* your computer dies.

The Smart Protocol

Despite the lack of official information from APC, this table has been constructed. It's standard RS-232 serial communications at 2400 bps/8N1. Don't rush the UPS while transmitting or it may stop talking to you. This isn't a problem with the normal single character queries, but it really does matter for multi-char things like "@000". Sprinkle a few calls to usleep() in your code and everything will work a lot better.

The following table describes the single character "Code" or command that you can send to the UPS, its meaning, and what sort of response the UPS will provide. Typically, the response shown below is followed by a newline (\n in C) and a carriage return (\r in C). If you send the UPS a command that it does not recognize or that is not available on your UPS, it will normally respond with "NA" for "not available", otherwise the response is given in the "Typical results" column.

Character Meaning Typical results Other info
^A Model string SMART-UPS 700 Spotty support for this query on older models
^N Turn on UPS n/a Send twice, with 1.5s delay between chars. Only on 3rd gen SmartUPS and Black Back-UPS Pros
^Z Permitted EEPROM Values long string Gives the EEPROM permitted values for your model. See EEPROM Values for details.
A Front panel test Light show + "OK" Also sounds the beeper for 2 seconds
B Battery voltage 27.87 Varies based on current level of charge. See also Nominal Battery Voltage.
C Internal Temperature 036.0 Units are degrees C
D Runtime calibration !, then $ Runs until battery is below 25% (35% for Matrix) Updates the 'j' values. Only works at 100% battery charge. Can be aborted with a second "D"
E Automatic self test interval 336

Writable variable. Possible values:

  • "336" (14 days)
  • "168" (7 days)
  • "ON " (at power on) note extra space
  • "OFF" (never)
F Line frequency 60.00 Units are Hz. Value varies based on locality, usually 50/60.
G Cause of last transfer to battery O

Possible values:

  • R (unacceptable utility voltage rate of change)
  • H (high utility voltage)
  • L (low utility voltage)
  • T (line voltage notch or spike)
  • O (no transfers since turnon)
  • S (transfer due to U command or activation of UPS test from front panel)
  • NA (transfer reason still not available; read again)
I Measure-UPS Alarm enable FF not decoded yet
J Measure-UPS Alarm status 0F,00 not decoded yet
K Shutdown with grace period (no return) OK or * Send twice with > 1.5s delay between chars. Older units send "*" instead of "OK". Length of grace period is set with Grace Period command. UPS will remain off and NOT power on if utility power is restored.
L Input line voltage 118.3 Value varies based on locality. Does not always read 000.0 on line failure.
M Maximum line voltage 118.9 This is the max voltage since the last time this query was run.
N Minimum line voltage 118.1 This is the min voltage since the last time this query was run.
O Output voltage 118.3 Also see on battery output voltage.
P Power load % 023.5 Relative to capacity of the UPS.
Q Status flags 08 Bitmapped, see status bits below
R Turn dumb BYE Only on 3rd gen SmartUPS, SmartUPS v/s, BackUPS Pro. Must send enter smart mode command to resume comms.
S Soft shutdown OK Command executes after grace period. UPS goes online when power returns. Only works when on battery.
U Simulate power failure !, then $ See Alert messages section for info on ! and $.
V Old firmware revision "GWD" or "IWI" See Interpretation of the Old Firmware Revision
W Self test OK Tests battery, like pushing button on the front panel. Results stored in "X"
X Self test results OK

Possible values:

  • OK = good battery
  • BT = failed due to insufficient capacity
  • NG = failed due to overload
  • NO = no results available (no test performed in last 5 minutes)
Y Enter smart mode SM This must be sent before any other commands will work. See also turn dumb command to exit smart mode.
Z Shutdown immediately n/a Send twice with > 1.5s delay between chars. UPS switches load off immediately (no grace period)
a Protocol info long string

Returns three main sections delimited by periods:

  • Protocol version
  • Alert messages (aka async notifiers)
  • Valid commands
b Firmware revision 50.9.D

See Interpretation of the New Firmware Revision.

Decoding the example:

  • 50 = SKU (variable length)
  • 9 = firmware revision
  • D = country code (D=USA, I=International, A=Asia, J=Japan, M=Canada)
c UPS local id UPS_IDEN Writable variable. Up to 8 letter identifier for keeping track of your hardware.
e Return threshold 00

Writable variable. Minimum battery charge % before UPS will return online after a soft shutdown. Possible values:

  • 00 = 00% (UPS turns on immediately)
  • 01 = 15%
  • 02 = 25%
  • 03 = 90%
f Battery level % 099.0 Percentage of battery charge remaining
g Nominal battery voltage 024 The battery voltage that's expected to be present in the UPS normally. This is a constant based on the type, number, and wiring of batteries in the UPS. Typically "012", "024" or "048".
h Measure-UPS ambient humidity (%) 042.4 Percentage. Only works on models with Measure-UPS SmartSlot card.
i Measure-UPS dry contacts 00

Bitmapped hex variable. Mapping:

  • 10 = contact 1
  • 20 = contact 2
  • 40 = contact 3
  • 80 = contact 4
j Estimated runtime 0327: Value is in minutes. Terminated with a colon.
k Alarm delay 0

Writable variable. Controls behavior of UPS beeper. Possible values:

  • 0 = 5 second delay after power fail
  • T = 30 second delay
  • L = alarm at low battery only
  • N = no alarm
l Low transfer voltage 103 Writable variable. UPS goes on battery when voltage drops below this point.
m Manufacture date 11/29/96 Format may vary by country (MM/DD/YY vs DD/MM/YY). Unique within groups of UPSes (production runs)
n Serial number WS9643050926 Unique for each UPS
o Nominal Output Voltage 115 Expected output voltage when running on batteries. May be a writable variable on 220/230/240 VAC units.
p Shutdown grace delay 020 Seconds. Writable variable. Sets the delay before soft shutdown completes. (020/180/300/600)
q Low battery warning 02 Minutes. Writable variable. The UPS will report a low battery condition this many minutes before it runs out of power
r Wakeup delay 000 Seconds. Writable variable. The UPS will wait this many seconds after reaching the minimum charge before returning online. (000/060/180/300)
s Sensitivity H

Writable variable. Possible values:

  • H = highest
  • M = medium
  • L = lowest
  • A = autoadjust (Matrix only)
t Measure-UPS ambient temperature 80.5 Degrees C. Only works on models with the Measure-UPS SmartSlot card.
u Upper transfer voltage 132 Writable variable. UPS goes on battery when voltage rises above this point.
v Measure-UPS firmware 4Kx Firmware information for Measure-UPS board
x Last battery change date 11/29/96 Writable variable. Holds whatever the user set in it. Eight characters.
y Copyright notice (C) APCC Only works if firmware letter is later than O
z Reset to factory settings CLEAR Resets most variables to initial factory values except identity or battery change date. Not available on SmartUPS v/s or BackUPS Pro.
+ Capability cycle (forward) various Cycle forward through possible capability values. UPS sends afterward to confirm change to EEPROM.
- Capability cycle (backward) various Cycle backward through possible capability values. UPS sends afterward to confirm change to EEPROM.
@nnn Shutdown and return OK or * UPS shuts down after grace period with delayed wakeup after nnn tenths of an hour plus any wakeup delay time. Older models send "*" instead of "OK".
0x7f Abort shutdown OK Use to abort @, S, K
~ Register #1 see below See Register 1 table
' Register #2 see below See Register 2 table
0 Battery constant   See Resetting the UPS Battery Constant
4 ???   Prints 35 on SmartUPS 1000
5 ???   Prints EF on SmartUPS 1000
6 ???   Prints F9 on SmartUPS 1000
7 DIP switch positions   See Dip switch info
8 Register #3 see below See Register 3 table
9 Line quality FF

Possible values:

  • 00 = unacceptable
  • FF = acceptable
> Number of external battery packs   SmartCell models return number of connected packs. Other models return value set by the user (use +/-).
[ Measure-UPS Upper temp limit NO,NO Degrees C. Writable Variable. Possible values: 55, 50, 45, ..., 05. Use +/- to change values.
] Measure-UPS lower temp limit NO,NO Degrees C. Writable Variable. Possible values: 55, 50, 45, ..., 05. Use +/- to change values.
{ Measure-UPS Upper humidity limit NO,NO Percentage. Writable Variable. Possible values: 90, 80, 70, ..., 10. Use +/- to change values.
} Measure-UPS lower humidity limit NO,NO Percentage. Writable Variable. Possible values: 90, 80, 70, ..., 10. Use +/- to change values.
Matrix-UPS and Symmetra Commands
^ Run in bypass mode BYP, INV, ERR If online, "BYP" response is received as bypass mode starts. If already in bypass, "INV" is received and UPS goes online. If UPS can't transfer, "ERR" received
< Number of bad battery packs 000 Count of bad packs connected to the UPS
/ Load current nn.nn True RMS load current drawn by UPS
\ Apparent load power nnn.nn Output load as percentage of full rated load in VA.
^V Output voltage selection  

Writable variable. Possible values:

  • A = automatic (based on input tap)
  • M = 208 VAC
  • I = 240 VAC
^L Front panel language  

Writable variable. Possible values:

  • E = English
  • F = French
  • G = German
  • S = Spanish
  • 1 = unknown
  • 2 = unknown
  • 3 = unknown
  • 4 = unknown
w Run time conservation  

Writable variable. Minutes of runtime to leave in battery (UPS shuts down "early"). Possible values:

  • NO = disabled
  • 02 = leave 2 minutes of runtime
  • 05 = leave 5 minutes
  • 08 = leave 8 minutes

Dip switch info

Bit Switch Option when bit=1
0 4 Low battery alarm changed from 2 to 5 mins. Autostartup disabled on SU370ci and 400
1 3 Audible alarm delayed 30 seconds
2 2 Output transfer set to 115 VAC (from 120 VAC) or to 240 VAC (from 230 VAC)
3 1 UPS desensitized - input voltage range expanded
4-7   Unused at this time

Status bits

This is probably the most important register of the UPS, which indicates the overall UPS status. Some common things you'll see:

  • 08 = On line, battery OK
  • 10 = On battery, battery OK
  • 50 = On battery, battery low
  • SM = Status bit is still not available (retry reading)
Bit Meaning when bit=1
0 Runtime calibration occurring (Not reported by Smart UPS v/s and BackUPS Pro)
1 SmartTrim (Not reported by 1st and 2nd generation SmartUPS models)
2 SmartBoost
3 On line (this is the normal condition)
4 On battery
5 Overloaded output
6 Battery low
7 Replace battery

Alert messages

These single character messages are sent by the UPS any time there is an Alert condition. All other responses indicated above are sent by the UPS only in response to a query or action command.

Character Meaning Description
! Line Fail Sent when the UPS goes on-battery, repeated every 30 seconds until low battery condition reached. Sometimes occurs more than once in the first 30 seconds.
$ Return from line fail UPS back on line power. Only sent if a ! has been sent previously.
% Low battery Sent to indicate low battery. Not implemented on SmartUPS v/s or BackUPS Pro models
+ Return from low batt Sent when the battery has been recharged to some level Only sent if a % has been sent previously.
? Abnormal condition Sent for conditions such as "shutdown due to overload" or "shutdown due to low battery capacity". Also occurs within 10 minutes of turnon.
= Return from abnormal condition Sent when the UPS returns from an abnormal condition where ? was sent, but not a turn-on. Not implemented on SmartUPS v/s or BackUPS Pro models.
* About to turn off Sent when the UPS is about to switch off the load. No commands are processed after this character is sent. Not implemented on SmartUPS v/s, BackUPS Pro, or 3rd generation SmartUPS models.
# Replace battery Sent when the UPS detects that the battery needs to be replaced. Sent every 5 hours until a new battery test is run or the UPS is shut off. Not implemented on SmartUPS v/s or BackUPS Pro models.
& Check alarm register for fault (Measure-UPS) Sent to signal that temp or humidity out of set limits. Also sent when one of the contact closures changes state. Sent every 2 minutes until the alarm conditions are reset. Only sent for alarms enabled with I. Cause of alarm may be determined with J. Not implemented on SmartUPS v/s or BackUPS Pro.
| Variable change in EEPROM Sent whenever any EEPROM variable is changed. Only supported on Matrix UPS and 3rd generation SmartUPS models.

Register 1

All bits are valid on the Matrix UPS. SmartUPS models only support bits 6 and 7. Other models do not respond.

Bit Meaning when bit=1
0 In wakeup mode (typically lasts < 2s)
1 In bypass mode due to internal fault (see Register 2 or Register 3)
2 Going to bypass mode due to command
3 In bypass mode due to command
4 Returning from bypass mode
5 In bypass mode due to manual bypass control
6 Ready to power load on user command
7 Ready to power load on user command or return of line power

Register 2

Matrix UPS models report bits 0-5. SmartUPS models only support bits 4-6. SmartUPS v/s and BackUPS Pro report bits 4, 6, 7. Unused bits are set to 0. Other models do not respond.

Bit Meaning when bit=1
0 Fan failure in electronics, UPS in bypass
1 Fan failure in isolation unit
2 Bypass supply failure
3 Output voltage select failure, UPS in bypass
4 DC imbalance, UPS in bypass
5 Battery is disconnected
6 Relay fault in SmartTrim or SmartBoost
7 Bad output voltage

Register 3

All bits are valid on the Matrix UPS and 3rd generation SmartUPS models. SmartUPS v/s and BackUPS Pro models report bits 0-5. All others report 0-4. State change of bits 1,2,5,6,7 are reported asynchronously with ? and = messages.

Bit Meaning when bit=1
0 Output unpowered due to shutdown by low battery
1 Unable to transfer to battery due to overload
2 Main relay malfunction - UPS turned off
3 In sleep mode from @ command (maybe others)
4 In shutdown mode from S command
5 Battery charger failure
6 Bypass relay malfunction
7 Normal operating temperature exceeded

Interpretation of the Old Firmware Revision

The Old Firmware Revision is obtained with the "V" command, which gives a typical response such as "GWD" or "IWI", and can be interpreted as follows:

Old Firmware revision and model ID String for SmartUPS & MatrixUPS

This is a three character string XYZ

   where X == Smart-UPS or Matrix-UPS ID Code.
     range 0-9 and A-P
       1 == unknown
       0 == Matrix 3000
       5 == Matrix 5000
     the rest are Smart-UPS and Smart-UPS-XL
       2 == 250       3 == 400       4 == 400
       6 == 600       7 == 900       8 == 1250
       9 == 2000      A == 1400      B == 1000
       C == 650       D == 420       E == 280
       F == 450       G == 700       H == 700XL
       I == 1000      J == 1000XL    K == 1400
       L == 1400XL    M == 2200      N == 2200XL
       O == 3000      P == 5000

   where Y == Possible Level of Smart Features, unknown???
       G == Stand Alone
       T == Stand Alone
               V == ???
       W == Rack Mount

   where Z == National Model Use Only Codes
       D == Domestic        115 Volts
       I == International   230 Volts
       A == Asia ??         100 Volts
       J == Japan ??        100 Volts

Interpretation of the New Firmware Revision

New Firmware revision and model ID String in NN.M.L is the format

    where NN == UPS ID Code.
        12 == Back-UPS Pro 650
        13 == Back-UPS Pro 1000
        52 == Smart-UPS 700
        60 == SmartUPS 1000
        72 == Smart-UPS 1400

        where NN now Nn has possible meanings.
            N  == Class of UPS
            1n == Back-UPS Pro
            5n == Smart-UPS
            7n == Smart-UPS NET

             n == Level of intelligence
            N1 == Simple Signal, if detectable WAG(*)
            N2 == Full Set of Smart Signals
            N3 == Micro Subset of Smart Signals

    where M == Possible Level of Smart Features, unknown???
        1 == Stand Alone
        8 == Rack Mount
        9 == Rack Mount

    where L == National Model Use Only Codes
        D == Domestic        115 Volts
        I == International   230 Volts
        A == Asia ??         100 Volts
        J == Japan ??        100 Volts
        M == North America   208 Volts (Servers)

EEPROM Values

Upon sending a ^Z, your UPS will probably spit back approximately 254 characters something like the following (truncated here for the example):

#uD43132135138129uM43229234239224uA43110112114108 ....

It looks bizarre and ugly, but is easily parsed. The # is some kind of marker/ident character. Skip it. The rest fits this form:

  • Command character - use this to select the value
  • Locale - use 'b' to find out what yours is (the last character), '4' applies to all
  • Number of choices - '4' means there are 4 possibilities coming up
  • Choice length - '3' means they are all 3 chars long

Then it's followed by the choices, and it starts over.

Matrix-UPS models have ## between each grouping for some reason.

Here is an example broken out to be more readable:

CMD DFO RSP FSZ FVL
u   D   4   3   127 130 133 136
u   M   4   3   229 234 239 224
u   A   4   3   108 110 112 114
u   I   4   3   253 257 261 265
l   D   4   3   106 103 100 097
l   M   4   3   177 172 168 182
l   A   4   3   092 090 088 086
l   I   4   3   208 204 200 196
e   4   4   2   00   15  50  90
o   D   1   3   115
o   J   1   3   100
o   I   1   3   230 240 220 225
o   M   1   3   208
s   4   4   1     H   M   L   L
q   4   4   2    02  05  07  10
p   4   4   3   020 180 300 600
k   4   4   1     0   T   L   N
r   4   4   3   000 060 180 300
E   4   4   3   336 168  ON OFF

CMD == UPSlink Command.
    u = upper transfer voltage
    l = lower transfer voltage
    e = return threshold
    o = output voltage
    s = sensitivity
    p = shutdown grace delay
    q = low battery warning
    k = alarm delay
    r = wakeup delay
    E = self test interval

DFO == (4)-all-countries (D)omestic (I)nternational (A)sia (J)apan
     (M) North America - servers.
RSP == Total number possible answers returned by a given CMD.
FSZ == Max. number of field positions to be filled.
FVL == Values that are returned and legal.

Programming the UPS EEPROM

There are at this time a maximum of 12 different values that can be programmed into the UPS EEPROM. They are:

Command Meaning
c The UPS Id or name
x The last date the batteries were replaced
u The Upper Transfer Voltage
l The Lower Transfer Voltage
e The Return Battery Charge Percentage
o The Output Voltage when on Batteries
s The Sensitivity to Line Quality
p The Shutdown Grace Delay
q The Low Battery Warning Delay
k The Alarm Delay
r The Wakeup Delay
E The Automatic Self Test Interval

The first two cases (Ident and Batt date) are somewhat special in that you tell the UPS you want to change the value, then you supply 8 characters that are saved in the EEPROM. The last ten item are programmed by telling the UPS that you want it to cycle to the next permitted value.

In each case, you indicate to the UPS that you want to change the EEPROM by first sending the appropriate query command (e.g. "c" for the UPS ID or "u" for the Upper Transfer voltage. This command is then immediately followed by the cycle EEPROM command or "-". In the case of the UPS Id or the battery date, you follow the cycle command by the eight characters that you want to put in the EEPROM. In the case of the other ten items, there is nothing more to enter.

The UPS will respond by "OK" and approximately 5 seconds later by a vertical bar (|) to indicate that the EEPROM was changed.

Apcupsd RPM Packaging FAQ

How do I build Apcupsd for platform xxx?

The apcupsd spec file contains defines to build for several platforms: RedHat 7.x (rh7), RedHat 8.0 (rh8), RedHat 9 (rh9), Fedora Core (fedora_core), RedHat Enterprise Linux and clones (rhel3 and rhel4), SuSE 9 & 10 (suse), and Mandrake (mdk). The package build is controlled by a define set at the beginning of the file. These defines basically just control the dependency information that gets coded into the finished rpm package. So while you could technically build a package without defining a platform, or with an incorrect platform, and have it install and run it would not contain correct dependency information for the rpm database. The platform define may be edited in the spec file directly (by default all defines are set to 0 or "not set"). For example, to build the RedHat 7.x package find the line in the spec file which reads

%define rh7 0

and edit it to read

%define rh7 1

Alternately you may pass the define on the command line when calling rpmbuild:

rpmbuild -ba --define "build_rh7 1" apcupsd.spec
rpmbuild --rebuild --define build_rh7 1" apcupsd-x.x.x-x.src.rpm
How do I control whether usb support gets built?

Up through version 3.12, by default standard serial port support was built and the apcupsd-std package was produced. The usb package pre-configured the configuration files for usb devices and installed a couple additional tools in /etc/apcupsd but the usb driver was built regardless. To get the usb package and support in those versions either set the

%define usb 0

to

%define usb 1

in the spec file directly or pass it to rpmbuild on the command line:

rpmbuild -ba --define "build_rh7 1" --define "build_usb 1" apcupsd.spec

With the release of 3.14 USB support is now considered standard and the apcupsd-std and apcupsd-usb packages are obsoleted in favor of a single apcupsd package configured for usb connected UPS's. The serial port driver is still built and can be configured accordingly after installation. If you are performing an upgrade it will of course not replace your current config file.

The build directive:

--define "build_usb 1"

is no longer recognized.

What other defines are used?

There is a define for the initdir for the daemon control script. On RedHat or Mandrake systems this is set to /etc/rc.d/init.d/. On SuSE systems this is set to /etc/rc.d. You would only need to edit this if packaging for a platform that uses a different directory.

A second define controls whether the Gnome monitoring application, new in the 3.14 release, is built. This application requires the Gtk2 version to be >= 2.4. If you want to build the apcupsd-gapcmon package add:

--define "build_gapcmon 1"

A third define controls whether the SNMP driver is built. If you want to build the net-snmp driver add:

--define "build_snmp 1"
Can I supply packages for other platforms you do not publish?
Yes, there are tools provided for contributors to supply rpm packages for platforms for which support is provided in the spec file but for which the development team chooses not to release binary packages, usually due to lack of interest or lack of an available platform. Please see platforms/contrib/README in the source package.
I'm getting errors about not having permission when I try to build the packages. Do I need to be root?

No, you do not need to be root and, in fact, it is better practice to build rpm packages as a non-root user. Apcupsd's packages are designed to be built by a regular user but you must make a few changes on your system to do this. If you are building on your own system then the simplest method is to add write permissions for all to the build directory (/usr/src/redhat/). To accomplish this execute one of the following commands as root depending on your distribution, RedHat, SuSE or Mandriva, respectively:

chmod -R 777 /usr/src/redhat
chmod -R 777 /usr/src/packages
chmod -R 777 /usr/src/RPM

If you are working on a shared system where you can not use the method above then you need to recreate the /usr/src/redhat (or other) directory tree with all of it's subdirectories inside your home directory. Then create a file named

.rpmmacros

in your home directory (or edit the file if it already exists) and add the following line:

%_topdir /home/myuser/redhat

Credits

./thanks.png

The success of apcupsd is due to the many people that helped in development, testing and in many other ways.

Thank all the developers that worked hard to make APCUPSD one of the best piece of software for UPS management.

Contributors

Current Code Maintainer and Project Manager
Adam Kropelin (akropel1@rochester.rr.com)
RPM Packager
D. Scott Barninger (barninger@fairfieldcomputers.com)
CGI and HTML fixer
William King (wrking@dadaboom.com)
Former Project Manager
Kern Sibbald (kern@sibbald.com)
Project Starter and Former Code Maintainer
Andre Hedrick (andre@linux-ide.org)
Former Code Maintainer and Project Manager
Riccardo Facchetti (riccardo@master.oasi.gpa.it)
Serial Communications
Andre Hedrick (andre@linux-ide.org)
2.0 User's Manual
Eric S. Raymond (esr@thyrsus.com)
Alpha Port
Kern Sibbald (kern@sibbald.com) J. Rochate (jrochate@ualg.pt) testing and machine loan
Caldera
John Pinner (john@clocksoft.com)
HP-UX Port
Carl Erhorn (Carl_Erhorn@hyperion.com) Robert K Nelson (rnelson@airflowsciences.com)
SOLARIS Port
Carl Erhorn (Carl_Erhorn@hyperion.com)
OpenBSD Port
Devin Reade (gdr@gno.org)
NetBSD Port
Neil Darlow (neil@darlow.co.uk)
Win32 Port
Kern Sibbald (kern@sibbald.com) Paul Z. Stagner (paul.stagner@charterco.com) testing
WEB Interfaces
Kern Sibbald (kern@sibbald.com) Joseph Acosta (joeja@mindspring.com)
apcupsd-3.14.10/doc/manual/manual.rst0000664000076400007640000067666411440256070016304 0ustar adk0212adk0212.. title:: APCUPSD User Manual .. image:: ./apcupsd.png =================== APCUPSD User Manual =================== | **Adam Kropelin** | **Kern Sibbald** **Apcupsd is a UPS control system that permits orderly shutdown of your computer in the event of a power failure.** | |date| |time| | This manual documents apcupsd version 3.14.x | Copyright |(C)| 2004-2009 Adam Kropelin | Copyright |(C)| 1999-2005 Kern Sibbald *Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the name Apcupsd, the copyright notice, and this notice are preserved.* *Apcupsd source code is released under the GNU General Public License version 2. Please see the file COPYING in the main source directory.* For more information on the project, please visit the main web site at http://www.apcupsd.com --------------------------------------------------------------------------- .. contents:: Table of Contents :local: :depth: 3 --------------------------------------------------------------------------- Important Legal Disclaimer ========================== No person should rely on the contents of the APCUPSD Manual ("the manual") without first obtaining advice from APC Technical Support. The manual is provided on the terms and understanding that: 1. the authors, contributors and editors are not responsible for the results of any actions taken on the basis of information in the manual, nor for any error in or omission from the manual; and 2. the authors, contributors and editors are not engaged in rendering technical or other advice or services. The the authors, contributors and editors, expressly disclaim all and any liability and responsibility to any person, whether a reader of the manual or not, in respect of anything, and of the consequences of anything, done or omitted to be done by any such person in reliance, whether wholly or partially, on the whole or any part of the contents of the manual. Without limiting the generality of the above, no author, contributor or editor shall have any responsibility for any act or omission of any other author, contributor or editor. How To Use This Manual ====================== This is the manual for apcupsd, a daemon for communicating with UPSes (Uninterruptible Power Supplies) made by American Power Conversion Corporation (APC). If you have an APC-made UPS, whether sold under the APC nameplate or OEMed (for example, the HP PowerTrust 2997A), and you want you get it working with a computer running Linux, Unix, or Windows, you are reading the right document. This manual is divided into parts which increase in technical depth as they go. If you have just bought a state-of-the-art smart UPS with a USB or Ethernet interface, and you are running a current version of Red Hat or SUSE Linux, then apcupsd is very nearly plug-and-play and you will have to read only the `Basic User's Guide`_. If your operating system is older, or if you have an old-fashioned serial-line UPS, you'll have to read about serial installation (see `Installation: Serial-Line UPSes`_). If you need more details about administration for unusual situations (such as a master/slave or multi-UPS setup) you'll need to read the sections on those topics as well. Finally, there are a number of technical reference sections which gives full details on things like configuration file directives and event-logging formats. You should begin by reading the Quick Start (see `Quick Start for Beginners`_) instructions. Basic User's Guide ================== Quick Start for Beginners ------------------------- apcupsd is a complex piece of software, but most of its complexities are meant for dealing with older hardware and operating systems. On current hardware and software getting it running should not be very complicated. The following is a help guide to the steps needed to get apcupsd set up and running as painlessly as possible. #. Check to see if apcupsd supports your UPS and cable (see `Supported UPSes and Cables`_). #. Check to see if apcupsd supports your operating system (see `Supported Operating Systems`_). #. Plan your configuration type (see `Choosing a Configuration Type`_). If you have just one UPS and one computer, this is easy. If you have more than one machine being served by the same UPS, or more than one UPS supplying power to computers that are on the same local network, you have more choices to make. #. Figure out if you have one of the easy setups. If you have a USB UPS, and a supported operating system and you want to use one UPS with one computer, that's an easy setup. APC supplies the cable needed to talk with that UPS along with the UPS. All you need to do is check that your USB subsystem is working (see `USB Configuration`_); if so, you can go to the build and install step. #. If you have a UPS designed to communicate via SNMP over Ethernet, that is also a relatively easy installation. Details are provided in `Support for SNMP UPSes`_. #. If you have a UPS that communicates via an RS232C serial interface and it is a SmartUPS, then things are relatively simple, otherwise, your life is about to get interesting. #. If you have a vendor-supplied cable, find out what cable type you have by looking on the flat ends of the cable for a number, such as 940-0020A, stamped in the plastic. #. If you don't have a vendor-supplied cable, or your type is not supported, you may have to build one yourself (see `Cables`_). Here is hoping you are good with a soldering iron! #. Now you are ready to read the Building and Installing (see `Building and Installing apcupsd`_) section of the manual and follow those directions. If you are installing from an RPM or some other form of binary package, this step will probably consist of executing a single command. #. Tweak your /etc/apcupsd/apcupsd.conf file as necessary. Often it will not be. #. Change the BIOS settings (see `Arranging for Reboot on Power-Up`_) on your computer so that boots up every time it gets power. (This is not the default on most systems.) #. To verify that your UPS is communicating with your computer and will do the right thing when the power goes out, read and follow the instructions in the Testing (see `Testing Apcupsd`_) section. #. If you run into problems, check the apcupsd users' email list archive for similar problems. This is an excellent resource with answers to all sorts of questions. See http://sourceforge.net/mailarchive/forum.php?forum_name=apcupsd-users. #. If you still need help, send a message to the apcupsd users' email list (apcupsd-users@lists.sourceforge.net) describing your problem, what version of apcupsd you are using, what operating system you are using, and anything else you think might be helpful. #. Read the manual section on `Monitoring and Tuning your UPS`_. Supported Operating Systems --------------------------- apcupsd supports many UNIX-like operating systems as well as several variants of Windows. Due to lack of API standardization, USB support is not available on every platform. See `Platform Support`_ below for details. In general it is recommended to obtain a prebuilt package for your platform. Given how apcupsd must integrate into the shutdown mechanism of the operating system and the rate at which such mechanisms are changed by vendors, the platform ports in the apcupsd tree may become out of date. In some cases, binary packages are provided by the apcupsd team (RedHat, Mandriva, SuSE, Windows, Mac OS X). For other platforms it is recommended to check your vendor's package repository and third party repositories for recent binary packages. Note that some vendors continue to distribute ancient versions of apcupsd with known defects. These packages should *not* be used. Platform Support ~~~~~~~~~~~~~~~~ **LINUX** - RedHat [1]_ [2]_ - SuSE [2]_ - Mandriva/Mandrake [2]_ - Debian [3]_ - Slackware [3]_ - Engarde [3]_ - Yellowdog [3]_ - Gentoo [3]_ **WINDOWS** - Windows NT 4 [2]_ [4]_ - Windows 98/ME/2000 [2]_ [4]_ - Windows XP/Vista (including 64 bit) [1]_ [2]_ - Windows Server 2003/2008 (including 64 bit) [2]_ - Windows 7 [2]_ **OTHERS** - Mac OS X Darwin [1]_ [2]_ - Solaris 8/9 [4]_ - Solaris 10 - NetBSD - FreeBSD - OpenBSD - HPUX [3]_ [4]_ - Unifix [3]_ [4]_ - QNX [4]_ .. [1] Platforms on which apcupsd is regularly developed and tested .. [2] Platforms for which apcupsd team distributes binary packages .. [3] Port included in apcupsd source tree but may be out of date, unmaintained, or broken. .. [4] USB not supported Supported UPSes and Cables -------------------------- apcupsd supports nearly every APC brand UPS model in existence and enough different cable types to connect to all of them. The ``UPSTYPE `` field is the value you will put in your /etc/apcupsd/apcupsd.conf file to tell apcupsd what type of UPS you have. We'll describe the possible values here, because they're a good way to explain your UPS's single most important interface property: the kind of protocol it uses to talk with its computer. apcsmart An APCSmart UPS and its computer communicate through an RS232C serial connection. They use it as a character channel (2400bps, 8 data bits, 1 stop bit, no parity) and pass commands back and forth in a primitive language resembling modem-control codes. The different APC UPSes all use closely related firmware, so the language doesn't vary much (later versions add more commands). This class of UPS is in decline, rapidly being replaced in APC's product line by USB UPSes. usb A USB UPS speaks a universal well defined control language over a USB wire. Most of APC's lineup now uses this method as of late 2003, and it seems likely to completely take over in their low- and middle range. Other manufacturers (Belkin, Tripp-Lite, etc.) are moving the same way, though with a different control protocol for each manufacturer. As long as USB hardware can be mass-produced more cheaply than an Ethernet card, most UPSes are likely to go this design route. Please note that even if you have a USB UPS, if you use a serial cable with it (as can be supplied by APC), you will need to configure your UPS as ``apcsmart`` rather than ``usb``. net This is the keyword to specify if you are using your UPS in Slave mode (i.e. the machine is not directly connected to the UPS, but to another machine which is), and it is connected to the Master via an ethernet connection. You must have apcupsd's Network Information Services NIS turned on for this mode to work. snmp SNMP UPSes communicate via an Ethernet NIC and firmware that speaks Simple Network Management Protocol. dumb A dumb or voltage-signaling UPS and its computer communicate through the control lines (not the data lines) on an RS232C serial connection. Not much can actually be conveyed this way other than an order to shut down. Voltage-signaling UPSes are obsolete; you are unlikely to encounter one other than as legacy hardware. If you have a choice, we recommend you avoid simple signalling UPSes. pcnet PCNET is an alternative for SNMP available on APC's AP9617 family of smart slot modules. The protocol is much simpler and potentially more secure than SNMP. Choosing a Configuration Type ----------------------------- There are three major ways of running apcupsd on your system. The first is a standalone configuration where apcupsd controls a single UPS, which powers a single computer. This is the most common configuration. If you're working with just one machine and one UPS, skip the rest of this section. Your choices become more interesting if you are running a small cluster or a big server farm. Under those circumstances, it may not be possible or even desirable to pair a UPS with every single machine. apcupsd supports some alternate arrangements. The second type of configuration is the NIS (Network Information Server) server and client. In this configuration, where one UPS powers several computers, a copy of apcupsd running one one computer will act as a server while the other(s) will act as network clients which poll the server for information about the UPS. Note that "NIS" is *not* related to Sun's directory service also called "NIS" or "Yellow Pages". The third configuration is where a single computer controls multiple UPSes. In this case, there are several instances of apcupsd on the same computer, each controlling a different UPS. One instance of apcupsd will run in standalone mode, and the other instance will normally run in network mode. This type of configuration may be appropriate for large server farms that use one dedicated machine for monitoring and diagnostics Here is a diagram that summarizes the possibilities: Configuration types ------------------- .. image:: ./main_configs.png If you decide to set up one of these more complex configurations, see the dedicated section on that particular configuration. USB Configuration ================= Apcupsd supports USB connections on all major operating systems: Linux, FreeBSD, OpenBSD, NetBSD, Windows, Solaris, and Mac OS X Darwin. If you plan to use a USB connection, please read the appropriate subsection in its entirety. You can skip this section if your UPS has a serial (RS232-C) or Ethernet interface or if you are not running one of the platforms listed above. Linux USB Configuration ----------------------- Known Linux USB Issues ~~~~~~~~~~~~~~~~~~~~~~ **Problem** Linux 2.4 series kernels older than 2.4.22 (RH 9, RHEL 3) do not bind the USB device to the proper driver. This is evidenced by /proc/bus/usb/devices listing the UPS correctly but it will have "driver=(none)" instead of "driver=(hid)". This affects RHEL3, among others. **Workaround** Upgrade linux kernel to 2.4.22 or higher. Alternately, you apply the linux-2.4.20-killpower.patch and linux-2.4.20-USB-reject.patch patches to your kernel and rebuild it. These patches can be found in the examples/ directory in the apcupsd source distribution. **Problem** Mandrake 10.0 and 10.1 systems with high security mode enabled (running kernel-secure kernel) use static device nodes but still assign USB minor numbers dynamically. This is evidenced by ``hiddev0: USB HID v1.10 Device [...]`` instead of ``hiddev96: ...`` in dmesg log. **Workaround** Boot standard kernel instead of kernel-secure or disable CONFIG_USB_DYNAMIC_MINORS and rebuild kernel-secure. **Problem** USB driver linux-usb.c fails to compile, reporting errors about ``HID_MAX_USAGES undefined``. This is due to a defect in the linux kernel hiddev.h header file on 2.6.5 and higher kernels. **Workaround** Upgrade to apcupsd-3.10.14 or higher. These versions contain a workaround for the defect. **Problem** On some systems such as Slackware 10.0, no USB devices will show up (see the next section). **Workaround** Add the following to rc.local :: mount -t usbdevfs none /proc/bus/usb **Problem** 2.6 kernels use udev and some distributions to not configure it to automatically create /dev/usb/hiddev?? as they should, causing apcupsd to fail to locate the UPS. **Workaround** Edit the file /etc/udev/rules.d/50-udev.rules, and add the following: :: KERNEL="hiddev*", NAME="usb/hiddev%n" More details are provided in the following section ... Verifying Device Detection and Driver ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To make sure that your USB subsystem can see the UPS, just do this from a shell prompt: :: cat /proc/bus/usb/devices This information is updated by the kernel whenever a device is plugged in or unplugged, irrespective of whether apcupsd is running or not. It contains details on all the USB devices in your system including hubs (internal and external), input devices, and UPSes. You should get some output back that includes something like this, featuring a BackUPS RS 1000: :: T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0 D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=051d ProdID=0002 Rev= 1.06 S: Manufacturer=American Power Conversion S: Product=Back-UPS RS 1000 FW:7.g3 .D USB FW:g3 S: SerialNumber=JB0308036505 C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 24mA I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=hid The important things to check for are the ``S:`` lines describing your UPS and and the ``I:`` line showing what driver is handling it. If on the ``I:`` line, ``Driver`` is listed as ``Driver=none`` then you do not have the HID driver loaded or the driver did not attach to the UPS. One common cause is having a Linux kernel older than 2.4.22 (such as a stock RedHat 9 or RHEL 3 kernel). If this is the case for your system, please upgrade to at least kernel version 2.4.22 and try again. If you are already running a 2.4.22 or higher kernel, please read further for instructions for other possible courses of action. Here is another example, this time featuring a Back-UPS 350: :: T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=1.5 MxCh= 0 D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=051d ProdID=0002 Rev= 1.00 S: Manufacturer=American Power Conversion S: Product=Back-UPS 350 FW: 5.2.I USB FW: c1 S: SerialNumber=BB0115017954 C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 30mA I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=hid E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl= 10ms In general, if you see your UPS model in the ``S:`` field, which means ``Manufacturer=``, ``Product=``, and ``SerialNumber=``, and you see ``Driver=hid`` in the ``I:`` field, you know the UPS has been recognized and is bound to the correct driver. If your UPS doesn't appear in the list at all, check the obvious things: The UPS must be powered on, and a cable must be properly seated in both the data port of the UPS and one of your machine's USB ports. Many UPSes have phone ports to provide surge protection for phones or modems -- make sure you haven't plugged your USB cable into one of those rather than the data port (which will usually be near the top edge of the case.) Also, ensure that the correct drivers are loaded. Under Linux-2.4.x, you can check this out easily by examining the /proc/bus/usb/drivers file. Here's how you can do that: :: cat /proc/bus/usb/drivers ...and you should get: :: usbdevfs hub 96-111: hiddev hid On Linux-2.6.x, make sure the sysfs filesystem is mounted on /sys and do: :: ls -l /sys/bus/usb/drivers/ ...where you should get: :: total 0 drwxr-xr-x 2 root root 0 May 1 18:55 hid drwxr-xr-x 2 root root 0 May 1 18:55 hiddev drwxr-xr-x 2 root root 0 May 1 18:55 hub drwxr-xr-x 2 root root 0 May 1 18:55 usb drwxr-xr-x 2 root root 0 May 1 18:55 usbfs ...or perhaps something like: :: total 0 drwxr-xr-x 2 root root 0 Jan 6 15:27 hiddev drwxr-xr-x 2 root root 0 Jan 6 15:28 hub drwxr-xr-x 2 root root 0 Jan 6 15:28 usb drwxr-xr-x 2 root root 0 Jan 6 15:27 usbfs drwxr-xr-x 2 root root 0 Jan 6 15:28 usbhid If your 2.6.x system does not have the /sys/bus/usb directory, either you do not have sysfs mounted on /sys or the USB module(s) have not been loaded. (Check /proc/mounts to make sure sysfs is mounted.) A USB UPS needs all of these drivers -- the USB device filesystem, the USB hub, the Human Interface Device subsystem driver, and the Human Interface Device driver. If you are compiling your own kernel, you want to enable :: CONFIG_USB CONFIG_USB_HID CONFIG_USB_HIDDEV CONFIG_USB_DEVICEFS ...as well as at least one USB Host Controller Driver... :: CONFIG_USB_UHCI_HCD (linux-2.6.x) CONFIG_USB_OHCI_HCD (linux-2.6.x) CONFIG_USB_UHCI (linux-2.4.x) CONFIG_USB_OHCI (linux-2.4.x) Device Nodes ~~~~~~~~~~~~ Apcupsd accesses USB UPSes via the hiddev device nodes. Typically these are located in ``/dev/hiddevN``, ``/dev/usb/hiddevN`` or ``/dev/usb/hiddev/hiddevN`` (where ``N`` is a digit 0 thru 9). Some distributions (some Debian releases, possibly others) do not provides these device nodes for you, so you will have to make them yourself. Check ``/dev``, ``/dev/usb``, and ``/dev/usb/hiddev`` and if you cannot find the ``hiddevN`` nodes, run (as root) the ``examples/make-hiddev`` script from the apcupsd source distribution. Modern Linux distributions using the 2.6 kernel create device nodes dynamically on the fly as they are needed. It is basically a hotplug system, giving a lot more power to the user to determine what happens when a device is probed or opened. It is also a lot more complicated. Some early 2.6 distributions (Fedora Core 3, for one) do not include hiddev rules in their default udev rule set. The bottom line for apcupsd on such a system is that if the ``hiddevN`` is not created when you plug in your UPS, apcupsd will terminate with an error. The solution to the problem is to add a rule to the udev rules file. On Fedora FC3, this file is found in ``/etc/udev/rules.d/50-udev.rules``. Start by adding the following line: :: BUS="usb", SYSFS{idVendor}="051d", NAME="usb/hiddev%n" *Note that this rule uses obsolete udev syntax and is specific to FC3 and other distributions of similar vintage.* Then either reboot your system, or unplug and replug your UPS and then restart apcupsd. At that point a ``/dev/usb/hiddevN`` node should appear and apcupsd should work fine. If you have several UPSes or you just want to give your UPS a fixed name, you can use rules like the following: :: KERNEL=="hiddev*", SYSFS{serial}=="JB0319033692", SYMLINK="ups0" KERNEL=="hiddev*", SYSFS{serial}=="JB0320004845", SYMLINK="ups1" *Note that this rule uses modern udev syntax and is appropriate only for more recent distros such as RHEL4 and FC4.* Replace the serial number in quotes with the one that corresponds to your UPS. Then whenever you plug in your UPS a symlink called ups0, ups1, etc. will be created pointing to the correct hiddev node. This technique is highly recommended if you have more than one UPS connected to the same server since rearranging your USB cables or even upgrading the kernel can affect the order in which devices are detected and thus change which hiddev node corresponds to which UPS. If you use the symlink-by-serial-number approach the link will always point to the correct device node. You can use... :: udevinfo -a -p /sys/class/usb/hiddev0/ ...to get more information on the fields that can be matched besides serial number. An additional device-node-related problem is the use of dynamic minors. Some distributions, such as Mandrake 10, ship with a kernel having ``CONFIG_USB_DYNAMIC_MINORS`` turned on. This is not ideal for running with apcupsd, and the easiest solution is to turn ``CONFIG_USB_DYNAMIC_MINORS`` off and rebuild your kernel, or find a pre-built kernel with it off. For a kernel with ``CONFIG_USB_DYNAMIC_MINORS`` turned on to work with apcupsd, you must enable ``devfs``. The following will tell you if devfs is enabled: :: $ ps ax | grep devs ...which should give something like the following: :: 533 ? S 0:00 devfsd /dev What complicates the situation much more on Mandrake kernels is their security level since ``CONFIG_DYNAMIC_USB_MINORS`` is turned on, but on higher security levels devfs is turned off. The net result, is that in those situations hiddev is completely unusable so apcupsd will not work. So, in these cases, the choices are: #. Reduce the security level setting of the system (not sure if this is possible after the initial install). #. Custom build a high security kernel with devfs enabled and make sure devfs is mounted and devfsd is running. #. Custom build a high security kernel with dynamic minors disabled #. Use udev Miscellaneous ~~~~~~~~~~~~~ If all these things check out and you still can't see the UPS, something is more seriously wrong than this manual can cover -- find expert help. If you are unable to list USB devices or drivers, you kernel may not be USB-capable and that needs to be fixed. BSD USB Configuration --------------------- Known BSD USB Issues ~~~~~~~~~~~~~~~~~~~~ **Problem** FreeBSD lockups: Some users have experienced lockups (apcupsd stops responding) on FreeBSD systems. **Solution** Recent versions of Apcupsd have addressed this issue. Please upgrade to apcupsd-3.10.18 or higher. **Problem** FreeBSD kernel panics if USB cable is unplugged while apcupsd is running. **Solution** This is a kernel bug and is most easily worked around by not hot- unplugging the UPS while apcupsd is running. This issue may be fixed in recent FreeBSD kernels. Platforms and Versions ~~~~~~~~~~~~~~~~~~~~~~ The \*BSD USB driver supports FreeBSD, OpenBSD and NetBSD. (Thanks go to the \*BSD developers who kept a nearly identical interface across all three platforms.) Kernel Configuration ~~~~~~~~~~~~~~~~~~~~ Users of OpenBSD, NetBSD, and some versions of FreeBSD will need to rebuild the kernel in order to *enable the ugen driver* and *disable the uhid driver*. uhid is not sufficient for apcupsd at this time and we need to prevent it from grabbing the UPS device. You should *make the following changes* to your kernel config file: *FreeBSD (v5.4 and below, v6.0)* | (you **will not** lose use of USB keyboard and mouse) | **Disable:** uhid | **Enable:** ugen *FreeBSD (v5.5, v6.1 and above)* | (you **will not** lose use of USB keyboard and mouse) | **Disable:** (nothing) | **Enable:** ugen This is the default configuration for a GENERIC kernel on many platforms so you most likely will not need to recompile. *NetBSD (v3.x and below)* | (you **will** lose use of USB keyboard and mouse) | **Disable:** uhidev, ums, wsmouse, ukbd, wskbd, uhid | **Enable:** ugen *NetBSD (v4.0 and above)* You can use apcupsd on single USB port without disabling the USB keyboard and mouse on other ports, though all other devices will be disabled on the port you pick for your UPS. First, decide which hub and port you wish to use. You can find out the hub and port numbers for any particular physical connector by plugging a USB device into it and looking at the messages printed by the kernel; you should messages something like this: :: uxx0 at uhub0 port 1 uxx0: To use your APC UPS on this port, configure the kernel to prefer attachment of the ugen driver over other drivers on this hub and port only, by adding a line like this to your kernel config file: :: ugen* at uhub0 port 1 flags 1 (The "flags 1" forces the ugen to attach instead of anything else detected there.) Configure and build that kernel as per the references below, and your UPS will now attach as a ugen device when plugged into that port. Don't forget to '``cd /dev``' and '``./MAKEDEV ugen1``' (and 2 and so on) if you have more than one generic usb device on your system. *OpenBSD* | (you **will** lose use of USB keyboard and mouse): | **Disable:** uhidev, ums, wsmouse, ukbd, wskbd, uhid | **Enable:** ugen For detailed information on rebuilding your kernel, consult these references: *FreeBSD* http://www.freebsd.org/doc/en\_US.ISO8859-1/books/handbook/kernelconfig.html *NetBSD* http://www.netbsd.org/guide/en/chap-kernel.html *OpenBSD* http://www.openbsd.org/faq/faq5.html#Building Verifying Device Detection and Driver ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After building a properly configured kernel, reboot into that kernel and plug in your UPS USB cable. You should see a dmesg log message like the following: :: ugen0: American Power Conversion Back-UPS RS 1500 FW:8.g6 .D USB FW:g6, rev 1.10/1.06, addr 2 Note that the ``ugen`` driver is called out. If you see ``uhid`` instead, it probably means you did not properly disable the uhid driver when you compiled your kernel or perhaps you're not running the new kernel. You can also check with '``usbdevs -d``' to get a list of USB devices recognized by the system as well as the drivers they are associated with. For example: :: # usbdevs -d addr 1: UHCI root hub, VIA uhub0 addr 2: Back-UPS RS 1500 FW:8.g6 .D USB FW:g6, American Power Conversion ugen0 Device Nodes ~~~~~~~~~~~~ Apcupsd communicates with the UPS through the USB generic device, ``ugen``. You may or may not need to manually make ``ugen`` device nodes in ``/dev``, depending on what OS you are using. FreeBSD No manual intervention needed. FreeBSD automatically creates the ugen nodes on demand. NetBSD By default, NetBSD only creates nodes for the first ugen device, ``ugen0``. Check ``usbdevs -d`` to see which device your UPS was bound to and then create the appropriate node by running '``cd /dev ; ./MAKEDEV ugenN``', where ``ugenN`` is the ugen device name shown by ``usbdevs``. It is probably a good idea to create several sets of ugen nodes in case you add more USB devices. OpenBSD Similar to NetBSD, OpenBSD creates nodes for ``ugen0`` and ``ugen1``. Check ``usbdevs -d`` to see which device your UPS was bound to and then create the appropriate node by running '``cd /dev ; ./MAKEDEV ugenN``', where ``ugenN`` is the ugen device name shown by ``usbdevs``. It is probably a good idea to create several sets of ugen nodes in case you add more USB devices. Windows USB Configuration ------------------------- Platforms and Versions ~~~~~~~~~~~~~~~~~~~~~~ Apcupsd supports USB UPSes on Windows XP and newer, including 64 bit systems. USB Driver Installation ~~~~~~~~~~~~~~~~~~~~~~~ USB connected UPSes on Windows require a special driver. In most cases, this driver is automatically installed when you install Apcupsd. However in some cases you may need to install the driver manually. For detailed instructions, please see the ``install.txt`` file located in the driver folder of your Apcupsd install. Verifying Device Detection and Driver ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After installing Apcupsd (and the Apcupsd USB driver, if necessary), plug in your UPS USB cable and open the Windows Device Manager. You should see a ``American Power Conversion USB UPS (Apcupsd)`` listed under the ``Batteries`` section. If a device of that name does not appear, check that your UPS is powered on and that the USB cable is connected at both ends. Reinstall the driver as directed above if needed. Solaris USB Configuration ------------------------- Platforms and Versions ~~~~~~~~~~~~~~~~~~~~~~ Apcupsd supports USB UPSes on Solaris 10 and higher. Both x86 and SPARC platforms are supported. Building Apcupsd with USB ~~~~~~~~~~~~~~~~~~~~~~~~~ Some specific packages are necessary when building Apcupsd with USB support on Solaris. You must install the ``SUNWlibusb`` and ``SUNWlibusbugen`` packages **BEFORE** attempting to build Apcupsd. These packages can be found on the Solaris installation CDROMs and should be installed with the ``pkgadd`` utility. You also should build using the gcc compiler and ccs make, not Sun's compiler. The appropriate make utility can be found in ``/usr/ccs/bin``. gcc can be installed from packages included on the Solaris installation CDROMs. Configure and build Apcupsd normally, as described in `Building and Installing Apcupsd`_. Be sure to include the ``--enable-usb`` flag to ``configure``. After building, install Apcupsd as root using '``make install``', then *perform a reconfigure boot* ('``reboot -- -r``'). During installation, Apcupsd will automatically configure your USB subsystem to attach APC USB devices to the ``ugen`` driver. This is a critical step and must be completed by a reconfigure boot. Note that the USB config changes will be reversed if you remove Apcupsd using '``make uninstall``'. Verifying Device Detection and Driver ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After installing Apcupsd as described above and performing a reconfigure boot, plug in your UPS USB cable. You should see a series of dmesg log messages similar to the following: :: Dec 5 17:50:50 sunblade usba: [ID 912658 kern.info] USB 1.10 device (usb51d,2) operating at low speed (USB 1.x) on USB 1.10 root hub: input@4, ugen0 at bus address 3 Dec 5 17:50:50 sunblade usba: [ID 349649 kern.info] American Power Conversion Smart-UPS 1000 FW:600.1.D USB FW:1.2 AS0127232356 Dec 5 17:50:50 sunblade genunix: [ID 936769 kern.info] ugen0 is /pci@1f,0/usb@c,3/input@4 Dec 5 17:50:50 sunblade genunix: [ID 408114 kern.info] /pci@1f,0/usb@c,3/input@4 (ugen0) online Note that the ``ugen`` driver is called out. If you do not see any dmesg entries related to your UPS, ensure that it is turned on and that the USB cable is connected at both ends. Also verify that you installed Apcupsd as root using the '``make install``' command and that you performed a reconfigure boot afterward. Device Nodes ~~~~~~~~~~~~ Apcupsd communicates with the UPS through the USB generic device, ``ugen``. The reconfigure boot performed after Apcupsd installation will ensure the correct device nodes are created. Once your UPS has been recognized in dmesg as shown above, you can check /dev/usb to see if the device nodes have appeared: :: [user@sunblade /]$ ls /dev/usb/51d.2/* cntrl0 cntrl0stat devstat if0in1 if0in1stat (``51d.2`` is the vendor/product id for APC UPSes.) Mac OS X (Darwin) USB Configuration ----------------------------------- Platforms and Versions ~~~~~~~~~~~~~~~~~~~~~~ Apcupsd supports USB UPSes on Mac OS X (Darwin) 10.4.x and higher. Both Intel and PowerPC platforms are supported. Building Apcupsd with USB ~~~~~~~~~~~~~~~~~~~~~~~~~ Some specific packages are necessary when building Apcupsd with USB support on Darwin. You must install libusb-0.1.12 which can be obtained from MacPorts (http://www.macports.org) (formerly DarwinPorts) or Fink (http://fink.sourceforge.net) or downloaded and built by hand (http://www.libusb.org). *You must not use libusb-1.x or higher (apcupsd does not support the new 1.0 APIs) nor any version earlier than 0.1.12 (earlier versions have a bug that apcupsd triggers). Generally that means you must use exactly 0.1.12.* Note that Apcupsd is sensitive to the install location of libusb, so beware if you change it from the default. Apcupsd should be built using gcc, preferably from the XCode development tools. Currently the maintainer is using gcc-4.0.1 from XCode 2.4. Other versions of gcc from other sources may also work. Configure and build Apcupsd normally, as described in `Building and Installing Apcupsd`_. Be sure to include the ``--enable-usb`` flag to ``configure``. After building, install Apcupsd as root using '``make install``' and then reboot. During installation, Apcupsd will automatically install a simple dummy kext driver designed to prevent Apple's monitoring software from taking over the UPS. It is necessary to reboot in order to activate the kext. Note that this kext will be automatically removed if you uninstall Apcupsd using '``make uninstall``', allowing Apple's monitoring tool to once again access the UPS. Verifying Device Detection and Driver ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After installing Apcupsd as described above and rebooting, plug in your UPS USB cable. You should notice that Darwin does **NOT** display the battery monitor tool in the menu bar. You can also check Apple Menu -> About This Mac -> More Info... -> USB to ensure that your UPS appears in the list of USB devices. Building and Installing apcupsd =============================== In general it is recommended to obtain a prebuilt binary package for your platform. Given how apcupsd must integrate into the shutdown mechanism of the operating system and the rate at which such mechanisms are changed by vendors, the platform ports in the apcupsd tree may become out of date. In some cases, binary packages are provided by the apcupsd team (RedHat, Mandriva, SuSE, Windows, Mac OS X). For other platforms it is recommended to check your vendor's package repository and third party repositories for recent binary packages before resorting to building apcupsd from scratch. Note that some vendors continue to distribute *ancient* versions of apcupsd with known defects. These packages should **not** be used. Installation from Binary Packages --------------------------------- RPMS ~~~~ For systems based on RPM packages, such as Red Hat and SuSE, apcupsd is available in binary RPM format. This is the simplest way to install. If you have no previous version of apcupsd on your machine and are creating a standalone configuration, simply install the RPM with a normal '``rpm -ihv``' command. You're done, and can now skip the rest of this chapter and go straight to tweaking your run-time configuration file. (see `After Installation`_) If you have a previous installation, you can upgrade with a normal '``rpm -Uhv``', but this may not upgrade the halt script. It may be better to do the upgrade as a remove '``rpm -e``' followed by a fresh install '``rpm -ihv``'. After installation of the binary RPM, please verify carefully that /etc/rc.d/init.d/halt was properly updated and contains new script lines flagged with ``***APCUPSD***``. Since there is no standard location for cgi-bin, the rpm will place the binary CGI programs in the directory /etc/apcupsd/cgi. To actually use them, you must copy or move them to your actual cgi-bin directory, which on many systems is located in /home/httpd/cgi-bin. Microsoft Windows ~~~~~~~~~~~~~~~~~ The Windows version of apcupsd is distributed as a simple double-click installer. Installation is very simple and straight-forward: Simply double-click the installer executable and follow the instructions. See `The Windows Version of apcupsd`_ for further details. Installation from Source ------------------------ Installation from source might have to be be done different ways depending on what system you are running. The basic procedure involves getting a source distribution, running the configuration, rebuilding, and installing. For building the system, we suggest that you run the configure and make processes as your normal UNIX user ID. The '``make install``' must be run as root. But if your normal ID has an environment setup for using the C compiler, it's simpler to do that than to set up root to have the correct environment. apcupsd requires ``gcc`` and ``g++`` compilers as well as GNU ``make``. Other compilers or BSD ``make`` will **not** work. GNU make is sometimes installed as ``gmake``. The configure script will check for this and will inform you of what command to use to invoke GNU make. The basic installation from a tar source file is rather simple: #. Unpack the source code from its tar archive. #. Go into the directory containing the source code. #. Run '``./configure``' (with appropriate options as described below) #. '``make``' or '``gmake``'' as instructed by configure #. '``su``' (i.e. become root) #. Stop any running instance of apcupsd. The command to do this will look like '``system-dependent-path/apcupsd stop``' #. uninstall any old apcupsd This is important since the default install locations may have changed. #. '``make install``' or '``gmake install``' #. edit your /etc/apcupsd/apcupsd.conf file if necessary #. ensure that your halt script is properly updated #. Start the new apcupsd with: '``system-dependent-path/apcupsd start``' If all goes well, the '``./configure``' will correctly determine which operating system you are running and configure the source code appropriately. ``configure`` currently recognizes the systems listed below in the `Operating System Specifics`_ section of this chapter and adapts the configuration appropriately. Check that the configuration report printed at the end of the ``configure`` process corresponds to your choice of directories, options, and that it has correctly detected your operating system. If not, redo the ``configure`` with the appropriate options until your configuration is correct. Please note that a number of the ``configure`` options preset apcupsd.conf directive values in an attempt to automatically adapt apcupsd as best possible to your system. You can change the values in apcupsd.conf at a later time without redoing the configuration process by simply editing the apcupsd.conf file. Other configuration options can be used to set up the installation of HTML documentation and optional modules, notably the CGI interface that enables the UPS state to be queried via the Web. You will find a complete reference later in this chapter. In general, you will probably want to supply a more elaborate ``configure`` statement to ensure that the modules you want are built and that everything is placed into the correct directories. On Red Hat, a fairly typical configuration command would look like the following: :: CFLAGS="-g -O2" LDFLAGS="-g" ./configure \ --enable-usb \ --with-upstype=usb \ --with-upscable=usb \ --prefix=/usr \ --sbindir=/sbin \ --with-cgi-bin=/var/www/cgi-bin \ --enable-cgi \ --with-css-dir=/var/www/docs/css \ --with-log-dir=/etc/apcupsd By default, '``make install``' will install the executable files in /sbin, the manuals in /usr/man, and the configuration and script files in /etc/apcupsd. In addition, if your system is recognized, certain files such as the startup script and the system halt script will be placed in appropriate system directories (usually subdirectories of /etc/rc.d). Verifying a Source Installation ------------------------------- There are a number of things that you can do to check if the installation (make install) went well. The fist is to check where the system has installed apcupsd using '``which``' and '``whereis``'. On my Red Hat system, you should get the following (lines preceded with a $ indicate what you type): :: $ which apcupsd /sbin/apcupsd $ whereis apcupsd apcupsd: /sbin/apcupsd /etc/apcupsd /etc/apcupsd.conf /etc/apcupsd.status /usr/man/man8/apcupsd.8.gz /usr/man/man8/apcupsd.8 If you find an apcupsd in /usr/sbin, /usr/local/sbin, /usr/lib, or another such directory, it is probably a piece of an old version of apcupsd that you can delete. If you are in doubt, delete it, then rerun the '``make install``' to ensure that you haven't deleted anything needed by the new apcupsd. Please note that the files specified above assume the default installation locations. As a final check that the '``make install``' went well, you should check your halt script (in /etc/rc.d on SUSE systems, and in /etc/rc.d/init.d on Red Hat systems) to see that the appropriate lines have been inserted in the correct place. Modification of the halt script is important so that at the end of the shutdown procedure, apcupsd will be called again to command the UPS to turn off the power. This should only be done in a power failure situation as indicated by the presence of the /etc/powerfail file, and is necessary if you want your machine to automatically be restarted when the power returns. On a Red Hat system, the lines containing the ``# ***apcupsd***`` should be inserted just before the final halt command: :: # Remount read only anything that's left mounted. #echo "Remounting remaining filesystems (if any) readonly" mount | awk '/ext2/ { print $3 }' | while read line; do mount -n -o ro,remount $line done # See if this is a powerfail situation. # ***apcupsd*** if [ -f /etc/apcupsd/powerfail ]; then # ***apcupsd*** echo # ***apcupsd*** echo "APCUPSD will now power off the UPS" # ***apcupsd*** echo # ***apcupsd*** /etc/apcupsd/apccontrol killpower # ***apcupsd*** echo # ***apcupsd*** echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd*** echo "Otherwise, the UPS may cut the power during the reboot!!!" # ***apcupsd*** echo # ***apcupsd*** fi # ***apcupsd*** # Now halt or reboot. echo "$message" if [ -f /fastboot ]; then echo "On the next boot fsck will be skipped." elif [ -f /forcefsck ]; then echo "On the next boot fsck will be forced." fi The purpose of modifying the system halt files is so that apcupsd will be recalled after the system is in a stable state. At that point, apcupsd will instruct the UPS to shut off the power. This is necessary if you wish your system to automatically reboot when the mains power is restored. If you prefer to manually reboot your system, you can skip this final system dependent installation step by specifying the ``disable-install-distdir`` option on the '``./configure``' command (see below for more details). The above pertains to Red Hat systems only. There are significant differences in the procedures on each system, as well as the location of the halt script. Also, the information that is inserted in your halt script varies from system to system. Other systems such as Solaris require you the make the changes manually, which has the advantage that you won't have any unpleasant surprises in your halt script should things go wrong. Please consult the specific system dependent README files for more details. Please note that if you install from RPMs for a slave machine, you will need to remove the changes that the RPM install script made (similar to what is noted above) to the halt script. This is because on a slave machine there is no connection to the UPS, so there is no need to attempt to power off the UPS. That will be done by the master. Configure Options ----------------- All the available ``configure`` options can be printed by entering: :: ./configure --help When specifying options for '``./configure``', if in doubt, don't put anything, since normally the configuration process will determine the proper settings for your system. The advantage of these options is that it permits you to customize your version of apcupsd. If you save the '``./configure``' command that you use to create apcupsd, you can quickly reset the same customization in the next version of apcupsd by simply re-using the same command. The following command line options are available for ``configure`` to customize your installation. --prefix=path This defines the directory for the non-executable files such as the manuals. The default is /usr. --sbindir=path This defines the directory for the executable files such as apcupsd. The default is /sbin. You may be tempted to place the executable files in /usr/sbin or /usr/local/sbin. Please use caution here as these directories may be unmounted during a shutdown and thus may prevent the ``halt`` script from calling apcupsd to turn off the UPS power. Though your data will be protected, in this case, your system will probably not be automatically rebooted when the power returns --enable-cgi This enables the building of the CGI programs that permit Web browser access to apcupsd data. This option is not necessary for the proper execution of apcupsd. --with-cgi-bin=path The with-cgi-bin configuration option allows you to define the directory where the CGI programs will be installed. The default is /etc/apcupsd, which is probably not what you want. --with-css-dir=path This option allows you to specify where you want apcupsd to put the Cascading Style Sheet that goes with the multimoncss.cgi CGI program. --enable-apcsmart Turns on generation of the APC Smart driver (default). --enable-dumb Turns on generation of the dumb signalling driver code (default). --enable-usb Turns on generation of the USB driver code. By default this is disabled. --enable-net Turns on generation of the NIS network driver for slaves. For each slave, this is the only driver needed. This driver works by reading the information from the the configured master using the NIS (Network Information Services) interface. --enable-snmp Turns on generation of the SNMP driver. This driver accesses the UPS over the network using SNMP. This is compatible only with UPSes equipped with an SNMP or Web/SNMP management card. By default this is enabled. --enable-net-snmp Turns on generation of the obsolete NET-SNMP driver. This driver was the precursor to the current snmp driver and is now obsolete. It is available as a fallback if the new driver cannot be used for some reason. By default this is disabled. --enable-pcnet Turns on generation of the PCNET (PowerChute Network Shutdown) driver. This driver accesses the UPS over the network using APC's custom protocol. This driver can be used as an alternative to SNMP for UPSes equipped with a modern Web/SNMP management card. --enable-test This turns on a test driver that is used only for debugging. By default it is disabled. --enable-gapcmon This option enables building the GTK GUI front-end for apcupsd. Building this package requires numerous GNOME libraries. The default is disabled. --enable-apcagent This option enables building the apcagent menubar application on Mac OS X platforms. The default is disabled. --with-libwrap=path, --with-libwrap This option when enabled causes apcupsd to be built with the TCP WRAPPER library for enhanced security. In most cases, the path is optional since configure will determine where the libraries are on most systems. --with-nologin=path This option allows you to specify where apcupsd will create the nologin file when logins are prohibited. The default is /etc --with-pid-dir=path This option allows you to specify where apcupsd will create the process id (PID) file to prevent multiple copies from running. The default is system dependent but usually /var/run. --with-log-dir=path This option allows you to specify where apcupsd will create the EVENTS and STATUS log files. The default is /etc/apcupsd. This option simply sets the default of the appropriate path in the apcupsd.conf file, which can be changed at any later time. --with-lock-dir=path This option allows you to specify where apcupsd will create the serial port lock file. The default is system-dependent but usually /var/lock. This option simply sets the appropriate path in the apcupsd.conf file, which can be changed at any later time. --with-pwrfail-dir=path This option allows you to specify where apcupsd will create the powerfail file when a power failure occurs. The default is system dependent but usually /etc. --with-serial-dev=device-name This option allows you to specify where apcupsd will look for the serial device that talks to the UPS. The default is system dependent, but often /dev/ttyS0. This option simply sets the appropriate device name in the apcupsd.conf file, which can be changed at any later time. --with-nis-port=port This option allows you to specify what port apcupsd will use for the Network Information Server (the CGI programs). The default is system dependent but usually 3551 because that port has been officially assigned to apcupsd by the IANA. This option simply sets the appropriate port in the apcupsd.conf file, which can be changed at any later time. --with-nisip=ip-address This option allows you to specify the value that will be placed on then NISIP directive in the configuration file. The default is 0.0.0.0. No checking is done on the value entered, so you must ensure that it is a valid IP address. --with-net-port=port This option allows you to specify what port apcupsd will use for Master and Slave communications. The default is system dependent but usually 6666. This option simply sets the appropriate port in the apcupsd.conf file, which can be changed at any later time. --with-upstype=type This option allows you to specify the type of UPS that will be connected to your computer. The default is: smartups. This option simply sets the appropriate UPS type in the apcupsd.conf file, which can be changed at any later time. --with-upscable=cable This option allows you to specify what cable you are using to connect to the UPS. The default is: smart. This option simply sets the appropriate UPS cable in the apcupsd.conf file, which can be changed at any later time. --disable-install-distdir This option modifies the apcupsd Makefiles disable installation of the distribution (platform) directory. Generally, this used to do a full installation of apcupsd except the final modification of the operating system files (normally /etc/rc.d/halt, etc.). This is useful if your operating system is not directly supported by apcupsd or if you want to run two copies of apcupsd on the same system. This option can also be used by those of you who prefer to manually reboot your system after a power failure or who do not want to modify your system halt files. Recommended Options for most Systems ------------------------------------ For most systems, we recommend the following options: :: ./configure --prefix=/usr --sbindir=/sbin --enable-usb and you can optionally build and install the CGI programs as follows: :: ./configure --prefix=/usr --sbindir=/sbin --enable-usb \ --enable-cgi --with-cgi-bin=/home/httpd/cgi-bin Compilers and Options --------------------- Some systems require unusual options for compilation or linking that the '``./configure``' script does not know about. You can specify initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: :: CFLAGS="-O2 -Wall" LDFLAGS= ./configure Or on systems that have the ``env`` program, you can do it like this: :: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Or for example on the Sun Solaris system, you can use: :: setenv CFLAGS -O2 setenv LDFLAGS -O ./configure You can get a listing of all available options by doing: :: ./configure --help or simply see the previous section of this manual. Operating System Specifics -------------------------- With the exception of Linux SUSE and Linux Red Hat systems used by the developers, we rely on users to help create installation scripts and instructions as well as to test that apcupsd runs correctly on their system. As you can imagine, most of these people are system administrators rather than developers so they are very busy and don't always have time to test the latest releases. With that in mind, we believe that you will find that a lot of very valuable work has been already done to make your installation much easier (and probably totally automatic). Below, you will find a list of operating systems for which we have received installation files: - Debian (see `Debian`_) - FreeBSD (see `FreeBSD`_) - HPUX (see `HPUX`_) - NetBSD (see `NetBSD`_) - Mac OS X Darwin (see `Mac OS X Darwin`_) - OpenBSD (see `OpenBSD`_) - Red Hat (see `Red Hat Systems`_) - Slackware (see `Slackware`_) - SUSE (see `SUSE`_) - Solaris (see `Sun Solaris`_) - unknown (see `Unknown System`_) - Win32 (see `Windows Systems`_) Debian ~~~~~~ This port is complete and is being used by several users. Since Debian build and install procedures are somewhat particular, we have put the extra Debian information into the following two subdirectories: ``platforms/debian/examples`` and ``platforms/debian/packageinfo`` You can also find the official Debian packages on the Debian site at: - http://packages.debian.org/stable/apcupsd - http://packages.debian.org/testing/apcupsd - http://packages.debian.org/unstable/apcupsd FreeBSD ~~~~~~~ This port is complete and is being used by several users. You will need to install and use GNU make (aka gmake) instead of the BSD make supplied with the system. On the FreeBSD OS, there is no known way for a user program to get control when all the disks are synced. This is needed for apcupsd to be able to issue the killpower command to the UPS so that the UPS shuts off the power. To accomplish the same thing on FreeBSD systems, make sure you have a SmartUPS and that your UPS shutdown grace period is set sufficiently long so that you system will power down (usually 2 minutes), the use the ``--kill-on-powerfail`` option on the apcupsd command line. HPUX ~~~~ Status of this port is unknown. NetBSD ~~~~~~ You will need to install and use GNU make (aka gmake) instead of the BSD make supplied with the system. Mac OS X Darwin ~~~~~~~~~~~~~~~ On OS X (Darwin), apcupsd can be built with ``configure`` defaults. The USB driver can be enabled, as per the directions on `Mac OS X (Darwin) USB Configuration`_ Apcupsd *may* be usable on OS X with a smart serial device, but certainly *does* work as a NIS client or using a USB interface. The startup information will be installed in ``/Library/StartupItems/apcupsd`` which is part of darwin's SystemStartup. OpenBSD ~~~~~~~ You will need to install and use GNU make (aka gmake) instead of the BSD make supplied with the system. Ensure that you read the distributions/openbsd/README file before running apcupsd. There are some critical differences in how the OpenBSD implementation operates when the UPS batteries are exhausted. Failure to take this into account may result in the system not being fully halted when power is lost. Red Hat Systems ~~~~~~~~~~~~~~~ Red Hat systems are fully supported, and by following the standard installation instructions given above, you should experience few or no problems. Slackware ~~~~~~~~~ Slackware systems are fully supported, and by following the standard installation instructions given above, you should experience few or no problems. SUSE ~~~~ SUSE systems are fully supported, and by following the standard installation instructions given above, you should experience few or no problems. Sun Solaris ~~~~~~~~~~~ Please read this before attempting to compile or install the beta software. It contains important information that will make your efforts easier. Before running '``./configure``', please be sure that you do not have /usr/ucb on your path. This may cause the ``configure`` to choose the wrong shutdown program. If ``configure`` detects that /usr/usb is on your path, it will print a warning message. Please follow the advice to avoid shutdown problems. Your normal UNIX user ID must own the source tree directories, and you must have the normal development tools in your path. This includes make, the compiler, the M4 preprocessor, the linker, and ar or ranlib. If the user you are logged in as can compile and link a C program from a source file, then you have all the required tools available. You will want to install the executables in a directory that remains mounted during the shutdown. Solaris will unmount almost everything except the root directories. Since the ability to power the UPS off requires access to the executable programs, they need to be in a directory that will never be unmounted. And since they should also be in a directory that normal users cannot get into, /sbin is the default. However, please be aware that if you want to follow Sun's filesystem conventions you would use the following: :: ./configure \ --prefix=/opt/apcupsd \ --sbindir=/etc/opt/apcupsd/sbin \ --sysconfdir=/etc/opt/apcupsd \ --with-cgi-bin=/opt/apcupsd/cgi-bin The way to setup the /sbin directory as the executables directory is to pass configure the ``--sbindir=/sbin`` option. No other arguments should be required, and your setup and platform should be detected automatically by configure. Once you have run configure, you will need to do a '``gmake``'. Once the make has completed with no errors, you must su to root to complete the install. After the su, you may not have a path to the make program anymore. In that case, you should do the '``gmake install``' step as: :: gmake install Once the install completes, you must edit the /sbin/rc0 script as detailed below, then exit from the su'ed shell. In order to support unattended operation and shutdown during a power failure, it's important that the UPS remove power after the shutdown completes. This allows the unattended UPS to reboot the system when power returns by re-powering the system. Of course, you need autoboot enabled for your system to do this, but all Solaris systems have this by default. If you have disabled this on your system, please re-enable it. To get the UPS to remove power from the system at the correct time during shutdown, i.e., after the disks have done their final sync, we need to modify a system script. This script is /sbin/rc0. We do not have access to every version of Solaris, but we believe this file will be almost identical on every version. Please let us know if this is not true. At the very end of the /sbin/rc0 script, you should find lines just like the following: :: # unmount file systems. /usr, /var and /var/adm are not unmounted by umountall # because they are mounted by rcS (for single user mode) rather than # mountall. # If this is changed, mountall, umountall and rcS should also change. /sbin/umountall /sbin/umount /var/adm >/dev/null 2>\&1 /sbin/umount /var >/dev/null 2>\&1 /sbin/umount /usr >/dev/null 2>\&1 echo 'The system is down.' We need to insert the following lines just before the last 'echo': :: #see if this is a powerfail situation if [ -f /etc/apcupsd/powerfail ]; then echo echo "APCUPSD will power off the UPS" echo /etc/apcupsd/apccontrol killpower echo echo "Please ensure that the UPS has powered off before rebooting" echo "Otherwise, the UPS may cut the power during the reboot!!!" echo fi We have included these lines in a file called rc0.solaris in the distributions/sun subdirectory of the source tree. You can cut and paste them into the /sbin/rc0 file at the correct place, or yank and put them using vi or any other editor. Note that you must be root to edit this file. You must be absolutely sure you have them in the right place. If your /sbin/rc0 file does not look like the lines shown above, do not modify the file. Instead, email a copy of the file to the maintainers, and we will attempt to figure out what you should do. If you mess up this file, the system will not shut down cleanly, and you could lose data. Don't take the chance. You will then need to make the normal changes to the /etc/apcupsd/apcupsd.conf file. This file contains the configuration settings for the package. It is important that you set the values to match your UPS model and cable type, and the serial port that you have attached the UPS to. People have used both /dev/ttya and /dev/ttyb with no problems. You should be sure that logins are disabled on the port you are going to use, otherwise you will not be able to communicate with the UPS. If you are not sure that logins are disabled for the port, run the 'admintool' program as root, and disable the port. The 'admintool' program is a GUI administration program, and required that you are running CDE, OpenWindows, or another XWindows program such as KDE. Solaris probes the serial ports during boot, and during this process, it toggles some handshaking lines used by dumb UPSes. As a result, particularly for simple signalling "dumb" UPSes it seems to kick it into a mode that makes the UPS think it's either in a calibration run, or some self-test mode. Since at this point we are really not communicating with the UPS, it's pretty hard to tell what happened. But it's easy to prevent this, and you should. Disconnect the UPS, and boot the system. When you get to a login prompt, log in as root. Type the following command: :: eeprom com1-noprobe=true or :: eeprom com2-noprobe=true depending on which com port your UPS is attached to. Then sync and shutdown the system normally, reattach the UPS, and reboot. This should solve the problem. However, we have some reports that recent versions of Solaris (7 & 8) appear to have removed this eeprom option and there seems to be no way to suppress the serial port probing during boot. At this point, you should have a complete installation. The daemon will load automatically at the next boot. Watch for any error messages during boot, and check the event logs in /etc/apcupsd. If everything looks OK, you can try testing the package by removing power from the UPS. NOTE! if you have a voltage-signalling UPS, please run the first power tests with your computer plugged into the wall rather than into the UPS. This is because dumb serial-port UPSes have a tendency to power off if your configuration or cable are not correct. As a user, your input is very helpful in solving problems with the package, and providing suggestions and future directions for the development of the package. We are striving to provide a useful package that works across all platforms, and welcome your feedback. Unknown System ~~~~~~~~~~~~~~ During the '``./configure``', if apcupsd does not find one of the systems for which it has specific installation programs, it will set the Operating System to ``unknown`` and will use the incomplete installation scripts that are in ``platforms/unknown``. You will be on your own, or you can ask the developers list (apcupsd-users@lists.sourceforge.net) for installation instructions. This directory also contains a hint file for Linux From Scratch, which could be helpful for other systems as well. Windows Systems ~~~~~~~~~~~~~~~ Appropriate scripts (actually Windows batch files) are included with the Apcupsd Win32 installer package. After Installation ================== Checking Your Configuration File -------------------------------- Once you have installed apcupsd, either from a binary package or by building from source, your next step should be to inspect your ``/etc/apcupsd/apcupsd.conf`` file to make sure it is valid. You can read the complete reference on configuration directives (`Configuration Directive Reference`_), but if you are setting up a normal standalone configuration you should only need to check (and possibly fix) the first three items listed below. Your ``UPSTYPE`` should be the UPS's protocol type: dumb, apcsmart, usb, net, pcnet, or snmp. Your ``UPSCABLE`` should be the type of cable you are using. ``DEVICE`` should be set to the path of the device node (usually in /dev) to use to communicate with the UPS. This is used primarily for serial port connections. If you have a USB device, it is better not to specify a ``DEVICE`` directive by leaving it black or commenting it out. Apcupsd will automatically search for your device in the standard places. If you specify a ``DEVICE``, it should be the name of the device that apcupsd is to use to communicate with the UPS. If the first time you execute apcupsd, you get a message to the effect that the Apcupsd USB driver is missing, it means that you most likely forgot to put ``--enable-usb`` on your '``./configure``' command line. The `Configuration Examples`_ chapter of this manual provides the essential characteristics of each main type of configuration file. After those elements are correct, apcupsd should run, and then it is only a matter of customization of your setup. Arranging for Reboot on Power-Up -------------------------------- The final consideration for a automatic reboot after a full power down is to ensure that your computer will automatically reboot when the power is restored. This is not the normal behavior of most computers as shipped from the factory. Normally after the power is cut and restored, you must explicitly press a button for the power to actually be turned on. You can test your computer by powering it down; shutting off the power (pull the plug); then plugging the cord back in. If your computer immediately starts up, good. There is nothing more to do. If your computer does not start up, manually turn on the power (by pressing the power on button) and enter your computer's SETUP program (often by pressing DEL during the power up sequence; sometimes by pressing F10). You must then find and change the appropriate configuration parameter to permit instant power on. Normally, this is located under the ``BOOT`` menu item, and will be called something such as ``Restore on AC/Power Loss`` or ``Full-On``. The exact words will vary according to the ROM BIOS provider. Generally you will have three options: ``Last State``, ``Power On``, and ``Power Off``. Although ``Last State`` should normally work, we recommend setting your computers to ``Power On``. This means that whenever the power is applied they are on. The only way to shut them off is to pull the plug or to have a special program that powers them off (/sbin/poweroff on Linux systems). If after making all the changes suggested above, you cannot get your computer to automatically reboot, you might examine your halt script (/etc/rc.d/init.d/halt in the case of Red Hat Linux) and see if the final line that performs the halt or reboot contains the ``-p`` option for powering down the computer. It should not with the logic used by apcupsd, but if it does, the ``-p`` option could cause your computer to power off while the UPS is still suppling power (i.e. before the UPS kills the power). Depending on the setting of your BIOS, it may prevent your computer from restarting when the power returns. As already mentioned, this should not apply, but in case of problems it is worth a try. Making sure apcupsd Is Running ------------------------------ The simplest way to invoke apcupsd is from the command line by entering: :: /sbin/apcupsd To do so, you must be root. However, normally, you will want apcupsd started automatically when your system boots. On some systems with installation support (e.g. SUSE and Red Hat), the installation procedure will create a script file that you will be automatically invoked when your system reboots. On other systems, you will have to invoke apcupsd from your rc.local script. On Red Hat systems, this script file that automatically invokes apcupsd on system start and stops is ``/etc/rc.d/init.d/apcupsd`` To start apcupsd manually (as you will probably do immediately following the installation), enter the following: :: /etc/rc.d/init.d/apcupsd start To understand how this file is automatically invoked at system startup and shutdown, see the man pages for ``chkconfig(8)``. On SUSE systems, the script file that automatically invokes apcupsd on system start and stops is ``/etc/rc.d/apcupsd``. To start apcupsd manually (as you will probably do immediately following the installation), enter the following: :: /etc/rc.d/apcupsd start Normally, when properly installed, apcupsd will be started and stopped automatically by your system. Unfortunately, the details are different for each system. Below, we give the commands for selected systems. Alternatively, there are simple stopapcupsd and startapcupsd scripts in the examples directory, or you can modify one of the scripts in the distributions directory to meet your needs. To stop apcupsd you can do the following: On Red Hat systems: :: /etc/rc.d/init.d/apcupsd stop On SUSE systems: :: /etc/rc.d/apcupsd stop Please see the `Testing Apcupsd`_ chapter for more details on insuring that apcupsd is running properly. Configuration Examples ====================== A Simple USB Configuration -------------------------- If you have a USB UPS, the essential elements of your apcupsd.conf file should look like the following: :: ## apcupsd.conf v1.1 ## UPSCABLE usb UPSTYPE usb DEVICE LOCKFILE /var/lock UPSCLASS standalone UPSMODE disable Notice that we have not specified a device. In doing so, apcupsd will try all the well known USB ports. We strongly recommend you use this (empty device address) form unless you have a good reason to do otherwise. Please use the explicit specifications of a device only if you know exactly what you are doing. In general, it is much easier to let apcupsd find the device itself. Please see `USB Configuration`_ for detailed help on setting up your system to work with a USB UPS. A Simple Configuration for a Serial SmartUPS -------------------------------------------- If you have a Smart UPS using the serial cable supplied by APC, or you build a CUSTOM SMART cable outlined in the cables chapter, a very simple configuration file would look like the following: :: ## apcupsd.conf v1.1 ## UPSCABLE smart UPSTYPE smartups DEVICE /dev/ttyS0 LOCKFILE /var/lock UPSCLASS standalone UPSMODE disable Normally you would have many more configuration directives to completely customize your installation, but this example shows you the minimum required. A Simple Configuration for a Simple Signaling or Dumb ----------------------------------------------------- If you have a simple signaling or dumb UPS such as a BackUPS, you will need to know exactly what cable you have and specify it on the UPSCABLE directive. Please see the list of UPSes versus cables in the beginning of this document for more information. The cable number is normally stamped in the plastic at one end of the cable. If you specify the wrong cable, it is very likely that at the first power failure, your computer will be immediately shutdown. This is an unfortunate consequence of the dumb signaling mode. To avoid this, first replace /etc/apcupsd/apccontrol with safe.apccontrol found in the examples directory, then test until everything works correctly. Once you have the correct cable, be sure to remember to reinstall the correct apccontrol file and test that your computer is correctly shutdown during a power failure. :: ## apcupsd.conf v1.1 ## UPSCABLE (number of cable you have) UPSTYPE dumb DEVICE /dev/ttyS0 LOCKFILE /var/lock UPSCLASS standalone UPSMODE disable If your cable does not have low battery detection, as is the case with some older models, you will also need to define ``TIMEOUT nnn`` where you set ``nn`` to be the number of seconds on a power failure after which a shutdown is effected. Normally you would have many more configuration directives to completely customize your installation, but this example shows you the minimum required. NIS Server/Client Configuration Using the Net Driver ---------------------------------------------------- NIS (Network Information Server) mode allows for communication between instances of apcupsd running on different hosts. Only one of those hosts, the server, needs to talk to the UPS directly. The others, clients, obtain information about the state of the UPS by querying the server. NIS is *not* related to Sun's NIS/YP services. NIS clients and servers require that apcupsd be compiled with the Net Driver ``--enable-net``. This is typically enabled by default. The NIS server is connected to the UPS and should be configured exactly as a standalone configuration, but with ``NETSERVER on``. In all other respects, the server should be configured in standalone mode. You may also set the NIS server specific options ``NISIP`` to restrict which IP address of the server which apcupsd listens on. The default, 0.0.0.0, means to list on all of the server host's IP addresses; ``NISPORT`` (default 3551) to set which TCP port the server listens on; and ``EVENTSFILE`` and ``EVENTSFILEMAX`` to provide information about the last few events to clients. You may also need to modify your firewall rules on the server's host to allow traffic to the ``NISPORT``. For the NIS client computer, you will have a configuration that looks something like what follows. What is important is that you get the information from an ``UPSCABLE ether`` with ``UPSTYPE net`` over the network and you must specify the address of a NIS server using ``DEVICE``. The client apcupsd will then poll the NIS server specified in ``DEVICE`` every ``POLLTIME`` seconds (formerly ``NETTIME``). :: ## apcupsd.conf v1.1 ## UPSCABLE ether UPSTYPE net LOCKFILE /var/lock DEVICE server-network-address:3551 UPSCLASS standalone UPSMODE disable POLLTIME 10 The ``DEVICE`` is set to ``server-address:port``, where ``server-address`` is the fully qualified domain name or IP address of the apcupsd NIS server, and ``port`` is the ``NISPORT`` that the server is listening on. The default is 3551, but older versions of apcupsd used port 7000. If you set ``POLLTIME`` too large, your client may not see the change in state of the NIS server before the server has shutdown. Normally, you have at least 30 seconds of grace time between the time the NIS server decides to shutdown and the time it no longer responds. Your slave must poll during this interval. Any client run using the Net driver will shutdown when its own timers expire or when the NIS server shuts down, whichever occurs first. This means that if you want the slave to shutdown before the server, you need only set ``BATTERYLEVEL``, ``MINUTES`` or ``TIMEOUT`` on the client for a faster shutdown than the values defined on the NIS server. This can often be useful if the slave is less important than the master and you wish to reduce battery power consumption so that the master can remain up longer during a power outage. NIS clients work principally by reading the STATFLAG record that is sent by the NIS server (present in the output of apcaccess). The low 16 bits are the standard APC status flag, and the upper 16 bits represent the internal state of apcupsd, so the slave can see when the power fails and know when to shutdown. It would be possible to have a client also work as a server, but that would increase the delay of information getting from the UPS to the secondary client. Differences between NIS Client/Server and the old (now removed) Master/Slave modes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The difference between the NIS mode and the removed master/slave mode is that the NIS server has no explicit knowledge of the slaves. The NIS server makes its information available via the net (NIS), and the NIS slaves read it. When the NIS server is going to shutdown, it makes the information available to any NIS slave that polls it, but the NIS server does not explicitly call each NIS slave as is the case in the Master/Slave networking described several sections above. Think of the difference as push (Master/Slave) vs. pull (NIS-based). In the case of M/S, the master makes all the shutdown decisions and notifies the slaves when they are to shut down or when some other interesting event happens. The slaves just do whatever the master says, whenever the master says to. On the other hand, with the NIS-based network config you basically "publish" the UPS status from one server and then your clients view that status and make their own decisions. PowerChute Network Shutdown Driver (PCNET) ------------------------------------------ As of 3.14, Apcupsd supports the PowerChute Network Shutdown protocol. This is an alternative to SNMP for use with APC's AP9617 family of network smartslot modules. Note that the older AP9606 modules do **not** support PCNET. To enable PCNET support, configure with the ``--enable-pcnet`` flag. This is typically enabled by default. The required apcupsd.conf settings are straightforward: :: ## apcupsd.conf v1.1 ## UPSCABLE ether UPSTYPE pcnet LOCKFILE /var/lock DEVICE ipaddr:user:passphrase UPSCLASS standalone UPSMODE disable The ``DEVICE`` setting specifies the IP address of the UPS as well as the username and authentication passphrase to use. Note that the username and passphrase are **not** the Web/SNMP login credentials. They are separate settings. The default username on a new card is "``apc``" and the default passphrase is "``admin user phrase``". To change the passphrase, log in to the Web UI and go to the UPS tab, then to PowerChute -> Configuration. (This assumes firmware v3.3.1. Other versions may place the setting elsewhere.) *The password must be a minimum of 15 characters long.* The web UI will silently ignore shorter passwords and does not give an error message. There is no apparent way to change the username. Note that you may leave ``DEVICE`` blank and Apcupsd will accept information from any PCNET UPS on the network, **however it will be very insecure since an attacker could easily send packets crafted to cause your server to shut down**. Using the ``ipaddr``, ``user``, and ``passphrase`` will prevent this behavior. You may need to take steps to ensure networking stays active during your OS's shutdown sequence in order for the PCNET driver to power off the UPS (the so-called "killpower" operation). On a Linux distro, you can use commands such as... :: chkconfig --level 0 network on chkconfig --level 0 iptables on ...to make sure networking stays up. Testing Apcupsd =============== The following testing procedures apply for the most part to SmartUPSes, whether USB or serial. If you have a dumb voltage-signalling UPS, your testing procedures will be somewhat different, and you should see the section on Testing Serial UPSes (see `Testing Serial-Line UPSes`_). Process-Status Test ------------------- After you start apcupsd, execute the following command: :: ps fax or the equivalent for your system. You should see something similar to the following output. :: 632 ? S 0:00 /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf 841 ? S 0:00 \_ /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf 842 ? S 0:00 \_ /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf This indicates that apcupsd is up and running and has started the two standard threads in addition to the main thread. If you see only one instance of apcupsd running, don't worry about it as this is normal on most non-Linux systems, and on Linux 2.6.x kernels. If you do not find that apcupsd is in the above list, the most likely problem is a configuration file glitch. If no messages were printed, you should check your system log (normally ``/var/log/messages``) where you will find one or messages indicating the nature of the problem. Logging Test ------------ Once you have established that the proper processes are running, do a tail of the system log file, normally ``/var/log/messages``: :: tail /var/log/messages You should see output that looks similar to the following: :: Dec 5 17:01:05 matou apcupsd[5917]: apcupsd 3.7.2 startup succeeded These messages should also appear in the temporary file (``/etc/apcupsd/apcupsd.events``) if you are using the default configuration file. If you have installed the RPM, they will probably be in ``/var/log/apcupsd.events``. apcaccess Test -------------- This test consists of running ``apcaccess`` to see if apcupsd is properly updating its internal variables. Please note that you must enable the apcupsd Network Information Server in your configuration file for ``apcaccess`` to work. This is done by setting: :: NETSERVER on NISPORT 3551 in your ``apcupsd.conf`` file. To run the apcaccess test, use the following command: :: apcaccess status Depending on the type of UPS you have, you will get slightly different output, but an example For a Smart-UPS is as follows: :: APC : 001,048,1088 DATE : Fri Dec 03 16:49:24 EST 1999 HOSTNAME : daughter RELEASE : 3.7.2 CABLE : APC Cable 940-0024C MODEL : APC Smart-UPS 600 UPSMODE : Stand Alone UPSNAME : SU600 LINEV : 122.1 Volts MAXLINEV : 123.3 Volts MINLINEV : 122.1 Volts LINEFREQ : 60.0 Hz OUTPUTV : 122.1 Volts LOADPCT : 32.7 Percent Load Capacity BATTV : 26.6 Volts BCHARGE : 095.0 Percent MBATTCHG : 15 Percent TIMELEFT : 19.0 Minutes MINTIMEL : 3 Minutes SENSE : Medium DWAKE : 000 Seconds DSHUTD : 020 Seconds LOTRANS : 106.0 Volts HITRANS : 129.0 Volts RETPCT : 010.0 Percent STATFLAG : 0x08 Status Flag STATUS : ONLINE ITEMP : 34.6 C Internal ALARMDEL : Low Battery LASTXFER : Unacceptable Utility Voltage Change SELFTEST : NO STESTI : 336 DLOWBATT : 05 Minutes DIPSW : 0x00 Dip Switch REG1 : N/A REG2 : N/A REG3 : 0x00 Register 3 MANDATE : 03/30/95 SERIALNO : 13035861 BATTDATE : 05/05/98 NOMOUTV : 115.0 NOMBATTV : 24.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : N/A BADBATTS : N/A FIRMWARE : N/A APCMODEL : 6TD END APC : Fri Dec 03 16:49:25 EST 1999 For a simple signaling or dumb UPS such as BackUPS, your output will be very minimal as follows: :: APC : 001,012,0319 DATE : Mon Feb 18 09:11:50 CST 2002 RELEASE : 3.8.5 UPSNAME : UPS_IDEN CABLE : APC Cable 940-0128A MODEL : BackUPS UPSMODE : Stand Alone STARTTIME: Mon Feb 18 09:11:45 CST 2002 LINEFAIL : OK BATTSTAT : OK STATFLAG : 0x008 Status Flag END APC : Mon Feb 18 09:15:01 CST 2002 If you see the above output, it is a good sign that apcupsd is working. Assuming that the output looks reasonable, check the following variables: ``LINEV`` This is the line voltage and it should be a value that is appropriate for your equipment. In the USA, it is typically about 120 Volts while in Europe, it is about 220 Volts. ``BATTV`` Unless you have additional battery packs, this should be near 24 Volts plus or minus 5 Volts. ``STATUS`` This is the status of the UPS and it should normally be ``ONLINE``. A very disturbing tendance is for some of the newer (Mar 2004) RS and ES UPSes to have no Voltage information. This is an annoying bug, but not serious. On the other hand, some of those UPSes now have no battery charge information ``BCHARGE``. If ``BCHARGE`` is zero in your listing and you are running a Smart or a USB UPS, then you will have to set the ``BATTERYLEVEL`` directive in your apcupsd.conf file to -1. If you see a message to the effect of: :: APCACCESS FATAL ERROR in apcaccess.c at line 336 tcp_open: cannot connect to server localhost on port 3551. It means that you have probably not enabled the Network Information Server in your configuration file for ``apcaccess`` to work. This is done by setting ``NETSERVER`` and ``NISPORT`` in your apcupsd.conf file as shown above. Communications Test ------------------- At this point, you should ensure that apcupsd is handling the connection to the UPS correctly. This test assumes you have a UPS that speaks apcsmart protocol, over either USB or a serial port. If you have an old-style voltage-signaling UPS, please skip to the next section (`Simulated Power Fail Test`_). When apcupsd detects a problem, it generates an EVENT, which consists of sending a message to the system log then invoking the ``apccontrol`` script (normally in /etc/acpupsd/apccontrol) to handle the event. In order to create an event, remove the serial port plug from the back of your computer or from the back of the UPS. Within 6 seconds, apcupsd should detect the lack of serial port communications and broadcast a ``wall`` message indicating that the serial port communications was lost: :: Warning communications lost with UPS lost. At the same time, it sends the same message to the system log and to the temporary EVENTS file (``/etc/apcupsd/apcupsd.events``). Plug the serial port plug back into your computer, and within about 12 seconds, apcupsd should reestablish communications and broadcast and log the following message: :: Communications with UPS restored. If these messages are logged but not broadcast, either you have your ``mesg`` permission set to ``no`` (see '``man wall``' or '``man mesg``'), or there is a problem with apccontrol. If you are running a window manager such as GNOME and don't have a console window open, you may not receive the ``wall`` messages. However, you should find them in your system log file (normally ``/var/log/messages``) and in the temporary EVENTS file, ``/etc/apcupsd/apcupsd.events``. For example, to observe these events in the temporary EVENTS file, you might do a :: tail -f /etc/apcupsd/apcupsd.events Note, if you have installed from the RPM, the proper events file may be ``/var/log/apcupsd.events``. You can find the actual filename by checking your apcupsd.conf file before running the test. If you do not observe these messages, you should correct this problem before proceeding with additional tests. Simulated Power Fail Test ------------------------- At this point, you should verify that in the event of a power fail apcupsd properly calls apccontrol. This test is appropriate for all models of UPSes (smart or dumb). To avoid the possibility that apcupsd might shut down your system, locate where apccontrol resides on your system (normally, /etc/apcupsd/apccontrol. Move this script to another location e.g. apccontrol.save and replace it with the script found in examples/safe.apccontrol. When that is done, ensure that your UPS battery is fully charged and that you have at least 5 minutes of remaining runtime on the batteries. This can be done by examining the values of the ``BATTCHG`` and ``TIMELEFT`` variables in the printout of '``apcaccess status``'. Athough this should not be necessary, as an extra precaution, you can shutdown your machine, remove the plug from the UPS you are testing, and plug your machine into another UPS or directly into the wall. Doing so, will ensure that the UPS doesn't cut the power to your machine at a bad time. Remember at the end of the testing to plug your machine back into the UPS. You can also minimize the risk from an unexpected shutdown by using a journaling filesystem such as Linux's EXT3. All modern disk drives park themselves safely when they power down, rather than ploughing up oxide on your disk's recording surface. Thus, unexpected power less has to hit very narrow timing windows in order to trash an EXT3 transaction. To begin the test, pull the power plug from the UPS. The first time that you do this, psychologically it won't be easy, but after you have pulled the plug a few times, you may even come to enjoy it. If all goes well, apcupsd should detect the power failure and print several warning messages. The first should appear after 5 to 6 seconds and read: :: Warning power loss detected. Then generally 6 seconds later, apcupsd is sure that it isn't a transient effect, so it sends: :: Power failure. Running on UPS batteries. After a few more seconds (total around 15 seconds), plug the power cord back in and ensure that apcupsd is aware that the power has returned. It should print: :: Power has returned... If you do not observe the above messages, please correct the situation before proceeding. The most likely cause of problems are: - apcupsd doesn't recognize the power failure because the configuration directives are not correct. E.g. wrong cable. - The file ``/etc/apcupsd/apccontrol`` doesn't exist or is not marked as executable. System Shutdown Test -------------------- This is an intermediate test that you can do, for all UPS models before doing the Full Power Down Test. First modify the ``/etc/apcupsd/apccontrol`` file so that in the ``killpower`` case, the line that re-executes apcupsd with the ``--killpower`` option is commented out. The original line probably looks something like: :: ${APCUPSD} --killpower when it is commented out, it looks like: :: #${APCUPSD} --killpower Now when you pull the power plug, and either the timer expires or the batteries are exhausted (see the next section for more details), the system should be fully shutdown. After performing this test, please be sure to restore ``/etc/apcupsd/apccontrol`` to its previous state. Full Power Down Test -------------------- To complete the testing, you should do a power fail shutdown of your system. This test is applicable to all UPS models. Please do a backup of your system or take other precautions before attempting this to avoid the possibility of lost data due to a problem (I have been through this at least 10 times and never once had problems, but we all know that someday something will go wrong). Before proceeding, please ensure that your halt script or the equivalent has been properly updated by the install process to contain the logic to call ``apcupsd --killpower`` or ``apccontrol killpower`` when it detects a power failure situation (the presence of a /etc/powerfail file). See the `Building and Installing apcupsd`_ section of this manual, or the README files for additional details about the halt modifications necessary. When you are ready to do the test, either simply pull the plug and wait for the batteries to become exhausted, or set the ``TIMEOUT`` configuration directive to something like 60 so that the system will shutdown before the batteries are exhausted. We recommend doing the full shutdown without using ``TIMEOUT`` to correctly simulate a real power failure, but the choice is yours (I did it once here, but now use ``TIMEOUT 30``). If all goes well, your system should be shutdown before the batteries are completely exhausted and the UPS should be powered off by apcupsd. Please be aware that if you do the full power down, you must ensure that your UPS is totally powered off. Otherwise, it may have been given the command to power off, but due to a long grace period it is still waiting. If you were to reboot your computer during the grace period, the UPS could then suddenly turn off the power (this happened to me). To avoid this problem, always wait for your UPS to power itself off, or power if off manually before restarting your computer. On my system, the UPS is configured as at the factory to have a 180 second grace period before shutting off the power. During this type of testing, 180 seconds *seems* like an eternity, so please take care to either wait or manually power off your UPS. To determine what grace period is programmed into your UPS EEPROM, run '``apcaccess eprom``' and look at the "Shutdown grace delay". If you experienced so problems with the above testing procedures, or if you are porting apcupsd to another system, or you are simply curious, you may want to know exactly what is going on during the shutdown process. If so, please see the `Shutdown Sequence`_ section of this manual. apctest ------- ``apctest`` is a program that allows you to talk directly to your UPS and run certain low-level tests, display all know values from the UPS's EEPROM, perform a battery runtime calibration, program the EEPROM (serial connection only), and enter in TTY mode with the UPS. Here we describe how to use it for a SmartUPS. The menus and options for USB and simple signaling UPSes are different but mostly self-explanatory. Shutdown apcupsd if it is running. Make sure your ``/etc/apcupsd/apcupsd.conf`` file has ``UPSTYPE apcsmart`` and ``UPSCABLE`` has one of the smart cables that are supported. Run apctest by invoking it with no arguments. It will read your installed apcupsd.conf configuration (so it knows where to find the UPS) and then it will present you with the following output: :: 2003-07-07 11:19:21 apctest 3.10.6 (07 July 2003) redhat Checking configuration ... Attached to driver: apcsmart sharenet.type = DISABLE cable.type = CUSTOM_SMART You are using a SMART cable type, so I'm entering SMART test mode mode.type = SMART Setting up serial port ... Creating serial port lock file ... Hello, this is the apcupsd Cable Test program. This part of apctest is for testing Smart UPSes. Please select the function you want to perform. 1) Query the UPS for all known values 2) Perform a Battery Runtime Calibration 3) Abort Battery Calibration 4) Monitor Battery Calibration progress 5) Program EEPROM 6) Enter TTY mode communicating with UPS 7) Quit Select function number: 1 Item 1 will probe the UPS for all values known to apcupsd and present them in rather raw format. This output can be useful for providing technical support if you are having problems with your UPS. Item 2 will perform a Battery Runtime Calibration. This test will only be performed if your battery is 100% charged. Running the test will cause the batteries to be discharged to approximately 30% of capacity. The exact number depends on the UPS model. In any case, apctest will abort the test if it detects that the battery charge is 20% or less. The advantage of doing this test is that the UPS will be able to recalibrate the remaining runtime counter that it maintains in its firmware. As your batteries age, they tend to hold less of a charge, so the runtime calibration may not be accurate after several years. We recommend that perform a Battery Calibration about once a year. You should not perform this calibration too often since discharging the batteries tends to shorten their lifespan. Item 3 can be used to abort a Battery Calibration in progress, if you some how became disconnected. Item 4 can be used to restart the monitoring of a Battery Calibration if you should some how become disconnected during the test. Item 5 is used to program the EEPROM. Please see the `Configuration Directives Used to Set the UPS EEPROM`_ chapter of this manual for the details. Item 6 will initiate a direct communication between your terminal and the UPS, at which point you can enter raw UPS commands. Please be aware that you should be careful what commands you enter because you can cause your UPS to suddenly shutdown, or you can modify the EEPROM in a way to disable your UPS. The details of the raw Smart mode UPS commands can be found in the `APC Smart Protocol`_ chapter of this manual. Item 7 will terminate apctest. Monitoring and Tuning your UPS ============================== After you have verified that your UPS is working correctly, you will probably want to query the state of its health occasionally. The tools apcupsd gives you to do this include one command-line utility (apcaccess) and a GUI you can use through a Web browser. You can also use apctest to tune some parameters of the UPS itself. apcaccess --------- ``apcaccess`` is a program (normally found in ``/sbin/apcaccess``) that permits you to print out the complete status of your UPS. apcaccess will use the Network Information Server to obtain the necessary information. You can specify a second optional argument to apcaccess in the form of ``host:port`` where the ``:port`` is optional. The default is ``localhost:3551``. Please note that in versions prior to 3.10.6, the default NIS port was 7000, so if you are mixing versions, you will need to take a lot of care to ensure that all components are using the same port. To enable the apcupsd Network Information Server, which is normally the default, you set: :: NETSERVER on NISPORT 3551 in your ``apcupsd.conf`` file. The full form of the apcaccess command is: :: apcaccess status localhost:3551 where only apcaccess status should normally be needed. localhost may be replaced by any machine name, fully qualified domain name, or IP address, which means that apcaccess can access any UPS on the network running the Network Information Server. The ``status`` command line option of apcaccess will produce a full printout of all the STATUS variables used by apcupsd. This can be very helpful for checking the condition of your UPS and to know whether or not apcupsd is properly connected to it. Please note that if you invoke apcaccess within the first 30 seconds of launching apcupsd, you will likely get an error message such as: :: APCACCESS FATAL ERROR in apcaccess.c at line 336 tcp_open: cannot connect to server localhost on port 3551. This is because apcupsd is still in the process of initializing the UPS. The solution is to wait at least 30 seconds after starting apcupsd before launching apcaccess. For a SmartUPS 1000 apcaccess will emit the following output: :: DATE : Fri Dec 03 12:34:26 CET 1999 HOSTNAME : matou RELEASE : 3.7.0-beta-1 CABLE : Custom Cable Smart MODEL : SMART-UPS 1000 UPSMODE : Stand Alone UPSNAME : UPS_IDEN LINEV : 232.7 Volts MAXLINEV : 236.6 Volts MINLINEV : 231.4 Volts LINEFREQ : 50.0 Hz OUTPUTV : 232.7 Volts LOADPCT : 11.4 Percent Load Capacity BATTV : 27.7 Volts BCHARGE : 100.0 Percent MBATTCHG : 5 Percent TIMELEFT : 112.0 Minutes MINTIMEL : 3 Minutes SENSE : Low DWAKE : 060 Seconds DSHUTD : 180 Seconds LOTRANS : 204.0 Volts HITRANS : 253.0 Volts RETPCT : 050.0 Percent STATFLAG : 0x08 Status Flag STATUS : ONLINE ITEMP : 29.2 C Internal ALARMDEL : Low Battery LASTXFER : U command or Self Test SELFTEST : NO STESTI : 336 DLOWBATT : 02 Minutes DIPSW : 0x00 Dip Switch REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : 01/05/99 SERIALNO : GS9902009459 BATTDATE : 01/05/99 NOMOUTV : 230.0 NOMBATTV : 24.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : 0 BADBATTS : N/A FIRMWARE : 60.11.I APCMODEL : IWI END APC : Fri Dec 03 12:34:33 CET 1999 For the various smaller, cheaper APC USB UPSes, such as the CS, ES, ..., you will get much of the information that is presented above, but not all of it. For example, you will not get ``MAXLINEV``, ``MINLINEV``, ``LINEFREQ``, ... and in particular, the LOADPCT will be zero when you are running on mains. ``LOADPCT`` will display when the UPS is on batteries. You must remember that the non-SmartUPSes are much simpler (and less expensive) and therefore produce less information. Apcupsd Notification and Events ------------------------------- When a major event is generated within apcupsd, control is passed to the script apccontrol normally found in /etc/apcupsd/apccontrol. The event name, and a number of other important parameters are passed to the script. The major function of the apccontrol script is to perform a shutdown of the system (as well as the killpower operation). In addition, another major task for this script is to notify you by email when certain events such as powerfail occur. Since apccontrol is a script, you can customize it to your own needs using any text editor. To do so, you must have a minimal knowledge of Unix shell programming. In addition, another feature is that you can write your own scripts that will be automatically called by apccontrol before any of its own code is executed. Details of the events and how to program them are contained in the Advanced topics section entitled `Customizing Event Handling`_. apcupsd Network Monitoring (CGI) Programs ----------------------------------------- There are four CGI programs (multimon.cgi, upsstats.cgi, upsfstats.cgi, and upsimage.cgi). To have them properly installed, you must run the '``./configure``' command with ``--enable-cgi`` and you should specify an installation directory with ``--with-cgi-bin=`` or load them manually. The default directory for installation of the CGI programs is ``/etc/apcupsd``, which is not really where you want them if you are going to use them. Normally, they should go in the cgi-bin of your Web server. Once built and loaded, they will give you the status of your UPS or UPSes via a web browser. Normally only ``multimon.cgi`` is directly invoked by the user. However, it is possible to directly invoke ``upsstats.cgi`` and ``upsfstats.cgi``. ``upsimage.cgi`` should never be directly invoked as it is used by ``upsstats.cgi`` to produce the bar charts. Setting up and Testing the CGI Programs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Before using multimon and the other CGI programs, first ensure that apcupsd is configured to run the Network Information Server. This is done by setting ``NETSERVER on`` in /etc/apcupsd/apcupsd.conf. This switch is on by default. Next you must edit the hosts file /etc/apcupsd/hosts.conf and at the end, add the name of the hosts you want to monitor and a label string for them. For example: :: MONITOR matou "Server" MONITOR polymatou "Backup server" MONITOR deuter "Disk server" matou, polymatou, and deuter are the network names of the three machines currently running apcupsd. Please note that the network names may either be IP addresses or fully qualified domain names. The network name (or IP address) may optionally be followed by ``:port``, where the port is the NIS port address you wish to use. This is useful if you are running multiple copies of apcupsd on the same system or if you are running in a mixed vendor environment where the NIS port assignments differ. An example could be the following: :: MONITOR matou "Server" MONITOR polymatou "Backup server" MONITOR deuter "Disk server" MONITOR polymatou:7001 "APC USB UPS" where the USB copy of apcupsd has been configured to use port 7001 by modifying apcupsd.conf. Note, the default NIS port is 3551 on most platforms. To test multimon.cgi, you can execute it as non-root directly from the source cgi build directory. To do so, enter at a shell prompt: :: ./multimon.cgi If everything is set up correctly, it will print a bunch of HTML with the values of the machines that you have put in the hosts.conf file. It should look something like the following (note, only a small portion of the output is reproduced here): :: Content-type: text/html Multimon: UPS Status Page \n"; echo "\n"; } }; echo "
... If you do not get similar output, check the permissions of the /etc/apcupsd directory and of those of /etc/apcupsd/hosts.conf to ensure that your web server can access it. At many sites, the Apache server is not running as root, so you must be careful to ensure that that /etc/apcupsd/hosts.conf and /etc/apcupsd/multimon.conf are world readable. To invoke multimon in your Web browser, enter: ``http://your-site/cgi-bin/multimon.cgi`` You should get something similar to the screen shot shown below. If you wish additional control over the colors, type faces, and sizes of the multimon output, you may simply edit the apcupsd.css file to specify the styles you prefer. Using the CGI Programs on Windows ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The CGI programs compiled for Windows are included in the Windows package starting with apcupsd-3.14.7. The CGI programs included with the Windows package are intended to be run on Windows. If your web server is running on Linux or another operating system, you will need to obtain binary packages for that platform (or build them from source) instead. The windows build of the CGI programs has been tested with the Apache web server for Win32. They should also work with MS Internet Information Server (IIS). To use the programs, copy the contents of the ``cgi/`` directory from your apcupsd installation directory to the ``cgi-bin/`` directory of your web server. Consult your web server's documentation for how to enable CGI programs to be executed. Sometimes special security settings are required. Configure the hosts.conf file as described above. The programs expect to find the ``hosts.conf`` file and the ``apcupsd.css`` file in the directory ``\apcupsd\etc\apcupsd`` on the same drive letter as the web server's ``cgi-bin`` directory. If you installed apcupsd into ``C:\apcupsd`` (the default) and your web server's ``cgi-bin/`` directory is also located on the ``C:`` drive, no further changes are necessary. If you installed apcupsd into a different directory or your web server ``cgi-bin`` is on another drive, you will need to relocate ``hosts.conf`` and ``apcupsd.css`` from the apcupsd install location to ``\apcupsd\etc\apcupsd`` on the appropriate drive. multimon.cgi ~~~~~~~~~~~~ This program monitors multiple UPSes at the same time. A typical output of multimon.cgi as displayed in your Web browser might look like the following: .. image:: ./multimon.png :align: center The machines monitored as well as the values and their column headings are all configurable (see /etc/apcupsd/hosts.conf and /etc/apcupsd/multimon.conf) upsstats.cgi ~~~~~~~~~~~~ By clicking on the ``system`` name in the multimon.cgi display, you will invoke upsstats.cgi for the specified system, which will produce a bar graph display of three of the monitored values. For example, .. image:: ./status.png :align: center You can display different bar graphs by selecting different variables from the drop down menus at the top of each of the three bar graphs. As with multimon, if you have your local host configured in the /etc/apcupsd/hosts.conf file, you can execute it from a Unix shell from the source cgi directory as follows: :: ./upsstats.cgi As with multimon, quite a few lines of html should then be displayed. upsfstatus.cgi ~~~~~~~~~~~~~~ If you would like to see all of the STATUS variables available over the network, click on the ``Data`` field of the desired system, and your browser will display something like the following: :: APC : 001,048,1109 DATE : Thu Dec 02 17:27:21 CET 1999 HOSTNAME : matou.sibbald.com RELEASE : 3.7.0-beta-1 CABLE : Custom Cable Smart MODEL : SMART-UPS 1000 UPSMODE : Stand Alone UPSNAME : UPS_IDEN LINEV : 223.6 Volts MAXLINEV : 224.9 Volts MINLINEV : 222.3 Volts LINEFREQ : 50.0 Hz OUTPUTV : 223.6 Volts LOADPCT : 6.2 Percent Load Capacity BATTV : 27.9 Volts BCHARGE : 100.0 Percent MBATTCHG : 5 Percent TIMELEFT : 167.0 Minutes MINTIMEL : 3 Minutes SENSE : High DWAKE : 060 Seconds DSHUTD : 020 Seconds LOTRANS : 196.0 Volts HITRANS : 253.0 Volts RETPCT : 050.0 Percent STATFLAG : 0x08 Status Flag STATUS : ONLINE ITEMP : 35.1 C Internal ALARMDEL : Low Battery LASTXFER : U command or Self Test SELFTEST : NO STESTI : 336 DLOWBATT : 02 Minutes DIPSW : 0x00 Dip Switch REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : 01/11/99 SERIALNO : GS9903001147 BATTDATE : 01/11/99 NOMOUTV : 230.0 NOMBATTV : 24.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : 0 BADBATTS : N/A FIRMWARE : 60.11.I APCMODEL : IWI END APC : Thu Dec 02 17:27:25 CET 1999 You should get pretty much the same output mixed in with html if you execute upsfstats.cgi directly from a Unix shell in the cgi subdirectory as explained above for upsstats.cgi and multimon.cgi. A Tip from Carl Erhorn for Sun Systems: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It is possible to run the CGI code to monitor your UPS using the answerbook HTTP server that runs on Solaris. As long as your server has the Answerbook2 web server installed and running, you can insert the cgi scripts into the cgi directory of the web server, and access the cgi using something like: ``http://hostname:8888/cgi/multimon.cgi`` CGI Credits ~~~~~~~~~~~ Many thanks go to Russell Kroll rkroll@exploits.org who wrote the CGI programs to work with his UPS Monitoring system named Network UPS Tools (NUT). Thanks also to Jonathan Benson jbenson@technologist.com for initially adapting the upsstatus.cgi program to work with apcupsd. We have enhanced the bar graph program and hope that our changes can be useful to the original author in his project. Security Issues: ---------------- - ``apcupsd`` runs as root. - If you have ``NETSERVER ON`` in your apcupsd.conf file (which is the default), be aware that anyone on the network can read the status of your UPS. This may or may not pose a problem. If you don't consider this information privileged, as is the case for many, there is little risk. In addition, if you have a perimeter firewall or NATting router with typical settings only users on your local network access to your UPS information. You may also restrict access using using firewall settings (see below) or TCP Wrappers (see below). Firewall Settings ~~~~~~~~~~~~~~~~~ If you are running apcupsd as an NIS server, you will need to ensure that the clients can reach it by opening up ``NISPORT`` (default: TCP 3551) on any firewall running on the server. You may wish to configure your firewall(s) to *only* allow connections from your local network or specifically from the masters, slaves, and servers as needed. TCP Wrappers ~~~~~~~~~~~~ If your operating system does not support a host based firewall (a firewall running on the local machine) then you may try to get some of the functionality of such a firewall with TCP Wrappers. As of apcupsd version 3.8.2, TCP Wrappers are implemented if you turn them on when configuring ``./configure --with-libwrap``. With this code enabled, you may control who may access your apcupsd via TCP connections (the Network Information Server). This control is done by modifying the file: /etc/hosts.allow. This code is implemented but untested. If you use it, please send us some feedback. Configuring Your EEPROM ----------------------- If you have a SmartUPS, there are depending on the UPS at least 12 different values stored in the EEPROM that determine how the UPS reacts to various conditions such as high line voltage, low line voltage, power down grace periods, etc. In general, for the moment, we do not recommend that you change your EEPROM values unless absolutely necessary. There have been several reported cases of problems setting the Low Transfer Voltage. Consequently, if at all possible, do not attempt to change this value. Using apctest to Configure Your EEPROM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *To make the EEPROM changes with apctest you must first stop the apcupsd daemon.* After apcupsd is stopped you may invoke apctest (as root). We recommend that you change the EEPROM as little as is absolutely necessary since it is a somewhat delicate process that has occasionally produced problems (i.e. improper EEPROM values are displayed after the update). apctest will present a menu of options which are generally self-explanatory. Note that USB connections will show a difference set of options than smart serial connections. .. include:: maintaining_ups.rst Frequently-Asked Questions ========================== See the bugs section of this document for a list of known bugs and solutions. :Question: Why all the craziness with custom serial cables? :Answer: It was nothing more nor less than a form of customer control. For a long time APC wanted to keep other people from talking to its UPSes so it could lock out potential competition for its PowerChute software. Scrambling the leads on its serial cables was a cheap way to accomplish this -- in fact, they tended to be wired so that if you tried a straight-through cable, opening a serial link to the UPS would be interpreted as a shutdown command! (Hardware companies often think like this -- they lock up interfaces by instinct, cornering a small market rather than growing a bigger one. It's fundamentally stupid and self-defeating, but it's the kind of stupid that tends to sound good at an executive meeting.) :Question: What UPS brands does apcupsd support? :Answer: Currently apcupsd supports only APC UPSes. However, some companies such as Hewlett Packard put their own brand name on APC manufactured UPSes. Thus even if you do not have an APC branded UPS, it may work with apcupsd. You will need to know the corresponding APC model number. apcupsd supports all the popular APC models. See the installation and configurations sections of this document for more details. :Question: Does apcupsd support Windows? :Answer: Yes. :Question: I don't have a cable, which one should I build? :Answer: First you must know if you have an apcsmart UPS or a voltage-signalling UPS. If you have a apcsmart UPS, we recommend building a Custom Smart cable. (see `Smart-Custom Cable for SmartUPSes`_) If you have a voltage-signaling UPS, we recommend that you build a Custom Simple cable. (see `Simple-Custom Voltage-Signalling Cable for "dumb" UPSes`_) :Question: How much CPU resources does apcupsd use? :Answer: Depending on your CPU speed, you may see more or less of the CPU consumed by apcupsd. On a 400MHz Unix system, the CPU usage should fall well below 0.1%. On slower systems, the percentage will increase proportionally to the decrease in the CPU speed. On a 400Mhz Win98 machine, the CPU usage will be on the order of 0.5-1.0%. This is higher than for Unix systems. However, compared to the 30% CPU usage by APC's PowerChute (the version on the CDROM shipped with my UPS), apcupsd's 0.5-1.0% is very modest. :Question: What language is apcupsd written in? :Answer: It is written in C and C++. :Question: To test apcupsd, I unplugged the UPS to simulate a power outage. After the machine went into the shutdown process I plugged the UPS back into the commercial power source. This caused the shutdown process to hang after the daemon tried to shut-off the ups. Have you run into this problem, and if so do you have a remedy? :Answer: Normally, once the shutdown process has begun, we cannot stop it -- how do you stop a shutdown that has killed off half of the daemons running on your system? Most likely you will be left with an unusable system. In addition, when apcupsd is re-executed in the halt script after the disks are synced, it tries to shut off the UPS power, but the UPS will generally refuse to do so if the AC power is on. Since we cannot be 100% sure whether or not the UPS will shut off the power, we don't attempt to reboot the system if we detect that the power is back as it might then get caught by a delayed power off (at least for Smart UPSes). :Question: After running apcupsd for a while, I get the following error: "Serial communications with UPS lost." What is the problem? :Answer: We use standard Unix serial port read() and write() calls so once a connection is made, we generally have few problems. However, there have been reports that APC's SNMP Management Card can cause serial port problems. If you have such a card, we suggest that you remove it and see if the problem goes away. It is also possible that some other process such as a getty is reading the serial port. :Question: I get the following error: :: Starting apcupsd power management. Mar 20 21:19:40 box apcupsd[297]: apcupsd FATAL ERROR in apcserial.c at line 83. Cannot open UPS tty /dev/cua01: No such file or directory. What is the problem? :Answer: The two most likely causes of your problem are: 1. You have the wrong serial port device name in the apcupsd.conf file. 2. The device name is not defined on your system. Suggestions for proceeding:For the first item, check what your serial port device should be named. You might be able to find the name with an: :: ls /dev Normally there will be hundreds or even thousands of names that print. If that doesn't produce anything useful, you can try step 2. Perhaps your device is not defined. To get more information on your devices try '``man MAKEDEV``' or '``find / -name MAKEDEV``'. It is often located in ``/dev/MAKEDEV``. Looking at the documentation may tell you what the correct name is, or at least allow you to create the device. :Question: How do I ensure that the slaves shutdown before the master? :Answer: Slaves make their shutdown decision independently from the master. Therefore you can use the ``TIMEOUT``, ``MINUTES``, and ``BATTERYLEVEL`` settings in the slaves' apcupsd.conf to configure them to shut down before the master. :Question: How do I ensure that my database server is correctly shutdown? :Answer: You simply add whatever commands are necessary in the appropriate case statements in /etc/apcupsd/apccontrol, which is a standard script file that is called to actually do the shutdown. Alternatively, you can add your own script file that will be called before doing the commands in apccontrol. Your script file must have the same name as the appropriate case statement in apccontrol; it must be executable; and it must be in the same directory as apccontrol. Customizing Event Handling ========================== When apcupsd detects anomalies from your UPS device, it will make some decisions that usually result in one or more calls to the script located in ``/etc/apcupsd/apccontrol``. The ``apccontrol`` file is a shell script that acts on the first argument that apcupsd passes to it. These actions are set up by default to sane behavior for all situations apcupsd is likely to detect from the UPS. However, you can change the apccontrol behavior for every single action. To customize, so create a file with the same name as the action, which is passed as a command line argument. Put your script in the ``/etc/apcupsd`` directory. These events are sent to the system log, optionally sent to the temporary events file (``/etc/apcupsd/apcupsd.events``), and they also generate a call to ``/etc/apcupsd/apccontrol`` which in turn will call any scripts you have placed in the ``/etc/apcupsd`` directory. Normally, ``/etc/apcupsd/apccontrol`` is called only by apcupsd. Consequently, you should not invoke it directly. However, it is important to understand how it functions, and in some cases, you may want to change the messages that it prints using ``wall``. We recommend that you do so by writing your own script to be invoked by ``apccontrol`` rather than by modifying apccontrol directly. This makes it easier for you to upgrade to the next version of apcupsd In other case, you may want to write your own shell scripts that will be invoked by apccontrol. For example, when a power fail occurs, you may want to send an email message to root. To write your own routine for the ``powerout`` action, you create shell script named ``powerout`` and put it in the lib directory (normally /etc/apcupsd). When the ``powerout`` action is invoked by apcupsd, apccontrol will first give control to your script. If you want apccontrol to continue with the default action, simply exit your script with an exit status of zero. If you do not want apccontrol to continue with the default action, your script should exit with the special exit code of 99. However, in this case, please be aware that you must ensure proper shutdown of your machine if necessary. Some sample scripts (onbattery and mainsback) that email power failure messages can be found in /etc/apcupsd after an install or in the platforms/etc directory of the source code. apccontrol Command Line Options ------------------------------- When apcupsd detects an event, it calls the apccontrol script with four arguments as: ``apccontrol`` *event* *ups-name* *connected* *powered* where: *event* is the event that occurred and it may be any one of the values described in the next section. *ups-name* is the name of the UPS as specified in the configuration file (not the name in the EEPROM). *connected* is 1 if apcupsd is connected to the UPS via a serial port (or a USB port). In most configurations, this will be the case. In the case of a Slave machine where apcupsd is not directly connected to the UPS, this value will be 0. *powered* is 1 if the computer on which apcupsd is running is powered by the UPS and 0 if not. At the moment, this value is unimplemented and always 0. The following *event* names are supported: **annoyme** When a shutdown is scheduled, and the time specified on the ANNOYME directive in the apcupsd.conf file expires, this event is generated. *Default:* ``wall`` a message **changeme** When apcupsd detects that the mains are on, but the battery is not functioning correctly, this event is generated. It is repeated every x hours. *Default:* ``wall`` a message **commfailure** This event is generated each time the communications line with the computer is severed. This event is not detected on dumb signaling UPSes. *Default:* ``wall`` a message **commok** After a commfailure event is issued, when the communications to the computer is re-established, this event will be generated. *Default:* ``wall`` a message **doreboot** This event is depreciated and should not be used. *Default:* Shuts down the system using ``shutdown -h`` or similar **doshutdown** When the UPS is running on batteries and one of the limits expires (time, run, load), this event is generated to cause the machine to shutdown. *Default:* Shuts down the system using ``shutdown -h`` or similar **emergency** Called for an emergency system shutdown. (What triggers such a shutdown is unclear...) After completing this event, apcupsd will immediately initiate a ``doshutdown`` event. *Default:* ``wall`` a message **failing** This event is generated when the UPS is running on batteries and the battery power is exhausted. The event following this one will be a shutdown. *Default:* ``wall`` a message **loadlimit** This event is generated when the battery charge is below the low limit specified in the apcupsd.conf file. After completing this event, apcupsd will immediately initiate a ``doshutdown`` event. *Default:* ``wall`` a message **powerout** This event is generated immediately when apcupsd detects that the UPS has switched to batteries. It may be due to a short powerfailure, an automatic selftest of the UPS, or a longer powerfailure. *Default:* ``wall`` a message **onbattery** This event is generated 5 or 6 seconds after an initial powerfailure is detected. It means that apcupsd definitely considers the UPS to be on batteries. The onset of this event can be delayed by the ``ONBATTERYDELAY`` apcupsd.conf configuration directive. *Default:* ``wall`` a message **offbattery** This event is generated when the mains return only if the onbattery event has been generated. *Default:* ``wall`` a message **mainsback** This event is generated when the mains power returns after a powerout condition. The shutdown event may or may not have been generated depending on the parameters you have defined and the length of the power outage. *Default:* nothing **remotedown** This event is generated on a slave machine when it detects either that the master has shutdown, or that a onbattery situation exists and the communications line has been severed. *Default:* ``wall`` a message **runlimit** This event is generated when the ``MINUTES`` value defined in the apcupsd.conf file expires while in a power fail condition. The ``MINUTES`` is the remaining runtime as internally calculated by the UPS and monitored by apcupsd. After completing this event, apcupsd will immediately initiate a ``doshutdown`` event. *Default:* ``wall`` a message **timeout** This event is generated when the ``TIMEOUT`` value defined in the apcupsd.conf file expires while in a power fail condition. It indicates that the total time in a power failure has been exceeded and the machine should be shutdown. After completing this event, apcupsd will immediately initiate a ``doshutdown`` event. *Default:* ``wall`` a message **startselftest** This event is generated when apcupsd detects a self test by the UPS. Normally due to the 6 second onbattery delay default time, self test events are not detected. *Default:* nothing **endselftest** This event is generated when the end of a self test is detected. *Default:* nothing **battdetach** This event is generated when apcupsd detects that the UPS battery has been disconnected. *Default:* nothing **battattach** This event is generated when apcupsd detects that the UPS battery has been reconnected after a battdetach event. *Default:* nothing Controlling Multiple UPSes on one Machine ========================================= *The following discussion does not apply to Windows servers. Apcupsd on Windows is limited to a single instance and cannot support monitoring multiple UPSes.* If you have multiple UPSes in use, you may wish to consolidate the monitoring of all of these UPSes onto a single machine, which we shall call the "UPS server". Generally one of the UPSes is powering the "UPS server" itself (and possibly other machines as well). The remaining UPSes are powering additional machines. Apcupsd can work quite well in this environment by running one instance of apcupsd on the UPS server for each UPS to be controlled. That is, you install a single copy of apcupsd but launch it multiple times using different configuration files and scripts. (Older versions of apcupsd required you to actually compile the daemon multiple times with different ``configure`` options. This is no longer required, as all necessary adjustments can be made in ``apcupsd.conf``.) Additionally, you will run one instance of apcupsd on each of the machines you wish to be shut down. You will configure each of these apcupsd's to use the 'net' driver to read UPS status from the proper instance of apcupsd on the UPS server. See `NIS Server/Client Configuration Using the Net Driver`_ for more information on the 'net' driver and setting up net clients. Multiple UPS Example -------------------- There are many ways one could set up multiple apcupsd instances. Here I will present the way I have used with great success on Red Hat Linux. I have two apcupsd.conf files (this is for a 2 UPS setup, easily expandable to N): :: [adk0212@mail apcupsd]$ ls -l /etc/apcupsd/*.conf -rw-r--r-- 1 root root 11799 Aug 3 08:39 /etc/apcupsd/apcupsd.ups0.conf -rw-r--r-- 1 root root 11822 Aug 25 14:31 /etc/apcupsd/apcupsd.ups1.conf In my case, ups0 is the UPS powering the UPS server running the multiple apcupsd instances, so only ups0 should initiate a shutdown of the local machine. The differences between the confs are minor since both UPSes are USB (although that is not a requirement; mixing cable types works fine too): :: [adk0212@mail apcupsd]$ diff -u apcupsd.ups0.conf apcupsd.ups1.conf --- apcupsd.ups0.conf 2007-08-03 08:39:26.000000000 -0400 +++ apcupsd.ups1.conf 2007-08-25 14:31:17.000000000 -0400 -UPSNAME ups0 +UPSNAME ups1 -DEVICE /dev/ups0 +DEVICE /dev/ups1 -SCRIPTDIR /etc/apcupsd +SCRIPTDIR /etc/apcupsd/null -PWRFAILDIR /etc/apcupsd +PWRFAILDIR /etc/apcupsd/null -NOLOGINDIR /etc +NOLOGINDIR /etc/apcupsd/null -ANNOY 300 +ANNOY 0 -NISPORT 3551 +NISPORT 3552 -EVENTSFILE /var/log/apcupsd.events +EVENTSFILE /var/log/apcupsd.2.events The important difference to note is that ups1 has its ``SCRIPTDIR``, ``PWRFAILDIR``, and ``NOLOGINDIR`` set to a special "null" directory that I have created. This directory contains a copy of the event handling scripts modified to avoid shutting down the local machine. (Details below). Also the UPSes are given different ``EVENTSFILE`` and ``NISPORT`` settings. Plus I disable the "annoy" feature on ups1. Since the state of that UPS does not impact local users, there's no reason to annoy them. I have the following files in the special "null" directory: :: [adk0212@mail apcupsd]$ ls -l /etc/apcupsd/null total 32 -rwxr--r-- 1 root root 4176 Aug 3 08:24 apccontrol -rwxr-xr-x 1 root root 475 Aug 3 08:28 changeme -rwxr-xr-x 1 root root 502 Aug 3 08:28 commfailure -rwxr-xr-x 1 root root 503 Aug 3 08:28 commok -rwxr--r-- 1 root root 8 Aug 3 08:22 doshutdown -rwxr-xr-x 1 root root 470 Aug 3 08:27 offbattery -rwxr-xr-x 1 root root 435 Aug 3 08:27 onbattery The important change here is the addition of a 'doshutdown' script which overrides apccontrol's shutdown action: :: [adk0212@mail null]$ cat /etc/apcupsd/null/doshutdown exit 99 The "exit 99" tells apccontrol to skip its normal processing for that event. apccontrol itself is unchanged; it is a direct copy of the original. The other scripts are also direct copies and have simply been modified to generate status email from NISPORT 3552 instead of 3551. I also have a custom init.d start/stop script to manage multiple instances. The start, stop, and status handlers are modified to iterate over all /etc/apcupsd/apcupsd.*.conf files. This is derived from the standard apcupsd redhat rc script: :: #! /bin/sh # # apcupsd This shell script takes care of starting and stopping # the apcupsd UPS monitoring daemon. # # chkconfig: 2345 60 99 # description: apcupsd monitors power and takes action if necessary # if test -f /etc/whitebox-release ; then f=/etc/whitebox-release else f=/etc/redhat-release fi if test `cat $f | grep release |\ cut -f 3 -d ' '`x = "Enterprise"x ; then DISTVER="Enterprise "`cat $f | grep release |\ cut -f 6 -d ' '` else DISTVER=`cat /etc/redhat-release | grep release |\ cut -f 5 -d ' '` fi # Source function library . /etc/rc.d/init.d/functions case "$1" in start) rm -f /etc/apcupsd/powerfail rm -f /etc/nologin for conf in /etc/apcupsd/apcupsd.*.conf ; do inst=`basename $conf` echo -n "Starting UPS monitoring ($inst):" daemon /sbin/apcupsd -f $conf -P /var/run/apcupsd-$inst.pid RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apcupsd-$inst done ;; stop) for conf in /etc/apcupsd/apcupsd.*.conf ; do inst=`basename $conf` echo -n "Shutting down UPS monitoring ($inst):" killproc -p /var/run/apcupsd-$inst.pid apcupsd echo rm -f /var/run/apcupsd-$inst.pid rm -f /var/lock/subsys/apcupsd-$inst done ;; restart|force-reload) $0 stop sleep 15 $0 start ;; reload) echo "$0: reload not implemented" exit 3 ;; status) for conf in /etc/apcupsd/apcupsd.*.conf ; do inst=`basename $conf` status -p /var/run/apcupsd-$inst.pid apcupsd-$inst RETVAL=$? if [ $RETVAL -eq 0 ] then NISPORT=`grep ^NISPORT < $conf | sed -e "s/NISPORT *\([0-9]\)/\1/"` /sbin/apcaccess status localhost:$NISPORT | egrep "(STATUS)|(UPSNAME)" fi done ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 ;; esac exit 0 That's about all there is to it. There are still some rough edges to clean up, but overall this is a *lot* easier with apcupsd 3.14.x than it used to be. Support for SNMP UPSes ====================== To run apcupsd with a SNMP UPS, you need the following things: - An SNMP UPS, for example a Web/SNMP (AP9716) or PowerNet SNMP (AP9605) card installed into the SmartSlot. Apcupsd also has support for some non-APC SNMP UPSes using RFC1628 or MGE MIBs, however the majority of the information in this section is for APC UPSes. Planning and Setup for SNMP Wiring ---------------------------------- SNMP packet requests are relayed to the UPS from monitoring APCUPSD servers over Ethernet via a switch, hub, or router. Protecting these Ethernet devices with UPS supplied power is necessary to ensure reliable SNMP communication during power failures. Servers may fail to shutdown quietly during power failures if SNMP communication is lost. Planning and Setup for SNMP Configuration ----------------------------------------- To establish communication to the UPS SNMP card installed in the UPS, the SNMP card will need the following: - Assign SNMP card IP Address - Set SNMP card General Parameters - Set SNMP card Shutdown Parameters - Set SNMP card Event Trap Receivers (apcupsd-3.12.0 and later) Assign SNMP Card IP Address ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following instructions come from the APC knowledge base: :: The Network Management Card (AP9617, AP9618, AP9619) must be configured with network settings before it can communicate on the network. Once the cards have been configured with an IP address, Subnet Mask, and Default Gateway the cards can be access, managed, and controlled from other computers on the network. There are two ways to configure the Network Management Card (NMC) with its initial settings: the (windows) Wizard and Address Resolution Protocol (ARP). 1. The wizard in included on the CD that comes with the card. The wizard must run on a Windows operating system. You can configure the card using the wizard over the network via FTP. If using the wizard please note, the un-configured NMC must be on the same subnet as the computer running the wizard. 2. Address resolution protocol (arp) can also be used to configure the NMC. The MAC Address of the NMC is needed for this method of configuration. The MAC address is located on the quality assurance slip that is shipped with the NMC, and is also located on the white sticker on the NMC itself. From a computer on the same subnet as the un-configured NMC, follow the instructions: Open up a command prompt and type the following (replacing and with the actual values): arp -s Next, use Ping with a size of 113 bytes to assign the IP address defined by the ARP command. - Linux command format: ping -s 113 - Windows command format: ping -l 113 Set SNMP card General Parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After the SNMP Network Management Card is configured with an IP address, the SNMP Card is ready for general configuration. This is accomplished by telneting to the SNMP Card. :: ~$ telnet Login using "apc" for both the username and password and the following menu will display: :: ******************************************************************************* American Power Conversion Network Management Card AOS v2.6.4 (c) Copyright 2004 All Rights Reserved Smart-UPS & Matrix-UPS APP v2.6.1 ------------------------------------------------------------------------------- Name : Date : 07/03/2006 Contact : Time : 04:43:33 Location : User : Administrator Up Time : 0 Days 01 Hours 57 Minutes Stat : P+ N+ A+ Smart-UPS 1000 named : On Line, No Alarms Present ------- Control Console ------------------------------------------------------- 1- Device Manager 2- Network 3- System 4- Logout - Main Menu, - Refresh, - Event Log > ******************************************************************************* Select **Option 2** for Network. Next select **Option 1** for TCP/IP settings. At this point the following settings will be to be specified: - Verify System IP: - Specify Subnet Mask: i.e. "225.225.225.0" - Specify Default Gateway - Specify Host Name - Specify Domain Name Specifying these parameters will complete the General Parameters setup. Additionally the SNMP Network Management Card can now be connected to from a web browser for monitoring and additional configuration. Set SNMP card Shutdown Parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There are two shutdown parameters that must be set in the SNMP card to ensure that connected servers shutdown quietly. These parameters can be set via the telnet terminal or the web browser interface. - Shutdown Delay (sec) - Return Battery Capacity (%) One of the draw-backs of SNMP communication to the UPS is that the Stand-alone or Primary server must issue the power down command to the UPS early in server halt procedure. This server must issue an early command to the SNMP UPS to power down before its ethernet service is halted. This creates a potential problem where the UPS may kill power to any connected servers before these affected servers' halt scripts complete a successful shutdown. The SNMP **Shutdown Delay** parameter is used to delay the UPS from killing power to its load by a prescribed period of seconds. The delay should be long enough to ensure that the Stand-alone or Primary server has enough time to successfully halt. The prescribed time should at least be 180 seconds. Any additional computers connected to the SNMP UPS must not be configured to issue the command to initiate UPS power down. These servers can be thought of as secondary stand-alone server. The APCUPSD daemons of secondary servers should be configured to initiate server halt a prescribed period of time before the Primary server issues the UPS power down command. The **Return on Battery Capacity** is useful during intermittent sequential power failures. This parameter insures that the UPS will not restore power to its loads until it has recharged it battery to a prescribed percentage. This parameter should be set to a value greater than value that the APCUPSD daemons configured "BATTERYLEVEL" shutdown of any connected servers. This will ensure that when the UPS restores power, any additional power failures will successfully re-trigger a server shutdown. Configure Event Trap Receivers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (Requires apcupsd-3.12.0 and later) By default, APCUPSD will poll the SNMP UPS card once per minute. In this case, server notification of UPS alarms could potentially be delayed one minute. Event trap catching mitigates this shortcoming. Any UPS alarms are instantly sent to prescribe servers connected SNMP UPS. These servers are referred to as Event Trap Receivers. The SNMP UPS card can be configure to send event traps to a maximum of four receivers that will "catch" these events. Event trap receivers IP address can be set using a telnet terminal or web browser interface. Also, be aware that servers configured to be Event Trap Receivers should have static IP set. Severs obtaining IPs from DHCP server will not catch instantaneous Events if the IP address changes from the address set in the SNMP UPS. Connecting APCUPSD to a SNMP UPS -------------------------------- The previous sections describe configuration of the actual SNMP card. The remaining sections describe configuration of the APCUPSD to communicate using SNMP Protocol. To enable the SNMP support it is enough to configure the correct device in your apcupsd.conf configuration file. The directive needed for this configuration is: :: DEVICE ::: ...where the directive is made by four parts. All but the first may be omitted completely or left empty to accept the default. - *host*: IP address or DNS hostname of the UPS (required) - *port*: Remote SNMP port (optional, default: 161) - *vendor*: The type of SNMP MIB available on the UPS (optional, default: autodetect). Allowable choices for vendor are: - APC : APC PowerNet MIB, used on most APC brand UPSes - RFC : RFC1628 MIB, used by some non-APC UPSes - MGE : MGE MIB, used by many MGE brand UPSes - blank : Autodetect Append "_NOTRAP" to the vendor name to disable SNMP trap catching (ex: "APC_NOTRAP"). See `SNMP Trap Catching`_. - *community*: The read-write community string, usually "private". You can specify a read-only community string, usually "public", if you do not require killpower support. If the community string is omitted, apcupsd will attempt to autotedect by trying "private" and "public". (optional, default: autodetect). A NIS Server/Client (Master/Slave) configuration with multiple servers is still applicable. However, an alternative configuration is possible with an SNMP enabled UPS. In this arrangement, all connected servers will be configured as a standalone server. Each will independently communicate to the UPS. One (primary) server will be chosen to manage the task of commanding the UPS to power down. All remaining (secondary) servers will be configured to quietly power down before the primary server issues the UPS power down command. Building with SNMP support -------------------------- Follow the instructions in `Building and Installing apcupsd`_, being sure to include the following options (in addition to any others you need) on the '``./configure``' line: :: ./configure --enable-snmp SNMP Trap Catching ------------------ apcupsd-3.11.14 introduces support for SNMP trap catching. Previous versions polled the UPS status once per minute, leading to significant delays before UPS state changes were recognized. With SNMP trap handling, apcupsd monitors the SNMP trap port and will re-poll the UPS whenever a trap is received. This happens, for example, when the UPS switches on or off battery. In order for this feature to work, you must configure your UPS to deliver traps to the server running apcupsd. This is generally done by connecting to your SNMP card via a web browser or telnet connection. You will need to enter your server's IP address as a trap receiver and make sure trap delivery is enabled. Trap catching can lead to problems if you are already running another SNMP trap daemon on your server. Only one daemon can listen to the trap port, so whichever one is started first will succeed and the others will fail. Apcupsd will fall back to polling behavior if it is unable to open the trap port. You can also forcibly disable trap catching by appending ``_NOTRAP`` to your vendor string in the apcupsd.conf ``DEVICE`` directive. Known Problems -------------- Currently (as of 3.10.0) the code to power off the UPS needs special configuration. The killpower command for SNMP UPSes can not be issued during shutdown as typically at some time during shutdown operations the network stack is stopped. To overcome this problem it is needed to modify the /etc/rc.d/apcupsd system control script to tell apcupsd to issue the power down command (killpower) to the UPS immediately before apcupsd initiates the system shutdown. For this reason it is paramount to set your UPS grace time to a value greater than 120 seconds to allow for clean shutdown operations before the UPS removes the power from its plugs. To enable correct shutdown operation during powerdown do the following: - Connect to your Web/SNMP card using your favorite web browser, go to the UPS configuration menu and change the "Shutdown Delay" parameter to 180 seconds or more, depending on how much time your system shutdown requires to umount all the filesystems. - **Option 1 (non-windows)** Edit the server halt script. Relocate the ups_kill_power() function higher in the shutdown sequence, primarily before the command to bring down the ethernet service. This is the preferred method for shutting down the UPS. The UPS will power down after the prescribed "Shut Down Delay" time (in seconds) has elapsed. - **Option 2** Change /etc/rc.d/apcupsd script adding the ``--kill-on-powerfail`` to the apcupsd invocation. This method is not preferred because the UPS is commanded to power down without delay. This creates the potential for UPS powering down before the server calling for UPS power down completes its shutdown. However, in the case of Microsoft Windows OS, this is the only method available for powering down the UPS. - Restart your apcupsd With this setup your UPS operations should be safe. apcupsd System Logging ====================== The apcupsd philosophy is that all logging should be done through the ``syslog`` facility (see: '``man syslog``') This is now implemented with the exceptions that STATUS logging, for compatibility with prior versions is still done to a file, and EVENTS logging can be directed to a temporary file so that it can be reported by the network information server. Logging Types ------------- apcupsd splits its logging into four separate types called: #. DEBUG #. DATA #. STATUS #. EVENTS Debug logging consists of debug messages. Normally these are turned on only by developers, and currently there exist very few of these debug messages. Data Logging ~~~~~~~~~~~~ This feature is somewhat outdated and not often used. Data logging consists of periodically logging important data concerning the operation of the UPS. For the definitive definition of the format, see log\_data() in apcreports.c. The format varies according to the UPS model and the information available from the UPS. For UPS models, NBKPRO, SMART, SHARESMART, and MATRIX, the output is written in a format very similar to what PowerChute writes. That is: MinLineVoltage, MaxLineVoltage, OutputVoltage, BatteryVoltage, LineFrequency, LoadPercent, UPSTemperature, AmbientTemperature, Humidity, LineVoltage, BatteryCharge, toggle Any value that is not supported by your UPS such as AmbientTemperature and Humidity will be blank or possibly as 0.0. In any case the commas before and after that field will still be output. The toggle value alternates from 0 to 1 on each line. This was added at user request so that no two adjacent samples are identical. An actual example from the log file is: :: Nov 2 12:43:05 matou apcupsd[23439]: 224.9,227.5,226.2,27.74,50.00,100.0,30.6,,,226.2,50.0,1 Status Logging ~~~~~~~~~~~~~~ Status logging consists of logging all available information known about your UPS as a series of ASCII records. This information is also made available by the apcupsd network information server. For more details on STATUS logging, see the `apcupsd Status Logging`_ section for details. EVENTS Logging ~~~~~~~~~~~~~~ Events logging consists of logging events as they happen. For example, successful startup, power fail, battery failure, system shutdown, ... See the `Customizing Event Handling`_ section for more details. Implementation Details ---------------------- In order to ensure that the data logged to syslog() can be directed to different files, I have assigned syslog() levels to each of our four types of data as follows: #. DEBUG logging has level LOG_DEBUG #. DATA logging has level LOG_INFO #. STATUS logging has level LOG_NOTICE #. EVENTS logging has levels LOG_WARNING, LOG_ERR, LOG_CRIT, and LOG_ALERT It should be noted that more work needs to be done on the precise definitions of each of the levels for EVENTS logging. Currently, it is roughly broken down as follows: LOG_WARNING general information such as startup, etc. LOG_ERR an error condition detected, e.g. communications problem with the UPS. LOG_CRIT a serious problem has occurred such as power failure, running on UPS batteries, ... LOG_ALERT a condition that needs immediate attention such as pending system shutdown, ... The default Facility for syslog() logging is DAEMON, although this can be changed with the FACILITY directive in apcupsd.conf. In the following example, we should the facility as local0. More work needs to be done to the code to ensure that it corresponds to the above levels. As a practical example of how to setup your syslog() to use the new logging feature, suppose you wish to direct all DATA logging to a file named /var/log/apcupsd.data, all EVENTS to the standard /var/log/messages file (to be mixed with other system messages), and at the same time send all EVENTS to /var/log/apcupsd.events, and finally, you want to send all STATUS logging to the named pipe /var/log/apcupsd.status First as root, you create the named pipe: :: mkfifo /var/log/apcupsd.status Change its permissions as necessary or use the -m option to set them when creating the pipe. Then you modify your /etc/syslog.conf file to direct the appropriate levels of messages where you want them. To accomplish the above, my syslog.conf file looks like: :: # exclude all apcupsd info by default *.info;local0.none /var/log/messages # Everything for apcupsd goes here local0.info;local0.!notice /var/log/apcupsd.data local0.notice;local0.!warn |/var/log/apcupsd.status local0.warn /var/log/apcupsd.events local0.warn /var/log/messages The Windows Version of apcupsd ============================== The Windows version of apcupsd has been tested on Win95, Win98, WinMe, WinNT, WinXP, and Win2000 systems. This version of apcupsd has been built to run natively on Windows (no Cygwin or other emulation layer needed). Even though the Win32 version of apcupsd is a port that relies on many Unix features, it is just the same a true Windows program. When running, it is perfectly integrated with Windows and displays its icon in the system icon tray, and provides a system tray menu to obtain additional information on how apcupsd is running (status and events dialog boxes). Once installed apcupsd normally runs as a system service. This means that it is immediately started by the operating system when the system is booted, and runs in the background even if there is no user logged into the system. Installing Apcupsd on Windows ----------------------------- Normally, you will install the Windows version of apcupsd from the binaries. Starting with version 3.11.15, the Windows binaries are distributed with a full GUI installer driven by NSIS, the Nullsoft Scriptable Install System (http://nsis.sourceforge.net). Installation is very simple and straight-forward: Simply double-click the installer executable and follow the instructions. Configuring Apcupsd on Windows ------------------------------ If you are installing Apcupsd for the first time, the installer will give you an opportunity to edit the apcupsd.conf configuration file to contain the values appropriate for your site. (Subsequent installations will maintain your existing apcupsd.conf, so you need not edit it again unless there are new features or syntax changes that must be accounted for.) The default configuration calls for a USB connected UPS. This is the most common connection for modern UPSes, especially those used with Windows computers. All other apcupsd drivers are available (apcsmart, dumb, net, snmp, pcnet) and can be used simply by editing the configuration file ``UPSCABLE``, ``UPSTYPE``, and ``DEVICE`` settings as described elsewhere in this manual. Note that on Windows, serial ports are specified using ``COM1``, ``COM2``, etc. notation instead of the UNIX-style /dev/tty\* notation. Note also if you are using WinNT or Win2000, the operating system may probe the serial port attempting to attach a serial mouse. This will cause apcupsd to be unable to communicate with the serial port. If this happens, or out of precaution, you can edit the ``c:\\boot.ini`` file. Find the line that looks something like the following: :: multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation Version 4.00" and add the following to the end of the line: ``/NoSerialMice:COM1`` (or COM2 depending on what you want to use). The new line should look similar to... :: multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation Version 4.00" /NoSerialMice:COM1 ...where the only thing you have changed is to append to the end of the line. This addition will prevent the operating system from interfering with apcupsd Starting Apcupsd on Windows --------------------------- The installer will give you an opportunity start the Apcupsd service immediately. If you choose to start it manually, you may do so by selecting the "Start Apcupsd" link from the Start->Programs->Apcupsd folder. On Windows NT/2000/XP, you may alternatively go to the Control Panel, open the Services folder, select Apcupsd UPS Server, and then click on the **Start** button as shown below: .. image:: ./wininstall6.png If the Services dialog reports a problem, it is normally because your ``DEVICE`` statement does not contain the correct serial port name. You probably should also click on the **Startup...** button to ensure that the correct defaults are set. The dialogue box that appears should have **Startup Type** set to **Automatic* and **Logon** should be set to **System Account**. If these values are not set correctly by default, please change them otherwise apcupsd will not work. For WinXP and Win2K systems, the dialogs are a bit different from those shown here for WinNT, but he concept is the same. You get to the Services dialog by clicking on: Control Panel -> Administrative Tools -> Component Services. The apcupsd service should appear in the right hand window when you click on **Services (Local)** in the left hand menu window. That should complete the installation process. When the system tray icon turns from a question mark |image4| into a plug |image5|, right click on it and a menu will appear. Select the **Events** item, and the Events dialogue box should appear. There should be no error messages. By right clicking again on the system tray plug and selecting the **Status** item, you can verify that all the values for your UPS are correct. When the UPS switches to the battery, the battery icon |image6| will appear in the system tray. While the UPS is online, if the battery is not at least 99% charged, the plug icon will become a plug with a lightning bolt in the middle |image7| to indicate that the battery is charging. Apctray ------- Starting with version 3.14.2, the tray icon is provided by a separate program called 'apctray'. This cleanly separates the user interface from the daemon (service) and is required for tray icon support on Windows Vista. Note that if you close or disable the tray icon this does **not** stop or disable the apcupsd service which will continue to monitor the UPS and shutdown the computer when appropriate. To stop or disable the service, use the service control panel. apctray has the capability of monitoring multiple apcupsd instances using apcupsd's Network Information Server (NIS). It will create a new icon for each instance being monitored. By default, apctray monitors the local apcupsd (localhost on port 3551). To add additional monitors, you can right-click an existing icon and choose "Add Monitor". To remove a monitor, right-click its icon and choose "Remove Monitor". To change thr settings for an existing monitor (ip address, port, refresh rate), right-click its icon and choose "Configure...". apctray can be installed standalone (without apcupsd) if you wish to use it only to monitor remote apcupsd instances. This can be convenient for keeping an eye on a room full of UPSes from your desktop. Download and run the normal apcupsd installer and simply uncheck all components except apctray. Then add as many monitors as you wish as described above. Testing Apcupsd on Windows -------------------------- It would be hard to overemphasize the need to do a full testing of your installation of apcupsd as there are a number of reasons why it may not behave properly in a real power failure situation. Please read the `Testing Apcupsd`_ section of this document for general instructions on testing the Win32 version. However, on Win32 systems, there is no Unix system log file, so if something goes wrong, look in the file ``c:\apcupsd\etc\apcupsd\apcupsd.events`` where apcupsd normally logs its events, and you will generally find more detailed information on why the program is not working. The most common cause of problems is either improper configuration of the cable type, or an incorrect address for the serial port. Additionally, check the application event log, if you're running a platform that supports it such as Windows 2000 or XP. Upgrading --------- An upgrade may be accomplished by uninstalling the old version (using the Add/Remove Programs Control Panel or clicking the "Uninstall Apcupsd" link from Start -> Programs -> Apcupsd. Near the end of the uninstall you will be prompted about removing configuration and event files. You should answer "No" in order to preserve your existing apcupsd.conf file. After the uninstall completes you may install the new version of Apcupsd as described above. If you preserved your existing apcupsd.conf file, the new apcupsd.conf will be installed as apcupsd.conf.new. Post-Installation ----------------- After installing apcupsd and before running it, you should check the contents of the config file ``c:\apcupsd\etc\apcupsd\apcupsd.conf``. You will probably need to change your UPSCABLE directive, your UPSTYPE and possibly your DEVICE directives. Please refer to the configuration section of this manual for more details. Problem Areas ------------- On some Windows systems, the domain resolution does not seem to work if you have not configured a DNS server in the Network section of the Control Panel. This problem should be apparent only when running a slave configuration. In this case, when you specify the name of the master in your apcupsd.conf file, apcupsd will be unable to resolve the name to a valid IP address. To circumvent this problem, simply enter the address as an IP address rather than a hostname, or alternatively, ensure that you have a valid DNS server configured on your system. On WinNT, WinXP, and Win2K systems, you can examine the System Applications log to which apcupsd writes Windows error messages during startup. Regardless of which Windows system you are running, apcupsd logs most error messages to ``c:\apcupsd\etc\apcupsd\apcupsd.events``. This type error messages such as configuration file not found, etc are written to this file. Note that on some systems (WinXP, possibly others) Apcupsd is unable to write to this file when running as a service. Email Notification of Events ---------------------------- It is possible to receive email notification of apcupsd events using some simple Visual Basic scripts contributed by Ed Dondlinger . The scripts are automatically installed in the ``etc/apcupsd`` directory of your apcupsd installation but are disabled by default. To enable them, first open them in a text editor such as Notepad and edit the ``USER VARIABLES`` section to set your email preferences including address, server information, etc. Then rename the script files without the ``*.example`` suffix. Scripts are supplied for onbattery, offbattery, and commfailure events. You can copy the scripts to other filenames and modify the email body text to respond to other events as described in `Customizing Event Handling`_. Killpower under Windows ----------------------- If your batteries become exhausted during a power failure and you want your machine to automatically reboot when the power comes back, it is useful to implement the killpower feature of the UPS where apcupsd sends the UPS the command to shut off the power. In doing so, the power will be cut to your PC and if your BIOS is properly setup, the machine will automatically reboot when the power comes back. This is important for servers. This feature is implemented on Unix systems by first requesting a system shutdown. As a part of the shutdown, apcupsd is terminated by the system, but the shutdown process executes a script where apcupsd is recalled after the disks are synced and the machine is idle. Apcupsd then requests the UPS to shut off the power (killpower). Unfortunately on Windows, there is no such shutdown script that we are aware of and no way for apcupsd to get control after the machine is idled. If this feature is important to you, it is possible to do it by telling apcupsd to immediately issue the killpower command after issuing the shutdown request. The danger in doing so is that if the machine is not sufficiently idled when the killpower takes place, the disks will need to be rescanned (and there is a possibility of lost data however small). Generally, UPSes have a shutdown grace period which gives sufficient time for the OS to shutdown before the power is cut. To implement this feature, you need to add the ``-p`` option to the apcupsd command line that is executed by the system. Currently the procedure is manual. You do so by editing the registry and changing the line: :: c:\apcupsd\apcupsd.exe /service found under the key: :: HKEY_LOCAL_MACHINE Software\Microsoft\Windows\CurrentVersion\RunServices to :: c:\apcupsd\apcupsd.exe /service -p If you have a Smart UPS, you can configure the kill power grace period, and you might want to set it to 3 minutes. If you have a dumb UPS, there is no grace period and you should not use this procedure. If you have a Back-UPS CS or ES, these UPSes generally have a fixed grace period of 2 minutes, which is probably sufficient. Power Down During Shutdown -------------------------- Our philosophy is to shutdown a computer but not to power it down itself (as opposed to having the UPS cut the power as described above). That is we prefer to idle a computer but leave it running. This has the advantage that in a power fail situation, if the killpower function described above does not work, the computer will continue to draw down the batteries and the UPS will hopefully shutoff before the power is restore thus permitting an automatic reboot. Nevertheless some people prefer to do a full power down. To do so, you might want to get a copy of PsShutdown, which does have a power down option. You can find it and a lot more useful software at: http://www.sysinternals.com/ntw2k/freeware/pstools.shtml. To use their shutdown program rather than the apcupsd supplied version, you simply edit: :: c:\apcupsd\etc\apcupsd\apccontrol with any text editor and change our calls to shutdown to psshutdown. Command Line Options Specific to the Windows Version ---------------------------------------------------- These options are not normally seen or used by the user, and are documented here only for information purposes. At the current time, to change the default options, you must either manually run apcupsd or you must manually edit the system registry and modify the appropriate entries. In order to avoid option clashes between the options necessary for apcupsd to run on Windows and the standard apcupsd options, all Windows specific options are signaled with a forward slash character (``/``), while as usual, the standard apcupsd options are signaled with a minus (``-``), or a minus minus (``--``). All the standard apcupsd options can be used on the Windows version. In addition, the following Windows only options are implemented: /service Start apcupsd as a service /run Run the apcupsd application /install Install apcupsd as a service in the system registry /remove Uninstall apcupsd from the system registry /about Show the apcupsd about dialogue box /kill Stop any running apcupsd /help Show the apcupsd help dialogue box It is important to note that under normal circumstances the user should never need to use these options as they are normally handled by the system automatically once apcupsd is installed. However, you may note these options in some of the .pif files that have been created for your use. Installation: Serial-Line UPSes =============================== Overview of Serial-Interface UPSes ---------------------------------- If you have a UPS that communicates via serial port, you need to do two things before you can even think about configuring the software. First, you need to figure out whether it's a dumb (voltage-signalling) UPS or speaks the apcsmart protocol. Second, if you have an interface cable from APC, you need to figure out what kind it is. If you don't have such a cable, you need to build one. A straight-through serial cable won't work. According to Bill Marr the Belkin F5U109, also sold as F5U409 also works with apcupsd for kernel versions 2.4.25 or higher and kernels 2.6.1 and higher. These newer kernels are needed to have the patch that makes the mct\_u232 (Magic Control Technology) module and other adapters work with RS-232 devices that do not assert the CTS signal. Connecting a Serial-Line UPS to a USB Port ------------------------------------------ By using a special adaptor, you can connect your serial-line UPS to a USB port. If you would like to free up your serial port and connect your existing serial port UPS to a USB port, it is possible if you have one of the later kernels. You simply get a serial to USB adapter that is supported by the kernel, plug it in and make one minor change to your apcupsd.conf file and away you go. (Kern adds: Thanks to Joe Acosta for pointing this out to me.) The device that Joe Acosta and Kern are using is IOgear GUC232A USB 2 serial adapter. Bill Marr informs us that it also works with a Back-UPS Pro 650 and the 940-0095B cable. At Kern's site, running Red Hat 7.1 with kernel 2.4.9-12, he simply changed his /etc/apcupsd/apcupsd.conf configuration line to be: :: DEVICE /dev/ttyUSB0 Depending on whether or not you have hotplug working, you may need to explicitly load the kernel modules ``usbserial`` and ``pl2303``. In Kern's case, this was not necessary. Testing Serial-Line UPSes ------------------------- If you have a serial-line UPS, there are some tests you should run before the general ones described in the `Testing Apcupsd`_ section. To test your computer's connection with a serial-line UPS, you first need to establish that the serial line is functioning, and then that the UPS is responding to commands. This can be a bit tricky, especially with a dumb voltage-signalling interface, because it is completely quiescent when there are no commands being passed, and the command repertoire doesn't include any self-tests. Because it is easy to configure a serial cable incorrectly in such a way as to cause premature shutdowns of the UPS power, we *strongly* recommend, especially for voltage- signaling (dumb) UPSes, that you do most of the initial testing with your computer plugged into the wall rather than your UPS. Thus if the UPS power is suddenly shut off, your computer will continue to run. We also recommend using safe-apccontrol as described below, until you are sure that the signaling is correct. Also note that if you launch the execution of apcupsd while your voltage-signaling UPS is on battery power, it is very likely that your UPS will immediately shut off the power. This is due to the initialization of the serial port line signals, which often looks to the UPS like a shutdown command. Finally, double-check the state of your cabling and UPS indicator lights frequently during testing. For voltage-signaling UPSes, apcupsd is not currently able to detect whether or not the serial cable is connected. In addition, some simple signaling UPSes with certain cable combinations are not able to detect the low battery condition. For more details please see `Voltage Signalling Features Supported by Apcupsd for Various Cables`_. Establishing Serial Port Connection ----------------------------------- Once you have compiled, installed, and invoked apcupsd, you should wait to allow apcupsd to configure itself and establish contact with the UPS. If you see a message similar to the following about 30 seconds after starting apcupsd... :: apcupsd FATAL ERROR in apcserial.c at line 156 PANIC! Cannot communicate with UPS via serial port. it means that apcupsd tried for about 30 seconds to establish contact with the UPS via the serial port, but was unable to do so. Before continuing, you must correct this problem. Some of the possible sources of the problem are: - You have not configured the correct serial port name on the ``DEVICE`` directive in your apcupsd configuration file. - The serial port that you have chosen has logins enabled. You must disable logins on that port, otherwise, the system prevents apcupsd from using it. Normally, the file /etc/inittab specifies the ports for which a getty process is started (on Sun machines, the serial port program equivalent to getty is called ttymon). You must disable this for the port that you wish to use. - Make sure you are doing your testing as root otherwise, you may have permissions problems accessing the serial port. - You may have cabling problems, either with an incorrect cable, or the incorrect cable specification directive in the configuration file. - You may have a problem with the /etc/apcupsd/acpupsd.conf file. For example, check that you have specified the correct type of UPS and the correct networking directives. For more details, see the `After Installation`_ section. - If you have a SmartUPS 5000 RM 15U or similar model, that comes with a "Web/SNMP management card" in one of the "Smart Slots", this card may interfere with the serial port operation. If you are having problems, please remove this card and try again. Supposedly V3.0 of the card firmware has been corrected to properly release the serial port. - Ensure that you have no other programs that are using the serial port. One user reported that he had problems because the serial port mouse (gpm) was using the same port as apcupsd. This causes intermittent seemingly random problems. - Try connecting your UPS to another machine. If it works, then you probably have a bad serial port card. As unlikely as this may sound, at least two of our users have had to replace bad serial port cards. - Try doing an '``lsof /dev/ttyS0``' where you replace the ``/dev/ttyS0`` with your serial port name. If you get no output, the port is free (or there is no physical port). If you get output, then another program is using the port, and you should see which one. - Try doing a '``dmesg | grep tty``'. This may show you if a program has grabbed the port. (Thanks to Joe Acosta for the suggestion.) - If all else fails, make sure your system is configured for serial port support. The first thing to do is to look at your log file, usually /var/log/messages because apcupsd writes more detailed information to the log file whenever there is an error. If you have a UPS that uses apcsmart protocol, you can manually test the serial communications with the UPS by starting a serial port communications program (such as minicom, tip, or cu) with the settings 2400 8N1 (2400 baud, 8 data bits, no parity, 1 stop bit). Be extremely careful what you send to your UPS as certain characters may cause it to power down or may even cause damage to the UPS. Try sending an upper case ``Y`` to the UPS (without a return at the end). It should respond with ``SM``. If this is not the case, review the possible problems listed above. If you fat finger the Y and enter y instead, no cause for alarm, you will simply get the APC copyright notice. Once you are sure that serial port communications is working, proceed to the next test. Once you have established serial communications ----------------------------------------------- Once you have established that apcupsd can talk to the UPS over the serial part, go do the series of functional tests described in the main Testing section (see `Testing Apcupsd`_). Troubleshooting Serial Line communications ------------------------------------------ *The most frequently encountered problem with voltage-signalling UPSes (e.g. BackUPS 650) is that you have incorrectly specified which cable is being used.* All cables furnished by APC have the cable number stamped on the side of the computer connector end of the cable. Using this number with apcupsd will normally work fine. If you do not know what cable you have, you can use the apctest program to determine the type of the cable. For simple signaling UPSes, you should **not** use ``simple`` in the cable specification (i.e. ``UPSCABLE simple``) unless you have made the cable yourself according to the wiring diagram given in the cables chapter of this manual. Bizarre Intermittent Behavior: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In one case, a user reported that he received random incorrect values from the UPS in the status output. It turned out that gpm, the mouse control program for command windows, was using the serial port without using the standard Unix locking mechanism. As a consequence, both apcupsd and gpm were reading the serial port. Please ensure that if you are running gpm that it is not configured with a serial port mouse on the same serial port. .. include:: cables.rst Recalibrating the UPS Runtime ============================= Note: In a future release of apcupsd this procedure will be replaced by a daemon operation that can be performed on all types of UPS. This section does not apply to voltage-signalling or dumb UPSes such as the older BackUPS models. Smart UPSes internally compute the remaining runtime, and apcupsd uses the value supplied by the UPS. As the batteries age (after say two or three years), the runtime computation may no longer be accurate since the batteries no longer hold the same charge. As a consequence, in the event of a power failure, the UPS and thus apcupsd can report a runtime of 5 minutes remaining when in fact only one minute remains. This can lead to a shutdown before you might expect it, because regardless of the runtime remaining that is reported, the UPS will always correctly detect low batteries and report it, thus causing apcupsd to correctly shutdown your computer. If you wish to have the UPS recalibrate the remaining runtime calculations, you can do so manually as the current version of apcupsd does not support this feature. To do so, - Shutdown apcupsd - contact your UPS directly using some terminal program such as minicom, tip, or cu with the settings 2400 8N1 (2400 baud, 8 bits, no parity, 1 stop bit). Be extremely careful what you send to your UPS as certain characters may cause it to power down or may even cause damage to the UPS. Try sending an upper case ``Y`` to the UPS (without a return at the end). It should respond with ``SM``. If this is not the case, read the chapter on testing. If you fat finger the ``Y`` and enter ``y`` instead, no cause for alarm, you will simply get the APC copyright notice. - when you are sure you are properly connected send an upper case D (no cr). This will put the UPS into calibration mode, and it will drain the battery down to 25% capacity (35% for a Matrix) at which point it will go back on the mains. In doing so, it will recompute the runtime calibration. - If you wish to abort the calibration, enter a second D command. - When you are done, restart apcupsd. In principle, you should be able to do this with the computer powered by the UPS, but if you wish to be completely safe, you should plug your computer into the wall prior to performing the runtime calibration. In that case, you will need to artificially load the UPS with light bulbs or other means. You should supply a load of about 30 to 35% but not more than 50%. You can determine the load by looking at the output of the ``apcaccess status`` command while apcupsd is running. You should not run the recalibration command more than once or twice per year as discharging these kinds of batteries tends to shorten their life span. Configuration Directive Reference ================================= Configuration directives in /etc/apcupsd/apcupsd.conf control the behavior of the apcupsd daemon. For most installations it is only necessary to set a handful of general directives. The rest can be left at their defaults unless you have an exotic configuration. General Configuration Directives -------------------------------- In general, each of these directives is required (except that the ``DEVICE`` directive is ignored for ``UPSCABLE ether`` and not required for ``UPSCABLE usb``). **UPSTYPE** *driver* The name of a driver. Should be one of ``dumb``, ``apcsmart``, ``net``, ``usb``, ``pcnet``, ``snmp``, or ``test``. This describes your interface type. The UPSTYPE directive can be defined during installation by using the ``--with-upstype=`` option of the ``configure`` program. **UPSCABLE** *cable* Defines the type of cable connecting the UPS to your computer. Possible generic choices for are: ``simple``, ``smart``, ``ether``, ``usb`` Or a specific cable model number may be used: ``940-0119A``, ``940-0127A``, ``940-0128A``, ``940-0020B``, ``940-0020C``, ``940-0023A``, ``940-0024B``, ``940-0024C``, ``940-1524C``, ``940-0024G``, ``940-0095A``, ``940-0095B``, ``940-0095C``, ``M-04-02-2000`` The ``--with-upscable=`` option of ``configure`` can be used to set a default for this directive during the your build. **DEVICE** *device* Specify which device is used for UPS communications. For serial ports, it is usually something like /dev/ttyS0. For USB ports, you may leave the name of the device blank (no specification) and apcupsd will automatically search the standard locations for the UPS. Normally, the ``configure`` program will set an appropriate default value. You may also specify the ``--with-serial-dev=`` option of the ``configure`` program to set this directive at build time. If you have specified ``UPSTYPE net``, then the device name to be specified consists of *hostname:port* where the *hostname* is the fully qualified name or IP address of the host (NIS server) and the *port* (optional) is the port to use to contact the server. If you specified ``UPSTYPE snmp``, then the device name becomes *hostname:vendor:community*. Please see the `Support for SNMP UPSes`_ chapter in this manual for more details. **POLLTIME** *time in seconds* The interval, in seconds, at which apcupsd polls the UPS for status. This rate is automatically set to 1 second if the UPS goes on batteries and reset to your specified value when the mains power returns. This setting applies both to directly-attached UPSes (``UPSTYPE`` ``apcsmart``, ``usb``, ``dumb``) and networked UPSes (``UPSTYPE`` ``net``, ``snmp``). Lowering this setting will improve apcupsd's responsiveness to certain events at the cost of higher CPU utilization. The default of 60 is appropriate for most situations. This directive was formerly known as ``NETTIME``. **LOCKFILE** *path to lockfile* This option tells apcupsd where to create a lockfile for the USB or serial port in the specified directory. This is important to keep two programs from reading or writing the port at the same time. Please note that although the directive name is LOCKFILE, you are actually specifying the lock file path. apcupsd automatically appends the name of the device when creating the file. On most systems, this directive is automatically set by the ``./configure`` program. You may also explicitly set it during the build process by using the ``--with-lock-dir=`` option of the ``configure`` program. Configuration Directives Used by the Network Information Server --------------------------------------------------------------- None of these directives are required for proper operation of apcupsd. **NETSERVER** *[on \| off]* This configuration directive turns the network information server on or off. If it is on, apcupsd will spawn a child process that serves STATUS and EVENTS information over the network. This information is currently used by the Web-based CGI programs. The default is on. *This option is required to be turned on for net clients and apcaccess to function.* **NISIP** *IP-address* This directive specifies the IP address of the network interface on which the NIS server will listen for incoming connections. Default value is 0.0.0.0 which means the NIS will listen for connections on all network interfaces. If your machine has more than one interface, you can specify the IP of a single interface to limit connections to only that interface. Furthermore, you can specify the loopback address (127.0.0.1) to accept connections only from the local machine. You may also use the ``--with-nisip=`` option of the ``configure`` program to set this directive during the build. **NISPORT** *port* This configuration directive specifies the port to be used by the apcupsd Network Information Server. The default is platform dependent, but typically 3551, which we have received from IANA as the official apcupsd networking port. This value should only be changed if it conflicts with an existing service in use on your network or if you are running multiple instances of apcupsd on the same machine. **EVENTSFILE** *filename* If you want the apcupsd network information server to provide the last 10 events via the network, you must specify a file where apcupsd will save these events. The default is: /etc/apcupsd/apcupsd.events. Currently, apcupsd will save at most the last 50 events. Periodically (once an hour by default), apcupsd will check the size of this file. When more than 50 events are recorded, apcupsd will truncate the file to the most recent 10 events. Consequently this file will not grow indefinitely. Although we do not recommend it, you may change these values by editing apcevents.c and changing the appropriate defines. Be aware that if you set these values to very large numbers, apcupsd may make excessive memory demands on the system during the data access and file truncation operations. This filename may also be specified at build time by using the ``--with-log-dir=`` option of the ``configure`` program. Configuration Directives used during Power Failures --------------------------------------------------- In general, none of these directives are required. However, if you have a voltage-signalling (dumb) UPS with a cable that does not support the Low Battery signal, you must set the ``TIMEOUT`` directive to force a shutdown. **BATTERYLEVEL** *percent of battery* If ``BATTERYLEVEL`` is specified, during a power failure, apcupsd will halt the system when the remaining battery charge falls below the specified percentage. The default is 5 percent. This directive is ignored for dumb (voltage-signalling) UPSes. To totally disable this counter, set ``BATTERYLEVEL -1`` in your apcupsd.conf file. **MINUTES** *battery runtime in minutes* If ``MINUTES`` is specified, during a power failure, apcupsd will shutdown the system when the remaining runtime on batteries as internally calculated by the UPS falls below the time specified. The default is 3. This directive is ignored for dumb (voltage-signalling) UPSes. It should be noted that some UPSes report an incorrect value for remaining runtime when the battery is fully charged. This can be checked by examining the ``TIMELEFT`` value as printed in the output of an '``apcaccess status``' command. If the value is zero or otherwise unreasonable, your UPS is probably broken. In this case, we recommend that you disable this timer by setting ``MINUTES -1`` in your apcupsd.conf file. **TIMEOUT** *time in seconds* After a power failure, apcupsd will halt the system when ``TIMEOUT`` seconds have expired. A value of zero disables this timer. Normally for all Smart UPS models and dumb UPSes with cables that support low battery detection, this should be zero so that the shutdown time will be determined by the battery level and/or remaining runtime (see above) or in the case of a voltage-signalling UPS, when the battery is exhausted. This command is required for dumb UPSes that do not provide a battery exhausted signal (only testing can determine this point). For more information, see the `Testing Apcupsd`_ section of this manual. This timer can also be useful if you want some slave machines to shutdown before other machines to conserve battery power. It is also useful for testing apcupsd because you can force a rapid shutdown by setting a small value (e.g. 60) and pulling the plug to the UPS. ``TIMEOUT``, ``BATTERYLEVEL``, and ``MINUTES`` can be set together without problems. apcupsd will react to the first case or test that is valid. Normally SmartUPS users will set ``TIMEOUT`` to zero so that the system is shutdown depending on the percentage battery charge remaining (``BATTERYLEVEL``) or the remaining battery runtime (``MINUTES``). **ANNOY** *time in seconds* Specify the time in seconds between messages requesting logged in users to get off the system during a power failure. This timer starts only when the UPS is running on batteries. The default is 300 seconds (5 minutes). apcupsd sends the annoy messages by invoking the apccontrol script with the ``annoyme`` argument. The default is to send a wall message on Unix systems and a popup message in Windows. The value of ``ANNOYDELAY`` must be greater than the value of ``ANNOY`` in order to receive annoy messages (this doesn't make sense, and means that the default values do not generate annoy messages: KES). Note that if ``NOLOGON disable`` is set, the annoy messages will also be disabled. **ANNOYDELAY** *time in seconds* Specify delay time in seconds before apcupsd begins requesting logged in users to get off the system during a power failure. This timer starts only after the UPS is running on batteries. This timer is reset when the power returns. The default is 60 seconds. Thus, the first warning to log off the system occurs after 60 seconds on batteries, assuming that ``NOLOGON`` is not set to ``disable``. **NOLOGON** *disable* | *timeout* | *percent* | *minutes* | *always* Specifies when apcupsd should prevent user logins The type specified allows you define the point when apcupsd will create the 'nologin' file and thus when user logins are prohibited. Once the 'nologin' file is created, normal users are prevented from logging in. Control of when this file is created is important for allowing systems with big UPSes to run as normally until the system administrator determines the need for preventing user logins. The feature also allows the system administrator to hold the "ANNOY" factor until the 'nologin' file is created. The default is always disable if no ``NOLOGON`` directive is specified. The 'nologin' file will be created in the directory specified by the ``NOLOGINDIR`` directive described below. As far as I can tell, the only useful types are disable and always since the difference in the time when the logout warning is given and shutdown occurs for the other types is very short (KES). *disable* prevents apcupsd from creating the nologin file. Consequently, any user can login during a power failure condition. Also, the ANNOY feature is disabled so users will not be warned to logoff the system. *timeout* specifies that apcupsd should prohibit logins after the UPS is on batteries for 90% of the time specified on the ``TIMEOUT`` configuration directive. Note! Normally you don't want to specify a TIMEOUT value, so this option is probably not too useful (KES). *percent* specifies that apcupsd should prohibit logins when the remaining battery charge percentage reaches 110% or less than the value specified on the ``BATTERYLEVEL`` configuration directive. Thus if the ``BATTERYLEVEL`` is specified as 15, apcupsd will prohibit logins when the battery charge drops below 16% (15% X 110% = 16%). *minutes* specifies that apcupsd should prohibit logins when the remaining runtime in minutes reaches 110% or less than the value specified on the ``MINUTES`` configuration directive. Thus if ``MINUTES`` is set to 3, apcupsd will prohibit logins when the remaining runtime is less than 3 minutes (3 X 110% = 3). *always* causes apcupsd to immediately prohibit logins when a power failure occurs. This will also enable the ANNOY feature. **NOLOGINDIR** *path to nologin dir* This directive configures the directory into which apcupsd will write the nologin file, as described above for the ``NOLOGON`` directive. Normally, the ``configure`` program will set an appropriate default value for your platform, often /etc. You may also specify the ``--with-nologdir=`` option of the ``configure`` program to change the default at compile time. **KILLDELAY** *time in seconds* If ``KILLDELAY`` is set, apcupsd will continue running after a shutdown has been requested, and after the specified time in seconds, apcupsd will attempt to shut off the UPS the power. This directive should normally be disabled by setting the value to zero, but on some systems such as Win32 systems apcupsd cannot regain control after a shutdown to force the UPS to shut off the power. In this case, with proper consideration for the timing, the ``KILLDELAY`` directive can be useful. Please be aware, if you cause apcupsd to kill the power to your computer too early, the system and the disks may not have been properly prepared. In addition, apcupsd must continue running after the shutdown is requested, and on Unix systems, this is not normally the case as the system will terminate all processes during the shutdown. **SCRIPTDIR** *path to apccontrol dir* This option configures the directory in which apccontrol and other event scripts are located. Normally, the ``configure`` program will set an appropriate default value for your platform, often /etc/apcupsd. **PWRFAILDIR** *path to powerfail dir* When apcupsd shuts down your system, it creates a temporary "flag file" which is used by the operating system halt scripts to know if this shutdown is due to a power failure. This directive configures which directory the flag file will be written into. The chosen directory must be writable by the user apcupsd is running as (normally root) and must not be cleared or unmounted early in the shutdown sequence. Normally, the ``configure`` program will set an appropriate default value for your platform, often /etc/apcupsd. You may also specify the ``--with-pwrfaildir=`` option of the ``configure`` program to change the default at compile time. Configuration Directives used to Control System Logging ------------------------------------------------------- **STATTIME** *time in seconds* This directive supplies the time interval in seconds between writes to the STATUS file. If set to zero, the STATUS file will not be written. Please note that in a future version of apcupsd the STATUS file code will disappear since its functionality has been replaced by the Network Information Server and by ``apcaccess status``, as a consequence, it is normally disabled by setting it to zero. **STATFILE** *file* This directive specifies the file to be used when writing the STATUS information. The default is /etc/apcupsd/apcupsd.status. **DATATIME** *time in seconds* This directives supplies the time interval in seconds between writes of PowerChute-like data information to the log file. See the `DATA Logging`_ section of this manual for additional details. **FACILITY** *log-facility* The ``FACILITY`` directive can be used to change the system logging class or facility. The default is ``DAEMON``. This parameter can be useful if you wish to direct the apcupsd system logging information to other than your system default files. See the `apcupsd System Logging`_ section of this manual for additional details. Configuration Directives for Sharing a UPS ------------------------------------------ The following directives apply to sharing an UPS using a ShareUPS hardware module. Most users will not use this mode. **UPSCLASS** *standalone* | *shareslave* | *sharemaster* The default is ``standalone`` and should be used for all machines powered by the UPS and having a serial port or other direct connection to the UPS. This is the normal case. Use ``shareslave`` if and only if you are using a ShareUPS and connected to a BASIC Port with Simple Signal. This code is not fully tested. Use ``sharemaster``, if and only if you are using a ShareUPS and connected to the ADVANCED Port Smart Signal control. This code is not fully tested. **UPSMODE** *disable* | *share* For normal standalone operations, you will set ``UPSMODE disable`` to indicate that you are disabling the ShareUPS support. Use ``share`` for two or seven additional simple signal ports on a SmartAccessories(tm) (internal/external box) for SmartUPSes. The share and sharenet code is not fully tested. Configuration Directives Used to Set the UPS EEPROM --------------------------------------------------- *These directives have no effect on the operation of apcupsd but are reserved for use by apctest when bulk programming the values of the UPS EEPROM configuration variables in a Smart-UPS model.* **UPSNAME** ** Name of UPS. Maximum of 8 characters. **BATTDATE** [ *mm/dd/yy* | *dd/mm/yy* ] Last battery replacement date. Maximum of 8 characters. **SENSITIVITY** [ *H* | *M* | *L* ] H : High (most sensitive setting) M : Medium L : Low (least sensitive setting) **WAKEUP** [ *000* | *060* | *180* | *300* ] The time delay in seconds that the UPS waits after the return of utility power before "waking up" and restoring power to the connected equipment. **SLEEP** [ *020* | *180* | *300* | *600* ] The time delay in seconds for which the UPS waits or "sleeps" after it receives a request to power off the connected system. **LOTRANSFER** ** Low line voltage causing transfer to battery power or activation of SmartBoost. Allowable values depend on the last letter of the firmware or APCMODEL. Typical values are:: D 106 103 100 097 M 177 172 168 182 A 092 090 088 086 I 208 204 200 196 where D = domestic (USA), M = Canada, A = Asia and I = International. **HITRANSFER** ** High line voltage causing transfer to battery power or activation of SmartTrim. Allowable values depend on the last letter of the firmware or APCMODEL. Typical values are:: D 127 130 133 136 M 229 234 239 224 A 108 110 112 114 I 253 257 261 265 where D = domestic (USA), M = Canada, A = Asia and I = International. **RETURNCHARGE** [ *00* | *15* | *50* | *90* ] Percentage of battery charge needed for the UPS to restore power to the connected equipment. **BEEPSTATE** [ *0* | *T* | *L* | *N* ] Alarm delay. :: 0 : Zero delay after power fails. T : When power fails plus 30 seconds. L : When low battery occurs. N : Never. **LOWBATT** ** Low battery warning occurs when the specified number of minutes remains before the UPS estimates battery power will be exhausted. There are four user-changeable settings: 2, 5, 7, or 10 minutes **OUTPUTVOLTS** ** UPS nominal output voltage when running on battery. Allowable values depend on the last letter of the firmware or APCMODEL. Typical values are:: D 115 M 208 A 100 I 230 240 220 225 where D = domestic (USA), M = Canada, A = Asia and I = International. **SELFTEST** [ *336* | *168* | *ON* | *OFF* ] Self test interval in hours (336 = 2 weeks, 168 = 1 week, ON = at power on, OFF = never). apcupsd Status Logging ====================== There is a good deal of information available about the UPS and apcupsd's status. This document describes the format of that information. Normally you will get at it via ``apcaccess``, but there are other ways as well. Status report format -------------------- STATUS output is in ASCII format with a single data value or piece of information on each line output. Because not all UPSes supply the same information, the output varies based on the type of UPS that you are using. In general, if the information is not available for your UPS, the line will be missing entirely or the data portion of the output record will contain an ``N/A`` indicating that the information is not available. Status logging consists of periodically logging ALL available information concerning the UPS. Since the volume of data is rather large (over 1000 bytes per status), the STATUS data is not automatically sent to the system log file. Instead, it is written as a series of data records in a specific file (normally /etc/apcupsd/apcupsd.status). After each write, the file is rewound so that the size of the file remains constant. The STATUS file is kept for backward compatibility and will be eliminated in a future version of apcupsd. The preferred method for obtaining this information is from apcaccess or by using the CGI interface (see `apcupsd Network Monitoring (CGI) Programs`_). To make reading the status data reliable via a named pipe, the first record written contains a version number, the number of records that follow the first record, and the total number of bytes in those subsequent records. An actual example of such a status file (/etc/apcupsd/apcupsd.status) is shown below. Consequently, the first record always consists of 24 bytes (23 characters followed by a newline). This record starts with APC and as indicated in the example is followed by 37 records consisting of 906 bytes. The last record begins with END APC and contains the date and time matching the DATE record. When this data is written to a file, it is written as two records, the first record, and all the other records together. In reading the file, it can be either be read a record at a time, or in one big read. When this data is written to syslog(), it is written a record at a time. The first record is the first 24 bytes. By having the number of records and the size in the first record, the complete status can be reliably reassembled. Status Report Example --------------------- An example of output from a BackUPS RS 1500 follows: :: APC : 001,037,0906 DATE : Sun Apr 26 17:22:22 EDT 2009 HOSTNAME : mail.kroptech.com VERSION : 3.14.2 (10 September 2007) redhat UPSNAME : ups0 CABLE : USB Cable MODEL : Back-UPS RS 1500 UPSMODE : Stand Alone STARTTIME: Sun Apr 26 10:22:46 EDT 2009 STATUS : ONLINE LINEV : 123.0 Volts LOADPCT : 24.0 Percent Load Capacity BCHARGE : 100.0 Percent TIMELEFT : 144.5 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds SENSE : Medium LOTRANS : 097.0 Volts HITRANS : 138.0 Volts ALARMDEL : Always BATTV : 26.8 Volts LASTXFER : Low line voltage NUMXFERS : 0 TONBATT : 0 seconds CUMONBATT: 0 seconds XOFFBATT : N/A SELFTEST : NO STATFLAG : 0x07000008 Status Flag MANDATE : 2003-05-08 SERIALNO : JB0319033692 BATTDATE : 2001-09-25 NOMINV : 120 NOMBATTV : 24.0 FIRMWARE : 8.g6 .D USB FW:g6 APCMODEL : Back-UPS RS 1500 END APC : Sun Apr 26 17:22:32 EDT 2009 Status Report Fields -------------------- The meaning of the above variables are: **APC** Header record indicating the STATUS format revision level, the number of records that follow the APC statement, and the number of bytes that follow the record. **DATE** The date and time that the information was last obtained from the UPS. **HOSTNAME** The name of the machine that collected the UPS data. **UPSNAME** The name of the UPS as stored in the EEPROM or in the ``UPSNAME`` directive in the configuration file. **VERSION** The apcupsd release number, build date, and platform. **CABLE** The cable as specified in the configuration file (``UPSCABLE``). **MODEL** The UPS model as derived from information from the UPS. **UPSMODE** The mode in which apcupsd is operating as specified in the configuration file (``UPSMODE``) **STARTTIME** The time/date that apcupsd was started. **STATUS** The current status of the UPS (ONLINE, CHARGING, ONBATT, etc.) **LINEV** The current line voltage as returned by the UPS. **LOADPCT** The percentage of load capacity as estimated by the UPS. **BCHARGE** The percentage charge on the batteries. **TIMELEFT** The remaining runtime left on batteries as estimated by the UPS. **MBATTCHG** If the battery charge percentage (BCHARGE) drops below this value, apcupsd will shutdown your system. Value is set in the configuration file (``BATTERYLEVEL``) **MINTIMEL** apcupsd will shutdown your system if the remaining runtime equals or is below this point. Value is set in the configuration file (``MINUTES``) **MAXTIME** apcupsd will shutdown your system if the time on batteries exceeds this value. A value of zero disables the feature. Value is set in the configuration file (``TIMEOUT``) **MAXLINEV** The maximum line voltage since the UPS was started, as reported by the UPS **MINLINEV** The minimum line voltage since the UPS was started, as returned by the UPS **OUTPUTV** The voltage the UPS is supplying to your equipment **SENSE** The sensitivity level of the UPS to line voltage fluctuations. **DWAKE** The amount of time the UPS will wait before restoring power to your equipment after a power off condition when the power is restored. **DSHUTD** The grace delay that the UPS gives after receiving a power down command from apcupsd before it powers off your equipment. **DLOWBATT** The remaining runtime below which the UPS sends the low battery signal. At this point apcupsd will force an immediate emergency shutdown. **LOTRANS** The line voltage below which the UPS will switch to batteries. **HITRANS** The line voltage above which the UPS will switch to batteries. **RETPCT** The percentage charge that the batteries must have after a power off condition before the UPS will restore power to your equipment. **ITEMP** Internal UPS temperature as supplied by the UPS. **ALARMDEL** The delay period for the UPS alarm. **BATTV** Battery voltage as supplied by the UPS. **LINEFREQ** Line frequency in hertz as given by the UPS. **LASTXFER** The reason for the last transfer to batteries. **NUMXFERS** The number of transfers to batteries since apcupsd startup. **XONBATT** Time and date of last transfer to batteries, or N/A. **TONBATT** Time in seconds currently on batteries, or 0. **CUMONBATT** Total (cumulative) time on batteries in seconds since apcupsd startup. **XOFFBATT** Time and date of last transfer from batteries, or N/A. **SELFTEST** The results of the last self test, and may have the following values: - OK: self test indicates good battery - BT: self test failed due to insufficient battery capacity - NG: self test failed due to overload - NO: No results (i.e. no self test performed in the last 5 minutes) **STESTI** The interval in hours between automatic self tests. **STATFLAG** Status flag. English version is given by STATUS. **DIPSW** The current dip switch settings on UPSes that have them. **REG1** The value from the UPS fault register 1. **REG2** The value from the UPS fault register 2. **REG3** The value from the UPS fault register 3. **MANDATE** The date the UPS was manufactured. **SERIALNO** The UPS serial number. **BATTDATE** The date that batteries were last replaced. **NOMOUTV** The output voltage that the UPS will attempt to supply when on battery power. **NOMINV** The input voltage that the UPS is configured to expect. **NOMBATTV** The nominal battery voltage. **NOMPOWER** The maximum power in Watts that the UPS is designed to supply. **HUMIDITY** The humidity as measured by the UPS. **AMBTEMP** The ambient temperature as measured by the UPS. **EXTBATTS** The number of external batteries as defined by the user. A correct number here helps the UPS compute the remaining runtime more accurately. **BADBATTS** The number of bad battery packs. **FIRMWARE** The firmware revision number as reported by the UPS. **APCMODEL** The old APC model identification code. **END APC** The time and date that the STATUS record was written. Logging the STATUS Information ------------------------------ If specified in the configuration file, the STATUS data will also be written to the system log file. Please note, that it would not normally be wise to write this data to a normal system log file as there is no mechanism in syslog() to rewind the file and hence the log file would quickly become enormous. However, in two cases, it can be very useful to use syslog() to write this information. The first case is to set up your syslog.conf file so that the data is written to a named pipe. In this case, normally not more than about 8192 bytes of data will be kept before it is discarded by the system. The second case is to setup your syslog.conf file so that the status data is sent to another machine, which presumably then writes it to a named pipe. Consequently, with this mechanism, provides a simple means of networking apcupsd STATUS information. Although we mention system logging of STATUS information, we strongly recommend that you use apcaccess or the CGI interface to get this information. The Shutdown Sequence and its Discontents ========================================= Shutdown Sequence ----------------- If you experienced so problems with the testing procedures, or if you are porting apcupsd to another system, or you are simply curious, you may want to know exactly what is going on during the shutdown process. The shutdown sequence is as follows: - apcupsd detects that there is a power problem and it calls ``/etc/apcupsd/apccontrol powerout``. By default this event does nothing, but it can be overridden to notify users, etc. - After the configured ``ONBATTERYDELAY``, apcupsd calls ``/etc/apcupsd/apccontrol onbattery``, which normally sends a message to all users informing them that the UPS is on batteries. - When one of the conditions listed below occurs, apcupsd issues a shutdown command by calling ``/etc/apcupsd/apccontrol doshutdown``, which should perform a shutdown of your system using the system shutdown(8) command. You can modify the behavior as described in `Customizing Event Handling`_. The conditions that trigger the shutdown can be any of the following: - Running time on batteries have expired (``TIMEOUT``) - The battery runtime remaining is below the configured value (``BATTERYLEVEL``) - The estimated remaining runtime is below the configured value (``MINUTES``) - The UPS signals that the batteries are exhausted. A shutdown could also be initiated if apcupsd detects that the batteries are no longer functioning correctly. This case, though very unusual, can happen at any time even if there is proper mains voltage, and ``/etc/apcupsd/apccontrol emergency`` is called. Just before initiating any shutdown through the apccontrol script, apcupsd will create the file /etc/apcupsd/powerfail. This file will be used later in the shutdown sequence to recall apcupsd after syncing of the disks to initiate a power off of the UPS. If the /etc/nologin file has not already been created, it will normally be created during the shutdown sequence to prevent additional users from logging in (see the ``NOLOGIN`` configuration directive). Even though apcupsd has requested the system to perform a shutdown, it continues running. - When the system signals apcupsd to do exit, it does so. This is part of the normal system shutdown (at least on Unix and Linux systems) and the exact time that apcupsd receives the termination signal depends on how the shutdown links (usually in /etc/rc.d) are set. Note that on Windows NT systems, apcupsd apparently continues to run as a Service even though the machine is "shutdown". - During the shutdown of the system after apcupsd has been forced to exit, one of the last things done by the system shutdown is to call the halt script, which is usually in /etc/rc.d/halt or /etc/rc.d/init.d/halt, or possibly in /sbin/init.d/rc.0 depending on your system. If apcupsd was properly installed, this standard halt script was modified to include a bit of new logic just before the final halt of the system. It first tests if the file /etc/apcupsd/powerfail exists, and if it does, it executes ``/etc/apcupsd/apccontrol killpower``. It is this last step that will cause apcupsd to be re-executed with the ``--killpower`` option on the command line. This option tells apcupsd to inform the UPS to kill the power. This final step is important if you want to ensure that your system will automatically reboot when the power comes back on. The actual code used on the Red Hat version is: :: # See if this is a powerfail situation. # ***apcupsd*** if [ -f /etc/apcupsd/powerfail ]; then # ***apcupsd*** echo # ***apcupsd*** echo "APCUPSD will now power off the UPS" # ***apcupsd*** echo # ***apcupsd*** /etc/apcupsd/apccontrol killpower # ***apcupsd*** echo # ***apcupsd*** echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd*** echo "Otherwise, the UPS may cut the power during the reboot!!!" # ***apcupsd*** echo # ***apcupsd*** fi # ***apcupsd*** The above code must be inserted as late as possible in the halt script. On many systems, such as Red Hat, all the disk drives were unmounted, then remounted read-only, thus permitting access to the /etc files and the apcupsd executable. If your system does not explicitly remount the disks, you must remount them in read-only mode in the code that you add. Examples of code fragments that do this can be found in the distributions/suse subdirectory of the source. If you are not able to insert the above code in your halt script because there is no halt script, or because your halt script calls the init program as some Unix systems do, you can either just forget about powering off the UPS, which means that your machine will not automatically reboot after a power failure, or there is yet another alternative, though not at all as satisfying as inserting code in the halt script. Only if you cannot insert the appropriate code in the halt script, when you start apcupsd, normally from the /etc/rc.d/init.d/apcupsd script, use the ``--kill-on-powerfail`` option. This will cause apcupsd to program the UPS to shutoff the power just before it (apcupsd) does the system shutdown. Please note that this is not the most ideal solution. Read on to understand why. A very important consideration is that you must set the EEPROM in your UPS so that it waits a sufficient time for the system to halt before it shuts off the UPS power. When using a USB connection, apcupsd automatically sets this value to 60 seconds. When using a serial connection to a SmartUPS, you must configure the value in the UPS EEPROM by hand using ``apctest``. Shutdown Problems ----------------- Obviously if your halt script is not properly modified, apcupsd will not be able to shut off the power to the UPS, and if the power returns before the batteries are exhausted your system will not automatically reboot. In any case, your machine should have been cleanly shut down. Master/Slave Shutdown --------------------- In master/slave configurations, however, the master cannot be 100 percent sure that the slaves have all shutdown before it performs the power off. To avoid this situation, be sure to configure any slaves (clients) to shut down before the master by setting different ``TIMEOUT``, ``BATTERYLEVEL``, or ``MINUTES`` parameters in the config file. Also, on a slave machine, you do not want to use the modified halt script since it will recall apcupsd, which will detect that it is a slave (i.e. no connection to the UPS) and will complain that it cannot do the killpower. This situation is not harmful just annoying and possibly confusing. One possible problem during shutdown can be caused by remnants of old versions. Please be sure to delete or rename all prior versions (/usr/local/sbin/apcupsd or /sbin/powersc). Startup ------- Normally, apcupsd is automatically started when your system is rebooted. This normally occurs because the startup script apcupsd is linked into the appropriate places in /etc/rc.d. On most Linux systems, there is a program called chkconfig(8) that will automatically link the startup script. This program is invoked by the ``make install`` scripts, or it is explicitly done for those systems that do not have chkconfig(8). If this is not the case, you can either link it in appropriately yourself or explicitly call it from your rc.local file. The appropriate manual way to startup apcupsd is by executing: :: /apcupsd start where *path* is normally /etc/rc.d or /etc/rc.d/init.d depending on your system. Using this script is important so that any files remaining around after a power failure are removed. Likewise, shutting down apcupsd should be done with the same script: :: /apcupsd stop Windows Considerations ---------------------- Please see the `Killpower under Windows`_ chapter of this manual for considerations pertaining to shutdown and killpower on Windows. .. include:: smartprotocol.rst Apcupsd RPM Packaging FAQ ========================= **How do I build Apcupsd for platform xxx?** The apcupsd spec file contains defines to build for several platforms: RedHat 7.x (rh7), RedHat 8.0 (rh8), RedHat 9 (rh9), Fedora Core (fedora_core), RedHat Enterprise Linux and clones (rhel3 and rhel4), SuSE 9 & 10 (suse), and Mandrake (mdk). The package build is controlled by a define set at the beginning of the file. These defines basically just control the dependency information that gets coded into the finished rpm package. So while you could technically build a package without defining a platform, or with an incorrect platform, and have it install and run it would not contain correct dependency information for the rpm database. The platform define may be edited in the spec file directly (by default all defines are set to 0 or "not set"). For example, to build the RedHat 7.x package find the line in the spec file which reads :: %define rh7 0 and edit it to read :: %define rh7 1 Alternately you may pass the define on the command line when calling rpmbuild: :: rpmbuild -ba --define "build_rh7 1" apcupsd.spec rpmbuild --rebuild --define build_rh7 1" apcupsd-x.x.x-x.src.rpm **How do I control whether usb support gets built?** Up through version 3.12, by default standard serial port support was built and the apcupsd-std package was produced. The usb package pre-configured the configuration files for usb devices and installed a couple additional tools in /etc/apcupsd but the usb driver was built regardless. To get the usb package and support in those versions either set the :: %define usb 0 to :: %define usb 1 in the spec file directly or pass it to rpmbuild on the command line: :: rpmbuild -ba --define "build_rh7 1" --define "build_usb 1" apcupsd.spec With the release of 3.14 USB support is now considered standard and the apcupsd-std and apcupsd-usb packages are obsoleted in favor of a single apcupsd package configured for usb connected UPS's. The serial port driver is still built and can be configured accordingly after installation. If you are performing an upgrade it will of course not replace your current config file. The build directive: :: --define "build_usb 1" is no longer recognized. **What other defines are used?** There is a define for the initdir for the daemon control script. On RedHat or Mandrake systems this is set to /etc/rc.d/init.d/. On SuSE systems this is set to /etc/rc.d. You would only need to edit this if packaging for a platform that uses a different directory. A second define controls whether the Gnome monitoring application, new in the 3.14 release, is built. This application requires the Gtk2 version to be >= 2.4. If you want to build the apcupsd-gapcmon package add: :: --define "build_gapcmon 1" A third define controls whether the SNMP driver is built. If you want to build the net-snmp driver add: :: --define "build_snmp 1" **Can I supply packages for other platforms you do not publish?** Yes, there are tools provided for contributors to supply rpm packages for platforms for which support is provided in the spec file but for which the development team chooses not to release binary packages, usually due to lack of interest or lack of an available platform. Please see platforms/contrib/README in the source package. **I'm getting errors about not having permission when I try to build the packages. Do I need to be root?** No, you do not need to be root and, in fact, it is better practice to build rpm packages as a non-root user. Apcupsd's packages are designed to be built by a regular user but you must make a few changes on your system to do this. If you are building on your own system then the simplest method is to add write permissions for all to the build directory (/usr/src/redhat/). To accomplish this execute one of the following commands as root depending on your distribution, RedHat, SuSE or Mandriva, respectively: :: chmod -R 777 /usr/src/redhat chmod -R 777 /usr/src/packages chmod -R 777 /usr/src/RPM If you are working on a shared system where you can not use the method above then you need to recreate the /usr/src/redhat (or other) directory tree with all of it's subdirectories inside your home directory. Then create a file named :: .rpmmacros in your home directory (or edit the file if it already exists) and add the following line: :: %_topdir /home/myuser/redhat Credits ======= .. image:: ./thanks.png The success of apcupsd is due to the many people that helped in development, testing and in many other ways. Thank all the developers that worked hard to make APCUPSD one of the best piece of software for UPS management. Contributors ------------ **Current Code Maintainer and Project Manager** Adam Kropelin (akropel1@rochester.rr.com) **RPM Packager** D\. Scott Barninger (barninger@fairfieldcomputers.com) **CGI and HTML fixer** William King (wrking@dadaboom.com) **Former Project Manager** Kern Sibbald (kern@sibbald.com) **Project Starter and Former Code Maintainer** Andre Hedrick (andre@linux-ide.org) **Former Code Maintainer and Project Manager** Riccardo Facchetti (riccardo@master.oasi.gpa.it) **Serial Communications** Andre Hedrick (andre@linux-ide.org) **2.0 User's Manual** Eric S. Raymond (esr@thyrsus.com) **Alpha Port** Kern Sibbald (kern@sibbald.com) J. Rochate (jrochate@ualg.pt) testing and machine loan **Caldera** John Pinner (john@clocksoft.com) **HP-UX Port** Carl Erhorn (Carl_Erhorn@hyperion.com) Robert K Nelson (rnelson@airflowsciences.com) **SOLARIS Port** Carl Erhorn (Carl_Erhorn@hyperion.com) **OpenBSD Port** Devin Reade (gdr@gno.org) **NetBSD Port** Neil Darlow (neil@darlow.co.uk) **Win32 Port** Kern Sibbald (kern@sibbald.com) Paul Z. Stagner (paul.stagner@charterco.com) testing **WEB Interfaces** Kern Sibbald (kern@sibbald.com) Joseph Acosta (joeja@mindspring.com) .. |image4| image:: ./commlost.png .. |image5| image:: ./online.png .. |image6| image:: ./onbatt.png .. |image7| image:: ./charging.png .. |date| date:: %B %e, %Y .. |time| date:: %T .. |(C)| unicode:: 0xA9 .. copyright sign .. |TM| unicode:: U+2122 .. trademark signapcupsd-3.14.10/doc/manual/multimon.png0000664000076400007640000001670311175165131016627 0ustar adk0212adk0212PNG  IHDR^l PLTERcyiIDATx]mr렒EfLߘ Vla>A#!8r b;4 {z~==:^:^:^:^:^ sO{NJJJJ-9.mrOLxvrz;^)ίJRz;^)d_B)ɻ4uwq>0}V9MT$mIˉb=t'$`7~ͯc>,ǔO9N!o>[sP_PsLI B &D?+k 6w $`FSRs<߷s f&,KA6Tުa틟6C1*N.4 :}"\ Xj` 씅-ӘsZW;-yQ^3Ăq2kz}3 @zz P eZ9^3)ץy]-PG&_wU,g9͂'H$q)}L90(k°F<Q[t.hCF:4Q;(.z,W2ePE rDYBxX jsV4LDi53)3!Edũ{lСwůxq=A@H11< )/I^ND R 1js%~e824Ȅm((ǬǨz{5+dTP`L5`Lчtan`L <bgqM6I2&2CLL{.T'_Թ~d{k5 ALtFY$JtOXX ~xyʱ\~I%XʼZZA&jo$V^i"Pxż1 qO_0 >ȅ0Z~>~r2c?d/$8L/cω$̯$+/#:.1 =ўIQXJ)7~H8z]ْ#in;GQbs7oH4_&să8KgF _`sc(Wpvʆny%K"{BXk09i&&e`x 2ʊZF,Zc/0ţ06L`2;ϪfƱ|ʑq+%c wuQDw`K"1 Ř9$?=_yW¤% _1?ȗIN)k^ |բǒ5M~ywůȲU;ὃCϲ);c&t ͺLz_B|=-2 cu~~9crS&`RU ^"Q1^ &)V9,)ƗCeSWNb9~eǯ V9 P^ u5VoBA{ٳ~)++p~t gZW2H N6is>eD5`)(YH _j QV. ϥ>eJH G#O4y*V吣M~EeLbIQuJMYGI.UŝYK;`9iGVŪ  <81ʄZu7ðdb%JpKFDܻa_+YU&p(R+l"၅i”4&f@3Jplt`0zi7',RX TU g~9zy~g(442Xi.q|L.!7B#!sdFNyz~i?/O/?~ɔ nqEN\@ ENt+l @SzIge$>ÜMy</߄[T*8d(K!T̅׊^?ͯtM~E;sj _5(k^Yn+rUi1_!ҦjڦWucpqKrU4i{_S{:G 0k~ڟI8Wq(UM N.hMoTES伃l3\\ ]DNAv)5WW%{Z^zv6ep A옘;{zqgᘖqFKJ$ljL8 {zE̿.D rpFuM۫.\6~F)rkS=i2~`c|[#$@!`Eq \IOe S; /V>Kϑ]S8[:qA9lh y.:kʎ^hh{_?eaKrZҋ6Ni a2^{pRM~i Q5-\QA%.(S_\&dVX +DtVM 뷎_AM̉ä$V!Z B/@:_\ #>ԍ.V z/U؅s-6-|GF!ij/d꤁ ΂_8q^1a'm^2 7`g2#fJ:KV B gU@/Ru_'-Q'*uSW_#Z+Ջ؂_xwA׳ܞ;OYSү_n0Q4&J S*Í'"8$H_9C9\]¡,LId ]+?X)hRz;O$h඄ <b⟺'*!xUk .OzVxx ('ՇI:2;K#b`D'0̯l ' K1A:'&dprIU ݏ{_ĂD 'z;~9ҁ_9LBKW1VٰE\@a:bʧS(n̩R:@(_ڤKΘC_ TA$aN_c{vs*7sM~NjUf[.e_$lKǜhSZSR'Tjy"BYn)m@KE_vd l]*oe*Q+P..zNJi07T|"}~|z{y2^|A?jsA?.;M9?Y% lI+Hx} H-1x#/ aů*huXS {z+x)^˚_+|hѪx\^78x 85^[xIϯ{6m5lvD9-P:݁ s!sGXx<^|nU x-;WDbs[? i2F#=Ƌ#.z$ZGuK & B7ϮK{DCVh.՛xmt.kPX"I3^#I.33(g&YeXG̈ /F xï7}sW_[xIY"F`e5y¯udoK=1mnx&ׇAx`r=/]kp m'5IoI1>`ċCv[Ï{zkxSo5V/bCp'^7G G3_c/UCѐTޜjͿ<ޜsm/9RۇGm PX֖}8yh9>\և/024 Zx5^ҐW֌DZ ZӠo0%/]d|c|/J [%2rA-m|/m`=C)5[FB]H}pC_b_x݋g#ug;u~Wǫxu:^?ǫk_^v:^Wǫxu:^Wix[xʙmY'$2Žވ'2ל'|7Ou.]D^Ot);>W9«x3ފ'*[Sׯ'Z5,K4X{≊W7E EDE)ȉvXx%^8=쇍Oq^x"7 2k0[sx"ևb밊-MDVezaP .y XOd`sͽ܉p'^],ERZE)h1,  5z/1De"_ulo'ZUYpoջw} F >d-MDp1ZܲӇT78HixZ,OtUL^{'2yڌ'z3íUꉶ'*?Lt^;'re;;u [x [x])QNבC-JTLBDlu4B ^;' CDG㢤lLu/D/poyvO>I|>DfQm DG+Z_)y<u<6J,{{>o|^8%*x9T.C느:^=DW'z-ȯWǫxu:^oëkkkk^=DxVxVxVxVxVxVxVxVxVxVxVxVxV/6pCh=IENDB`apcupsd-3.14.10/doc/manual/onbatt.png0000664000076400007640000000024011175165131016237 0ustar adk0212adk0212PNG  IHDRRPLTEbKGDoѓIENDB`apcupsd-3.14.10/doc/manual/publishdoc0000775000076400007640000000034611203566735016342 0ustar adk0212adk0212#!/bin/sh sftp -b - web.sourceforge.net <<-END cd /home/groups/a/ap/apcupsd/htdocs -mkdir manual cd manual -rm * progress put manual.pdf put manual.html put *.png ln manual.pdf apcupsd.pdf ln manual.html index.html END apcupsd-3.14.10/doc/manual/smartprotocol.rst0000664000076400007640000012464211442015366017722 0ustar adk0212adk0212APC smart protocol ================== The APC UPS protocol was originally analyzed by Pavel Korensky with additions from Andre H. Hendrick beginning in 1995, and we want to give credit for good, hard work, where credit is due. After having said that, you will see that Steven Freed built much of the original apcupsd information file. The start of this chapter of the apcupsd manual in HTML format was pulled from the Network UPS Tools (NUT) site (http://www.networkupstools.org/protocols/apcsmart.html). It has been an invaluable tool in improving apcupsd, and I consider it the Bible of APC UPS programming. In the course of using it, I have added information gleaned from apcupsd and information graciously supplied by APC. Description ----------- Here's the information on the elusive APC smart signaling protocol used by their higher end units (Back-UPS Pro, Smart-UPS, Matrix-UPS, etc). What you see here has been collected from a variety of sources. Some people analyzed the chatter between PowerChute and their hardware. Others sent various characters to the UPS and figured out what the results meant. RS-232 differences ------------------ Normal 9 pin serial connections have TxD on 3 and RxD on 2. APC's smart serial ports put TxD on pin 1 and RxD on pin 2. This means you go nowhere if you use a normal straight through serial cable. In fact, you might even power down the load if you plug one of those cables in. This is due to the odd routing of pins - DTR and RTS from the PC usually wind up driving the on/off line. So, when you open the port, they go high and \*poof\* your computer dies. The Smart Protocol ------------------ Despite the lack of official information from APC, this table has been constructed. It's standard RS-232 serial communications at 2400 bps/8N1. Don't rush the UPS while transmitting or it may stop talking to you. This isn't a problem with the normal single character queries, but it really does matter for multi-char things like "@000". Sprinkle a few calls to usleep() in your code and everything will work a lot better. The following table describes the single character "Code" or command that you can send to the UPS, its meaning, and what sort of response the UPS will provide. Typically, the response shown below is followed by a newline (\\n in C) and a carriage return (\\r in C). If you send the UPS a command that it does not recognize or that is not available on your UPS, it will normally respond with "NA" for "not available", otherwise the response is given in the "Typical results" column. +---------+------------+----------------+--------------------------------------+ |Character|Meaning |Typical results |Other info | +=========+============+================+======================================+ |^A |Model string|SMART-UPS 700 |Spotty support for this query on older| | | | |models | +---------+------------+----------------+--------------------------------------+ |^N |Turn on UPS |n/a |Send twice, with 1.5s delay between | | | | |chars. Only on 3rd gen SmartUPS and | | | | |Black Back-UPS Pros | +---------+------------+----------------+--------------------------------------+ |^Z |Permitted |*long string* |Gives the EEPROM permitted values for | | |EEPROM | |your model. See `EEPROM Values`_ for | | |Values | |details. | +---------+------------+----------------+--------------------------------------+ |A |Front panel |Light show + |Also sounds the beeper for 2 seconds | | |test |"OK" | | +---------+------------+----------------+--------------------------------------+ |B |Battery |27.87 |Varies based on current level of | | |voltage | |charge. See also Nominal Battery | | | | |Voltage. | +---------+------------+----------------+--------------------------------------+ |C |Internal |036.0 |Units are degrees C | | |Temperature | | | +---------+------------+----------------+--------------------------------------+ |D |Runtime |!, then $ |Runs until battery is below 25% (35% | | |calibration | |for Matrix) Updates the 'j' values. | | | | |Only works at 100% battery charge. Can| | | | |be aborted with a second "D" | +---------+------------+----------------+--------------------------------------+ |E |Automatic |336 |Writable variable. Possible values: | | |self test | | | | |interval | |- "336" (14 days) | | | | |- "168" (7 days) | | | | |- "ON " (at power on) note extra space| | | | |- "OFF" (never) | +---------+------------+----------------+--------------------------------------+ |F |Line |60.00 |Units are Hz. Value varies based on | | |frequency | |locality, usually 50/60. | +---------+------------+----------------+--------------------------------------+ |G |Cause of |O |Possible values: | | |last | | | | |transfer | |- R (unacceptable utility voltage rate| | |to battery | | of change) | | | | |- H (high utility voltage) | | | | |- L (low utility voltage) | | | | |- T (line voltage notch or spike) | | | | |- O (no transfers since turnon) | | | | |- S (transfer due to U command or | | | | | activation of UPS test from front | | | | | panel) | | | | |- NA (transfer reason still not | | | | | available; read again) | +---------+------------+----------------+--------------------------------------+ |I |Measure-UPS |FF |*not decoded yet* | | |Alarm enable| | | +---------+------------+----------------+--------------------------------------+ |J |Measure-UPS |0F,00 |*not decoded yet* | | |Alarm status| | | +---------+------------+----------------+--------------------------------------+ |K |Shutdown |OK or * |Send twice with > 1.5s delay between | | |with grace | |chars. Older units send "*" instead of| | |period (no | |"OK". Length of grace period is set | | |return) | |with Grace Period command. UPS will | | | | |remain off and NOT power on if utility| | | | |power is restored. | +---------+------------+----------------+--------------------------------------+ |L |Input line |118.3 |Value varies based on locality. Does | | |voltage | |not always read 000.0 on line failure.| +---------+------------+----------------+--------------------------------------+ |M |Maximum line|118.9 |This is the max voltage since the last| | |voltage | |time this query was run. | +---------+------------+----------------+--------------------------------------+ |N |Minimum line|118.1 |This is the min voltage since the last| | |voltage | |time this query was run. | +---------+------------+----------------+--------------------------------------+ |O |Output |118.3 |Also see on battery output voltage. | | |voltage | | | +---------+------------+----------------+--------------------------------------+ |P |Power load |023.5 |Relative to capacity of the UPS. | | |% | | | +---------+------------+----------------+--------------------------------------+ |Q |Status flags|08 |Bitmapped, see `status bits`_ below | +---------+------------+----------------+--------------------------------------+ |R |Turn dumb |BYE |Only on 3rd gen SmartUPS, SmartUPS | | | | |v/s, BackUPS Pro. Must send enter | | | | |smart mode command to resume comms. | +---------+------------+----------------+--------------------------------------+ |S |Soft |OK |Command executes after grace period. | | |shutdown | |UPS goes online when power returns. | | | | |Only works when on battery. | +---------+------------+----------------+--------------------------------------+ |U |Simulate |!, then $ |See `Alert messages`_ section for info| | |power | |on ! and $. | | |failure | | | +---------+------------+----------------+--------------------------------------+ |V |Old firmware|"GWD" or "IWI" |See `Interpretation of the Old | | |revision | |Firmware Revision`_ | +---------+------------+----------------+--------------------------------------+ |W |Self test |OK |Tests battery, like pushing button on | | | | |the front panel. Results stored in "X"| +---------+------------+----------------+--------------------------------------+ |X |Self test |OK |Possible values: | | |results | | | | | | |- OK = good battery | | | | |- BT = failed due to insufficient | | | | | capacity | | | | |- NG = failed due to overload | | | | |- NO = no results available (no test | | | | | performed in last 5 minutes) | +---------+------------+----------------+--------------------------------------+ |Y |Enter smart |SM |This must be sent before any other | | |mode | |commands will work. See also turn dumb| | | | |command to exit smart mode. | +---------+------------+----------------+--------------------------------------+ |Z |Shutdown |n/a |Send twice with > 1.5s delay between | | |immediately | |chars. UPS switches load off | | | | |immediately (no grace period) | +---------+------------+----------------+--------------------------------------+ |a |Protocol |*long string* |Returns three main sections delimited | | |info | |by periods: | | | | | | | | | |- Protocol version | | | | |- Alert messages (aka async notifiers)| | | | |- Valid commands | +---------+------------+----------------+--------------------------------------+ |b |Firmware |50.9.D |See `Interpretation of the New | | |revision | |Firmware Revision`_. | | | | | | | | | |Decoding the example: | | | | | | | | | |- 50 = SKU (variable length) | | | | |- 9 = firmware revision | | | | |- D = country code (D=USA, | | | | | I=International, A=Asia, J=Japan, | | | | | M=Canada) | +---------+------------+----------------+--------------------------------------+ |c |UPS local |UPS_IDEN |Writable variable. Up to 8 letter | | |id | |identifier for keeping track of your | | | | |hardware. | +---------+------------+----------------+--------------------------------------+ |e |Return |00 |Writable variable. Minimum battery | | |threshold | |charge % before UPS will return online| | | | |after a soft shutdown. Possible | | | | |values: | | | | | | | | | |- 00 = 00% (UPS turns on immediately) | | | | |- 01 = 15% | | | | |- 02 = 25% | | | | |- 03 = 90% | +---------+------------+----------------+--------------------------------------+ |f |Battery |099.0 |Percentage of battery charge remaining| | |level % | | | +---------+------------+----------------+--------------------------------------+ |g |Nominal |024 |The battery voltage that's expected to| | |battery | |be present in the UPS normally. This | | |voltage | |is a constant based on the type, | | | | |number, and wiring of batteries in the| | | | |UPS. Typically "012", "024" or "048". | +---------+------------+----------------+--------------------------------------+ |h |Measure-UPS |042.4 |Percentage. Only works on models with | | |ambient | |Measure-UPS SmartSlot card. | | |humidity (%)| | | +---------+------------+----------------+--------------------------------------+ |i |Measure-UPS |00 |Bitmapped hex variable. Mapping: | | |dry contacts| | | | | | |- 10 = contact 1 | | | | |- 20 = contact 2 | | | | |- 40 = contact 3 | | | | |- 80 = contact 4 | +---------+------------+----------------+--------------------------------------+ |j |Estimated |0327: |Value is in minutes. Terminated with | | |runtime | |a colon. | +---------+------------+----------------+--------------------------------------+ |k |Alarm delay |0 |Writable variable. Controls behavior | | | | |of UPS beeper. Possible values: | | | | | | | | | |- 0 = 5 second delay after power fail | | | | |- T = 30 second delay | | | | |- L = alarm at low battery only | | | | |- N = no alarm | +---------+------------+----------------+--------------------------------------+ |l |Low transfer|103 |Writable variable. UPS goes on battery| | |voltage | |when voltage drops below this point. | +---------+------------+----------------+--------------------------------------+ |m |Manufacture |11/29/96 |Format may vary by country (MM/DD/YY | | |date | |vs DD/MM/YY). Unique within groups of | | | | |UPSes (production runs) | +---------+------------+----------------+--------------------------------------+ |n |Serial |WS9643050926 |Unique for each UPS | | |number | | | +---------+------------+----------------+--------------------------------------+ |o |Nominal |115 |Expected output voltage when running | | |Output | |on batteries. May be a writable | | |Voltage | |variable on 220/230/240 VAC units. | +---------+------------+----------------+--------------------------------------+ |p |Shutdown |020 |Seconds. Writable variable. Sets the | | |grace delay | |delay before soft shutdown completes. | | | | |(020/180/300/600) | +---------+------------+----------------+--------------------------------------+ |q |Low battery |02 |Minutes. Writable variable. The UPS | | |warning | |will report a low battery condition | | | | |this many minutes before it runs out | | | | |of power | +---------+------------+----------------+--------------------------------------+ |r |Wakeup delay|000 |Seconds. Writable variable. The UPS | | | | |will wait this many seconds after | | | | |reaching the minimum charge before | | | | |returning online. (000/060/180/300) | +---------+------------+----------------+--------------------------------------+ |s |Sensitivity |H |Writable variable. Possible values: | | | | | | | | | |- H = highest | | | | |- M = medium | | | | |- L = lowest | | | | |- A = autoadjust (Matrix only) | +---------+------------+----------------+--------------------------------------+ |t |Measure-UPS |80.5 |Degrees C. Only works on models with | | |ambient | |the Measure-UPS SmartSlot card. | | |temperature | | | +---------+------------+----------------+--------------------------------------+ |u |Upper |132 |Writable variable. UPS goes on battery| | |transfer | |when voltage rises above this point. | | |voltage | | | +---------+------------+----------------+--------------------------------------+ |v |Measure-UPS |4Kx |Firmware information for Measure-UPS | | |firmware | |board | +---------+------------+----------------+--------------------------------------+ |x |Last battery|11/29/96 |Writable variable. Holds whatever the | | |change date | |user set in it. Eight characters. | +---------+------------+----------------+--------------------------------------+ |y |Copyright |\(C) APCC |Only works if firmware letter is | | |notice | |later than O | +---------+------------+----------------+--------------------------------------+ |z |Reset to |CLEAR |Resets most variables to initial | | |factory | |factory values except identity or | | |settings | |battery change date. Not available on | | | | |SmartUPS v/s or BackUPS Pro. | +---------+------------+----------------+--------------------------------------+ |\+ |Capability |*various* |Cycle forward through possible | | |cycle | |capability values. UPS sends | | |(forward) | |afterward to confirm change to EEPROM.| +---------+------------+----------------+--------------------------------------+ |\- |Capability |*various* |Cycle backward through possible | | |cycle | |capability values. UPS sends | | |(backward) | |afterward to confirm change to EEPROM.| +---------+------------+----------------+--------------------------------------+ |@nnn |Shutdown and|OK or * |UPS shuts down after grace period with| | |return | |delayed wakeup after nnn tenths of an | | | | |hour plus any wakeup delay time. Older| | | | |models send "*" instead of "OK". | +---------+------------+----------------+--------------------------------------+ |0x7f |Abort |OK |Use to abort @, S, K | | |shutdown | | | +---------+------------+----------------+--------------------------------------+ |~ |Register #1 |*see below* |See `Register 1`_ table | +---------+------------+----------------+--------------------------------------+ |' |Register #2 |*see below* |See `Register 2`_ table | +---------+------------+----------------+--------------------------------------+ |0 |Battery | |See `Resetting the UPS Battery | | |constant | |Constant`_ | +---------+------------+----------------+--------------------------------------+ |4 |*???* | |Prints 35 on SmartUPS 1000 | +---------+------------+----------------+--------------------------------------+ |5 |*???* | |Prints EF on SmartUPS 1000 | +---------+------------+----------------+--------------------------------------+ |6 |*???* | |Prints F9 on SmartUPS 1000 | +---------+------------+----------------+--------------------------------------+ |7 |DIP switch | |See `Dip switch info`_ | | |positions | | | +---------+------------+----------------+--------------------------------------+ |8 |Register #3 |*see below* |See `Register 3`_ table | +---------+------------+----------------+--------------------------------------+ |9 |Line quality|FF |Possible values: | | | | | | | | | |- 00 = unacceptable | | | | |- FF = acceptable | +---------+------------+----------------+--------------------------------------+ |> |Number of | |SmartCell models return number of | | |external | |connected packs. Other models return | | |battery | |value set by the user (use +/-). | | |packs | | | +---------+------------+----------------+--------------------------------------+ |[ |Measure-UPS |NO,NO |Degrees C. Writable Variable. Possible| | |Upper temp | |values: 55, 50, 45, ..., 05. | | |limit | |Use +/- to change values. | +---------+------------+----------------+--------------------------------------+ |] |Measure-UPS |NO,NO |Degrees C. Writable Variable. Possible| | |lower temp | |values: 55, 50, 45, ..., 05. | | |limit | |Use +/- to change values. | +---------+------------+----------------+--------------------------------------+ |{ |Measure-UPS |NO,NO |Percentage. Writable Variable. | | |Upper | |Possible values: 90, 80, 70, ..., 10. | | |humidity | |Use +/- to change values. | | |limit | | | +---------+------------+----------------+--------------------------------------+ |} |Measure-UPS |NO,NO |Percentage. Writable Variable. | | |lower | |Possible values: 90, 80, 70, ..., 10. | | |humidity | |Use +/- to change values. | | |limit | | | +---------+------------+----------------+--------------------------------------+ |**Matrix-UPS and Symmetra Commands** | +---------+------------+----------------+--------------------------------------+ |^ |Run in |BYP, INV, ERR |If online, "BYP" response is received | | |bypass mode | |as bypass mode starts. If already in | | | | |bypass, "INV" is received and UPS goes| | | | |online. If UPS can't transfer, "ERR" | | | | |received | +---------+------------+----------------+--------------------------------------+ |< |Number of |000 |Count of bad packs connected to the | | |bad battery | |UPS | | |packs | | | +---------+------------+----------------+--------------------------------------+ |/ |Load current|*nn.nn* |True RMS load current drawn by UPS | +---------+------------+----------------+--------------------------------------+ |\\ |Apparent |*nnn.nn* |Output load as percentage of full | | |load power | |rated load in VA. | +---------+------------+----------------+--------------------------------------+ |^V |Output | |Writable variable. Possible values: | | |voltage | | | | |selection | |- A = automatic (based on input tap) | | | | |- M = 208 VAC | | | | |- I = 240 VAC | +---------+------------+----------------+--------------------------------------+ |^L |Front panel | |Writable variable. Possible values: | | |language | | | | | | |- E = English | | | | |- F = French | | | | |- G = German | | | | |- S = Spanish | | | | |- 1 = *unknown* | | | | |- 2 = *unknown* | | | | |- 3 = *unknown* | | | | |- 4 = *unknown* | +---------+------------+----------------+--------------------------------------+ |w |Run time | |Writable variable. Minutes of runtime | | |conservation| |to leave in battery (UPS shuts down | | | | |"early"). Possible values: | | | | | | | | | |- NO = disabled | | | | |- 02 = leave 2 minutes of runtime | | | | |- 05 = leave 5 minutes | | | | |- 08 = leave 8 minutes | +---------+------------+----------------+--------------------------------------+ Dip switch info --------------- === ====== ===================================================================== Bit Switch Option when bit=1 === ====== ===================================================================== 0 4 Low battery alarm changed from 2 to 5 mins. Autostartup disabled on SU370ci and 400 1 3 Audible alarm delayed 30 seconds 2 2 Output transfer set to 115 VAC (from 120 VAC) or to 240 VAC (from 230 VAC) 3 1 UPS desensitized - input voltage range expanded 4-7 Unused at this time === ====== ===================================================================== Status bits ----------- This is probably the most important register of the UPS, which indicates the overall UPS status. Some common things you'll see: - 08 = On line, battery OK - 10 = On battery, battery OK - 50 = On battery, battery low - SM = Status bit is still not available (retry reading) === ============================================================================ Bit Meaning when bit=1 === ============================================================================ 0 Runtime calibration occurring (Not reported by Smart UPS v/s and BackUPS Pro) 1 SmartTrim (Not reported by 1st and 2nd generation SmartUPS models) 2 SmartBoost 3 On line (this is the normal condition) 4 On battery 5 Overloaded output 6 Battery low 7 Replace battery === ============================================================================ Alert messages -------------- These single character messages are sent by the UPS any time there is an Alert condition. All other responses indicated above are sent by the UPS only in response to a query or action command. ========= ============= ======================================================== Character Meaning Description ========= ============= ======================================================== ! Line Fail Sent when the UPS goes on-battery, repeated every 30 seconds until low battery condition reached. Sometimes occurs more than once in the first 30 seconds. $ Return from UPS back on line power. Only sent if a ! has been sent line fail previously. % Low battery Sent to indicate low battery. Not implemented on SmartUPS v/s or BackUPS Pro models \+ Return from Sent when the battery has been recharged to some level low batt Only sent if a % has been sent previously. ? Abnormal Sent for conditions such as "shutdown due to overload" condition or "shutdown due to low battery capacity". Also occurs within 10 minutes of turnon. = Return from Sent when the UPS returns from an abnormal condition abnormal where ? was sent, but not a turn-on. Not implemented on condition SmartUPS v/s or BackUPS Pro models. \* About to Sent when the UPS is about to switch off the load. No turn off commands are processed after this character is sent. Not implemented on SmartUPS v/s, BackUPS Pro, or 3rd generation SmartUPS models. # Replace Sent when the UPS detects that the battery needs to be battery replaced. Sent every 5 hours until a new battery test is run or the UPS is shut off. Not implemented on SmartUPS v/s or BackUPS Pro models. & Check alarm Sent to signal that temp or humidity out of set limits. register Also sent when one of the contact closures changes for fault state. Sent every 2 minutes until the alarm conditions (Measure-UPS) are reset. Only sent for alarms enabled with I. Cause of alarm may be determined with J. Not implemented on SmartUPS v/s or BackUPS Pro. \| Variable Sent whenever any EEPROM variable is changed. Only change in supported on Matrix UPS and 3rd generation SmartUPS EEPROM models. ========= ============= ======================================================== Register 1 ---------- All bits are valid on the Matrix UPS. SmartUPS models only support bits 6 and 7. Other models do not respond. === ============================================================================ Bit Meaning when bit=1 === ============================================================================ 0 In wakeup mode (typically lasts < 2s) 1 In bypass mode due to internal fault (see `Register 2`_ or `Register 3`_) 2 Going to bypass mode due to command 3 In bypass mode due to command 4 Returning from bypass mode 5 In bypass mode due to manual bypass control 6 Ready to power load on user command 7 Ready to power load on user command or return of line power === ============================================================================ Register 2 ---------- Matrix UPS models report bits 0-5. SmartUPS models only support bits 4-6. SmartUPS v/s and BackUPS Pro report bits 4, 6, 7. Unused bits are set to 0. Other models do not respond. === ============================================================================ Bit Meaning when bit=1 === ============================================================================ 0 Fan failure in electronics, UPS in bypass 1 Fan failure in isolation unit 2 Bypass supply failure 3 Output voltage select failure, UPS in bypass 4 DC imbalance, UPS in bypass 5 Battery is disconnected 6 Relay fault in SmartTrim or SmartBoost 7 Bad output voltage === ============================================================================ Register 3 ---------- All bits are valid on the Matrix UPS and 3rd generation SmartUPS models. SmartUPS v/s and BackUPS Pro models report bits 0-5. All others report 0-4. State change of bits 1,2,5,6,7 are reported asynchronously with ? and = messages. === ============================================================================ Bit Meaning when bit=1 === ============================================================================ 0 Output unpowered due to shutdown by low battery 1 Unable to transfer to battery due to overload 2 Main relay malfunction - UPS turned off 3 In sleep mode from @ command (maybe others) 4 In shutdown mode from S command 5 Battery charger failure 6 Bypass relay malfunction 7 Normal operating temperature exceeded === ============================================================================ Interpretation of the Old Firmware Revision ------------------------------------------- The Old Firmware Revision is obtained with the "V" command, which gives a typical response such as "GWD" or "IWI", and can be interpreted as follows: :: Old Firmware revision and model ID String for SmartUPS & MatrixUPS This is a three character string XYZ where X == Smart-UPS or Matrix-UPS ID Code. range 0-9 and A-P 1 == unknown 0 == Matrix 3000 5 == Matrix 5000 the rest are Smart-UPS and Smart-UPS-XL 2 == 250 3 == 400 4 == 400 6 == 600 7 == 900 8 == 1250 9 == 2000 A == 1400 B == 1000 C == 650 D == 420 E == 280 F == 450 G == 700 H == 700XL I == 1000 J == 1000XL K == 1400 L == 1400XL M == 2200 N == 2200XL O == 3000 P == 5000 where Y == Possible Level of Smart Features, unknown??? G == Stand Alone T == Stand Alone V == ??? W == Rack Mount where Z == National Model Use Only Codes D == Domestic 115 Volts I == International 230 Volts A == Asia ?? 100 Volts J == Japan ?? 100 Volts Interpretation of the New Firmware Revision ------------------------------------------- :: New Firmware revision and model ID String in NN.M.L is the format where NN == UPS ID Code. 12 == Back-UPS Pro 650 13 == Back-UPS Pro 1000 52 == Smart-UPS 700 60 == SmartUPS 1000 72 == Smart-UPS 1400 where NN now Nn has possible meanings. N == Class of UPS 1n == Back-UPS Pro 5n == Smart-UPS 7n == Smart-UPS NET n == Level of intelligence N1 == Simple Signal, if detectable WAG(*) N2 == Full Set of Smart Signals N3 == Micro Subset of Smart Signals where M == Possible Level of Smart Features, unknown??? 1 == Stand Alone 8 == Rack Mount 9 == Rack Mount where L == National Model Use Only Codes D == Domestic 115 Volts I == International 230 Volts A == Asia ?? 100 Volts J == Japan ?? 100 Volts M == North America 208 Volts (Servers) EEPROM Values ------------- Upon sending a ^Z, your UPS will probably spit back approximately 254 characters something like the following (truncated here for the example): :: #uD43132135138129uM43229234239224uA43110112114108 .... It looks bizarre and ugly, but is easily parsed. The # is some kind of marker/ident character. Skip it. The rest fits this form: - Command character - use this to select the value - Locale - use 'b' to find out what yours is (the last character), '4' applies to all - Number of choices - '4' means there are 4 possibilities coming up - Choice length - '3' means they are all 3 chars long Then it's followed by the choices, and it starts over. Matrix-UPS models have ## between each grouping for some reason. Here is an example broken out to be more readable: :: CMD DFO RSP FSZ FVL u D 4 3 127 130 133 136 u M 4 3 229 234 239 224 u A 4 3 108 110 112 114 u I 4 3 253 257 261 265 l D 4 3 106 103 100 097 l M 4 3 177 172 168 182 l A 4 3 092 090 088 086 l I 4 3 208 204 200 196 e 4 4 2 00 15 50 90 o D 1 3 115 o J 1 3 100 o I 1 3 230 240 220 225 o M 1 3 208 s 4 4 1 H M L L q 4 4 2 02 05 07 10 p 4 4 3 020 180 300 600 k 4 4 1 0 T L N r 4 4 3 000 060 180 300 E 4 4 3 336 168 ON OFF CMD == UPSlink Command. u = upper transfer voltage l = lower transfer voltage e = return threshold o = output voltage s = sensitivity p = shutdown grace delay q = low battery warning k = alarm delay r = wakeup delay E = self test interval DFO == (4)-all-countries (D)omestic (I)nternational (A)sia (J)apan (M) North America - servers. RSP == Total number possible answers returned by a given CMD. FSZ == Max. number of field positions to be filled. FVL == Values that are returned and legal. Programming the UPS EEPROM -------------------------- There are at this time a maximum of 12 different values that can be programmed into the UPS EEPROM. They are: ======= ======================================================================== Command Meaning ======= ======================================================================== c The UPS Id or name x The last date the batteries were replaced u The Upper Transfer Voltage l The Lower Transfer Voltage e The Return Battery Charge Percentage o The Output Voltage when on Batteries s The Sensitivity to Line Quality p The Shutdown Grace Delay q The Low Battery Warning Delay k The Alarm Delay r The Wakeup Delay E The Automatic Self Test Interval ======= ======================================================================== The first two cases (Ident and Batt date) are somewhat special in that you tell the UPS you want to change the value, then you supply 8 characters that are saved in the EEPROM. The last ten item are programmed by telling the UPS that you want it to cycle to the next permitted value. In each case, you indicate to the UPS that you want to change the EEPROM by first sending the appropriate query command (e.g. "c" for the UPS ID or "u" for the Upper Transfer voltage. This command is then immediately followed by the cycle EEPROM command or "-". In the case of the UPS Id or the battery date, you follow the cycle command by the eight characters that you want to put in the EEPROM. In the case of the other ten items, there is nothing more to enter. The UPS will respond by "OK" and approximately 5 seconds later by a vertical bar (\|) to indicate that the EEPROM was changed. apcupsd-3.14.10/doc/manual/status.png0000664000076400007640000001775711175165131016320 0ustar adk0212adk0212PNG  IHDRN|;KPLTE111ŦIDATxMq`ګloro m36~Z,?$R{LIQ,XWm8!pCԇS~ǘӫ/PQ]pjZ]pjZ]pjZ]pjZ]ЅMσ)V/9=l ^Uxԇԇԇԇ sهJbmH[rn0}Nt"979'y6/yu7{sLs*+#٘ћc8=7?do-fNCilfga^zrr} E-r")R1-rbߍ4EsZd>ז<_,X- 6GLYۑ2'6C7j=q_4|6W8=i'cD©`nB2&wZ8L}/!;[~N_vӏ6qby}/}d^R3p'r:ēr?.N u(9ۏOgקY8i~}*qv}:iPn޹5c$맜MfW '䞑)5iccm/^*%'PM;{d!S6d1gDGE# kfa}(r*(] -s ,]tR88RҭdIe1q)4PγoJv툓bfɹ<ӡyfT Ɂ{bnW): xh|i M9g9i=]-s/2,pr[yd+QΉܹg8eRO!^_7-p=sklgeN9S_݉}R|\pYsqWIY9㡂AsqkFO^laJT>[Ͻs8y d׊E+AX'+!?f8mx|\p\p\p\p\p\p\p\p\p\p\p\p\p\p\p\p\p\p\p܌ӫ܁V܋Rs˜pjZ]pjZ]pjZ]pjZ]pjZ]8U~BL]B%^7xgSSS~h6˿%צCnm2_{gȦ q 4z;a\Bֳ$4INIྷa+sb6'b39D!oCuNqZQ1++pDCQN ڌcVD< NG9I8:5-ؤk~[g?t9i+8M&q߷.&99/0pb^H y=ބȔ.Ir=W2f8i\ 8M'"V)a5q9=<'7IQÍt%>O}*3%>T8i8шK9>5ӄ֟SDŽsF$i}N>L|d| {N^i}a:[ft'rJ=I"dv)oB)NTRO\U^*c?Arm }.mdt; 6gO!ۛ8r(ڼ~S-N %N .4}mGT|VHRpo32d ?p:_d(溎>)^Of|FIJƁ&e'H|R3Ya4eXpShC}F)' ,Ɓ%:SNVR姙'9?*/O x~9Ym=t5ܧT..4đSFST;IUT!'d;^Q~?krz  ˒?{Si?:N}N"tSeg5$-t,نJ/m8pS?b|ίi)ԧBp>etL6g > pđSe~ЏXNg9Gf |*~98> 圆Ns$p'pąX,58iYNdc:X{3q271o:&eNF58[0i. xxgJp+kS&CzU礏`4R?EI̽OHNy/g`OdivgroB̽}eBϭt>={zN/:DTUn&}{Nzx'=n%;rJ )8k}[N4V Nk8SByqYp3Jg_9 qtfN6vNiܜa(No#VNs֨hөf#('SLa28SZlrJ8Qt8>eϯHa<3|fep=O7闋yB~N/888888^N| $.¨sYf&='&o|{''sUb p:ɇ7$4s_Ed_Kp)Uk4_}koT3UOLc}4oS=l ~a~ kӥ5׆#ߑSj`ENv qb.8888888˩4!M̭+}y~^Ӻ\kB\}(\(֏~,Ӈ82W$VImAd!i/X|qbM~ 19 P8]I5RFY5NLSIڑ ~)}3s <Nvi4ZӞO N1WCz88888%3NQS_Ϥ w'188]Sh\5O:D>?jkUne}אqm84G}Mw)'tO} &O)35NSTהק ֈ0?jkr8d>1yNkN8?*5YEF?KO\u N7'p'p'p'pNNNNN‰59 CњslI򖜮]e'9 #'kYǜN Ӝ.ʯA6ُ׸> 4`>ʜ 8D#N81eix.#sp:MkؘB\nCxGWO?pp [SX?t d59!3*,'sl|' %NrIś8(֥8=R(8l_ȍiTQgksc67s*b0KBr C;OfK`N楜pI|LqsqS0/q5^^T#`˸Vls5s4"v}~ 3Ii<:fuiCŠ's ܟOZ3}]G91uwtE4T'J¼ ȉ.D k9lX8Oa])TʜE\_ܷ{FK$'V>[v$/ɯ!קXwsz_Ή_t}z1srOOV}GNƘkpxD'gm0X'9388888}y*,("18b.T? BP|󟮬O4?q]?esF\p_?epq){Nt'ނP6'sYb'=Oԧ ^/p:iប͌Iuo|s N'9Sٺ>FcNn{s>';q'b_cYINaԌFQo= #N#Z):hOb/ٍ lKӦN2 ilӺ pr|qY?X|8^ 8n8|>O 2N[Foџ888\NNNNNz9Dvz}q4̜1M9vx;U /+m8~CsߔO}q%e' _N'l?)9I_9̜18'wJ쟝8-ϛ9cp^wOq}}SRqrks4oMq}Z>11mCT?"nܤDӏ(+mЯGpp N} N} N} N} N} N} N} N} N} N} N} N} N} N} N} N} N} N}qф܁V܋Rs˜pjZ]pjZ]pjZ]pjZ]pjZ]8 5?.pznR pCԇS>N} 'f- tS zvq*v kZD[N/FN.d[B Ԍ!ws5lV9T^\Hk'k 6p"<>R^^_ kՇvg`ӿh}r-dXS'38EWY뜴*ku]⅋p}ҽ#ʈ۸UYCԇS>N}8!pCԇS>N}8!pCԇS>N}8N zrfkӫG_i}˷/pjZ_Z8= J}Q27,en N{8y4Ӳ|??S>|M쿓Ԑgn/wqonŌx~?$sm :Z[2c]dل{Β_urqbN=Hrsj"'aٵ]Nڦ9Nf;'W&q-mbTRr_1{8ٜp}<6'9IZOR?o,޷j4zod ?bʦk+W__OK~:IMp9LIP#?qx}v'>Qv~)SzƜ> vwm"#8iyS Lx}vq/VFpdYOaԇԧ3't)2zgv-jO}:J}BW׬C<6]ק'ER2XޯljMlG1(WѮ SX6P38~-jw}:J} WdLF̵Pdj]f9Na,t>?>O6i8d2|hQۢvէ'tIG1ߤ9Yb{l3665#>z3#9[}TV>UO}>!ԧ>n'3~{?kOHmL2%vhSIo8zT;tSֹN%Ѹ)7&eu*K^.t}m9龱koSM?>mK~ciN ƩO8!pCԇS+^?AO7q7˵OS}swiw|S'2"֓wISXgX8l9l}P⅝?uɏgCUnpuY?8*Y?Q9QGp:ۜ?QIʵox{8U?Q/?yL&wwS:"ךmWoӧ Y!ijCȧև^z{WFԽ?xP5FJw~]wϽ?1lۋWSiSloEV܁N}8!pCԇS>N}8!pCԇS>N}h-pZCi=tCi=tCi=tCi=tCi=tsgE9A 8!pCԇS>N}8!pCԇS`-)QrIENDB`apcupsd-3.14.10/doc/manual/thanks.png0000664000076400007640000003717611175165131016262 0ustar adk0212adk0212PNG  IHDRqVVPLTE~fffJJJeEBBBL9:::i666#2I0!"*:I.fᚚ&&& )^^_epVFbvvv""%NKN>nc 2]ZH`v5Jmu>;l@>AZ!!&D5*r0-N R1Lh>Z~":FFFf`1?>D1>V~&f\v,*z VB0B nJR0&GXP1?R2fhUN.TR'5=nUv e/{pv7Nr.D\PTx#1v VRrhV^ &S*:T" {04XXXl"":  =Lv"E (/Ba2?4o>*pIf<=FrR[>UP$1n ZNZD,X;2[X]:) &<)E~z.zt6,^2Ff2 t~.zi \3"FV fNn&j(*H'G&6P:Rx: r^ b2=]w*>Zr Y)2W3"*FjvR e> o9z* yT=2 v.>\V\Jd 82,!*J jVbT:=lR=>Z b(#&t#+G(0/2>&_=YCBFO"">Nf bYjv{v84F l& z*:%CCN|b5v"04Kj6%"&fF&Vh`rjBBC^. t*,L&*PPPN i>> ~ ~C;mFFvCJ{Bvvvj&:O>" !3FkD;^rb `6 r bKGDK ;2IDATx}}\T癶4B!|4'! 6EFe!n邱C'tP,]݂ӼkAe 0qN(1d7"ɀK`$k1/cg>pΙ3gs\9I!£: "M>mUz7| ӂ(Oc Q\$%%`KIuEͯ5cHr&gx S|G<\9!uŭ6.x>.ƉE^^q< R)2^(>~G~p#B[R2\ԡ}_W|L .bbQXOI.8ʕ["beW{)q²l5)7$K [ЬH$~+W0$ǃ!͛[P:pBTEC(~L$nI 9޿u'4[$i0n6UP'=@~_u@rM! }>&z?sD(͏ y6CE4k<V}^IHFq!|9l4_IJpj4 vzP*뒒BpS -Ȭ lP hL~z@[ЂMg.^<лW.YH-GGS^Q]-Rvu*i2lgQG!!L&ZKSR|g7|ŅnBCM*R&ܸH`L>AVKG4}7#!ؐLBqVp'1rurBsv.z/LQG>z't;FG[z1ᨆֵKn:5xZ|a^`:C& b L7K;@i\XY@|lh(PdYeb*>:NϦ̦1K{+yy/+1#SO WG \L~)cIKѬ~ :!=T)!-,u4a2n*,&q¿+WBTS{w39g_)kc؊'/@ܯRlq=}}) : AmY>D{Q/r!V=2۲ʯZm9NDtlWi0^=|q7L*8skB[ 9fS|<@q78KY,ŝ0*4nIqn. үH$(>VְqBL9v#v W1I).U|!p' hZ:gLN&[_-o$[u$Ge6 .:Ù"4")NE?ξ`='>XpU N!*~E1\,FE$ҨB&6Ȭ{u|h2iq8q8>8 YY}`??0iQ 6?U$Iwu~oKZWT0T.$,)-E^R_"K^zTqF]Fe|GnD jw()W #^^nQQtI 97|C}qsiϣ [DRJϋ}ˇ8!@ܢ&O?n)ɸ@aחv\v9Nmef(E_^rO/8ѻ=@6/^u0\8/G yssvn6pKXFdbEVk.?x96g3+vp\E y@\jJ|S.Jhao#U(B~^av2ν}Oq"~_%F-ϱIŻIdz})#2PR{JLdk}MJK !]oUI .t 6>.2}RqP8^i1O6qudLK{c!,7D(9Nqpj g`ae+CtxuZFOōܔUWV<ɉ(ϱ~JcJHCV&*g(??ņ\g?Z~*.h7DOڀR([ e_R3r'^.T3HAglFǁfhN}Mv,.lC$- |(`p~Q\qǁ8ULkg[$ccchf[/%3Sa>sRݒNB"9n";i%aIeXm{@WF_5NC~e;grmޖN> U}&,oa/6ɂP&*q iL9;ƈc2q}r gLxLNÌ^#l Q[_1qp_o)bWY YYVxFPF<,9Q!~O(KoM ]-J[wot^S9ui^7 QFXmm.~z x ٤o:}ի^u3d{5CY0t/5/ }3*5LgLV"ȱdpֈz'sPR18tW/8Q(Y_!H1ӳ|#Nr7bI̮Dq\qEbΌBoO_ĸ%#&ͳ2.8NAݑoBƣ(MITo"ďgC~ eFM)/כ&0Ѫ2Vj-C)d2.[^pCZm~~~ywYselʪyao/jXWܛjk}.:&7ׅBOk{-<;, cx̟} A7oF  1S1btD(=Y&&6r,zn X%Dž pirtMY r|:kJH[RR cx*ZSZԷ9T7p 9xSOKQPV[ tڴi跓y 4jW!ȇjv M78ӆ!P8>@׾=͕DdK!) t7 $+9558[à'~q?U')Br ~?Ĵ^L_ ^8%q?L`m >E'4/WxDo#S䀮 w(jOZMG\rW;H>,}YOjY!ON&ubP$(>gHTPcv] 5)ۺZ*Tv8~]u^:JKهv i|D/ cc٪lEqFX><Ù b6CQlk[Fd'&6d &`LB WLC}qp> 9Yr1a9騝d j琠?tCCT:P} 8TJ1tlܵr8BJ4oFl<wJu2(aVVPCݻwwڲc߾\@x(EqTkX/$x$*:9|&*-«O-[VwTRmkZrzδؕP涒~]UV괁7jȊrtg:"d= |N8gגAòS̀lJEMRA6=-S{?s4q $8kNx_EV/.vŭ2ZG_8KQQG 87SOc8sݩO>ڔ/Oygjj;*\ڇYm/N 6iĔ{͝ӄ_qyz10q %U)ٔ52򍦆7NqPxY9.(ӯ) ,]g#odB`S]0$* xB%KXU5|bEcaБK}'Q<2ˏ-y_#:j8jgp዗ &WJQ t<3|qPl&# .$S<݆WZ_׫{5"rzVrGx! T%DbzO-ZNj5G&):q5UXx rg2L&?]&S|?"gcj!nsr1KRvݻs9o'Igq7y:NpL۽"j)x*O0]q;v 7sEQvV[oA$ i1)D@U}Y%ݕ Vzs N"IZ^0Ƀ[Uψ?$gI,,y%%8XM".A\je'_m%\1(ֱSL|$S\r>CUd!*u<#Ei9i_E-Ĕ=6s604 ߓTs"-g,f)Ըm}sx y $D?'uG hI@-1&3D%Hq1 UѓARG?|)ye9oҥI *~E^O ̏su,!ap˂v@i$D*"w)w9 6hsBGp|JURo'fEqEpn9 077\Zqs0q_Grj +o r*1|(w'ݓ\"1mG+-qD|W&/$4ϏsvY3ꢀg\8 %l < TbD/f!r~B&z-9pPumD9> U,wqu[NC9rEqqb8IW(*G#1A9NQ*r>yi'mǥ8.{z?37qp\Upz xcHیtf)z>yyÏU^E$''hߐVހ[F[L*D H_qI ^rSSլ*gIUxDWa K @ȧ@b"Ў,TY,/LE" {we{[ =ɯ򕲘Wq-gkNXh8?Bt<9N Pj]&nb GONܛaHe"8y5QpXtvA%6g[#ӲKb ҡ+|Q0 G˹~Px\jR\p|^l1"P|Ga0^ZȁynE.Ø_c)Q?!:.nW*d'M!>^ck^>EzT㼯S«TWym~U‹¡)=N{84E>,^AǎUꢜB $O~W|jVsuYQV:*qvbx͛7-3;~[c+_eῠ}"{n_gBܠ!ċms݄ɯ\%~+Lγ\%kYyeVq!_ akJ0O_r/=GeqMڒK,:E4[CIsƕ t/ϻ|{<#Snq݁6hʹ:mf߽u/x:AF<}'Lf7_?_T4e{x79m%(eɐs~ΚUIxu꩕x]ɓiQXg~vdUqH8Q; pu~%_g4_M̯W`5Vt-T%o.+1=qײGbcȎ{姄8-Y$qūpB1Y9I^/e(5r0k''C6kN]8ľzyR "XS0lfɊNt+ӓMbO<_߷mKVt|>O@<Iưb9lVyIF f_*<Qp]ik_KTc%j_B!ߎAVà 9]@Q}Dt|W,j˔yUL%6fhhcvTLʾ24^-~2b 9tDvAhzq#;ǂF8!V`QK vuj }˟-a2.HQyHO׉ojqL';؏8Sq+++ѫY?KX'!9^~70 SkO`(\XR_FF܆6Κged*"#s`QY侠n T1nIDM9 L@'rC{1g&r FM 2fijG@\̓Q85j@Y.溡q=Tr=Og^'Z/B8ໜ? h(PRVɒUF7U7&"#Η晗1ɢR>M"fÄxW U_G'r?=vB}']9 |Ǒx kR[~uhn[߻p<,z`K1Sƫ *mj(tE+{bFo< Q< &_oK#HBѝ x奛, d'U]  o'Wisz\]zmyZF'O >ԶE۵mrxQmP1EAJΎ__6F?-8.[0%NBt3ǛyI hW==fYy>~=O;OD?;^eI@v q|eJ7quÕAw oQ|Ar\h_{fZ>eLV_ZRʸq0##Å7MTgJ^/Tg}ee:Az55oYr& } ;x{CFfsoʃШQy'~*6F.͛z팃oMwdA6y[Ÿ-:6L)W&^ody%' e_kbx2]/n#bIK?{ߐs^mlQmHMsKK\ų2R4ESjϭ{zNO`/kG<j(D!w`EEF#5 YO9}S(j{\!S6\h4hƛ7#s#{bRlږgjXȓU,Ka~p10^,_mB\:(U2/wcclȧ'"[@_gNawIOgeiS$Fڃ>_ j$bF|'V^-ٴ 0)wѫZ;֫}ua >j(os۶M}ZLaB+hϾT= ک0b76<|ïP7W&( {NU1&9C5[U8XL/U8e>w4}KG$WDuq ʏQ㙙ˆ[,%^rTW/[z ;^^}oaNJ*U)4q=!N|Q.~c!]L ʴ۷ک C bwa.nY~0\ȍ`Q'ćSr3`f>C> Tt䗛E@^;HL4|jsjjC| yd-gsP]~`dDTJF܃_ڸqyE`8JV6pn d쁩WIkc侥UrоȊb?SSn?g>/c Հ'AÇPoEgQ|+}?g>w]OJĈ?FOyÏChٱs£8xnSOfn{➻y}qߗMB}m ";O(q}';s|ǭ{˯q_p=8C~P8J^<Cٻ}>җ>x|K_}xm-xC`CzzލO~6M;ΐ.5nqX_ٻ?[%L}S|mG;8߹t|w>&8Nn;h]=XH? [< n%c_6N.C;;օ{8/xG ZH ޹7k!V@B(? 1g-rmIENDB`apcupsd-3.14.10/doc/manual/wininstall6.png0000664000076400007640000001135611175165131017234 0ustar adk0212adk0212PNG  IHDRSPLTE{AJIDATxђ*9_صJO> DbcuF60ճ !v7]@w o+AP[읿STÍ:}'KBy@u exMKtTHWޕGqm~Tʦ:TҼP@*PdEOEE@U"_y UwgDzT+oJJuNu~?]j)Jڪ D@""\ """""""""""""nFv kk*О1nc'\@(zR”.0*K~樚TFX׫{?{rNەr*ԯ+aJڿ{tAT: )o|SJiYQ =d{ S ZҦ &&YPmh0yڳH@{V*(㝵fԅ@֡{_M@[C;([C(^u FfN졶P0kuTۭ-)nZy~oE]y@WʶhE&׊cyW6 ,4F lsE@Wh鴉tb'Q30^O_>P*{Oг ? I@7'$Lȿ(d#(~&8w< m:K>KTv6o[N@6ƹBoQ6x}}DyP>Ah7EPX(\6S q>Ƭ?^3%uDGn3 T=Z@t">`}/Sm:к@ovPA=u:|^RE(^˧T(*RuflP ,C+PzTvW*/Gx&S^Z-PTL6!AdM&-0?6T@*t<ֵP"F/WJ {'ֵ0j23лXj>=uo[*p:2bZyn un{!V~oЃVBV//c]y= o[%PB1PU f{(fжTz:PLg!W" 4O$ ywyz:g(7F7)P'g8~V{>qJV^:<0AM d&&Z=N)t; A8SKzGR׍F*<pqJ˭yZ4[4~‰mP"01JR8XQ&J=6lCݭ(qJbKpzɽ{̉=7h8%@4݃@ VDB BYm VlKW|" %Y(hdt*[R~>:ncrOXU m88Ħ.@Z(lE@21B.;1 .(yM)ZS&6OFzې. xb`} ^NŸɷwNPa.rmX*P)2|u p"p0}>%(,"Ӥb eEξ4@cPs@ \VeŅB]BI({KF@>4}J@Z]@j*\Lۇo]5M+"Ѕ:Kak],Ԟ;O ͹n yzԤZSifkߧ ==L@ ,"ęB/-UjIRꑷjZ&qd @@AzRCNznGr<*PL*U%Yաj:"/?E@s*C 㕊ɧt-{}w%l@EzNȫVD3h7&Sng@Shw*\`Mw^2.6Bmjzą[k^w%p)6}Jyn МO)j|ϽNtE@)Ej|I{I4F5S1Є{"ߘOI̴vuȽ4 >%9w`&oM@i3h=BqE-P\MPKsDRH|G44.א}J@G"gdr 1D_IԍP,B b\625$L?xt=(@''5iTO-2 zMtF5$L/_u8ہމCOC$$/&P8)pynf OU*P=Q\jNև_DYc?98/MP-͙zJ5G0/DiTWETe=#Ћye:9΃Te=2@3+:&-T Λh}OֵP[Lc2";| 4[j؅)UBtT34ܙxZsr}zJ@cqW% E`,Wd" Y(BqU7M7>$}yYcqXco nb#"7?cjG (,bڗ9LRw l74}_N&z\?}2XC=5}PoC IARO|Pqʝc飀:͘A=ОM@&EcաSON͉Լq@+Ϸ~ ,t`]Ϻczм AQLz 肞j:%v@'*lPFu=P}bZN7Lk4]f;_.aPARs+qQ>U<)9eИ]d}q DZb7\sii&}_k\+V}{%jv^5GP~m<3nEMkjT Ig-Tx@%3󫀪O As+<4]0Z>Cj@~I6'nЄ tQBӘ}h 4'-aO"mî:*zED[J ?SmocW@IEEEEǢW#ԝM㘻pi^'D@SZj0Ub1^"FQ0Mc.H}]*O5L >J@S-wh!*_@5_**hJ1P{fE >J@SZ:tj;')ѥ'"f IG hJd"""""g ~0G0gfP)h<Q41]76+n$:45]Im ߺnChK~+D7JѼ%3M5tyzTB?"`T\nChKщ}<] 5u) MZG*OP%"zE@E@}m-`#" 5s;t;s#֢#1uʅ5J@ h PaHC@e- n: 'VJ@v Ju(&Pjzro@uJZhV ^aF6L4oqF@I8""""""""""""]]gﰁ_VS8ҌIENDB`apcupsd-3.14.10/doc/techlogs/0000775000076400007640000000000011634011372014576 5ustar adk0212adk0212apcupsd-3.14.10/doc/techlogs/1999/0000775000076400007640000000000011634011372015211 5ustar adk0212adk0212apcupsd-3.14.10/doc/techlogs/1999/cpe16Dec990000664000076400007640000000305607474702772016676 0ustar adk0212adk0212 Technical notes on my code submission of 16 Dec 99 Carl Erhorn General: - I've added some source files to the sun directory, changed many others as a result of testing, and added a README.solaris file in the source directory. I added my name to a new port entry in the Developers file, 'Solaris Port:'. - This is the first real attempt to provide a port of the 3.7.0 package to the Sun Solaris system. I am currently testing on a Solaris X86 system, running Solaris 2.6 with all recommended patches, and the Y2K recommended patches. The UPS is an APC SMartUPS-700, attached by a standard serial port. - I have moved the PID files into /etc/apcupsd, rather than using /etc. It keeps all the related files except the lock file in one place. - Many thanks to Kern and Riccardo, who helped me get the initial bugs out, provided a tremendous amount of information, and made many changes for me as a result of my feedback. Kern in particular has been instrumental in my getting going again with the porting process. Work to complete: - I have not done careful testing of the network features, as I do not have a second Solaris system here. However, I intend to test using a Redhat Linux system as a net client, and will be building the package on that system soon. Suggestions: - I think that the killpower diagnostic messages should not be displayed unless the daemon determines that it cannot get an OK response from any of the methods that it tries. As long as one method works, the diagnostic messages should be suppressed. apcupsd-3.14.10/doc/techlogs/1999/kes03Nov990000664000076400007640000000661407474702771016756 0ustar adk0212adk0212 Technical notes on my code submission of 03 Nov 99 Kern Sibbald General: - This is a preliminary submission that has not been fully tested though I have been using the apcupsd generated by this submission as the changes are made. - LW LI and LD are gone. They are replaced by log_event() New features: - All logging except apcnet.c and the status file done through syslog(). - New cgi code with graphical display of UPS data. - Configuration file may be specified on the command line. - Status file location can be specified in the configuration. - Status file writes can also be logged. - Status file contains additional data. - The first record of the status file contains a version, the number of records (not including the first one), and the total bytes (not including the first record). New directory: - I added a new cgi directory. It contains the cgi code that interfaces to apcupsd through a web server. Follow the directions in the directory for compiling and installing it. - Note, we should probably automatically call the make in this directory from our make. Changes to code: general - I cleaned up the error_abort() and error_exit() code a bit to eliminate the varags #defines. It should now compile on compilers that do not support varags in defines. - There is now only a single syslog call in all of apcupsd. It is in subroutine log_event(), which is used to log all events. - I eliminated a lot of printfs (not all of them) and replaced them with log_event() calls or error_abort()s as appropriate. - I added additional log_event() calls in many places to enhance logging. - error_abort() now logs an event. - Cleaned up some of the error messages and messages that are logged. - Cleaned up some of the messages in the configuration section. - Changed the PROCFS configuration statement to STATTIME - Changed the LOGGING configuration statement to DATATIME - Added the STATFILE configuration statement - Added the LOGSTATS configuration statement - Changed the ACCESS configuration statement to NETACCESS - Removed the JUSTOSHUTUPCOMPILER configuration statement - added lpr, mail, news, and uucp to the FACILITY statement - added code to close and reopen the logging if the facility changes from the default. - added variables necessary for new format of UPS function codes. - allow the configuration file location to be specified on the command line. - tried to cleanup and simplify the killpwr code. I believe that I stumbled into a bug where non Smart UPS are not being correctly shutdown. See subroutine unknown() - LD LI and LD were eliminated in favor of log_event(). - Rewind the status file rather than reopening it for each write. - Handle the writing of the status file differently. - Status file contains additional data. - The first record of the status file contains a version, the number of records (not including the first one), and the total bytes (not including the first record). - added a maximum length to getline() to avoid buffer overflows Final comments: Work to complete: - Automatically call cgi make from our make. - Documentation. - Automatic conversion of old apcupsd.config files to the new format? - Eliminate the rest of the printfs(). - Examine all configuration messages, and eliminate all "Someone will have to explain this to me" messages. - Check and double check killpwr changes. apcupsd-3.14.10/doc/techlogs/1999/kes05Nov990000664000076400007640000002520307474702772016754 0ustar adk0212adk0212 Technical notes on my code submission of 05 Nov 99 Kern Sibbald General: - Since I did not complete my submission notes of yesterday, this file contains the missing parts. Additional documenatation of kes03Nov99: - I changed the default location of the status file to be /etc/apcupsd/apcupsd.status (previously /etc/apcupsd.status). - Added new function codes for the functions and codes used to access the UPS. This code will be described more in detail in a later submission, but essential it replaces the UPS capability flag word (limited to 32 bits or capabilities) with a character array, allowing us to add additional functions. - Removed the old defines for LI, LW and LD. - Removed the old defines for error_abort and error_exit. They are now simple subroutines. - Removed the subroutine remove_file() as it is better written simply as unlink(). - Removed the killpwr variable from several subroutines, and created a new subroutine to actually do the work, called kill_power(). - Renamed procfs to be status - Cleaned up the text in apccontrol to be a bit easier to understand, and slightly more explicit (at least for me). Changes submitted this submission: - added code for LOGSTATS in apcconfig.c - removed all logprintf() from apcnet.c replacing them with log_event(LOG_DEBUG, ...). - removed logprintf() subroutine. - Completed STATUS logging code. - Added a first step at documenting the program flow to the end of apcupsd.c as comments. - put an updated version of apcupsd.conf into the /etc directory. - put a dumb readfifo.c test program into the examples directory. If you point this program to a named pipe that writes the STATUS data, it will print it out. - The Makefiles in the cgi and cgi/gd1.2 directories were missing in the snapshot. I suspect that they were deleted by the make distclean command. To prevent their loss in the future, I also created a Makefile.in in each of these directories. Work to complete: - Automatically call cgi make from our make. - Documentation. - Automatic conversion of old apcupsd.config files to the new format? - Eliminate the rest of the printfs(). - Examine all configuration messages, and eliminate all "Someone will have to explain this to me" messages. - Check and double check killpwr changes. - Correct problems pointed out by Riccardo in integrating my submission. - Complete writing of status logging. - Rework the cgi program to correct errors and add other display modes (e.g. remaining run time). - Add the full status display to the cgi program (same as currently printed by "apcaccess status" - Remove remaining traces of old log file. Suggestion: - I suggest we begin changing names of our program from apc... to ups... to be more generic, especially if we are intending to support UPSes other than APC UPSes. New syslog() code: Our basic philosophy is that all logging should be done through the syslog() facility. This is now implemented with one exception that I will explain below concerning the status file logging. All logging functions and all error reporting are now done through the log_event() subroutine call. Exceptions to this are: initialization code where printf's are done, and writing to the status file. Once the initialization code has completed and the fork() to become a daemon is done, no printf's are used. log_event() has exactly the same format as syslog(). In fact, the subroutine consists of only a syslog() call. If anyone really wishes to log to a file, the code to do so can easily be done by adding code to log_event() in apclog.c. I have broken logging into four separate types that I call: 1. DEBUG 2. DATA 3. STATUS 4. EVENTS DEBUG logging: Debug logging consists of debug messages. Normally these are turned on only by developers, and currently there exist very few of these debug messages. DATA logging: Data logging consists of periodically logging important data concerning the operation of the UPS. For the definitive definition of the format, see log_data() in apcreports.c. The format varies according to the UPS model and hence the information available. However, for UPS models, configured with the UPSTYPE statement as newbackupspro, backupspropnp, smartups, matrixups, and sharesmart will be written in a format very similar to what PowerChute writes. logging output will be the same for all the following models: Configured UPSTYPE Long name =========== ================= newbackupspro Smarter BackUPS Pro backupspropnp Smarter BackUPS Pro smartups SmartUPS matrixups MatrixUPS sharesmart ShareUPS Advanced Port That is: MinLineVoltage, MaxLineVoltage, OutputVoltage, BatteryVoltage, LineFrequency, UPSTemperature,AmbientTemperature,Humidity,LineVoltage where AmbientTemperature and Humity are always blank in the current implementation. An actual example from the log file is: Nov 2 12:43:05 matou apcupsd[23439]: 224.9,227.5,226.2,27.74,50.00,100.0,30.6,,,226.2 STATUS logging: Status logging consists of periodically logging ALL available information concerning the UPS. In this case, the volume of data is rather large, consequently, this information is not automatically sent to the system log file, but rather written as a series of data records to a specific file. After each write, the file is rewound so that the size of the file remains constant. At the current time, this file is 763 bytes. The format of this file is very similar to the old apcupsd procfs file. Once networking is implemented, we can consider eliminating this file. However, in the mean time. It is essential so that users can obtain all desired information. In fact, the current CGI brower user interface uses this file to graphically display information. If specified in the configuration file, this data will also be written to the system log file. Please note, that it would not normally be wise to write this data to a normal system log file as there is no mechanism in syslog() to rewind the file and hence the log file would quickly become enormous. However, in two cases, it can be very useful to use syslog() to write this information. The first case is to setup your syslog.conf file so that the data is written to a named pipe. In this case, normally not more than about 8192 bytes of data will be kept before it is discarded by the system. The second case is to setup your syslog.conf file so that the status data is sent to another machine, which presumably then writes it to a named pipe. Consequently, with this mechanism, we have a very simple means of networking apcupsd data. To make reading the status data reliable via a named pipe, the first record written contains a version number, the number of records that follow the first record, and the total number of bytes in those subsequent records. An actual example of such a status file (/etc/apcupsd/apcupsd.status) is: APC : 001,028,0675 DATE : Nov 03 11:56:32 RELEASE : 3.6.3 CABLE : Custom Cable Smart UPSMODEL : SMART-UPS 1000 UPSMODE : Stand Alone UPSNAME : UPS_IDEN ULINE : 228.8 Volts MLINE : 230.1 Volts NLINE : 227.5 Volts FLINE : 50.0 Hz VOUTP : 228.8 Volts LOUTP : 011.4 Percent Load Capacity BOUTP : 27.7 Volts BCHAR : 100.0 Batt. Charge TIME : 112.0 Minutes SENSE : LOW WAKEUP : 060 Cycles SLEEP : 180 Cycles LOTRANS : 204.0 Volts HITRANS : 253.0 Volts CHARGE : 050.0 Percent BFAIL : 0x08 Status Flag UTEMP : 30.1 C Internal ALARM : Low Batt LASTEVNT : LINE VOLTAGE DECREASE LOWBATT : 02 Minutes DIPSW : 0x0000 END APC : Nov 03 11:56:32 Consequently, the first record always consists of 24 bytes (23 characters followed by a newline). This record starts with APC and as indicated in the example above is followed by 28 records consisting of 675 bytes. The last record begins with END APC and contains the date and time matching the DATE record. Documentation of each record needs to be written. In the coming weeks, I plan to add additional records and possibly change the names of some of the fields. When this data is written to a file, it is written as two records, the first record, and all the other records together. In reading the file, it can be either be read a record at a time, or in one big read. When this data is written to syslog(), it is written a record at a time. The first record is the first 24 bytes. By having the number of records and the size in the first record, the complete status can be reliably reassembled. EVENTS logging: Events logging consists of logging events as they happen. For example, successful startup, power fail, battery failure, system shutdown, Implementation details: In order to ensure that the data logged to syslog() can be directed to different files, I have assigned syslog() levels to each of our four types of data as follows: 1. DEBUG logging has level LOG_DEBUG 2. DATA logging has level LOG_INFO 3. STATUS logging has level LOG_NOTICE 4. EVENTS logging has levels LOG_WARNING, LOG_ERR, LOG_CRIT, and LOG_ALERT It should be noted that more work needs to be done on the precise definitions of each of the levels for EVENTS logging. Currently, it is roughly broken down as follows: LOG_WARNING general information such as startup, etc. LOG_ERR an error condition detected, e.g. communications problem with the UPS. LOG_CRIT a serious problem has occurred such as power failure, running on UPS batteries, LOG_ALERT a condition that needs immediate attention such as pending system shutdown, More work needs to be done to the code to ensure that it corresponds to the above levels. As a practical example of how to setup your syslog() to use the new logging feature, suppose you wish to direct all DATA logging to a file named /var/log/apcupsd.data, all EVENTS to the standard /var/log/messages file (to be mixed with other system messages), and at the same time send all EVENTS to /var/log/apcupsd.events, and finally, you want to send all STATUS logging to the named pipe /var/log/apcupsd.status First as root, you create the named pipe: mkfifo /var/log/apcupsd.status change its permissions as necessary or use the -m option to set them when creating the pipe. Then you modify your /etc/syslog.conf file to direct the appropriate levels of messages where you want them. To accomplish the above, my syslog.conf file looks like: # exclude all apcupsd info by default *.info;local0.none /var/log/messages # Everything for apcupsd goes here local0.info;local0.!notice /var/log/apcupsd.data local0.notice;local0.!warn |/var/log/apcupsd.status local0.warn /var/log/apcupsd.events local0.warn /var/log/messages apcupsd-3.14.10/doc/techlogs/1999/kes08Dec990000664000076400007640000002317407474702772016715 0ustar adk0212adk0212 Technical notes on my code submission of 8 Dec 99 Kern Sibbald General: - Please delete apccontrol.sh and apccontrol.sh.in from the scripts directory. - Please delete apcnetlib.c from the cgi directory. - With Carl Erhorn's help, we got apcupsd running on Solaris, and we believe that we have resolved the problems for the HP-UX as well. - New html manual in doc/manual. It still needs more work, but a lot of the sections are pretty well documented. - I added new directories for the Sun and HP-UX named distributions/sun and distributions/hpux. They contain skeletions of the necessary files. - I added automatic detection of the Sun and HP systems to the configure script. - Due to the differences in the shutdown procedures (calls to shutdown) between the Solaris operating system and Linux, I had to move apccontrol.sh.in from the scripts directory to each of the machine dependent files (distributions/redhat, ...). - Because of the problems with Solaris, I eliminated the action process by combining it with the serial port process. - I corrected the CGI programs to properly recognize different battery voltages (12, 24, and 48). I did the same for the line voltages (100, 120, 220). Changes submitted this submission: - I corrected the compile and link flags in Makefile.in for the Sun as suggested by Carl. - I modified the installation part of Makefile.in to pull apccontrol.sh from the appropriate distributions subdirectory. This way, apccontrol.sh can be adapted for the different operating systems. - Removed an old le[] from apcaccess and aligned some code. - Modified apcupsd.c apcserial.c and apcaction.c so that the previous action process is eliminated and instead the action code is called immediately after the wait on the serial port. This eliminates a system incompatibility that arose because of the handling of alarm(), and it ensures that any actions are attended to immediately when they occur. In addition, in future releases, this will permit sending of commands to the UPS as there is now only a single process reading the serial port and taking action. - In writing the documentation, I realized that some of the names of the new configuration directives that I created are misleading. Consequently, I changed NETSTATUS -> NETSERVER STATUSPORT -> SERVERPORT EVENTFILE -> EVENTSFILE For this update, I left the old names in, but in a few weeks, I will remove them. - In order to make the STATUS code work for older style UPSes, I had to move the "flags" variable into the shared memory buffer. This was cleanup of the STATUS code that I had forgotten to do. - During truncating of the temporary EVENTS file, I forgot to rewind() the file after truncating it. This caused the subsequent write back of the old data to be lost. - I changed the name "sun" to "apcsun" in apcipc.c to avoid problems with the Sun compiler as reported by Carl. - The file locking code that detected stale lock files was not working correctly because it didn't take into account the fact that the lock file was created by the parent of the current process. This was observed by Carl and had previously gone undetected because the details of these failures were never logged until my last submission. - In apclog.c, I was writing all events to the temporary events file, but I should have excluded LOG_INFO, which is the DATA logging. Bug observed by Carl. - Carl noted a problem in apcnet.c pointed out by his compiler, when I looked at the code, I realized that it apparently could never work since it did a read and lock of the shared memory area then entered an infinite loop from which it would never exit. This had the effect of locking out all other processes from reading the shared memory area. I restructure the code. I also eliminate the alarm() and replaced it by a sleep(). - Corrected several casts that caused compiler warnings on Solaris and added INADDR_NONE in apcnetlib.c for Solaris. - Carl reported that apcupsd.log was always created. This was because vestiges of the old data logging remained in the code. I removed them. - In testing the shutdown code again, I found it did not send the correct commands to the UPS for turning off the power. Consequently, I reworked the logic a bit and made it correctly detect all UPS responses as well as send the correct codes. - In my testing, I noticed that if I disconnected the serial port cable, it took more than 2 minutes for apcupsd to complain. The problem turned out to be the smart_poll() was not so smart after all in that it ignored the error return status. I modified the code to immediately call UPSlinkCheck() if it got an error. This means that loss of serial port communications is detected within 6 seconds and reported within 12 seconds. It also means that only one bad data value is returned if the serial port is disconnect. Previously, all data values after that point were incorrectly reported. - I moved the flow documentation from the bottom of apcupsd to the top. - I wrote new code to put apcupsd in daemon mode. This was added to apcupsd.c at the end as subroutine daemon_start(). Although the code is a good deal more complicated than the original code, in principal, it now completely detaches from the control terminal for all operating systems. - I modified the cgi code to use the apcnetlib code in the main source directory. - The search string for the output voltage in upsfetch.c was incorrect causing the output voltage bar graph not to display. - I optimized upsimage.c reducing the volume of code significantly by moving it to subroutines. - I made the changed necessary to configure.in so that it will run correctly on a Solaris system. These changes were provided by Carl. - I added sun and hpux to the system recognized by configure. - The apccontrol script always executed any user script as well as executing the default behavior. I modified the code so that if the user script is executed and it returns a 99 as a return code, the default action will not be executed. - In the RedHat version of the apcupsd, I removed the killpower option as it is not used, and it is rather dangerous. - I noticed that on a full shutdown, the system would sometimes automatically reboot (I'm not sure exactly why). As a consequence, I modified the RedHat halt scripts to wait two days after a power kill and then to exit. - Updated the RedHat and SuSe apccontrol.sh.in script to have many of the changes necessary for running on the Sun. These are minor script changes that will make it easier for other systems to take our scripts and modify them for their use. - Eliminated the /sbin/powersc from the unknown directory and replaced it with a call to apccontrol. - Deleted apcstatus.man from the doc directory. - Added a new doc/manual directory containing the new html documentation. Lots of new files. - Updated apcupsd.conf to have the new configuration directive names and added more documentation for the TIMEOUT directive. - Added example STATUS output files to the examples directory. It would be nice to have a STATUS output example for nearly each UPS type. - Updated examples/apcupsd.master.conf and slave.conf. - Added a safe.apccontrol to the examples directory for testing. See the Testing section of the new manual for details. - Added startapcupsd and stopapcupsd examples to the examples directory. - Added the necessary changed to apc_config.h for the Sun compler -- thanks Carl. Kern's ToDo List To do: - Complete documentation - Add and test a bunch of events that email a message. - Check and double check killpwr changes (one pass made). - Fix the *** fixme ***s in apcupsd.c and apcconfig.c - Expand Last UPS Self Test field in cgi program - Automatic conversion of old apcupsd.config files to the new format? - Produce a RPM for RedHat Wish list: - Add remaining time before TIMEOUT to STATUS output. - Add more commands (individual variables) to apcnetd - Accumulate time on batteries and number of transfers to batteries. Perhaps save history in file so that the info can be recovered if apcupsd restarts. - Fix apcupsd so that it respawns the server if it dies (limit number of times). This will avoid the possibility that someone can bring down our apcupsd by connecting via Internet (denial of service attack, or exploit possible buffer overflow). - Make apcaccess use the network code as an option. - Remember date and time when apcupsd started. - Eliminate rest of character command codes using new capabilities code in apcsetup.c (for setup stuff). - Eliminate the rest of the printfs(). - Eliminate as many error_aborts as possible in making new events. - Possibly retab new cgi/net server code - Apparently during self test, apcupsd thinks that the power was lost. Distinguish this condition! - Check out apmd and see if we should interface to it. Done: - Integrated changes for Solaris provided by Carl. - Add TIMEOUT to STATUS output. - Document TIMEOUT in apcupsd.conf - Inhibit DATA records from being written to the events file. - Fix the battery voltage display in the cgi to handle battery voltages of 12 and 48 volts as well as 24 volts. - Document the new configuration options. - Document installation. - Update apcupsd.man and apcnetd.man, and create new sgml documentation for EVENTS, DATA, LOGGING, and STATUS output as well as documenting the network "programming" interface. - Document the CGI programs (partially). - Document log_event for developers -- especially the LOG_ values. See info in developers/apcupsd.logging apcupsd-3.14.10/doc/techlogs/1999/kes09Dec990000664000076400007640000000176707474702772016722 0ustar adk0212adk0212 Technical notes on my code submission of 9 Dec 99 Kern Sibbald General: - I added some more documentation and corrrected some of the previous stuff. - Bug fix in upsimage.c, see below. Changes submitted this submission: - Kaspar Klingholz is having similar problems to those experienced on the Sun and HP. When he applied some of the partial fixes I sent to Carl, the program ran but did not register EVENTS. Since Riccardo still was on vacation, I requested him to take the latest source from my Web site and report the results. He also reported a divide by zero problem in upsimage.c when the runtime goes to zero (you exhaust your batteries). I corrected it here. - Added some new documentation and corrected some previous stuff. - I've succeeded in building RPMs (source and binary), but will wait for awhile before making them available. - I deleted apcnetd.man from the doc directory. It is out of date and not really needed given the new manual. apcupsd-3.14.10/doc/techlogs/1999/kes13Nov990000664000076400007640000001045007474702772016751 0ustar adk0212adk0212 Technical notes on my code submission of 11 Nov 99 Kern Sibbald General: - I worked mainly on the cgi programs. - For all the files that I changed, you will see that they are fully tabbed now (i.e. where ever a tab could be inserted, it is). This generated a bit more changes than might otherwise be the case since many spaces were replaced by tabs. This is in keeping with the new coding standards. - For the new files that I created, I created them in my own indenting style. This needs to be reviewed and possibly I will need to reindent them. Changes submitted this submission: - Added the cgi directory to the Makefile.in. To build the cgi programs, you must explictly type "make cgi" To install them, you must "make install-cgi". - Temporary kludge to the ./configure script to configure the cgi-bin directory, use: ./configure -datadir=/home/httpd/cgi-bin - Updated apcaccess to print all the new information. - apcaccess attaches to the shared memory with read-only access. Consequently, you no longer need to be root to run apcaccess. - apcaction.c, updated a couple of messages to be more explicit, and only log "Allowing logins" if logins were actually stopped. - I added permissions to the creation of the shared memory area to the create_shmarea() call. The current value is 0644 (as before), but this probably should be put in a header file or as a configuration parameter. - I added permissions to the attach_semaphore() call. This allows the user to call it in read_only mode. How to get the new cgi code running: 1. Add the datadir option to your ./configure as described above to configure your installation path. If you want to do this manually, cd to the cgi directory, insure that the three .cgi programs are built, then copy these three programs to your cgi bin. 2. Do the following: ./configure -datadir=... make make install make cgi make install-cgi 3. Restart your apcupsd daemon 4. Start the apcnetd daemon (not done automatically so for the moment you will have to do it after every reboot). ./apcnetd 5. Edit /etc/apcupsd/hosts.conf to add your hosts to be monitored. You must do this. 6. Optionally edit /etc/apcupsd/multimon.conf to change the default multimon display. The list of available keywords can be found in cgi/upsfetch.c and multimon.h. 7. Execute the multimon program from your browser with something like: http://127.0.0.1/cgi-bin/multimon.cgi 8. Good luck Work to complete (this seems to get longer each submission!): - Documentation. - Automatic conversion of old apcupsd.config files to the new format? - Eliminate the rest of the printfs(). - Examine all configuration messages, and eliminate all "Someone will have to explain this to me" messages. - Check and double check killpwr changes. - Correct problems pointed out by Riccardo in integrating my submission. - Complete writing of status logging. - Add the full status display to the cgi program (same as currently printed by "apcaccess status" - Remove remaining traces of old log file. - Cleanup error_abort/printf inconsistencies in cgi code. - Possibly retab new cgi/net server code - Make apcnetd capable of being called from inetd - Add more commands (individual variables) to apcnetd - Make fetch_data() be called automatically from getvardata(). - Put in new capabilities code. - Start capabilities codes from 0 instead of 1. - Add additional STATUS output. - Create new line for status bits but in English - Fix name of unknown() and change comments in subroutine save_dumb_status() ... - Make non-available STATUS information print N/A - Update CGI programs to understand N/A - Expand Last UPS Self Test field in cgi program - Produce a RPM for RedHat - The TCP port for apcnetd should be configurable. - Probably apcnetd should be started at the same time as apcupsd. Or perhaps a configuration parameter should be added to have apcupsd start it. - Change translo and transhi to be use new mnemonics lowxfer and highxfer. - Remember date and time when apcupsd started. - Accumlate time on batteries and number of transfers to batteries. Perhaps save history in file so that the info can be recovered if apcupsd restarts. - Save last 5 major events and pass them in STATUS file. apcupsd-3.14.10/doc/techlogs/1999/kes13Nov99-20000664000076400007640000000122407474702773017110 0ustar adk0212adk0212 Technical notes on my second code submission of 13 Nov 99 Kern Sibbald General: - Fixes to make install work on RedHat 5.2 Changes submitted this submission: - Fixed the cgi/Makefile.in to include the -lm option so that floor() is included on RH5.2 Also the tabs were missing (my fault). - Modified the apcupsd.in file in the RedHat distributions directory to detect whether or not it is running on RedHat 5.2. If so, it does not call the success or fail routines that were added in RedHat 6.0 - Use the correct directory for apccontrol - Modified all the halt files to call apccontrol instead of /sbin/powersc apcupsd-3.14.10/doc/techlogs/1999/kes15Nov990000664000076400007640000001542607474702773016764 0ustar adk0212adk0212 Technical notes on my code submission of 15 Nov 99 Kern Sibbald General: - Riccardo, again, you will notice some differences due solely to the addition of a tab that replaces spaces. - I've completed my first pass at making the cgi programs robust. In most error conditions they now behave reasonably. More testing needed by other developers. - I put the cgi build in the configuration on --enable-cgi as suggested by Riccardo. - There were previously four copies of the STATUS output command code, and with my new code, it increased to six copies. I have reduced it to one by creating a new file -- apcstatus.c - I've integrated the apcnetd code into apcupsd. The new code resides in apcserver.c - I've modified the apcnetd to be capable of being started either on a command line or directly from inetd. - I added more documentation to the internal variable names, and changed LinUp to be OnBatt to be more readable. - I still seem to be getting a number of "Cannot increment read count" errors that are being logged, but I cannot figure out what is doing it. Help. Changes submitted this submission: - Completed the integration of the cgi program with configure.in and Makefile.in - To get the cgi directory to build, you add the new configure option --enable-cgi as in: ./configure --enable-cgi You will probably also want to specify an installation directory as in: ./configure --enable-cgi -datadir= So to do a cgi build: ./configure --enable-cgi -datadir=... make make install Restart your apcupsd daemon by default with the new apcupsd.config file, the networking will be turned on. There is no extra daemon to start. Edit /etc/apcupsd/hosts.conf to add your hosts to be monitored. You must do this. Optionally edit /etc/apcupsd/multimon.conf to change the default multimon display. The list of available keywords can be found in cgi/upsfetch.c and multimon.h. Execute the multimon program from your browser with something like: http://127.0.0.1/cgi-bin/multimon.cgi - There were 6 copies of the STATUS output code, so I reduced it to one copy. In order to give the flexibility that we need, the new output_status() routine is called with function pointers to its open, write, and close routines. This permits processing the data differently, and either writing it to a file, logging it, printing it, printing it to stderr, or sending it over the network. I'll document the code more later. - I removed the check for superuser from apcaccess. If the user attempts to do something that requires root, the program will tell him (i.e. error). If you don't want the average Joe Blow to execute it, I recommend using file permissions. - I changed the name LineUp to OnBatt because to me LineUp implies that the Line Voltage is up, when in fact, it means the opposite. The name came from the old UPSes where serial port lines were either up or down to indicate the state of the UPS. - I deleted the logging of the change of facility because it was more annoying than useful. - I deleted the httpport variable as it is no longer used. - I moved a number of variables around in the shared memory area in an attempt to bring a bit of order. More work needed here. - I moved the test for sanity in the shared memory area versions to the attach routine, so it is only done once rather than on every read. - Cleaned up apcnetlib.c so that it never error_aborts() but always returns a status and leaves a pointer to an error message. Added more documentation to the subroutines. - I modified how the apcupsd.conf file is installed. Instead of going in apcupsd.conf.new if the file already exists, I rename the old file to apcupsd.conf.old and then install the new one. The reason is that I believe that most times, the user will have an old config file that MUST be replaced. For us developers, it is a bit of an annoyance to have our config file replaced by the default one -- tant pis. - I did a lot of cleanup of the cgi directory to ensure that it is robust and can handle the fact that machines are down or that certain data may not be available. In general all of the lower level routines now return a status rather than calling error_abort(). They also leave a pointer to an error message, permitting the higher level routines to print a reasonable error message. To do this right, we should add our own errno codes. - I changed the location of where the apccontrol script goes. It now goes in the @sysconfdir@/apcupsd. I've also modified apccontrol so that the script files that it calls are expected to be in the same directory (normally /etc/apcupsd). To do: - Fix error_aborts in apcnetd - Documentation. - Automatic conversion of old apcupsd.config files to the new format? - Eliminate the rest of the printfs(). - Examine all configuration messages, and eliminate all "Someone will have to explain this to me" messages. - Check and double check killpwr changes. - Correct problems pointed out by Riccardo in integrating my submission. - Complete writing of status logging. - Add the full status display to the cgi program (same as currently printed by "apcaccess status" - Possibly retab new cgi/net server code - Put in new capabilities code. - Start capabilities codes from 0 instead of 1. - Add additional STATUS output. - Create new line for status bits but in English - Fix name of unknown() and change comments in subroutine save_dumb_status() ... - Make non-available STATUS information print N/A - Expand Last UPS Self Test field in cgi program - Produce a RPM for RedHat - Remember date and time when apcupsd started. - Accumlate time on batteries and number of transfers to batteries. Perhaps save history in file so that the info can be recovered if apcupsd restarts. - Save last 5 major events and pass them in STATUS file. - Eliminate duplicate copies of apcnetlib.c and apcnetlib.h - Fix "celsius" flag in cgi routines. To do MUCH later: - Add more commands (individual variables) to apcnetd Done: - Change translo and transhi to be use new mnemonics lowxfer and highxfer. - Make fetch_data() be called automatically from getvardata(). - Cleanup error_abort/printf inconsistencies in cgi code. - Put date/time in shared memory buffer in UPSfill() - Probably apcnetd should be started at the same time as apcupsd. Or perhaps a configuration parameter should be added to have apcupsd start it. - The TCP port for apcnetd should be configurable. - Update CGI programs to understand N/A - Remove remaining traces of old log file. - Delete apcnetd on make clean - Make apcnetd capable of being called from inetd - Fix STATUS code so that there is only ONE copy. - Fix configure.in to add AC_ARG_ENABLE() for cgi directory. apcupsd-3.14.10/doc/techlogs/1999/kes18Dec990000664000076400007640000001044007474702773016707 0ustar adk0212adk0212 Technical notes on my code submission of 18 Dec 99 Kern Sibbald General: - I added pretty strict checking for strings to prevent buffer overflows. For everything read in from the config file, I ensure that the string is properly terminated. For things read from the UPS, I use a strncpy(). Consequently, under the worst conditions, the string may not be properly terminated. However, this is preferable to overwriting memory. - I corrected some problems with the EPROM configuration code. Please note, this is still likely to be a problem area. I will document this more in the manual. - Made exec()s non-blocking. - Continue running if a network process dies. Changes submitted this submission: - Added a new SIZE field for the match_str routine in apcconfig.c to prevent the user from putting a long string in his configuration file and overwritting memory. - Added a OUTPUTVOLTS configuration directive so that the user may configure the output voltage (when on batteries). - Added a BATTDATE configuration directive to allow the user to be able to set the EPROM battery date. - Corrected the overflows detected by the Solaris compiler and reported by Carl (changed -1 to 0) in the configuration in two places. - Added a new capabilities code CI_CYCLE_EPROM. - Added code to allow non-blocking exec()s. - Added code to keep apcupsd from dying if the network process dies. - Corrected the typo in apcoptd that prevented the -n option from working. - Corrected a bug reported by Kasper (I think) where on a reboot, your machine would hang if apcupsd could not establish serial port communications. This could be rather nasty in some cases. - Reworked the killpower code to eliminate unnecessary sleep()s and to eliminate the error messages unless they are absolutely necessary. I also added the time before the power off to the messages if it is available (UPS shut off grace delay). - Totally rewrote from scratch the EPROM configuration code in apcsetup.c. With a bit of testing, it should be significantly more robust than the old code, and it is also a lot less code. - Renamed UPS_GARBAGE to UPS_EPROM_CHANGE, which more accurately describes what the character represents. - Added better print output in apcupsd.c for the configuration options and removed some unneeded code. - Cleaned up the ***FIXME*** error messages. - Removed some code that can never be executed at the end of apcupsd main. - Additional testing documentation. - More cleanup and documentation of apcupsd.conf - Added a few new STATUS files send to me to the examples directory. - Added an onbattery shell script that emails root on each power failure detected (if placed in the /etc/apcupsd directory). - Changed NomOutputVoltage from double to int. Because of limitations of the configuration code, it MUST be int. - I made the modifications suggested by Carl to my makediff script and added it to the doc/developers directory. Kern's ToDo List To do: - Complete documentation - Expand Last UPS Self Test field in cgi program - Automatic conversion of old apcupsd.config files to the new format? - Move more control files to /etc/apcupsd - Move EVENTS file truncation code to main process. - Setuid of network processes to "nobody". Wish list: - Add remaining time before TIMEOUT to STATUS output. - Add more commands (individual variables) to apcnetd - Accumulate time on batteries and number of transfers to batteries. Perhaps save history in file so that the info can be recovered if apcupsd restarts. - Fix apcupsd so that it respawns the server if it dies (limit number of times). This will avoid the possibility that someone can bring down our apcupsd by connecting via Internet (denial of service attack, or exploit possible buffer overflow). - Make apcaccess use the network code as an option. - Remember date and time when apcupsd started. - Eliminate rest of character command codes using new capabilities code in apcsetup.c (for setup stuff). - Eliminate the rest of the printfs(). - Eliminate as many error_aborts as possible in making new events. - Possibly retab new cgi/net server code - Apparently during self test, apcupsd thinks that the power was lost. Distinguish this condition! - Check out apmd and see if we should interface to it. Done: apcupsd-3.14.10/doc/techlogs/1999/kes18Nov990000664000076400007640000001446107474702773016765 0ustar adk0212adk0212 Technical notes on my code submission of 18 Nov 99 Kern Sibbald General: - This patch submission consists of cgi changes, the addition of new capabilities code, and some variable name changes to make the code more readable and consistent. - Again, some differences that are due only to tabbing. Changes submitted this submission: - Reworked the integration of the cgi program with configure.in and Makefile.in - To get the cgi directory to build, you add the new configure option --enable-cgi as in: ./configure --enable-cgi You will probably also want to specify an installation directory as in: ./configure --enable-cgi --with-cgi-bin= So to do a cgi build: ./configure --enable-cgi --with-cgi-bin=... make make install Restart your apcupsd daemon by default with the new apcupsd.config file, the networking will be turned on. There is no extra daemon to start. Edit /etc/apcupsd/hosts.conf to add your hosts to be monitored. You must do this. Optionally edit /etc/apcupsd/multimon.conf to change the default multimon display. The list of available keywords can be found in cgi/upsfetch.c and multimon.h. Execute the multimon program from your browser with something like: http://127.0.0.1/cgi-bin/multimon.cgi - For developers, the cgi-bin directory can be obtained in your Makefile.in with @CGIBIN@. - I began adding code to save the last 5 events. Most of this code will be removed in the next patch as I have now figured out "the right way" to do it. - Changed BattUp to BattLow; changed BatLoad to BattChg (for battery charge), changed lowbatt to dlowbatt, changed minon to rtnpct, changed sleep to dshutd, changed wakeup to dwake, change replace to battdat. - Fixed all the "Someone will have to explain this to me" in apcconfig.c. I need to make an audit of this file. - Reworked all the capabilities code and implemented it almost everywhere (there are a few stray smart_poll() calls that should be convered). - To avoid accidently mixing up capibilities indicies (CI_ ...) and capabilities commands (codes sent to UPS), I renamed the commands to be XXX_CMD_... These are used only in one place in apcconfig.c and should never be used elsewhere in the code. - Consolidated a lot of the old capabilities code into two new subroutines read_static_ups_data() and read_volatile_ups_data(). See comments in the code. - Added a number of new capabilities and made apcupsd poll for them (register 1, 2, 3, nominal output voltage, nominal battery voltage, number of external batteries, firmware revision, and model). See STATUS output. - Changed thread SIGCHLD from SIG_DFL to SIG_IGN, which explicitly sets it to what we want rather than relying on the default action of the system. - The time and date on the DATE record is now the time and date that the UPS was last polled rather than the current time and date. - added a new upsfstats.cgi program to the cgi directory. It is not yet complete, but if you call it with a proper host, it will dump the full status. Next patch, it will be integrated into the multimon.cgi program. No bug reports yet, please. The Makefile.in does not yet build it. - Updated acpupsd.conf with more documentation and to as a default turn off NETSTATUS, STATTIME, DATATIME, and the FACILITY command. - Reduced the BATTERYLEVEL in apcupsd.conf to 5% and the MINUTES to 3. - Reorganized the shared memory buffer again and added some more documentation. In general, I tried to group the static items reported by the UPS and the changable items. See the code in include/apc_struct.h for more details. Kern's ToDo List To do: - Add "events" command to the network interface to retrieve the last five events. - Make the END record of the STATUS command have the current time/date rather than the poll time/date. - Remember date and time when apcupsd started. - Save last 5 major events and pass them in STATUS file. - Check error_aborts in apcnetd (especially apcserver.c) - Documentation. - Automatic conversion of old apcupsd.config files to the new format? - Eliminate the rest of the printfs(). - Check and double check killpwr changes. - Add the full status display to the cgi program (same as currently printed by "apcaccess status" - Possibly retab new cgi/net server code - Create new line for status bits but in English - Fix name of unknown() and change comments in subroutine save_dumb_status() ... - Expand Last UPS Self Test field in cgi program - Produce a RPM for RedHat - Audit apcconfig.c - Enhance documentation of apcupsd.conf - Fix apcupsd so that it respawns the server if it dies (limit number of times). This will avoid the possibility that someone can bring down our apcupsd by connecting via Internet (denial of service attack, or exploit possible buffer overflow). - Eliminate rest of character command codes using new capabilities code in apcsetup.c (for setup stuff). Wish list: - Add more commands (individual variables) to apcnetd - Accumlate time on batteries and number of transfers to batteries. Perhaps save history in file so that the info can be recovered if apcupsd restarts. Done: - Change translo and transhi to be use new mnemonics lowxfer and highxfer. - Make fetch_data() be called automatically from getvardata(). - Cleanup error_abort/printf inconsistencies in cgi code. - Put date/time in shared memory buffer in UPSfill() - Probably apcnetd should be started at the same time as apcupsd. Or perhaps a configuration parameter should be added to have apcupsd start it. - The TCP port for apcnetd should be configurable. - Update CGI programs to understand N/A - Remove remaining traces of old log file. - Delete apcnetd on make clean - Make apcnetd capable of being called from inetd - Fix STATUS code so that there is only ONE copy. - Fix configure.in to add AC_ARG_ENABLE() for cgi directory. - Complete writing of status logging. - Put in new capabilities code. - Start capabilities codes from 0 instead of 1. - Add additional STATUS output. - Make non-available STATUS information print N/A - Add capabilities to codes sent to UPS. - Examine all configuration messages, and eliminate all "Someone will have to explain this to me" messages. - Added all known (to me) status codes apcupsd-3.14.10/doc/techlogs/1999/kes19Dec990000664000076400007640000001113607474702773016713 0ustar adk0212adk0212 Technical notes on my code submission of 19 Dec 99 Kern Sibbald General: - Moved the EVENTS file truncation code to the main process. - Enhanced apcaccess to print the EPROM values. Changes submitted this submission: - In order to know the current EPROM values and the permitted values, I added a new command line option for apcaccess "eprom" that produces a print out of your EPROM. A sample output is: >apcaccess eprom Valid EPROM values for the SMART-UPS 1000 Config Current Permitted Description Directive Value Values =================================================================== Upper transfer voltage HITRANSFER 253 253 264 271 280 Lower transfer voltage LOTRANSFER 204 196 188 208 204 Return threshold RETURNCHARGE 15 00 15 50 90 Output voltage on batts OUTPUTVOLTS 230 230 240 220 225 Sensitivity SENSITIVITY H H M L L Low battery warning LOWBATT 2 02 05 07 10 Shutdown grace delay SLEEP 180 020 180 300 600 Alarm delay BEEPSTATE T 0 T L N Wakeup delay WAKEUP 60 000 060 180 300 Self test interval SELFTEST 336 336 168 ON OFF - I modified the configuration option of apcupsd so that if no configuration directive is present, that value will not be set. This permits the user to choose which values he wants to change in his EPROM. Previously, the code attempted to change ALL EPROM values. This was accomplished by setting the default values to -1, and testing for this value in apcsetup.c before attempting the change. - I moved the code that truncates the EVENTS file out of the server code into its own subroutine. This new subroutine (truncated_events_file) is called from the reports main loop in apcreports.c at the same way that the other reports are called. This subroutine is called once every 5 hours. I am much happier with this solution because it permits me to completely close the old file description for writing to the file and reopen it. In addition, the server code now has the file open as read-only. - I merged the write_reports() code into do_reports() and merged several of the if statments into a single if. - By the way, the file doc/manual/apcupsd.apf is a control file for the manual project used by my HTML tool. - I updated the default etc/apcupsd.conf to have all the EPROM configuration directives turned off by default. That way, the user can turn them on one by one if he wishes. - A pile of improvements to the manual. Kern's ToDo List To do: - Complete documentation - Expand Last UPS Self Test field in cgi program - Automatic conversion of old apcupsd.config files to the new format? - Move more control files to /etc/apcupsd - Setuid of network processes to "nobody". - Add credits to manual. Update testers names, ... - Check time delays in shutdown especially for master/slaves. - Look at Vladimir's code. - Update make clean to remove distributions/*/apccontrol.sh ????? - Set appropriate permissions on files in /etc/apcupsd during make install. Wish list: - Add remaining time before TIMEOUT to STATUS output. - Add more commands (individual variables) to apcnetd - Accumulate time on batteries and number of transfers to batteries. Perhaps save history in file so that the info can be recovered if apcupsd restarts. - Fix apcupsd so that it respawns the server if it dies (limit number of times). This will avoid the possibility that someone can bring down our apcupsd by connecting via Internet (denial of service attack, or exploit possible buffer overflow). - Make apcaccess use the network code as an option. - Remember date and time when apcupsd started. - Eliminate rest of character command codes using new capabilities code in apcsetup.c (for setup stuff). - Eliminate the rest of the printfs(). - Eliminate as many error_aborts as possible in making new events. - Possibly retab new cgi/net server code - Apparently during self test, apcupsd thinks that the power was lost. Distinguish this condition! - Check out apmd and see if we should interface to it. - Pass second argument to apccontrol indicating if we are master/slave and other info. - STATUS file should be opened with open() rather than fopen(). Some small changes required. Done: - Move EVENTS file truncation code to main process. - Ask Riccardo to change the name of distributions to packages or opsys apcupsd-3.14.10/doc/techlogs/1999/kes20Nov990000664000076400007640000001004307474702773016746 0ustar adk0212adk0212 Technical notes on my code submission of 20 Nov 99 Kern Sibbald General: - Again, a bunch of tabbing problems. Sorry Riccardo. I will fix my editor ... - This submission mainly contains the code necessary to add the last 5 events to the cgi programs. I am planning to change the code a bit in the near future to possibly pass the last 10 events. Changes submitted this submission: - I created a new file apcevents.c to send the last 5 events over the network. As currently configured, it truncates the events file when it reaches 50 events rewriting only the last 5 events. This prevents it from growing indefinitely. - The events are written to a temporary file when they are generated. This resolves the problem of multiple processes generating events as well as preserving events across a system crash or restarting of apcupsd. - I added a new configuration statement EVENTFILE That tells apcupsd where to create the events file. If this name is not specified, no events will be available over the network. - I removed the old le structures that I had created in the shared memory area to hold the last events. They are now written to a file. - I added code to log_event() to write the event to a file if the file is opened. - I reworked the code in the server to ensure that if it error_aborts, it informs the other end to prevent the client from hanging for a long time. More work is needed for the integrated server to ensure that apcupsd does not die when the server dies. - Changed the STATUS output to have the current time and date on the END APC record. The DATE record contains the time and date that the UPS was last polled. - Fixed the name of unknown() to be save_dumb_status() and added a bit of documentation to the subroutine. - Created a new cgi program called upsfstats.c (I think this was in the last submission). This program produces an apcaccess like status giving all information available from the UPS. - I updated the cgi multimon.c to output the last 5 events and to have a link to produce the full status by calling upsfstats.cgi. - I cleaned up some of the html that was written. It still is not really up to standards, but it is better. And it displays correctly on 3 browsers. - I set the default NETSTATUS off in the configuration file. - Updated the client test program to use the apcnetlib. Kern's ToDo List To do: - Fix my editor to have a mode to leave tabs alone. - Check error_aborts in apcnetd (especially apcserver.c) - Documentation. - Automatic conversion of old apcupsd.config files to the new format? - Eliminate the rest of the printfs(). - Check and double check killpwr changes. - Possibly retab new cgi/net server code - Create new line for status bits but in English - Expand Last UPS Self Test field in cgi program - Produce a RPM for RedHat - Audit apcconfig.c - Enhance documentation of apcupsd.conf - Fix apcupsd so that it respawns the server if it dies (limit number of times). This will avoid the possibility that someone can bring down our apcupsd by connecting via Internet (denial of service attack, or exploit possible buffer overflow). - Eliminate rest of character command codes using new capabilities code in apcsetup.c (for setup stuff). - Remember date and time when apcupsd started. - Add events display to the full upsfstats.cgi Wish list: - Add more commands (individual variables) to apcnetd - Accumlate time on batteries and number of transfers to batteries. Perhaps save history in file so that the info can be recovered if apcupsd restarts. Done: - Add "events" command to the network interface to retrieve the last five events. - Save last 5 major events and pass them in STATUS file. - Fix name of unknown() and change comments in subroutine save_dumb_status() ... - Make the END record of the STATUS command have the current time/date rather than the poll time/date. - Add the full status display to the cgi program (same as currently printed by "apcaccess status" apcupsd-3.14.10/doc/techlogs/1999/kes26Sep990000664000076400007640000001650507474702773016752 0ustar adk0212adk0212 Technical notes on my code submission of 26 Sep 99 Kern Sibbald General: - I've tried to follow the indenting standards existing for apcupsd, but in reviewing my changes, I've noted several places where I have followed the standards that I have used for many years, being a bit lazy to correct them, I submit them as is, but if someone objects, I'll be glad to fix them. - I recommend that we discuss indenting standards. I find the current standard of something like 6 of 7 spaces for each level of indentation difficult to enter (it slows me down), difficult to read, and it allows a lot less code per line. I propose a standard that indents three spaces for each new indention level. This yields very readable code and preserves space. Comments? - I was displeased to discover two things about GNU software in making this submission: 1. diff has no option to ignore tabs on input when making comparisons. 2. make REQUIRES a tab in certain positions -- this "problem" was fixed 10 years ago in all other versions of make with which I have worked. - In order to produce a minimum diff for this submission, I was forced to remove all tabs from all .c and .h files. Unfortunately, due to the make restrictions, I was not able to remove them from the Makefile.in files. Consequently, for this submission, you will find that all lines in the Makefile.in files that I changed are tabbed. Changes to code: general - This first set of changes attempts to implement two new error termination routines error_abort() and error_exit(). Both are implemented as #defines taking a variable number of arguments. I used defines, because they pass the file and line number of the calling statement. Both ultimately use the subroutine error_out(), which is a new subroutine located in apcupsd.c. Note, for compilers such as the HP which apparently do not permit variable arguments in #defines, I recommend that the HP coder, simply make some HP defines as follows: #define error_abort error_out #define error_exit error_out Then use ifdefs to change the definition of error_out to eliminate the first three arguments keeping only the error varargs message passed to it. - I then cleaned up a number of files (mostly those called directly from apcupsd.c) to use the new routines. There are still MANY other places where these routines could be used. For example, apcserial.c takes great care to return SUCCESS or FAILURE, but in doing so, the reason for any failure is completely lost. Personally, I would prefer that apcserial.c immediately error if it cannot continue. However, before making any sweeping changes there, I would like to get the reactions of the other developers to this code. The same applies to other files. - Not implemented, but possible is to log the error messages rather than fprintf them depending on whether or not the system log file is open. I'll be glad to implement this idea depending on the reaction of the developers. - I modified all the routines called by terminate() to do nothing if they were not initialized. This means that terminate() or error_abort,... can be called from anywhere either before or after the program becomes a daeon and starts the networking ... Again, some future work needs to be done to use the log file rather than fprintf if apcupsd is running as a daemon, but with my changes, it should be centralized in one or two subroutines for the most part. - I moved the initialization of the myUPS structure to very early in the program. This permits proper checking of the state for early shutdowns. - I added a sentinel to the beginning of the shared memory structure. This permits distinguishing the old version and the new version when the memory structure changes. I also added a version number for ensuring that the programs such as apcaccess (and future .cgi programs) are using the proper structure definition. I also added the size of the structure, and the release number of apcupsd. This allows for full sanity checking. - I updated the .man file. There seems to be a lot more work to do here. Please give me your reactions. - I cleaned up the apcupsd.config file a bit (removed obsolete configuration statements) and added a bit more documentation. - I added code to detect that the installation is being done on a RedHat 5.2 or 6.0 system (all the hooks were already there -- thanks). I also added all the code necessary to do a correct make install on a RedHat system. Please note that this is not tested yet on RedHat 5.2, so I am sure there will need to be additional changes. In doing this, I moved the code (or the logic) of /sbin/powersc into the apcupsd script -- this makes it much more readable and eliminates the need for /sbin/powersc on RedHat systems. I recommend that the same be done in all other platforms and that we eliminate entirely /etc/powersc. In the mean time, I would like to see powersc moved to the distributions directory. That way it will not be installed on RedHat systems. - I like the new /usr/lib/apccontrol file. It is very nice. However, I am a bit surprised that we eliminated the CONTROL configuration statement. On RedHat systems, I would MUCH prefer to put this file in /etc/apcupsd and to be able to configure its location in /etc/apcupsd.conf. Eventhough /etc is getting a bit cluttered, most system administrators would prefer that the really critical system stuff (such as apcupsd) be located in etc. Can we resurrect the CONTROL code? Comments. - Instead of erroring when obsolete configuration statements are found, I made it print and error message and continue. This makes upgradding a bit more pleasant. - I removed the 10 second sleep in terminate() as in my opinion, it is very undesirable. I have not yet had the time to test all the termination cases, so there may be some subtile problems lurking in this change. I'll test all the various shutdown cases in the next few weeks. Final comments: - I would like to get some feedback about what I did. Good/bad/indifferent? - Now that I have a bit of experience in the code, I would like to undertake a more "serious" project while at the same time continuing some of the cleanup efforts that I have started. Some projects that I consider "serious" are: 1. Implement PowerChute event logging. 2. Implement some way through a user program to query and change the state of the UPS (e.g. Initiate UPS self test, Initiate UPS runtime calibration, Simulate power failure, test UPS alarm, ...) 3. Integrate the apcupscgi-1.0 code with apcupsd. 4. Implement .cgi programs that query and change the state of the UPS. 5. Implement a general .cgi interface in place of the old HTTP code. 6. Implement networking with APC PowerChute programs on other machines (probably a .cgi program to keep the footprint of apcupsd small). Other projects already planned that I would like to continue with little by little: - Implementation of error_abort() throughout the code where appropriate. - Implementation of consistent logging as discussed in recent emails. - Adding additional documentation. - Making a source and binary .rpm release for RedHat. I would like to hear your comments on these and particularily what the rest of you consider the priority of items 1 - 6. apcupsd-3.14.10/doc/techlogs/1999/kes28Nov990000664000076400007640000001553107474702774016766 0ustar adk0212adk0212 Technical notes on my code submission of 28 Nov 99 Kern Sibbald General: - Mostly documentation and cleanup of problems found in testing. - Fixed some important bugs in power fail shutdown. - I added two new events "commfailure" and "commok". - Again some tabbing differences. The good news is that I've completed about half of the work to make my editor more compatible. Changes submitted this submission: - I added two new events "commfailure" and "commok". This was done when rewritting the UPSlinkCheck code. The code is now much simpler (at least I think so). It attempts to get a valid response from the UPS by sending a Y command and receiving a SM. If not, it logs the failure once every 10 minutes, waits one second (actually a total of six seconds) and then tries again. This continues until it establishes contact. The old code that restarted apcupsd after 100 tries has been eliminated. - I tested the full shutdown conditions and found a number of minor problems. This prompted me to rewrite the shutdown code in apcaction to put it all in a single subroutine as it was being done slightly differently in different places. Now all shutdowns are done in do_shutdown(). - I fixed logging of the fact that users are requested to logoff to occur only once. - If for some reason, apcupsd continued to run after the requested shutdown, it would send additional shutdown commands. Now, only a single shutdown will be issued. - I moved the code to prohibit user logins to a subroutine. - As a result of the above modifications, you will find the code in apcaction.c much easier to read since many more of the details are done (the same way) in a subroutine. - I restructured the order of the configuration variables in apcconfig.c. This is to help distinguish networking, shutdown parameters, and EPROM parameters. - I ressurrected SELFTEST as I am planning to add it as one of the values that apcupsd can set in the EPROM. - I removed what I think are the last vestiges of the old http code from the configuration and from apc_struct.h - I changed the default of annoy to 5 minutes (previously one minute), and set the annoydelay to one minute. I personally found this much more reasonable during my long mulitude of power failure tests. - I added a new UPS code that returns the number of bad external battery packs. - I increased the number of events from 5 to 10 that are sent as EVENTS information. - I experienced a number of problems acquiring the serial port lock file. Consequently, I added detailed logs to all the error conditions. This should allow us to MUCH more easily diagnose these kinds of problems. In fact, it helped me eliminate a bug with killpower. - I added a new command line option "-t" and long form "--term-on-powerfail", which causes apcupsd to terminate on a powerfail condition rather than hanging around waiting for the SIGTERM signal. I'm a little uncertain whether or not we want to keep this option. If you don't like it, tell me and I will remove it. - I put the options in the usage display in alphabetic order. This made it easier to document them. - Simplified the initial code that establishes contact with the UPS (17 lines reduced to 6 lines). - Added more log messages for display when apcupsd does a killpower. These messages tell the user to power off the UPS. I did this because during my testing, I noticed that the UPS power never shutoff -- possibly a bug. One time, I rebooted my computer and during the reboot, the UPS shutdown -- NOT GOOD for my hard disk. - I fixed the server (apcserver.c) so that it never error_aborts. It simply waits in a loop periodically logging the problem until it goes a way. - Poll the ups for the number of bad batteries. - As mentioned above, simplified the code that does the UPSlinkCheck (21 lines of code => 11 lines of code) at the same time increasing the functionality. NOTE: This is very important code for apcupsd. Please help me check it in reading it. - Added a human readable form of the STATFLAG to the status output. The new variable is named STATUS and gives the status of the UPS. - Corrected the way the last transfer status and selftest status are displayed. - Changed configure.in to display more visibly the machine and version that it found. This is important to verify for proper installation. - Enhanced the instructions for the users after installation of the RedHat version. - I changed the logic of the code placed in the halt file. In my opinion, it was buggy because it would cause apcupsd to be reexecuted after a powerfail if the UPS power did not shut off and subsequently the user pressed ctl-alt-del, which his is very likely to do (at least I did it). Please look at the new code in /distributions/redhat/halt-6.1 - I have started to bring the documentation up to date with the changes made (apcupsd.man). Much more work to be done here. - I've added additional documentation and restructured the order in apcupsd.conf - I made the default configuration file /etc/apcupsd/apcupsd.conf - more documentation in apc_struct.h - Fixed killpower in apccontrol.sh.in, added the new commfailure and commok. I also added a bit of text to the shutdown commands. Finally, instead of attempting to cancel the shutdown by calling init, I call shutdown with the -c option. I'm not 100% sure this is correct. Kern's ToDo List To do: - Apparently during self test, apcupsd thinks that the power was lost. Distinguish this condition! - Add and test a bunch of events that email a message. - Documentation. - Automatic conversion of old apcupsd.config files to the new format? - Check and double check killpwr changes (one pass made). - Expand Last UPS Self Test field in cgi program - Produce a RPM for RedHat - Check out apmd and see if we should interface to it. Wish list: - Add more commands (individual variables) to apcnetd - Accumulate time on batteries and number of transfers to batteries. Perhaps save history in file so that the info can be recovered if apcupsd restarts. - Fix apcupsd so that it respawns the server if it dies (limit number of times). This will avoid the possibility that someone can bring down our apcupsd by connecting via Internet (denial of service attack, or exploit possible buffer overflow). - Make apcaccess use the network code as an option. - Remember date and time when apcupsd started. - Eliminate rest of character command codes using new capabilities code in apcsetup.c (for setup stuff). - Eliminate the rest of the printfs(). - Eliminate as many error_aborts as possible in making new events. - Possibly retab new cgi/net server code Done: - Eliminate all error_aborts in apcnetd (especially apcserver.c) - Create new line for status bits but in English - Enhance documentation of apcupsd.conf - Audit apcconfig.c apcupsd-3.14.10/doc/techlogs/1999/kes30Dec990000664000076400007640000001232107474702774016702 0ustar adk0212adk0212 Technical notes on my code submission of 30 Dec 99 Kern Sibbald General: - PLEASE NOTE: the default installation directories have been changed. Please "make uninstall" with your old configuration before installing the new release. - Documentation. - Clean up configure for Solaris. Changes submitted this submission: - Did a lot of updates to the manual. At this point, I will wait for comments before doing additional documentation. - I fixed configure.in and Makefile.in so that the CFLAGS and LDFLAGS can be passed to configure as in the documentation -- i.e. CFLAGS=-g ./configure ... - I modified sysconfdir so that it is /etc/apcupsd by default. The user can change it as an option on the ./configure. - I moved the definition of APCCONTROL into a header file as is the case with ACPCONFDIR. - In the makefile, I moved the cgi install in front of the main install. The advantage is that the install finishes with the main messages desired. - Added a new define "HAVE_CYGWIN" to the header files. - Merged in Andre's copyright changes. This touched virtually ever file. - Applied fixes to compiler complaints reported by Carl (apcconfig.c, apcnetlib.c, apcserver.c). - Replace the const on shortoptions with static because of a GNU compiler warning. - Added a call to cfsetospeed() to apcserial.c on HAVE_CYGWIN ifdefs. This is needed to set the serial port baud rate to 2400 baud. This statement is probably needed by some of the other ports such as the HP (and SGI if we do one). - I removed all the old UPS command documentation from apcsmart.c Some of it was out of date and wrong. In any case, every thing that I removed is now in doc/manual/upsbible.html. - apcupsd.c #ifdefed out the check for super user for CYGWIN and ifdefed off the daemon_start() code. - apcwinipc.c is a new file used to simulate the shared memory functions on Windows. It is a bare bones implementation that addresses only our current use of the functions. All the semaphore functions are currently void. This file is #ifdefed for CYGWIN. - Makefile.in sysconfdir is now the full path (default /etc/apcupsd). Pass CFLAGS and LDFLAGS from configure. - Same changes in the cti directory. - configure.in. I added some new functionality -- the default sysconfdir is /etc/apcupsd, our PATH is now concatenated to the user's PATH. This permits having compilers in wierd places. The sbindir is now default /sbin. Had to split up some of the tests for headers that are not present on CYGWIN. Recognize the CYGWIN system. configure now prints out a configurations summary at the end. This is very helpful for knowing where things are going to go. - Removed unused files (powerstatus, powerpid, ...) from all the distribution makefiles. I also removed all tests for whether or not the shutdown is being done twice. I prefer that it is done twice rather than having the possiblity that it is not done at all because some old file is left laying around. - I implemented an awk script that automatically inserts the necessary powerfail statements in the halt script. It needs a bit more work to more properly detect error conditions. - Updated my makediff file to remove more files that should not be compared. - Lots of manual updates. - I added a mainsback script to examples which is the complement of onbatteries. Kern's ToDo List To do: - Expand Last UPS Self Test field in cgi program - Automatic conversion of old apcupsd.config files to the new format? - Setuid of network processes to "nobody". - Add credits to manual. Update testers names, ... - Check time delays in shutdown especially for master/slaves. - Look at Vladimir's code. - Update make clean to remove distributions/*/apccontrol.sh - Set appropriate permissions on files in /etc/apcupsd during make install. - Check if we should do detach_ipc() in apcserver.c Wish list: - Add remaining time before TIMEOUT to STATUS output. - Add more commands (individual variables) to apcnetd - Accumulate time on batteries and number of transfers to batteries. Perhaps save history in file so that the info can be recovered if apcupsd restarts. - Fix apcupsd so that it respawns the server if it dies (limit number of times). This will avoid the possibility that someone can bring down our apcupsd by connecting via Internet (denial of service attack, or exploit possible buffer overflow). - Make apcaccess use the network code as an option. - Remember date and time when apcupsd started. - Eliminate rest of character command codes using new capabilities code in apcsetup.c (for setup stuff). - Eliminate the rest of the printfs(). - Eliminate as many error_aborts as possible in making new events. - Possibly retab new cgi/net server code - Apparently during self test, apcupsd thinks that the power was lost. Distinguish this condition! - Check out apmd and see if we should interface to it. - Pass second argument to apccontrol indicating if we are master/slave and other info. - STATUS file should be opened with open() rather than fopen(). Some small changes required. Done: - Added compliler cleanups reported by Carl. - Move more control files to /etc/apcupsd - Complete documentation apcupsd-3.14.10/doc/techlogs/1999/kes30Nov990000664000076400007640000001102007474702774016744 0ustar adk0212adk0212 Technical notes on my code submission of 30 Nov 99 Kern Sibbald General: - Some enhancements to the cgi programs, documentation, and tweeking of buffer lengths. Changes submitted this submission: - I've added a new man page for apcnetd. This page will be expanded in the coming weeks. - I've added several new .man files, but will shortly convert them to sgml format. They are the beginning of the documentation for STATUS output and EVENTS. - To ensure that we don't get string buffer overflows (as has happened to me), I've increased the lengths of some strings. In one case (the UPS name), I reduced the length. This is probably a bit overkill, but I prefer not to have buffer overflows. - I added new capability codes to fetch the EPROM capabilities string, which is 254 bytes long. It provides the valid EPROM settings for all versions of the model. Although this information is obtained from the UPS, it is currently not used, and I will not develop it further until after the official release. - I started adding the code to determine the length of time since the last self test. This code is turned off and will not be developed further until after the offical release. - I added additional documentation received from APCC as well as other sources. - I added several new status variables to the STATUS output. These were previously overlooked. - I enhanced the CGI programs to have a red bar indicating below what battery percentage that apcupsd will force a system shutdown. I also added a red bar indicating the point at which the remaining runtime becomes too low and apcupsd will force a system shutdown. - Updates to the man pages. - Fixed the -i option for apcnetd (called by inetd). Kern's ToDo List To do: - Update apcupsd.man and apcnetd.man, and create new sgml documentation for EVENTS, DATA, LOGGING, and STATUS output as well as documenting the network "programming" interface. - Document the CGI programs and how to write them. - Fix the battery voltage display in the cgi to handle battery voltages of 12 and 48 volts as well as 24 volts. - Add and test a bunch of events that email a message. - Check and double check killpwr changes (one pass made). - Expand Last UPS Self Test field in cgi program - Document log_event for developers -- especially the LOG_ values. See info in developers/apcupsd.logging - Document the new configuration options. - Document installation, particularly the chkconfig: However, since one day it will be networked, it might be better to start it after the network is up, so S20/K99 is probably the best. In the latest development stream, I have redone the RedHat installation and added the following two lines to the top of the apcups script (now renamed to apcupsd) so that the proper links are setup during the install: # chkconfig: 2345 20 99 # description: apcupsd monitors power and takes action if necessary If you add those lines to the top of your existing apcups script (presumably in /etc/rc.d/init.d/apcups) and then delete the old startup links (if any) with: chkconfig-del apcups then create the new recommended links with: chkconfig-add apcups All the necessary links will be setup so that it apcupsd starts and stops automatically in each appropriate runlevel. If you are not familiar with chkconfig, try: man chkconfig - Automatic conversion of old apcupsd.config files to the new format? - Produce a RPM for RedHat Wish list: - Add more commands (individual variables) to apcnetd - Accumulate time on batteries and number of transfers to batteries. Perhaps save history in file so that the info can be recovered if apcupsd restarts. - Fix apcupsd so that it respawns the server if it dies (limit number of times). This will avoid the possibility that someone can bring down our apcupsd by connecting via Internet (denial of service attack, or exploit possible buffer overflow). - Make apcaccess use the network code as an option. - Remember date and time when apcupsd started. - Eliminate rest of character command codes using new capabilities code in apcsetup.c (for setup stuff). - Eliminate the rest of the printfs(). - Eliminate as many error_aborts as possible in making new events. - Possibly retab new cgi/net server code - Apparently during self test, apcupsd thinks that the power was lost. Distinguish this condition! - Check out apmd and see if we should interface to it. apcupsd-3.14.10/doc/techlogs/1999/ric06Nov990000664000076400007640000000444207474702774016754 0ustar adk0212adk0212= Using getopt_long() for command line parameter parsing = Riccardo Facchetti - Preface This work is inteded to slim down apcupsd startup routine and to clean up the old parameter parsing code. - Implementation The command line options of apcupsd are of 2 types: . Parameters that need to be used alone . Parameters that can be used in conjunction of other parameters The first kind are all parameters that in one way or another interact with the UPS, reprogramming it or shutting it down. Two parameters of this kind can not be present at the same time in the command line for obvious reasons. The second kind are all parameters that can be used in conjunction with any other parameter so that for example we can update the "battery changed" date, reading the UPS configuration from a special config file while having debug messages enabled. For parsing the command line I have decided to use getopt_long(). This function, present in the getopt(3) package, is very interesting because can handle both short and long versions of command line switches (e.g. we can shut down the ups passing the `-k' argument or the `--killpower' argument). The getopt(3) package have another advantage over a self-written one: it is already present in the `porting' library of apcupsd. In linux environment we don't use the porting version of getopt(3) because standard libc already contain this package. In environment where getopt(3) is not present we use the porting version that have the same functionality of the standard linux version. Another advantage of getopt(3) package is that it is quite easy to add new switches. - Results The code is clean, readable and small. The apcupsd startup function have gained lot of readability. - Hints apcoptd.c source is tailored on apcupsd executable. If someone want to add getopt(3) functionality to other apcupsd programs, the apcoptd.c can be used as a good example on how to implement the command line parsing. Every program that need to use getopt(3) need its tailored apcopt.c file: the apcopd.c code can not be reused as-is. I could have made it more general to share most of the code in the libapcups.a but the work (thinkering+coding) would have been a lot more and I don't think the advantages of sharing few Kb of code justify losing so much time on such a basic functionality. apcupsd-3.14.10/doc/techlogs/1999/ric30Sep990000664000076400007640000000446107474702771016734 0ustar adk0212adk0212= Using select() mechanism on UPS file descriptor = Riccardo Facchetti - Preface - The UPS send its status in various ways and not all these ways can fit well in the select() mechanism. The UPS (but not all the UPSes) have two types of information: 1. simple status (online, onbatt, etc etc) that is sent by UPS on status change so no need to ask UPS to send us anything. It's the '!', '$' etc etc. In this case the _best_ way to read the status is select() since we don't know _when_ the status change will happen. 2. verbose status (Voltages, temperatures, etc etc) that need to be asked to the UPS. In this case, select()ing on the FD is not functional because we ask to the UPS something and the UPS will answer immediately so select() it is likely to return immediately with something waiting from the FD. Here select have _no_ effect. We are interested mainly in 1., and only with low priority we can be interested in 2. We want to know if batteries are failing much more than we want to know that voltage is 221 and not 220 V. - Proposal - The best way to ask the UPS its status is: 1. Waiting for simple status on fd by default. 2. Asking for verbose status once in a while. - Implementation - We have two UPS types: 1. dumb-cable 2. smart-cable Type 1. is stupid and need only ioctl to know the simple status. No verbose status is known. In this case we do not have a way to select because we don't read the file descriptor at all. For this one instead of select() we have to sleep() to give CPU to other processes. Type 2. is more intelligent, and implementation is more complicated. We wait on the FD with select() by default. This means that select() is likely to timeout because it is not so frequent a status change on the UPS. Once in a while we ask the UPS all the info we need to fill the UPSINFO structure. This timing can be done by select() timeout mechanism. The timeout is likely to be the preferred path because the UPS is meant to be everytime online. When timeout occours we read the UPS status and fill the info that come back. After filling the info we do_report so that the do_report is timed by the same timeout ... there's no point to do_report() faster or slower than fillUPS. Note: in this implementation I assume that the only writer to shmarea is apcserial! apcupsd-3.14.10/doc/techlogs/2000/0000775000076400007640000000000011634011372015157 5ustar adk0212adk0212apcupsd-3.14.10/doc/techlogs/2000/kes02Aug000000664000076400007640000000136307474702774016652 0ustar adk0212adk0212 Technical notes on my code submission of 02 Aug 00 Kern Sibbald General: - Submission of code to make apcupsd compile under CYGWIN and run on Windows 98 and Windows NT (possibly Win95). Changes submitted this submission: - I removed the directory distributions/win32 - I added a new directory under the source directory named win32 that contains all the Win32 code. - I moved much of the configure code into a new autoconf directory - I updated the configure.in code to integrate the Win32 builds correctly. This required a few changes to the Makefile.in file as well. - Updated the HTML manual to have the beginnings of documentation of the Windows code. There is much to be done here. apcupsd-3.14.10/doc/techlogs/2000/kes05Dec000000664000076400007640000000352107474702774016632 0ustar adk0212adk0212 Technical notes on my code submission of 05 Dec 00 Kern Sibbald General: - Fixed Win32 to work with simple signalling UPSes. - Upgraded Win32 to CGYWIN 1.1.5. - Fixed an Alpha Tru64 64/32 bit problem. - Fixed the random incorrect on battery timers (I think). - Upgraded to latest version of gcc - Do much better argument checking in the .cgi programs. This improves security (at least psychologically). Changes submitted this submission: - The new version of gcc caused a number of problems especially with the #defines and varargs. As a consequence, all the error_aborts() were changed. You must now explicitly put the number of message substitutions on the Error_abortN() subroutine call. - Added a make depend to the main Makefile in case the automatic dependencies fails. - Added a Makefile rule to build the apctest program for Windows. - Moved the powerfail and logonfail to apcaction.c as Riccardo did in 4.0. This required adding these subroutines to apctest. - Removed the static declarations in apcaction.c in preparation for 4.0. - Added the ups variable as the first argument to log_event() in preparation for 4.0. - Added the ups argument to do_action(). - Moved a number of static variables to the ups structure. - Corrected a problem with the on battery timers where the last time on battery was not set because there was not a full confirmation of on battery (i.e. a power outage of less than 5 seconds or a self test). - Reindented apcstatus.c a bit so that the code can be more easily read on an 80 character wide screen. - Implemented a very crude form of serial port line status ioctl() for Win32 to support simple signalling UPSes. Despite the limitations of the Win32 API, it seems to work and implements most features for most UPS/cable combinations. - Enhancements to the manual. apcupsd-3.14.10/doc/techlogs/2000/kes05Oct000000664000076400007640000000337107474702774016667 0ustar adk0212adk0212 Technical notes on my code submission of 05 Oct 00 Kern Sibbald General: - Several bug fixes - Fixed problems with Win32 binary release that prevented proper shutdown. Thanks to the testing efforts of Paul Stagner. - More documentation for Win32. Add ChangeLog to manual, renumber to 3.8.0 Changes submitted this submission: - Moved # comment characters in Makefiles to column 1 to avoid problems with native Alpha make. - Fixed a problem in apcaction.c reported by Nikita Schmidt that caused early shutdown on power loss in some cases if using a nonzero value of TIMEOUT. This was a bug that I introduced in 3.8.0 in optimizing the code. - Fixed a problem with old SmartUPSes manufactured before 1994 where certain EEPROM values are not available. This was causing immediate shutdown on power loss. This is an ancient bug. - Enhanced the error print out if apcupsd is unable to execv() the apccontrol file. This is critical for proper shutdown and helps debugging failed shutdown testing. - Fixed a problem where when the cursor is over the tray icon in the Win32 version that is being run as a slave. The correct status was not shown. - Modified configure.in to add the -Wall option to the compile only if we are using a gcc compiler as this option does not normally exist on other compilers. - Removed a C++ comment from multimon.c and replaced it with a standard C comment. - Increased the version from pre1 to pre3 (pre2 was used to release corrected Win32 binaries). - At Riccardo's request fixed a script problem on SuSE as reported by Lothar Hegebart. - Fixed a bug in configure.in when setting the default compilation options to -O2 -Wall that caused and error message on Solaris and Alpha systems. apcupsd-3.14.10/doc/techlogs/2000/kes06Jan000000664000076400007640000001345607474702775016661 0ustar adk0212adk0212 Technical notes on my code submission of 06 Jan 00 Kern Sibbald General: - I worked on porting apcupsd to Windows under CYGWIN. This was a very good exercise since the Windows CYGWIN environment is much closer to BSD than Linux, thus I was able to resolve a large number of portability issues. - In making apcupsd run on Windows, I discovered that the serial port handeler was terminating on a carriage return. However, the UPS protocol is to send characters such as: SM\r\n. Thus, there was an unread newline character always sitting in the read queue. This generally caused apcupsd to loop more times than necessary through the getline() routine. - I turned on the -Wall compiler option and found a lot of warning messages, which I eliminated. - Modified the network information server code to return EOF and error status better than before. This reduces the number of zombies. - Added additional info to error messages: shared memory, serial port lock code. This will significantly reduce our "error" or problem reports and aid users in getting apcupsd to run. - Created a new directory distributions/win32 to hold Windows specific code. For the moment, this is mostly unfinished or test stuff. Changes submitted this submission: - Added apcwinipc. to the list of files in Makefile.in. It Is used to simulate shared memory on Windows. - To make the server code work correctly, I had to remove a global and pass it as an argument to output_status and stat_close(). This necessitated some minor changes to a number of files. - Eliminated a number of unused variable definitions. - Added additional code to reap zombies on BSD systems. - Added quite a bit of additional information in case of errors. For example, in the shared memory, I added the errno, and in the serial port locking code, I added the name of the file as well as the full error message. - I had lots of problems with zombies on CYGWIN, mainly because there seems to be a timing bug in their socket code where the server can hang on a read() when the client has closed the socket. To get around this, I managed all the child processes, give them 20 seconds to do their work, then on the next server request, send any laggards a SIGTERM signal. - In apcnetlib.c, I more carefully return the EOF status, which was occassionally getting lost if only a partial buffer arrived. I also made it aware that the read() request could be interrupted by a child termination. - Removed an error_abort from apcreports.c making it a log_event in the case of a buffer overflow. - The serial port was opened O_APPEND. I removed this flag. I used the TIMER_SERIAL define in setting up the read() timeout value. - Reap children as described above in apcnetd.c and apcserver.c Lots of new error checking in those two files. No change in logic. - On CYGWIN, the select() mechanism does not work very reliably, and consumes about 10% of my 400MHz cpu with 5 second waits! In looking at the code carefully, I now see no reason to have the select() as the read() already has a 5 second wait. On CYGWIN, I eliminate the select(), dropping the CPU usage from 10% to about 0.3% and simplifying the code. It is my opinion that this same change should be made on all platforms, but for the moment, I have turned off the select() only for CYGWIN. - Corrected the error with interpretation of \r and \n in getline(). - I enhanced the UPSlinkCheck() subroutine to eliminate false serial port loss of communications. This was necessary on CYGWIN because of the \r \n problem. However, the changes I made, make UPSlinkCheck much more robust, so I have left them. - Corrected a number of problems in cgi lib where external subroutines did not have the prototype. Also, the code had lone % in several print statements, which I converted to %%. - Updated the hpux/apccontrol.sh.in program so it should now work on the HP. Thanks to Tom Schroll. - As usual, a number of documentation updates. - Cleaned up a number of subroutine prototypes in apc_extern.h. Kern's ToDo List To do: - Automatic conversion of old apcupsd.config files to the new format? - Setuid of network processes to "nobody". - Add credits to manual. Update testers names, ... - Check time delays in shutdown especially for master/slaves. - Look at Vladimir's code. - Update make clean to remove distributions/*/apccontrol.sh - Set appropriate permissions on files in /etc/apcupsd during make install. - Finish the rpm spec file. Wish list: - Add remaining time before TIMEOUT to STATUS output. - Add more commands (individual variables) to apcnetd - Accumulate time on batteries and number of transfers to batteries. Perhaps save history in file so that the info can be recovered if apcupsd restarts. - Fix apcupsd so that it respawns the server if it dies (limit number of times). This will avoid the possibility that someone can bring down our apcupsd by connecting via Internet (denial of service attack, or exploit possible buffer overflow). - Make apcaccess use the network code as an option. - Remember date and time when apcupsd started. - Eliminate rest of character command codes using new capabilities code in apcsetup.c (for setup stuff). - Eliminate the rest of the printfs(). - Eliminate as many error_aborts as possible in making new events. - Possibly retab new cgi/net server code - Apparently during self test, apcupsd thinks that the power was lost. Distinguish this condition! - Check out apmd and see if we should interface to it. - Pass second argument to apccontrol indicating if we are master/slave and other info. - STATUS file should be opened with open() rather than fopen(). Some small changes required. Done: - Check if we should do detach_ipc() in apcserver.c - Expand Last UPS Self Test field in cgi program apcupsd-3.14.10/doc/techlogs/2000/kes06Oct000000664000076400007640000000135307474702775016667 0ustar adk0212adk0212 Technical notes on my code submission of 06 Oct 00 Kern Sibbald General: - Update timers when first power problem detected to eliminate timing window. - Because of their importance, moved changeme, commfailure, commok, mainsback, and onbattery from /examples to /etc - Copy changeme, commfailure, commok, mainsback, and onbattery into sysconfigdir by default. - NOTE: the above script files should really be processed by ./configure to contain the correct locations for the executables and for the mail program. This needs to be done, but in the mean time, they should not create any problems, and can be a valuable tool for notification. Changes submitted this submission: - See above. apcupsd-3.14.10/doc/techlogs/2000/kes08Dec000000664000076400007640000000270207474702775016636 0ustar adk0212adk0212 Technical notes on my code submission of 08 Dec 00 Kern Sibbald General: - Integrated Riccardo's fixes to the automatic dependencies make problem with ./configure. - Allow NIS process to run regardless of the configuration. Previously it ran only if the UPS was connected to the serial port. Changes submitted this submission: - Created a .in file for apcupsd.spec on the RedHat version that includes @VERSION@ so that it is automatically updated with each version. - Changed the version in version.h not to have the apcupsd in front of the numbers, which was redundant. - Hopefully this time, I corrected the on battery timers. I now start them when we first detect a power failure. - I've added a new time value, which is the last time the master contacted a slave. This value is then put in the STATUS output as MASTERUPD. Thus, in looking at the STATUS output, you can see if the slave is being updated from the master. - Allow the Network Information Service process to be created in any configuration. - Updated the trouble shooting section of the manual. - Updated the Win32 source build instructions. - Commented out the popup window calls on the Win32 version in apccontrol for powerfail and mainsback. These tend to be more annoying than helpful since usually you are very aware that the power has gone off, or you aren't there and the unanswered dialogue boxes remain around a long time. apcupsd-3.14.10/doc/techlogs/2000/kes09Jan000000664000076400007640000000775607474702775016672 0ustar adk0212adk0212 Technical notes on my code submission of 09 Jan 00 Kern Sibbald General: - I worked on porting apcupsd to Windows under CYGWIN. - Redesigned the Network Information Server protocol to allow the server to send back any amount of information. This was accomplished by terminating each server response with a record having a zero length -- much like when read() gets and EOF. Changes submitted this submission: - Modified configure.in and Makefile.in to check and use the executable extension (necessary for apcnetd. - Used the new network protocol to pass the EVENTS records one at a time rather than in a big block. This simplified the code on the sending and receiving ends. - apcnetd.c and apcserver.c, in general cleaned up the error handling somewhat and modified to protocol to send a zero length record at the end of every transmission. Also for CYGWIN, I removed the fork() as this seems to cause some problems in inheritance of handles. I also cleaned up the error messages, putting the lengths as compiler defined rather than hard coding them. - apcnetlib.c. There was no change in logic, just a lot of little changes to return proper error statuses. None of the core code really takes advantage of all the statuses returned, but it is there if needed. - apcstatus.c removed some code that will never be used. - upsfetch -- modified the code to use the new protocol. This considerably simplifies the code. - In the distributions/win32 directory, I now have a skeleton Makefile (it doesn't do installation yet), a correct shutdown program, and functioning apccontrol and apcupsd scripts. - Made a simple UPS icon for apcupsd.exe on Windows machines. - Updated makediff to cope with the win32 directory. - Enhanced the examples/client.c program to work with the new network protocol. You will notice that it too is much simpler than the old protocol. - Added function prototypes to apc_winipc.h. - Did a lot of cleanup of the manual. All files are now correct HTML (not always easy) except for the upsbible, which still contains a lot of errors from the original author. There were so many that I got tired of correcting them. Most of them are like compiler warning messages, they are harmless, but do not conform to the HTML standard. Kern's ToDo List To do: - Setuid of network processes to "nobody". - Check time delays in shutdown especially for master/slaves. - Look at Vladimir's code. - Set appropriate permissions on files in /etc/apcupsd during make install. - Finish the rpm spec file. Wish list: - Make an apcupsd terminating event so that a script gets control and can notify me. - Add remaining time before TIMEOUT to STATUS output. - Add more commands (individual variables) to apcnetd - Accumulate time on batteries and number of transfers to batteries. Perhaps save history in file so that the info can be recovered if apcupsd restarts. - Fix apcupsd so that it respawns the server if it dies (limit number of times). This will avoid the possibility that someone can bring down our apcupsd by connecting via Internet (denial of service attack, or exploit possible buffer overflow). - Make apcaccess use the network code as an option. - Remember date and time when apcupsd started. - Eliminate rest of character command codes using new capabilities code in apcsetup.c (for setup stuff). - Eliminate the rest of the printfs(). - Eliminate as many error_aborts as possible in making new events. - Possibly retab new cgi/net server code - Apparently during self test, apcupsd thinks that the power was lost. Distinguish this condition! - Pass second argument to apccontrol indicating if we are master/slave and other info. - STATUS file should be opened with open() rather than fopen(). Some small changes required. - Expand Last UPS Self Test field in cgi program - Update make clean to remove distributions/*/apccontrol.sh Done: Will not do: - Automatic conversion of old apcupsd.config files to the new format? apcupsd-3.14.10/doc/techlogs/2000/kes10Sep000000664000076400007640000000264107474702775016665 0ustar adk0212adk0212 Technical notes on my code submission of 10 Sep 00 Kern Sibbald General: - The bulk of my changes were to the Win32 subdirectory and have already been integrated by Riccardo. - This release is one bug fix, some security improvements concerning file permissions, and manual updates. Changes submitted this submission: - In Makefile.in, I tightened down the file permissions by adding 744 to apccontrol. - apcsetup.c: changed a character string from MAXSTRING to 1000 bytes in length. This is because the cababilities string in some APC models overflowed the buffer. - Added a Pragma no-cache to multimon.c to keep the file from being cached. - Deleted config.h.in from the source directory as it is now in the autoconf subdirectory. - For the RedHat distribution changed permissions on apcupsd to 744, added 744 to the permissions of halt (both in /etc/rc.d/init.d). - A number of manual updates including additions to testing, and a new Trouble Shooting section that needs additional work (at least it is a beginning). I also cleaned up most of the HTML errors except in the bible where there still remain quite a number to be fixed. - Updated /etc/apcupsd.conf correcting the version number and the spelling of TIMEOUT in one of the comments. - Added changeme, commfailure, and commok scripts to the examples directory that email root when one of those events occurs. apcupsd-3.14.10/doc/techlogs/2000/kes11May000000664000076400007640000000255407474702775016670 0ustar adk0212adk0212 Technical notes on my code submission of 11 May 00 Kern Sibbald General: - Some additions to the manual, particularly concerning "dumb" UPSes. Clarification of cable requirements. Added quick search tags to the configuration manual for use with the new configurator. - Added a new option to allow apcupsd to do a powerkill before exiting when a power loss is detected. - Joseph Acosta has been working on a nice Browser based configuration utility for creating apcupsd configuration files. I include his contribution in contrib/apcupsdconf Changes submitted this submission: - Updated Makefile.in version to 3.7.2 - apcaction.c added code to call kill_power() before the shutdown if the kill_on_powerfail option is set. - apcnet.c removed the terminate() from kill_net() it is now done in the main program. - apcoptd.c Added the -p and --kill_on_powerfail option which causes apcupsd to issue a powerkill command before the shutdown command. I have certain misgivings about this command, but it seems to be necessary in some cases. - apcupsd.c added terminate() after the kill_power() and kill_net() subrotine calls as it is no longer done in these routines. - Added a new directory contrib/apcupsdconf, which contains the submission of a Web browser based configuration utility for apcupsd submitted by Joe Acosta. apcupsd-3.14.10/doc/techlogs/2000/kes12Feb000000664000076400007640000001045407474702775016635 0ustar adk0212adk0212 Technical notes on my code additions of 12 and 17 Feb 00 Kern Sibbald General: - Dumb UPSes were not working in the 3.7.0 release, see below. Both Riccardo and I are surprised that we didn't have any dumb testers :-(. Fortunately, we now have two volunteers (Al Tuttle and Christian Moeller) -- thanks guys. - The TIMEOUT value on the slave could shortened (too quick) by the value of NETTIME. The TIMEOUT timing now begins from the time the slave (or master) considers it is really on batteries. Changes submitted this submission: - Two users reported that dumb UPSes worked fine in 3.6.2, but not at all in 3.7.0. The main problem reported was that apcupsd reported loss of serial communications with the UPS. - As best I can determine, there were four problems: 1. The code (since a long time) has called smart_poll() even for dumb UPSes. Prevously, this just caused a 5 second wait for a dumb UPS. However, recently I added code that checks for loss of communications. Solution, prevent dumb UPSes from executing smart_poll(). Note, there were a number of different tests in the code for distinguing SmartUPSes and dumb UPSes. I standardized on the following: if (ups->mode.type > SHAREBASIC) it is a smart UPS (character signalling) else it is a dumb UPS (ioctl signalling) 2. A number of the serial port status flags tests were bitwise tests resulting in a zero or nonzero value, where the nonzero value was not 1. The code in apcactions.c then tested for zero or 1, possibly overlooking a valid status. I corrected both the code in apcaction.c to check for zero or nonzero, rather than zero or 1. I also corrected the code in apcserial.c that picks up the flags bits to return a zero or one. If you are not familar with the following construct: variable = !!(flag & bit); Note, that this expression sets variable to zero if (flag & bit) is zero and sets it to 1 if (flag & bit) is nonzero. It could also be written: variable = (flag & bit)?1:0; which some people prefer. 3. Finally, a real show stopper was in the dumb UPS code in check_serial() in apcserial.c. The code picked up the serial port line flags, then did a read_andlock_shmarea(), which promptly erased the value of the serial port flags. The fix was to do the read_andlock_shmarea() before the ioctl(). 4. Under certain circumstances, which seem to depend on whether apcupsd was executed from a command line or from a script, when the serial port was reset to its original state on termination of apcupsd by a tcsetattr() command, the status bits of the serial port would be reset, thus signalling the UPS to drop power. This caused the premature killpowers, and is aparently also the reason why there were previously a number of sleep() calls before the termination -- they simply masked the problem. - I added a new -R option to the command line that puts a SmartUPS into dumb mode. I did not document it because it is primarily for testing. In my case, I don't have the correct cable, but at least, I can exercise the dumb mode code. - I merged in the changes that Riccardo sent me for 3.7.1 - I modified the message which is printed if a slave attempts to do a power kill, which is not possible, but happens because the install inserts the call in the halt script. The message now simply says that the killpower was ignored rather than printing FATAL ERROR. This is a little less concerting to the user. - The nologin_file flag was passed from the master to the slave. It prevented the slave from setting a nologin file, so I removed it. - I noticed several times that the TIMEOUT for the slave seemed to be incorrect -- that is the slave shutdown rather rapidly. It turns out that the time variables were reset only when a pass was made through do_action(). One pass is made each time the slave it contacted by the master, which is NETTIME. Consequently if you had a net time of 60, the slave TIMEOUT value could triger up to 60 seconds before it should have. I corrected this by resetting the timeout values when the slave detects that it is REALLY on batteries i.e. the second on battery signal. apcupsd-3.14.10/doc/techlogs/2000/kes12Jan000000664000076400007640000001045307474702776016651 0ustar adk0212adk0212 Technical notes on my code submission of 12 Jan 00 Kern Sibbald General: - Brian Daniels reported that the master/slave code does not properly shutdown the slave. Due to the fact that in 3.7.0, the slave code calls do_action(), which was not the case in 3.6.2, additional variables needed to be passed from the master to the slave (or major changes to apcaction.c were needed, which I ruled out at this stage). Consequently, the network structure needed to be changed. The original implementation, while it worked, did not lead to easy modification. Consequently, I made a major rewrite of the code. Additional coding should be done as noted in my todo list as well as the source code of apcnet.c, but it will wait until after 3.7.0 is released. Note, there are very few changes to the "core" part of apcupsd, so the chances of new bugs are minimal. Of course, the chances of needing additional work on the master/slave code is far from minimal given the extent of the changes. Changes submitted this submission: - Throughout the code, I changed the names of local variables to correspond to the global names. This reduces the chances of an error in purely mechanical coding. - apcaction.c, I implemented the send_slaves_urg flag to indicate that the slaves should be immediately notified. This consisted of setting the flag for an urgent condition (e.g. on batteries) and clearing it when off of batteries. - apcnet.c -- this was a major rewrite at the same time keeping the major logic flow. I added an error state to the SLAVEINFO packet as well as an error count. The former allows printing an error message only once per error rather than once every 10 seconds. The latter, in future code, will permit us to DOWN any connection with excessive errors. I also set the string length of usermagic[] to the correct size rathr than MAXSTRING thus reducing a fair amount of wasted memory. I modified the state variable remote_state. The new states are described at the top of the file. There is a lot less interaction of the states between the master and the slave now. The only case where the slave needs to act on the state of the master is in the case of an initial connection or a reconnection. In the old code, the master always sent a packet to the slave and waited for the slave to repond. However, this was really only necessary during the connection phase. Consequently, in the new code, the slave responds to the master only on a connection or reconnection. write_struct_net(), read_struct_net(), reconnect_slave(), and the contents of prepare_master() are all gone. Previously, during initialization, apcupsd would block for a very long period of time waiting for the slaves to come up (5 minutes per slave, if I am not mistaken). The new code does not block for either the master or the slaves. It simply logs whether or not the connection was successful and continues trying at the interval defined by the user NETTIME. Also, during an urgent situation as noted above, NETTIME is ignored by the master and instead, it sends updates once a second. - I increased the time a master waits from 15 to 30 seconds before issuing a powerkill. This gives a bit more time to the slaves to properly shutdown. - apcstatus.c: in response to complaints about too much output from Andr, I have reordered the STATUS output so that the items that I consider the most important are grouped toward the beginning. This was a pure reordering of the code, no functional change was made. - apcupsd.c: I improved the netslave powerkill and prepare_slave() error messages now that I understand what was being done. I pass the slave pid so that if the slave process exits so does apcupsd. I changed the process names so that they more correctly reflect what is being done in the process rather than who they are talking to. - During testing, I noticed that I introduced a harmless bug in apccontrol for all the machines. The cancel of the shutdown should only be done if the powerfail file was created. Fixed. - I eliminated a lot of old out of date stuff in apc_defines.h that had to do with master/slaves. - Updates to the structures in SLAVEINFO, and NETDATA. - Updated the manual to reflect the changes. apcupsd-3.14.10/doc/techlogs/2000/kes13Jan000000664000076400007640000000133107474702776016645 0ustar adk0212adk0212 Technical notes on my code submission of 13 Jan 00 Kern Sibbald General: - A linking problem on some systems occurred in the CGI libraries. - I reverified that as best I can tell, except for the drop of priority to nobody in the servers, we have implemented all the ideas given by Vladimir in his patch. However, most have been done slightly differently due to the evolution of our code. Changes submitted this submission: - Modified cgi/Makefile.in to include -lm on all the links. I also parameterized the makefile a bit more. - I added the necessary credits to the Apcupsd manual for the use of the gd 1.2 image libraries used to produce the bar graphs in our CGI programs. apcupsd-3.14.10/doc/techlogs/2000/kes16Jan000000664000076400007640000000211007474702776016644 0ustar adk0212adk0212 Technical notes on my code submission of 16 Jan 00 Kern Sibbald General: - Bug fixes and documentation. Changes submitted this submission: - On the Solaris 7 system, apparently make -C does not work. I noticed this for the build of the cgi directory, so I modified the configure.in script to do an explicit cd. - Due to some reported problems with the halt script on older RedHat systems, I reworked the awk script to work for more cases. I also updated the messages that are printed by the RedHat make. - Based on questions and the problems, I've enhanced the documentation a bit. Mainly, I added clearer examples of how to test things. - I added a new STATUS output that includes humidity and termperature. - I updated the client.c program to accept a host name on the command line. - I added eeprom as a command line argument to apcaccess. I thought I had done this in a previous submission, but it seems to be missing. This is important because the manual refers to apcaccess eeprom in many places and I prefer not to change it. apcupsd-3.14.10/doc/techlogs/2000/kes17Jan000000664000076400007640000000115507474702776016655 0ustar adk0212adk0212 Technical notes on my code submission of 17 Jan 00 Kern Sibbald General: - Config/make fixes Changes submitted this submission: - I removed some of the CYGWIN tests since they were not working correctly. Unfortunately, I do not have the time to fix it now. - I fixed the problems I introduced in eliminating the make -C for the cgi directory. - Please note I believe these problems exist for some of the other subdirectories, and I was not able to find the time to fix them. - I added the local host as the default in etc/hosts.conf and added a little more documentation. apcupsd-3.14.10/doc/techlogs/2000/kes17Oct000000664000076400007640000000053507474702776016673 0ustar adk0212adk0212 Technical notes on my code submission of 17 Oct 00 Kern Sibbald General: - Integrated Andr's fixes to support the 0119A cable used for BackUPS Office. - Integrated Solaris xlib fix supplied by Riccardo. - Manual updates. - Built on Linux OK. Built on Solaris OK. Changes submitted this submission: - See above. apcupsd-3.14.10/doc/techlogs/2000/kes21Oct000000664000076400007640000000327507474702776016672 0ustar adk0212adk0212 Technical notes on my code submission of 21 Oct 00 Kern Sibbald General: - Win32 updates - Fixed some WinNT problems. - Updated the manual for the Win32 version. Changes submitted this submission: - Implemented simple email.exe program to send email messages. This permits notification of important events by email on Win32. - Implemented changeme, onbattery, mainsback, commfailure, and commok for Win32. - Added make Makefile to Win32 Makefile.in - Modified the Win32 syslog() routine to append to the events file if it is not already open. The events filename is hard coded since the configuration file may not have been opened yet. - A few enhancements of error messages where I ran into problems and did not get enough information. - Fixed win32/Makefile.in and Makefile.in to do a correct win32 installation. - Corrected a problem reported by Bostjan Muller that caused the NT version to crash when used as a slave. Once again, NT does not pass open shared memory descriptors to child processes. I had to add explict attach_ipc() calls in the network master/slave child processes. - Reworked the code submitted by Andr as it contained a number of errors. It remains to be tested as soon as this version is out. - Updated the manual for installation of the Win32 version. - Brought the master/slave example configuration files up to date and removed the EEPROM configuration statements. - Updated the safe.apccontrol script in the examples directory to remove the printf statements, which are not necessary. Apparently on some systems, this caused the output to be blank (I observed it here too). - Fixed a Solaris link problem in the cgi library. apcupsd-3.14.10/doc/techlogs/2000/kes26Jan000000664000076400007640000000335207474702776016656 0ustar adk0212adk0212 Technical notes on my code submission of 26 Jan 00 Kern Sibbald General: - Reviewed master/slave network problems reported by Marcus - Documentation Changes submitted this submission: - I moved the slave_count and slaves[] data out of the shared memory buffer thus reducing its size by about 6K. This was because of a problem reported by Marcus that the master would stall for about 90 seconds after a slave went down. This occurred because the shared memory buffer was being locked while the master contacted the slaves. Thus it prevented the master's serial port code from accessing the shared memory buffer. The solution to the problem was to remove the shared memory locking while contacting the slaves, and move the slave variables out of the shared memory buffer into global memory. This required a substantial number of changes to apcnet.c to remove the ups reference infront of all references to slaves[]. However, it should be noted that this was purely a mechanical change. There were also a very small number of similar changes in apcconfig.c and apcupsd.c as well as moving the definition of the variables. The only "real" change to the code was to remove the read_andlock_sharea() and the write_andunlock_shmarea(). - I eliminated slave_bool as it is never referenced. - I updated the document to correct some spelling errors and to incorporate some of the ideas learned from Marcus' tests. I updated the new features section to contain the ChangeLog - Corrected a minor problem in the example slave config file where the UPSTYPE was not the same as in the master config file example. I also set NOLOGIN to disable in each file as this is a more reasonable default. apcupsd-3.14.10/doc/techlogs/2000/kes27Oct000000664000076400007640000000235407474702776016675 0ustar adk0212adk0212 Technical notes on my code submission of 27 Oct 00 Kern Sibbald General: - Win32 updates - Updated the manual for the Win32 version. Changes submitted this submission: - Additional work on the Windows email.exe program. - Added binary_tar_file as object of make in win32 directory, which makes a win32 binary tar file. - Updated the apctest program some more to add time/date stamps for almost all operations, implemented kill_power option. - Added VERSION, DATE, and LSMDATE to values updated by ./configure. This permits automatically building a tar file with the correct name. - Updated the Win32 distribution README.txt file. Added documentation for Riccardo's setup.exe, updated the email script files to include the correct path for the shell. Moved a lot of the stuff into new directories win32/bin win32/etc and win32/examples. - A lot of updates to the document for Win32 and support for the Back-UPS Office UPSes. - Added proper support to apcserial.c for the 940-0119A cable used by the Back-UPS Office. This was based on the tests done by Jason A. Smith (many thanks Jason). - Moderately improved the readability and enhanced the version line printed by apcupsd by adding the build date. apcupsd-3.14.10/doc/techlogs/2000/kes27Sep000000664000076400007640000000575007474702776016702 0ustar adk0212adk0212 Technical notes on my code submission of 27 Sep 00 Kern Sibbald General: - Integrated fixes from Devin Reade -- many thanks. - Did an Alpha Tru64 port - "Completed" the Win32 port - Lots of documenation updates. Changes submitted this submission: - Moved the version definition from Makefile.in to version.h. This makes it easier to change the version. Note, I added additional version fields that are not yet used, but might be useful. - New changes to Makefile.in to support building of a Win32 version. Still to be done make install for Win32. - added a new program apctest.c, which tests dumb cables. More work is needed on this program. - when rebuilding the configure file, ensure that old configure files are removed. - if we create a sysconfdir, create it with 0755 permissions. - Makefile.in: clean: remove only regular files of zero length (Devin Reade). - apcaction.c: add new time variables to keep track of when we went on batteries. Also optimize the code to drastically reduce the number of time() calls and to call it only if really needed. - apcaction.c: remove the LineDown variable, which is not used. - apcaction.c: complain once every nine hours if the battery must be replaced. - keep track of number of transfers to batteries and when last done. - apcconfig.c: do correct casting of pointer to long so that it works on 64 bit machines. - apcnet.c: move the master's IP address to a static variable. On Win32, the address was being released, which is perfectly reasonable. - apcnet.c: rationalize the log_event types a bit. - apcnet.c: if we get a bad bind, continue trying for 15 minutes. - apcnet.c: remove invalid close() - apcserial.c: set in/out serial port speeds for Alpha, CYGWIN, and Linux systems. - apcserial.c: correct low battery signal for dumb UPSes using Custom Simple cable. - apcsmart.c: add code to support # -> replace battery - apcstatus.c: report new variables. - apcupsd.c: unlink pid file before creating it. - apcupsd.c: use open() to create the pid file, with 0644 permissions. - apcupsd.c: vastly simplify becoming a daemon. - apcupsd.c: make umask() set 022 (Devin Reade) - apcupsd.c: close stdin, stdout, stderr - autoconf/acconfig.h.in: add HAVE_OSF1_OS for Alpha - autoconf/configure.in: fix Win32 stuff, remove old VERSION stuff; pull version from version.h; add Alpha stuff; add code to support --with-pid-dir=; - autoconf/configure.in: fixed HOST to have DISTNAME, previously, it was always NONE. - add distributions/alpha subdirectory with new Alpha port code. - make RPM spec file for RedHat release -- lots of work! - A number of new STATUS examples in the examples directory. - Corrected a few minor errors in the master/slave examples. - Corrected and added additional EVENT script files that email event messages. These really should be standard. - Reworked apc.h and apc_config.h to separate system stuff and machine dependencies. Also tweaked apc_defines.h - win32 directory a number of changes. apcupsd-3.14.10/doc/techlogs/adk-3.110000664000076400007640000003270010356262016015645 0ustar adk0212adk0212 Technical notes on version 3.11.17 Adam Kropelin General: 02Jan06: - doc: Update version to 3.12.x and remove ChangeLog and ReleaseNotes sections since it is better to fetch them directly from SourceForge or from the source tarball. 01Jan06: - snmp: Remove misuse of NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE. Also use snmp_{session,pdu} instead of netsmp_{session,pdu} to retain compatibility with the ucd-snmp library. - Fix compliation of examples/ files: client.c, megaclient.c, newslave.c, upsapm.c 31Dec05: - conf: Update EEPROM section comments. 19Dec05: - win32: Convert Readme.TXT to DOS text format so it will be readble in Notepad (default *.txt handler on Windows). Remove version number since I'll never remember to update it. Point users to manual for detailed install instructions. - m/s: Fix sense of onbatt/online, which was reversed. 16Dec05: - doc: Fix latex errors that crept in during SNMP and USB updates. - configure: Force NIS to enabled since libnis is required by apcaccess. Users may still disable NIS at runtime in apcupsd.conf. - doc: Remove references to --enable-nis and --disable-nis. - doc: Update Win32 section to cover nifty new NSIS installer. 15Dec05: - win32: More installer fixes: Create start/stop links regardless of service or not. Remove apcupsd.events on uninstall, if user wants to. Fix compile error in installation directory message text. - win32: A few last fixes (hopefully): WinNT and 9x need different service start methods. Remove extra double-quotes around Win9x start handling because they seem to result in a bogus Exec commandline. 14Dec05: - win32: Fix an uninstaller bug where apcupsd.conf was left behind even if the user chose to remove it. - win32: Fix uninstall so it doesn't miss any files. Change destination path instructions to help prevent inoperable installations. Fix documentation and start link creation. 24Nov05: - Get rid of unsupported -c (configure), -u (update battery date), and -n (rename) options. 22Nov05: - configure: -mwindows is only needed for the link step, so kill $WCFLAGS and let all compile steps be driven by the .c.o rule. - configure: Don't add ncurses libs to $LIBS, only to $POWERLIBS. That prevents libncurses from being linked with every executable. - configure: Kill apcnisd. It requires sysv shmem and since we've eliminated that, so too must apcnisd be eliminated. 19Nov05: - snmp: Initialize nfds to zero before calling snmp_select_info(). Fixes crash on Win32 and potential crash on other platforms. - win32: Build fixes: apc_defines.h -> defines.h, remove use of astr* pending future cleanup, C++ casting fixes. - win32: Switch to pthreads for the Main_Msg_Loop thread. This seems to fix a bug where Main_Msg_Loop called do_status() which attempted to take the UPS read_lock. Apparently taking pthreads locks from CreateThread threads is bad. Switching to pthreads seems to fix it. 12Nov05: - No need to specify mode parameter to open() when O_CREAT is not set. - configure: Simplify SNMP rules. Prefer net-snmp, but fall back on ucd-snmp if it is not found. Look for snmp libs in /usr/local. --enable-snmp and --enable-net-snmp act identically now. 11Nov05: - Remove lingering references to getNextUps() in Cygwin build. 06Nov05: - snmp: Add support for SNMP traps in powernet_snmp_ups_check_state(). - snmp: Accept "APC_NOTRAP" as a valid DeviceVendor string, providing users a way to disable SNMP trap catching. - docs: Document SNMP trap catching. - docs: Fix formatting of master/slave network errors section. 05Nov05: - apctest: Remove useless deletion and recreation of lock file. - snmp: SNMP strings are not NUL terminated. Treat them accordingly. - snmp: Don't claim to support CIs that we don't populate. - snmp: Regenerate *-mib-mgr.c and *-mib.h files with smidump-0.4.3. - snmp: Fix heap corruption bug in powernet_check_comm_lost(). - snmp: Generate events during commlost handling. 29Oct05: - m/s: Convert is_ups_foo() to ups->is_foo(). - m/s: C++ compatibility fixes. - Add a few set_foo(bool) methods plus a few missing is_foo() methods. 26Oct05: - docs: Fix page numbers in the index. - docs: Fix multimon section and a few other details in the surrounding area. 18Oct05: - bsd-usb: Workaround for compile failure on FreeBSD <= 4.7. - bsd-usb: Fix a subtle bug in pusb_ups_check_state() which was pointed out by a compiler warning. - usb: Make all pusb_* functions return int and thus match their prototypes in usb.c. Previously some functions were defined to return bool but declared to return int in usb.c. This led to bizarre return value corruption on FreeBSD. Eventually all boolean type returns should be bool, but that change is better done all at once. 16Oct05: - docs: USB updates suggested by Mark Martinec. - docs: Fix typo in web target. - docs: Fix first round of major LaTeX bugs. There are many more such as undefined references and overfull hboxes, but this is a step in the right direction. - docs: Second run of latex should be on apcupsd.tex not manual.tex. On its own, manual.tex is just a massive stream of syntax errors. - docs: Add missing \\. - docs: Fix undefined and redefined symbols. - docs: Kill blank lines after \begin{verbatim}. 12Oct05: - docs: Move common latex2html flags into a variable so html and web targets do not accidentally differ. (Previously -t was not specified for html target). Also run apcupsd.html thru a sed script to remove references to "apcupsd.html" and thus allow the file to be renamed at will. Copy final html output into manual.html to maintain an archived copy of the generated output. 10Oct05: - Rewrite the UPSCABLE description to hopefully eliminate the common mistake of thinking the cable model numbers were listed in columns by type. Also clean up some of the config directive descriptions and add some blank lines to improve readability. - docs: Fix up some links to the Win32 section. 24Sep05: - Update examples/snoopdecode.c to latest version and add to Makefile. - Add SmartUPS serial protocol simulator 'smartsim' to examples/ directory. - Do not clear_onbatt_msg() when shutting down. This just causes a redundant "On Battery" event. - apcsmart: Convert do/while loop to a regular while loop in UPSlinkCheck(). The do/while form is harder to read and doesn't add any value. - apcsmart: Remove pointless check in apcsmart_ups_get_capabilities(). - apcsmart: Fix commlost deadlock caused when locking was added to NIS code. We have to drop the UPS lock in UPSlinkCheck(), otherwise NIS is blocked until the link comes back up. Also fix timing bug which caused commlost events every 20 seconds instead of every 10 minutes. To do that, rewrite the event loop to not depend on the timing behavior of getline(). - Fix TV_DIFF_MS macro. - apcsmart: Fix excessive startup delay: Don't probe for commands where ups->UPS_Cmd[i] == 0. 18Sep05: - Be careful not to close trace_fd while daemonizing. - Add example {on,off}battery scripts that scale CPU frequency down to save power when UPS is running on battery. Requires linux-2.6.x kernel with cpufreq support and compatible CPU. Inspired by Paul Devriendt's talk at OLS 2004. 17Sep05: - Use fast polling when battery is disconnected. This minimizes the battery reattach delay. - Process actions immediately after volatile poll in addition to after a state check. This allows transitions caught by polling to be acted upon without waiting thru another state check interval. - Remove debounce logic. The USB debounce code was vestigial since the big USB changes went in. The SmartUPS code actually interfered with proper operation of ONBATTERYDELAY, causing powerfail and onbattery messages to be generated ~2 seconds apart instead of whatever the user configured via ONBATTERYDELAY. - USB: Fix selftest detection on RS 1500 models. Delay slightly before reading APCLineFailCause because this usage apparently is not valid immediately after power failure. Also disable CI_ACPresent when CI_Discharging is available because the RS 1500 reports (Discharging=1 && ACPresent=1) during self test, which confuses Apcupsd. 15Sep05: - USB: Work around spurious BatteryPresent=1 bug in RS 1500 firmware. 13Sep05: - manpage: Default STATUSPORT is 3551. Manually editing cgi is no longer required when changing the port. 7Sep05: - Fix set_online(int) modifier to change both UPS_online and UPS_onbatt like the regular set_online(void) does. Eliminate future ocurrences of this bug by writing all set_foo(int) modifiers in terms of set_foo(void) and clear_foo(void). - Reorder device loop contents so do_action() is invoked early to handle preexisting conditions instead of waiting thru a device_check_state() period first. The overall order of operations is unchanged; only the loop entrypoint has shifted. - Add BATTDETACH and BATTATTACH events which are triggered by changes in the UPS_battpresent flag. - USB: Fix the battlow FIXME by performing status bit updates the way the USB driver used to, namely by clearing the APC part of the status word and then setting bits based on CIs. Note that this technique requires a locking change in apcstatus.c to solve the NIS race condition seen with the old USB code. - NIS: Lock the UPS structure for reading in output_status(). Otherwise a client can get corrupt NIS data if the driver is in the middle of updating a field. This is particularly troublesome for the net driver. 6Sep05: - USB: Update APCLineFailCause interpretation in USB driver with info from APC. - Add XFER_FREQ to represent transfers due to input frequency out of range. - Remove individual UPS_prev_onbatt and UPS_prev_battlow bits in favor of a generic status bit change detection mechanism. 3Sep05: - CGI: Teach multimon about NOBATT and make buffer length tracking in parsefield() less prone to errors in the future. - USB: Make volatile data debug output consistent. - USB: Set status bits directly from USB data so UPSINFO follows the hw state. 2Sep05: - CGI: Fix a few instances of "sizeof(pointer)" caught by g++ on OpenBSD. 1Sep05 - SNMP: UPSINFO::G[] and UPSINFO::X[] to enum conversion. - CGI: Fix C++ compilation. - Kill unused (or nearly unused) fields from class UPSINFO. Also remove unused structs while we're in the neighborhood. 31Aug05 - USB: Make older gcc happy by not introducing a local variable in the middle of a switch statement. - USB: My RS 1500 models seem to return APCLineFailCause=8 for transitions due to utility power failure. Update return value decoding to account for this. - hid-ups: Name usage 0xFF860052 as APCLineFailCause. - Convert UPSINFO::G[] to LastXferCause enumeration and eliminate the need for core code to know about last xfer CIs. - Kill off UPSINFO::X[], replacing it with enum SelfTestResult. - Add support for tracking battery presence via new NOBATT status flag. 30Aug05 - Rephrase comm{ok,failure} messages to not assume a serial port connection. - USB: Add CI_APCLineFailStatus support. This allows apcupsd to distinguish battery transitions due to self test from those due to utility power failure. - Increase self test grace period to 20 seconds (from 12) to accomodate lengthy USB event hysteresis imposed by the UPS. - USB: Set self test result string. - USB: Fix excessive unlocking bug in pusb_ups_check_state(). - NET: Fix minor copy-n-paste error in net_ups_read_volatile_data. 23Aug05 - USB: Use CI_RETPCT instead of CI_APCDelayBeforeStartup which is not only cleaner but also causes RETPCT to be properly reported. 18Aug05 - Fix powerflute SIGALRM timer on Solaris by reinstalling signal handler whenever the timer expires. 15Aug05 - Increase inter-URB delay to 20 msec as per 3.10.18. - Fix powerflute compilation on Solaris by preferring ncurses/*.h headers over include/*.h when both exist. - C++ fixes for compilation on Solaris. - BSD and Linux USB rework to report events via callback. 08Jul05 - Bump version number and date - Back-port inter-URB delay lockup fix from Branch-3_10_17 - Significantly rework USB driver event and poll handling. More cleanup to come, and BSD driver still needs update. 22Jun05 - bsd-usb: compile fix - linux-usb: Filter duplicate reports in pusb_ups_check_state(). - linux-usb: Strengthen CI <-> usage association - linux-usb: Only exit event read() loop when an 'important' CI is processed - Add a parameterized version of set_battlow() and make use of it. - linux-usb: Add some more 'important'-looking events 08Jun05 - Retroactively create my own techlog 07Jun05 - Rename mainsback.in to offbattery.in so default power loss/return actions are symmetrical. - Fix bsd-usb build on FreeBSD-4.11 by allowing Makefiles to add their own include flags via EXTRAINCS. - Exclude HPUX from signal recursion 31May05 - Code style normalization. 19May05 - C++ cleanliness fixes in libusbhid 27Apr05 - Merge hidu_set_report bug fix from Branch-3_10_17. 24Apr05 - Make apctest work with empty DEVICE setting for USB driver. 22Apr05 - Merge BSD UHCI lockup fixes from Branch-3_10_17. 04Apr05 - Remove trailing commas in enum declarations to make AIX 5.1 + VACPP 6.0 happy. 29Mar05 - Make SNMP missing SNMP libs cause ./configure fail - Remove references to serial port in comms lost/restored messages in apccontrol.in since in UPSes may be connected by other means (USB, net, etc.). - More unsafe string conversions. strcpy -> astrncpy and sprintf -> asnprintf. 22Mar05 - Convert some potentially unsafe string functions to apcupsd safe versions. None of the usages were actually unsafe, but this change pacifies OpenBSD and prevents future bugs. apcupsd-3.14.10/doc/techlogs/adk-3.130000664000076400007640000000033010365315540015642 0ustar adk0212adk0212 Technical notes on version 3.13.0 Adam Kropelin General: 23Jan06: - Add gapcmon courtesy of James Scott Jr - Merge generic-usb driver from Branch-generic_usbapcupsd-3.14.10/doc/techlogs/kes-3.110000664000076400007640000000441010342363077015671 0ustar adk0212adk0212 Technical notes on version 3.11.0 Kern Sibbald General: 26Nov05 - Update the version - Cleanup errors in the uninstall script - Remove a few MessageBoxes that annoy on Win98 - Set default UPSTYPE to apcsmart (was smartups) - Add examples to installer script. - Try to remove all files on uninstall. - Add "missing" installer macro files. - Implement NSIS installer. It can be downloaded from: http://sourceforge.net/projects/nsis/ I'm using version 2.0, but the latest one is 2.11 - Create winapcupsd.nsi.in file in src/win32 directory. - Modify configure.in to generate winapcupsd.nsi file. - Remove most of the old ServiceHelper code. It is not used, and creates problems on remote logins. - Add nagios plugin contributed by Christian Masopust. - Add all the new cygwin 1.5.18 binaries and the dll. - Eliminate some compiler warnings. - Make the old make binary-release work. - Implement a new target for building the NSIS installer. ./configure (options...) make cd src/win32 make winapcupsd.exe 26Jun05 - Correct compiler warnings in cgi for g++ 4.0 13Jun05 - Make /usr/share/man the default man directory. - Require C++ compiler and use full path. 12Jun05 - Renamed: apcdevice.c device.c apcreports.c reports.c apcaction.c action.c - Added set_replacebatt(value) and set_shutdownimm(value) 11Jun05 - Renamed: apc_defines.h defines.h apc_struct.h struct.h apc_drivers.h drivers.h apc_nis.h nis.h apc_extern.h extern.h - Replace all old bit set/tests with methods. There are a few exceptions to this (multimon.c, ...) generally where status bits from the network are being examined. 06Jun05 - Implement trace to file with -T option. - Convert all set/clear/test of Status to method accesses. There are some inconsistencies that must be resolved. - Eliminate apc_version.h by combining it with version.h 01Jun05 - Get rid of old forking code. - Start conversion of Status word to method accesses. 15May05 - Convert the core code to be compiled by C++. Most of it was already done. - Modify the UPSINFO structure to be a class so that I can add class methods for accessing some of the variables (status bits). 05Apr05 - Move kes-3.10.17 to new 2005 directory (keeps techlogs cleaner). apcupsd-3.14.10/doc/techlogs/2001/0000775000076400007640000000000011634011372015160 5ustar adk0212adk0212apcupsd-3.14.10/doc/techlogs/2001/kes03Aug010000664000076400007640000000226007612516665016646 0ustar adk0212adk0212 Technical notes on version 3.9.3 03 August 2001 Kern Sibbald General: - Improvements in master/slave timeout detection and error messages. - New master connect/disconnect events (accontrol). - Additional master/slave documentation. - Document USB. Changes submitted this submission: - Create new events "masterconnect" and "mastertimeout", which are triggered when a slave detects that the master has connected and timedout respectively. - Add mastertimeout and masterconnect scripts to etc. - Cleanup the POWERFAIL file write as suggested by Neil. - Add additional detail to master/slave error messages (in many cases the errno is now printed). - Implement select() on accept() and on read() in master and slave to permit timing out master/slave. - Implement CommLost status for master/slave communications. - Fixed SuSE start/stop symbolic linking. - Implemented a generic apccontrol, which is placed in the distribution directory. If a platform wants a customized version (openbsd, freebsd, sun), simply place the apccontrol in the platform subdirectory and ensure that configure.in knows which one to make. apcupsd-3.14.10/doc/techlogs/2001/kes05Sep010000664000076400007640000000063707612516665016671 0ustar adk0212adk0212 Technical notes on version 3.8.3 05 September 2001 Kern Sibbald General: - Changed OpenBSD to use -pthread rather than -lpthread on compiles and links as suggested by Adam Kropelin. - Made the above change to NetBSD -- hoping it will work. - Merged the latest version of the manual (it has a bit of 3.9.x stuff). Changes submitted this submission: apcupsd-3.14.10/doc/techlogs/2001/kes11Aug010000664000076400007640000000235607612516665016653 0ustar adk0212adk0212 Technical notes on version 3.9.4 11 August 2001 Kern Sibbald General: - Added Makefile to examples directory - Modified main Makefile.in to do clean and distclean of examples - Additional documentation. - Major bug fix to USB driver. - Removed the sleep 2d from the RedHat halt script. Changes submitted this submission: - Added Makefile.in to examples directory. Updated configure.in and Makefile.in to handle it. This does a clean, distclean as well as builds the sample programs. - Removed the sleep 2d from the RedHat halt script as well as the exit. This should allow the script to run to completion and properly shutdown any raid devices. Other platforms to be done. - Lots of documentation, more to be done. - Started adding Dmsg (debug print code) to apclog.c. Not yet complete. - Removed some 4.0 code from apcstatus and apcaction. - Fixed a major bug in the USB driver. I had done extensive testing, but always with a slave machine, forgetting that the path was different on the main machine. Fixed the read_usb_ups() routine to return when the event is read allowing apcaction to do his work. Added a few additional small details. - Updated the version. apcupsd-3.14.10/doc/techlogs/2001/kes12Nov010000664000076400007640000000247307612516665016702 0ustar adk0212adk0212 Technical notes on version 3.9.7 12 November 2001 Kern Sibbald General: - These are my changes to the sychronization code that Riccardo sent me 31 October. Changes submitted this submission: - Eliminated the get_raw_upsinfo() from apcaccess for the status command because it was byte order and apcupsd version dependent. I replaced it using the network "status" command. However the get_raw_upsinfo() is still used for the eprom option since it requires an enormous amount of information to work. With a little more work, I may be able to eliminate the rawupsinfo command. - Modified apcacces to assume that the "status" option was given if no option is specified. Thus apcaccess produces the status output. - There was a difference of coding convention between what Riccardo and I did for the drivers concerning the return status. I have changed from the old Unix style 0 meaning success to 0 meaning failure and 1 meaning success. This allows for much more readable code. As a consequence, I modified the return values for a number of drivers. - I deleted apcupsd.conf from the main source directory. - I corrected some minor problems in the distributions/sun apccontrol.sh.in script (new events and new script arguments). apcupsd-3.14.10/doc/techlogs/2001/kes16Sep010000664000076400007640000000275107612516665016672 0ustar adk0212adk0212 Technical notes on version 3.9.6 16 September 2001 Kern Sibbald General: - Pulled in the latest copy of the manual, which corrects a number of errors reported by users. - updated all the halt scripts in the distributions script to remove the sleep commands after the killpower. This will allow the halt script to run to completion and to synchronize any raid devices (often done in the final steps by the kernel). - applied the RedHat apcupsd.spec patch supplied by Giulio Orsero. - Made quite a few changes to the master/slave code so that it will reconnect in case of an error. It also sets a bit in Status when the slave is down, and polls the slave more frequently attempting to connect. Changes submitted this submission: - Modified calling sequence to the device self check to eliminate the time argument. This simplifies the code slightly. - If a slave is marked DOWN, after 2 minutes, attempt to bring him back up on the next poll. - Applied pthread link fix reported by a user for netbsd and openbsd. - Fixed a bug in apctest where the kill power test would not work because of the powerfail file was not created. - Removed all the sleeps from the halt scripts as noted above. - Added a new subdirectory to doc named jobs, which contains the job descriptions. - Reworked the self test message code in the Smart driver a bit. - Added locking code to linux-usb.c to correspond to new driver requirements. apcupsd-3.14.10/doc/techlogs/2001/kes18Dec010000664000076400007640000000135407612516665016636 0ustar adk0212adk0212 Technical notes on version 3.9.8 18 December 2001 Kern Sibbald General: - Hopefully, I merged in to 3.9.8 all the fixes that I made to 3.8.4. I'm not 100% sure because a general diff is not possible due to the new directory structure. Changes submitted this submission: - Copied the latest version of the 3.8.4 manual. - Included all the fixes that I made to the distributions directory for 3.8.4 (lock file directory fixes and the exec in apcccontrol) - Included the lock file search fix for version 3.8.4 made to configure.in - Included the fixes to the cgi directory made in 3.8.4 - Included all the last 3.8.4 techlogs - Moved 3.8.4 techlogs into a 3.8.4 subdirectory. apcupsd-3.14.10/doc/techlogs/2001/kes19Oct010000664000076400007640000000277307612516665016677 0ustar adk0212adk0212 Technical notes on version 3.9.6 19 October 2001 Kern Sibbald General: - Many improvements and enhancements to the manual. - Generated PDF version of the manual that can be found in /doc/manual/apcupsd.pdf - Tested Smart UPS, USB UPS, and Dumb UPS successfully. - Implement a smtp program to permit email messages from WinNT/Win2000 machines. Changes submitted this submission: - Corrected a bug in multimon reported by a user that prevented display of Temperature in Farenheit. - Added code for APC Smart-UPS 370Ci as provided by a user (slightly modified). - Modified the dumb driver to work correctly. This code needs additional testing/checking as I did not have the time for a full audit. - Added a few changes to the new net driver that interfaces to an NIS server. Much work remains to be done to get it working properly. For the moment, it is in Riccardo's hands. - Added the build date to apcupsd.conf.in - Created a simple program in the examples directory called upsapm.c, which returns the string as expected by the kernel for an APM device. The format of the string is the same a found in /proc/apm. This program allows the user to run the Battery applet and have it report the status of his UPS. - Wrote an smtp program that allows sending of email messages. This program will work in a service context on WinNT and Win2000 machines, as well as everywhere else. - Updated the win32 examples to use the smtp program. apcupsd-3.14.10/doc/techlogs/2001/kes22Nov010000664000076400007640000000362507612516665016703 0ustar adk0212adk0212 Technical notes on version 3.9.8 22 November 2001 Kern Sibbald General: - Pulled in the latest copy of the manual. - Applied the changes as submitted by Carl Erhorn for Solaris. Most I pulled from Riccardo's integration into 3.9.7. - Updated the version and date. Changes submitted this submission: - Applied a casting fix to apcnisd.c reported by the SCO user. - Added NETWORK_UPS to the case statements in apctest, apcreports, and apcstatus. This was the principal problem with the NIS network driver. - Made some small updates to the Solaris configure.in changes so that sbindir is correctly set. - Created an SCO subdirectory in distributions. This is just the very beginning please don't look at the code yet. - In manual separated the Shutdown documentation into a separate chapter for people who are porting. - Made a quick pass through the new network driver. Most everything was done. Here are the minor changes I made: - sorted the translation list to make it easier to find the entries - Added the remotedown flag so that the slave will be shutdown when the master goes down. - Added a few more debug messages which could be removed now. - Optimized fill_status_buffer() so that it does it at most once a second. - Used atof() on most of the input because even though they are stored as integers, they are passed over the net as decimal numbers. - used strtol() to get the status word, which is actually in hex. - Deleted a number of variables that should be locally set rather than pulled from the master. - Fixed a bug in apcipc.c (non-fatal) found by the compiler on the SCO. We need to think about the proper way to set CABLE and UPSMODE in the status output for a new network driver. I think we should probably just force them to something reasonable rather than take what the master publishes. To be decided. apcupsd-3.14.10/doc/techlogs/2001/kes26Sep010000664000076400007640000000234007612516665016665 0ustar adk0212adk0212 Technical notes on version 3.9.6 26 September 2001 Kern Sibbald General: - Pulled in the latest copy of the manual, which should significantly reduce support requests because I put the Models, Cables, and OSes supported into the index. Changes submitted this submission: - Changed the name of drivers/apcdrivers.c to drivers.c (no changes to drivers.c), also changed a few of the defines in the Makefile. - Added code to the apcsmart driver to set the RTS bit on the 0095 cables for the BackUPS Pro models. This enables Smart mode on those UPSes. It seems a bit odd to be using ioctl() for Smart models, but that is apparently what is needed. - Removed the code in dumb_close() that reset the port parameters to conform 3.8.x code. This prevents unexpected power off conditions. - Added new code to dumb_close() that clears the kill_power bit. This will prevent the serial port from possibly triggering a power kill later. - Corrected an error message (flagged as incorrect by Riccardo) in dumbsetup.c. Note, I have compiled and reviewed my changes, but they need testing, which I will do when I receive the merge that Riccardo has prepared. apcupsd-3.14.10/doc/techlogs/2001/kes28Oct010000664000076400007640000000263207612516665016671 0ustar adk0212adk0212 Technical notes on version 3.9.7 28 October 2001 Kern Sibbald General: Changes submitted this submission: - moved some device specific fields previously in the UPSINFO structure into the driver_internal_data location (defined structures for USB, APCSMART, and DUMB drivers). - Added "debounce" code to wait 6 seconds between issuing the "Power problem detected" message and the "Power failure" message. This will prevent annoying messages for short power interruptions. The old 3.8.2 code worked this way because we previously blocked on a select() for 5 seconds. This no longer worked in 3.9.x because I changed to a slow select() of 60 seconds, and a fast select() of 1 second after any power problem. - I cleaned up the apcstatus.c code that was referencing the ioctl bits (and so removed the #warning message). In the process, I did a bit of cleanup of simple signalling code. When we switch to using the Status word, we will be able to simplify a lot of code! - Enhancements to the document (ANNOY documentation, runtime calibration documentation) - Make USB driver detect different UPS and reset static data. - Increase number of events that are saved and reported from 10 to 50. - Modified USB code to signal that the USB connection was lost only after 2 retrys of 5 seconds each. This should reduce the noise level a bit. apcupsd-3.14.10/doc/techlogs/2001/ric07Aug010000664000076400007640000000012607612516665016644 0ustar adk0212adk0212- Added generic symlink installation in distributions/ - Cleanups of main Makefile.in apcupsd-3.14.10/doc/techlogs/2001/ric15Sep010000664000076400007640000001166107612516665016664 0ustar adk0212adk0212LOG - Corrected a mayor bug in test_status_bits(): here we change the values inside UPSINFO but we don't lock/unlock and this caused these values to get lost at the next read_andlock_shmarea (where we do memcpy from the shared area overwriting the local copy). Now do read/write_andlock_shmarea around the function. - Selftest may return "NA and get Status may return "SM". These errors were not handled causing apcupsd unpredictable behavior. Now in case it happens, we retry up to 5 times to get the correct values from firmware. - Written generic code for attaching the drivers. New config directives for generic UPS types (backward compatibility for old specific types). - Now after attempting to cancel a shutdown -h, force a shutdown -r - Commented out the SelfTest code into the apcsmart as now we use a driver entry point from apcaction. - Added Kern's patch for depend and debug levels. - Added entry points to allow for core calls to particular driver functions. - Applyed Kern's patch: .removal of unused var in kill_power .compiled driver list on not-present driver .core dump solved, patch modified by me so that ups->driver checks are inserted in all preprocessor macros .apcsmart and dumb drivers enabled by default, usb driver disabled by default (slightly modified form of Kern's patch). .install-symlinks.sh must not exit with exit code 1 if distribution is not handled. - Removed the WARNING msg about eeprom programming (kept the compiler warning). - Added device entry point for specific device commands called from inside the core apcupsd. - Added pre-compiler macros for hiding the internal device calls. - Started the drivers/ project - Moved ups-specific code in drivers/ - All the tricky code is commented with the C pre-processor #warning directive so that at compile time the positions where the code needs to be reimplemented differently are well defined and visible. This is dependent on GNU gcc but as we are developing the code it seems to be a minor issue. On the way, these warnings will disappear. - Glued everything together, but almost all the code is the old code splitted: it compiles and runs. - linux-usb driver does not compile on plain linux kernel (patches are on the road from Alan Cox. - Fixed a major bug in drivers/apcsmart/smart.c:getline() (this bug may also be present in previous versions of apcupsd). This bug caused very high delays in UPS state change notifications to the core. - I could not test the USB driver as I don't own an USB UPS. - smart UPS is working (no changes to the configuration file) at least at the point where it detects power failures. - USB driver compiles. - Moved test_status_bits() in the core apcupsd. - Reorganized the developers documentation inside an HTML manual. Needs editing as this manual was written for the retired 4.x code (but is still current for many of its parts). - Removed check_serial() and read_dumb_ups(), substituting the code with drivers code. - Removed the tmp trick inside drivers for library build. Now it builds and check dependancies correctly. NOTES The drivers project is built on a number of rules: 1. Drivers must be re-entrant 2. A single driver can drive more than one connected UPS 3. A single UPSINFO structure must be driven by one single UPS driver 4. Glue between UPSINFO and DRIVER structures is a pointer inside the UPSINFO structure 5. Any DRIVER function must return a value or not return at all (bail out). This rule is transitory as with time all the functions will return even on error and bailing out will be done by the core code. Right now what is preferred is a simple move of the code from core code to drivers. IMPLEMENTATION choices - Entry points were added: they are needed to keep the old functionality but they will go away as soon as we reduce the coupling between drivers and core. - Always, when accessing ups->driver, a NULL ptr check is done. - A special entry point in the driver has been implemented for reaching special functions inside the driver from the core apcupsd. - oldtio is inside UPSINFO - lock files are created after the open() call. - signals are set up after the lock file has been created. - moved all the apc_chat code from apcaction.c to drivers/apcsmart/* - removed the insane use of variables to store TIOCM_* bit values BUT THIS HAS TO BE TESTED. I did everything to make sure it still works. - moved ups_connected inside the UPSINFO as this is something specific to the driver. - The new DRIVERS layer will add three keywords to the UPSTYPE variable: [ dumb | apcsmart | usb ] Now basing on the UPSTYPE, the correct driver is attached. But in the future the idea is to have only these three driver labels, translating the old ones for backward compatibility to the new keywords. - In future we will turn all the library builds into libtool compilation. This will allow better library handling and as a side effect, will allow to compile shared libraries. apcupsd-3.14.10/doc/techlogs/2001/ric23Sep010000664000076400007640000000043407612516665016657 0ustar adk0212adk0212LOG - Merged Kern's patch 21Sep01. - Reviewed drivers name-space to avoid function name clashes with standard libraries. - Added new slaves code example in examples/ - Added "no-" prefix for drivers that are disabled in configure. - Added the first cut of new network driver code. apcupsd-3.14.10/doc/techlogs/2002/0000775000076400007640000000000011634011372015161 5ustar adk0212adk0212apcupsd-3.14.10/doc/techlogs/2002/dr20Jan020000664000076400007640000000707207612516665016474 0ustar adk0212adk0212From dranch@trinnet.net Sat Jan 19 19:23:04 2002 Return-Path: Received: from trinity3.trinnet.net (w140.z064220150.sjc-ca.dsl.cnc.net [64.220.150.140]) by matou.sibbald.com (8.11.6/8.11.6) with ESMTP id g0JIN0a23790 for ; Sat, 19 Jan 2002 19:23:04 +0100 Received: from dellster.trinnet.net (dellster.trinnet.net [192.168.0.4]) by trinity3.trinnet.net (8.11.6/8.11.0) with ESMTP id g0JIMoQ19901 for ; Sat, 19 Jan 2002 10:22:54 -0800 Message-Id: <4.3.2.7.0.20020119100203.03c8bf00@trinity3.trinnet.net> X-Sender: dranch@trinity3.trinnet.net X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Sat, 19 Jan 2002 10:14:40 -0800 To: kern@sibbald.com From: David Ranch Subject: Quick graphing question with APCUPSd Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-yC9rWE1hjHgNHKs6bWrA" X-Evolution-Source: imap://kern@lmatou/ --=-yC9rWE1hjHgNHKs6bWrA Content-Type: text/plain; charset=us-ascii; FORMAT=flowed Content-Transfer-Encoding: 8bit Hey Kern, One of my TrinityOS users sent me this graph. Overall, I have NO idea how the Utility ramped up the voltage like that (bizzar) and I've asked for more info. Anyway, the graph is pretty cool though something is really bothering me. Where is the "UPS LOAD" line? It isn't the "magenta" line as that is the BattV line. (I'm working on moving the graph key to some other spot on the graph). Here is some of the data I'm getting from that 700VA SmartUPS using APCUPSd: -- Jan 18 08:59:40 vesta last message repeated 2 times Jan 18 08:59:46 vesta apcupsd[605]: 123.5,124.8,124.1,27.74,60.00,100.0,36.0,,,124.1 Jan 18 08:59:53 vesta apcupsd[605]: 123.5,124.1,123.5,27.74,60.00,100.0,36.0,,,123.5 Jan 18 08:59:59 vesta apcupsd[605]: 122.2,124.1,124.1,27.74,60.00,100.0,36.0,,,124.1 Jan 18 09:00:06 vesta apcupsd[605]: 123.5,124.1,124.1,27.74,60.00,100.0,36.0,,,124.1 Jan 18 09:00:12 vesta apcupsd[605]: 123.5,124.1,124.1,27.06,60.00,100.0,36.0,,,124.1 Jan 18 09:00:17 vesta apcupsd[605]: Power failure. Jan 18 09:00:19 vesta apcupsd[605]: 008.4,124.1,119.6,26.66,60.00,99.0,36.0,,,013.0 Jan 18 09:00:20 vesta apcupsd[605]: Running on UPS batteries. Jan 18 09:00:21 vesta apcupsd[605]: 008.4,013.6,119.6,26.52,60.00,98.0,36.0,,,013.0 Jan 18 09:00:24 vesta apcupsd[605]: 008.4,013.6,119.6,26.39,60.00,97.0,36.0,,,012.3 Jan 18 09:00:26 vesta apcupsd[605]: 008.4,013.6,119.6,26.25,60.00,95.0,36.0,,,013.0 Jan 18 09:00:29 vesta apcupsd[605]: 008.4,013.6,119.6,26.12,60.00,95.0,36.0,,,012.3 -- (sorry for the line wrap (if any)) From this, I gather the data is: IN IN OUT BATT OUT Batt UPS IN V. LOW HIGH V V Hz Char Temp now But at home, I still use Powerchute on a SmartUPS 1400 and I get: -- 01/18/02,07:53:29,120.9,122.8,121.5,54.55,60.00,039.0,037.3, , 01/18/02,07:53:39,120.9,122.2,121.5,54.55,60.00,039.0,037.3, , 01/18/02,07:53:49,120.9,122.2,121.5,54.55,60.00,037.9,037.3, , -- IN IN OUT BATT OUT UPS UPS LOW HIGH V V Hz Load Temp How can I get "UPS load" out of the 700VA unit? Is this a firmware issue on the 700? Is there a set of commands I can use to possibly configure the UPS to give me this output or at least confirm that it cannot give me these details? Ps. At the top of the APCUPSd log, you can see that SYSLOG surpressed a duplicate line. Do you know if there is a way to disable this? Overall, it obviously won't change the graph output but it might be a good thing to tell my users about. --David ----------------- This was a bug. It is fixed in 3.9.8. apcupsd-3.14.10/doc/techlogs/2002/jp09Jan020000664000076400007640000000336307612516665016506 0ustar adk0212adk0212From: Jim Pennino To: apcupsd-devel@apcupsd.org Subject: [Apcupsd-devel] HP-UX bug I'm setting up some HP workstations running HP-UX 10.20 with apcupsd and found a minor bug. This probably applies to HP-UX 11 also, but I don't have access to an 11 machine at the moment to double check. In apc_struct.h there are several declarations (from grep): apc_struct.h: char configfile[FILENAME_MAX]; /* config filename */ apc_struct.h: char statfile[FILENAME_MAX]; /* status filename */ apc_struct.h: char eventfile[FILENAME_MAX]; /* temp events file */ apc_struct.h: char master_name[FILENAME_MAX]; /**/ apc_struct.h: char lockpath[FILENAME_MAX]; /* BSC, made static -RF */ The problem is under HP-UX 10, FILENAME_MAX is defined as 14, i.e. the file name part of a file path, while most other systems define it as the complete file path including name. E.g. on Solaris it is 1024. This causes some really bizarre things to happen when you try to run the code because the code where the definitions are used does not check for overrun of the defined length. For example: apcconfig.c: strcpy(ups->configfile, cfgfile); apcconfig.c: strcpy(ups->lockpath, LOCK_DEFAULT); apcconfig.c: strcat(ups->lockpath, APC_LOCK_PREFIX); Needless to say /var/spool/locks/LCK..tty0p0 doesn't fit too well into 14 characters... On HP-UX, I fixed this (the definition part, not the check for overrun part) by simply changing FILENAME_MAX to PATH_MAX. This probably has other implications for ansi/POSIX/whatever systems that may or may not have a PATH_MAX but will leave the answer to that question to someone more familiar with the standards. Jim Pennino ======= KES: Applied a quickie patch to this in my kes09Jan02 submission apcupsd-3.14.10/doc/techlogs/2002/kam03Jan020000664000076400007640000000346207612516665016637 0ustar adk0212adk0212From: Kamal A Mostafa To: Kern Sibbald Cc: Riccardo Facchetti Subject: apcupsd trimeventsfile patch Date: 03 Jan 2002 19:03:07 -0800 trimeventsfile.patch - provides TRIMEVENTSFILE config parameter etc/apcupsd.conf.in - added "TRIMEVENTSFILE [ on | off ]" parameter and description include/apc_struct.h - added trimeventsfile member to 'struct ups' lib/apcconfig.c - added config parsing for TRIMEVENTSFILE apcreports.c - added code to obey ups->trimeventsfile - moved locking and close/re-open code into truncate_events_file() lib/apcevents.c - BUG: The do_reports() shmarea locking code is still slightly broken -- if truncate_events_file() works but the read lock fails then ups->eventfile will be left in a bad state. Also it occurs to me that truncate_events_file() should manage ups->eventfile in the first place, so I moved the shmarea locking and ups->eventfile close/re-open code into truncate_events_file(). Now, truncate_events_file() is more robust, in that it doesn't require the caller to fiddle with the ups structure afterwards. - truncate_events_file() seems kinda silly in that it first determines whether or not it needs to trim the file (i.e. trunc=TRUE), but even even if it doesn't plan to trim the file, it goes ahead and malloc's a bunch of space, sorts the file as if it were going to trim it, and then ends up throwing it all away again. I changed truncate_events_file() so that it bails out much sooner if it doesn't need to do any work. (Took me longer to describe the change here than it did to fix it! ;-) apcupsd-3.14.10/doc/techlogs/2002/kam05Jan020000664000076400007640000000373707612516665016646 0ustar adk0212adk0212Date: Sat, 5 Jan 2002 21:46:44 -0800 From: Kamal A Mostafa To: Riccardo Facchetti , Kern Sibbald Subject: new EVENTSFILEMAX code Hi Guys- Well, I went ahead and rewrote truncate_events_file() from scratch -- it was a nice file-size-based thing that used no malloc's. Alas, while testing it I discovered a rather nasty bug which, I believe, has been present since at least 3.8.4... I was running some tests where I'd fill up the events file to force the new truncation code to kick in. The new code worked fine, but when I killed off apcupsd, I noticed that I didn't get the usual "apcupsd exiting, signal 15" and "apcupsd shutdown succeeded" log_event() messages that should have been at the tail end of the eventsfile. I suspect that the function terminate() is using an old copy of the event_fd file descriptor (which has since been closed) or something along those lines. As I see it, any truncation scheme which closes and reopens the ups->evend_fd would cause this problem. Maybe truncation screws up the forked children or threads also. Bummer. So I rewrote it again. My new trim_eventfile() doesn't ever close the ups->event_fd -- that's probably just "better" anyway. The basic premise is rewind, read, rewind, truncate, write. And sure enough, now I get the "exiting" messages even after the file has been trimmed, so I think all is well. *Whew* I'm sorry I ever started poking at it in the first place! ;-} Anyway... The new version replaces the TRIMEVENTSFILE [on|off] param with "EVENTSFILEMAX ". I've attached two versions of the patch. Use one or the other, depending on whether you have or haven't already applied my previous TRIMEVENTSFILE patch. apc.evmax-398.patch -applies to apcupsd-3.9.8-18Dec01 apc.evmax-kamal.patch -applies to TRIMEVENTSFILE version Comments? =================== KES: Integrated 9Jan02 there were a number of rejects due to space/tab mangling. apcupsd-3.14.10/doc/techlogs/2002/kes02Jun020000664000076400007640000000372607612516665016677 0ustar adk0212adk0212 Technical notes on version 3.9.10 2 June 2002 Kern Sibbald General: - Made shared memory implementation use shared memory pointer rather than copying. - I did not test the master/slave code under the new scheme. - The tab characters in a number of files had been removed, so the diffs for some files are larger than really necessary. Use diff -b if you want to see the real differences. - The Makefile dependencies are not correct. E.g. changing apc_extern.h will not cause all the appropriate files to rebuild. I did not fix this. Changes submitted this submission: - Modified the ./configure process so that the output summary report is saved in config.out. Thus at a later time, you can see how apcupsd was configured. - Corrected a problem with configure.in where the AC_DEFINE(HAVE_CYGWIN) was inside a test rather than at the top level. - Removed the install of the examples. This is something important to have in the source, but it should not be loaded into the system files. - Removed an inappropriate #ifdef in hid-ups.c. This prevented it from building properly. - Major cleanup and reorganization of the shared memory implementation. The shared memory image is no longer copied to local storage but referenced directly by the shared memory pointer. This makes the shared memory scheme much more similar to the pthreads implementation. - Added a number of write_lock(ups) that were missing. - Eliminated read_shmarea() and write_shmarea(). Use memcpy() if you need to do this. - NOTE!!! init_ups_struct() must NOT clear memory as the shared memory structures or the pthreads structures are already setup. - The test for no NISIP configuration statement was incorrect causing apcupsd to always report an error. I fixed it. - The test for NISIP was placed before the attach to shared memory in apcnis.c, which means it would not have worked on a shared memory configuration. I corrected this. apcupsd-3.14.10/doc/techlogs/2002/kes08Nov020000664000076400007640000000137107612516665016705 0ustar adk0212adk0212 Technical notes on version 3.10.2 08 November 2001 Kern Sibbald General: - New cable design for BackUPS CS models to run it in Smart serial mode. - Corrected a major bug in the smart and net code where the status word was getting clobbered. Changes submitted this submission: - A few days ago, slither_man sent me an email with some information on how to run a BackUPS CS in smart mode with a serial cable. He found the information by assuming that the UPS supported Smart mode and through trial and error. Well, it works!!!!!!! Amazing!!!! Thanks slither_man. - Documentation for new CUSTOM-RJ54 cable that can be constructed from the end of an ethernet cable and a DB9F connector. apcupsd-3.14.10/doc/techlogs/2002/kes09Jan020000664000076400007640000000123607612516665016654 0ustar adk0212adk0212 Technical notes on version 3.9.8 08 January 2002 Kern Sibbald General: - Integrated the OpenServer patch sent to me by Riccardo, who had integrated the submission by Kamal. - Integrated Kamal's enhancement of his previous work to truncate the events file. Changes submitted this submission: - Based on a user input (Jim Pennino), I added a patch that ensures that if FILENAME_MAX is less than 50 it is set to 256. On HP it is 14, and we use it for our maximum pathname length. - Modified a few apccontrol.sh.in files in the distribution directory to be stamped with the apcupsd version number. apcupsd-3.14.10/doc/techlogs/2002/kes11Dec020000664000076400007640000000217107612516665016627 0ustar adk0212adk0212 Technical notes on version 3.10.3 11 December 2001 Kern Sibbald General: - Tried to correct problems with Makefiles - Thanks to David Walser who pointed out where on the Sun, the make install was doing terrible things -- I found that there was a missing semicolon in the new Makefile. Before my previous cleanup, there were actually 4 missing semicolons. Hopefully this will correct the problem. - For a second time, David Walser came to the rescue finding the CGI install problem reported by lots of people. The new code used "make" instead of $(MAKE) to call the CGI make. Fixed. Changes submitted this submission: - Removed Makefile code that creates and sets permission bits on /tmp $(prefix) and $(exec-prefix) - Removed all occurrences of -z in the Makefiles (at least that I found) and replaced them with a more conservative formulation. - Removed the install-symlinks script that caused some problems on distributions with blanks in the DISTVER name. - Added install-symlinks to the suse Makefile.in. This is the only platform that currently uses it. apcupsd-3.14.10/doc/techlogs/2002/kes15Jul020000664000076400007640000000146607612516665016700 0ustar adk0212adk0212 Technical notes on version 3.9.10 15 July 2002 Kern Sibbald General: Changes submitted this submission: - Based on recent emails concerning the cable wiring for the 940-0128A cable, I updated the document and did some testing. - Modified apctest to perform a shutdown test for USB UPSes. - Removed the device_close() statements from kill_power() as they should not be there. - Removed the generation of the reboot for dumb UPSes after a kill power. Previous comments indicated that they should be removed, and now they are commented out. This change is essential for the apctest code to work for a USB UPS. - Made another attempt at getting USB kill power to work. I've left a good deal of debug code in the source -- until it all works. apcupsd-3.14.10/doc/techlogs/2002/kes16May020000664000076400007640000000062407612516665016670 0ustar adk0212adk0212 Technical notes on version 3.9.9 16 May 2002 Kern Sibbald General: Changes submitted this submission: - Removed hid-ups from the default files built in the examples directory because it only builds on Linux machines. - Tweaked src/win32/winmain.cpp to ensure that the main thread is signaled to shutdown if the main Windows loop stops. apcupsd-3.14.10/doc/techlogs/2002/kes22Jan020000664000076400007640000000260707612516665016652 0ustar adk0212adk0212 Technical notes on version 3.9.8 22 January 2002 Kern Sibbald General: - Merged in changes sent by Riccardo and by Kamal ric05Jan02 ric13Jan02 kam03Jan02 kam05Jan02 Actually Riccardo did a lot of the merging. I've sort of lost track. - See also dr20Jan02 and mb07Jan02 - Significant changes to the usb driver to handle the SmartUPS in usb mode. - Copied over the latest tech logs from 3.8.5. Changes submitted this submission: - Made apctest build on Win platforms. - Apcupsd now needs -lm option because usb driver uses the pow() function to do proper unit scaling. - Added wait_time to the UPSINFO structure which gives an indication to the driver of how much time to wait. This takes a bit of calculation (see apcdevice.c) because of data and status reports that my have faster times. The driver can still adjust this time if necessary, as the DUMB and NET drivers do. - Enhanced the data logging to include Ambient temperature and humidity as well as correct a wrong value. - Added some new status word bits: UPS_SHUTDOWNIMM UPS_BELOWCAPLIMIT UPS_REMTIMELIMIT They remain to be implemented. - Moved a good part of the USB specific capability arrays into the USB driver. We could do likewise for other drivers. - Pulled over the French translation of the messages from 3.8.5 - Updated the version to 3.9.8-22Jan02 apcupsd-3.14.10/doc/techlogs/2002/kes27Jan020000664000076400007640000000070007612516665016647 0ustar adk0212adk0212 Technical notes on version 3.9.8 27 January 2002 Kern Sibbald General: - Corrected a bad net.c file reported by Riccardo. Changes submitted this submission: - Updated the manual from version 3.8.5 to 3.9.8, and added a few changes. - Updated apctest to contain latest 3.8.5 Runtime Calibration changes and to recognize USB, but print error message. Not tested. - Update ChangeLog apcupsd-3.14.10/doc/techlogs/2002/ric05Jan020000664000076400007640000000114507612516665016642 0ustar adk0212adk0212- Merged SCO OpenServer specific changes. - Changed gethostname test to check in different libs. - Customized syslog test to detect syslog even if it is a macro. - ifdef'ed #warning only for HAVE_GCC compiler. - In distributions/Makefile changed apccontrol installation so that if /apccontrol.sh exists it install the customized script instead of the standard one. - Added HAVE_OPENSERVER_OS in autoconf/acconfig.h so that it can be used inside C sources too. - Corrected a test "else if fi fi" in "elif fi": bad nesting in configure.in due to OpenServer patch. - Bumped version date to 5 Jan 2002. apcupsd-3.14.10/doc/techlogs/2002/ric13Jan020000664000076400007640000000040607612516665016640 0ustar adk0212adk0212- SCO OpenServer syslog() handling at config time - Work around for FILENAME_MAX definition. Now we have an APC_FILENAME_MAX. We check for all the known standard definitions and if we find one suitable for use we use it, if not we use a static value of 256. apcupsd-3.14.10/doc/techlogs/2003/0000775000076400007640000000000011634011372015162 5ustar adk0212adk0212apcupsd-3.14.10/doc/techlogs/2003/RN-3.10.60000664000076400007640000000464107753141773016174 0ustar adk0212adk0212 Release Notes for Apcupsd 3.10.6 General: This new release has been in the works for over two years, and it represents a significant and fundamental change in apcupsd due to the efforts of Riccardo Faccetti that is the addition of UPS drivers allowing apcupsd to be more easily adapted to different UPS architechtures. Changes since apcupsd 3.10.6 - Integrated Alexander Schremmer's stdout fix for Windows -- keeps debug printout from being sent to the serial port. - Bob Kuo found a bug that caused a seg fault for newer USB UPSes. The error was that my code walked off the end of a table in linux-usb.c if the USB code was not in the table. Major Changes since version 3.8.6 this Release: - The manual has been totally rewritten/reorganized by Eric S. Raymond. Thanks. - Support for USB UPSes. - Full kill power for USB UPSes is supported if you have a kernel 2.4.22 or higher, or you apply the kernel patch supplied by Sergey Vlasov. See the examples directory. - Version 3.10.6 (as opposed to 3.8.x) has device specific drivers, and thus can have a much smaller footprint by turning off unused drivers and parts of the code. See the new ./configure options. - There is a new networking driver (net) that uses the NIS interface rather than the older master/slave networking. It is very simple to setup, but has certain disadvantages -- for details see the manual - Win32 daemons work much better with a new version of cygwin. - Using a special cable (easy to build), you can run your APC USB UPSes in serial mode. - The apctest program has been enhanced to do EEPROM programming in a much more interactive way than the prior versions. Other Changes this Release: - The rpms now build without being root. - A number of bug fixes. - Support for additional systems, UPSes, and cables. - Support for system gd program rather than older version we supply. - pthreads is turned on by default, and we no longer support the old forking version. We have left the code in case anyone needs it, but there is some fixing to do to make it work. Items to note: !!!!! - The default NIS port has changed from 7000 to 3551. Port 3551 has been officially assigned to apcupsd by IANA. - A number of directive names have changed since 3.8.6, so please check your .conf file carefully, or better yet, rename your old version so that apcupsd will install the new one, then make any minor modifications that you need. apcupsd-3.14.10/doc/techlogs/2003/Release_Notes-3.10.9.txt0000664000076400007640000000321310001554621021174 0ustar adk0212adk0212Apcupsd-3.10.9 Release Notes ************************************************** *This rpm release contains some important changes* ************************************************** The platform designator (rh7, rh8, rh9) has been REMOVED from the package names as this was creating some problems. Hence, you CAN NOT upgrade existing installations with these packages (rpm -U). To upgrade: 1. Backup your configuration files (/etc/apcupsd/apcupsd.conf) "just to be safe." 2. Uninstall the old apcupsd package, ie. rpm -e apcupsd-usb-rh9 If you are not sure what package name is installed do rpm -qa | grep apcupsd 3. Install the new package with rpm -i In addition, the spec file has been reworked to include a platform configuration section at the beginning of the file. To rebuild the SRPM, first install using rpm -i then edit /usr/src/redhat/SPECS/apcupsd.spec (or whatever directory structure your platform uses) to set platform options and select whether to build usb support. You may also pass the defines on the command line as in the past. You only need to specify the platform for RH7.x builds. ************************* *Future Platform Support* ************************* RedHat 9 and perhaps 8 will continue to be supported for the forseeable future. Whitebox Enterprise Linux support is added with this release as I intend to migrate my server (currently RH8) to that platform. I may also continue to provide RH8 packages by setting up a box for that purpose. There is no intent to provide Fedora Core packages as neither one of us wishes to get on that upgrade treadmill, however I expect the SRPM will continue to build on that platform for some time. apcupsd-3.14.10/doc/techlogs/2003/kes-3.10.40000664000076400007640000000360407753141773016433 0ustar adk0212adk0212 Technical notes on version 3.10.4 02 February 2003 Kern Sibbald General: - Added error messages if old master/slave code called. - Reworked the messages for ./configure --help to be aligned and clearer for networking and master/slave - A number of important patches all supplied by Mirko Doelle. - Moved technotes for 2001 and 2002 into respective directories. - Created a new kes-3.10.4 file to which I will append if there are additional changes to 3.10.4. This will reduce the number of release note files. Changes submitted this submission: 28Jan03 - Fixed a lot of problems in the Win32 build (improper #ifdefing, missing prototypes, inet_pton not properly ifdeffed. Header files that are not available, ...) - Modified make distclean to remove CVS directories (or most of them). 21Jan03 - Added error messages if old master/slave code called. - Reworked the messages for ./configure --help to be aligned and clearer for networking and master/slave - A number of important patches all supplied by Mirko Doelle. - Moved technotes for 2001 and 2002 into respective directories. - Created a new kes-3.10.4 file to which I will append if there are additional changes to 3.10.4. This will reduce the number of release note files. 19Jan03 - Fixed hangs in usb driver startup when could not open port by releasing the ups structure lock before the Error_abort calls. Thanks to Mirko Doelle for reporting this. - Fixed the default path for mkinstalldirs from $(topdir) to $(topdir)/autoconf. Reported by Mirko. - Fixed configure.in to always create platform/apccontrol. Previously it was not being created for Debian. Reported by Mirko. - Removed Debian specific installation of apccontrol. Reported by Mirko. - Implemented code to display the apcupsd events with the most recent first. Code sent by Mirko, but I modified it slightly. apcupsd-3.14.10/doc/techlogs/2003/kes-3.10.50000664000076400007640000000127507753141773016436 0ustar adk0212adk0212 Technical notes on version 3.10.5 03 February 2003 Kern Sibbald General: Changes submitted this submission: 03Feb03 - Sanitize messages before passing them to syslog() to avoid %n exploit. - Added an avsnprinf() routine. - Replaced all vsprintf() calls with avsnprintf() to close a master/slave exploit that was published. - Remove awk processing of halt script for Mandrake as suggested by David Walser. 02Feb03 - Corrected --enable-oldnet to be --enable-master-slave as I had intended. Thanks to David Walser for pointing this out. - Added David Walser's apcupsd.spec.in for Mandrake and his changes to configure.in. apcupsd-3.14.10/doc/techlogs/2003/kes-3.10.60000664000076400007640000001776007753141773016445 0ustar adk0212adk0212 Technical notes on version 3.10.6a 30 October 2003 Kern Sibbald General: Changes submitted this submission: 30Oct03 - Integrated Alexander Schremmer's stdout fix for Windows -- keeps debug printout from being sent to the serial port. 28Oct03 - Bob Kuo found a bug that caused a seg fault, which was due to my code that walked off the end of a table in linux-usb.c 03Oct03 Released here - Move the old manual to old_documents and commit the new docbook manual to the CVS. Don't include the web html directory. 28Sep03 - Test net slave mode. It works fine. I made it behave more like a slave, so it shows the last time it contacted the master. - Add MASTER name to status output if device is a slave. - Display last master update if device is a net slave. - Add 10 sec delay before calling apcupsd --killpower it is needed for USB killpower to work right. Why???? - Save old apccontrol when installing a new one. - Replace old UPS_SET() with set_ups() in a number of places. 27Sep03 - Implement autodetect of USB port if no DEVICE given. 14Sep03 - After the upgrade to RH9 with the new autoconf, quite a few things broke. As far as I can tell, it is because autoconf set top_srcdir to ., and since apcupsd exects top_srcdir to be absolute, lots of things broke. Fixed by editing all the Makefiles and switching to topdir. - Had to disable autoheader since it wipes out config.h.in 10Sep03 - Made pthreads default -- lots of problems converting to new autoconf -- it deleted my config.h.in file! 01Sep03 - Fixed bad file descriptor in SO_KEEPALIVE for slave (reported by Derek Battams. - Added informative subject to email onbattery, ... (suggested by a user, thanks -- sorry I forgot who). - #ifdef off IP6 code in inet_pton for platforms that do not have it. 06Aug03 - Added the -s "$MSG" to each of the script files (mainsback, ...) as suggested by Nicholas Robinson. - The dependencies were not being correctly generated, so simplified the code. - Added install: to the include Makefile.in. Lack of it caused problems on OpenBSD. - Changed LINEVOLT to MAINS in apcstatus.c to fix a problem reported by David Walser of CGI reporting zero volts. - Tried to clarify the difference between the net and the master/slave drivers in the doc. 05Aug03 - Because of the complaints about the master/slave code, I finally got around to testing it, and it was seriously broken in more than one way. It seems to be working now. - Started adding new set_ups() instead of UPS_SET(). - Adding the SIGCHLD broke quite a lot of calls in the master/slave code. This will probably also show up elsewhere. 04Aug03 - Tested the net driver, it seems to work perfectly fine. I did add a grace period of 4 seconds with comm loss on batteries before the shutdown is done. - A number of changes to the manual. - Clean up the net driver to be compatible with C++ for building on Windows. - Ensure that we don't get stuck in a waitpid loop after calling apccontrol. Hopefully this will fix the 100% CPU usage on Win32 after a power condition. 18Jul03 - Reissue accept() immediately if interrupted rather than waiting. 15Jul03 - In attempting to build the .cgi files on Windows, I realized that the gd1.2 code was no longer in the distribution. Although some people were worried about the gif patent (I wasn't) it has now expired, so I see no reason why not to distribute the code as we always have. For the purists, it appears that the version you have on your system (png) will be used in preference to the local gd code. - I backed out the 12July SNMP changes since they probably only work for 3 phase and I don't have the libraries to test compile or the card to test. 12Jul03 - Modify snmp driver to use upsPhaseOutputPercentPower instead of upsAdvOutputLoad as requested by ivac@gnjilux.srk.fer.hr. 08Jul03 - As reported by Brandon Applegate, the net driver was not clearing old flags after a power failure. In fact, it was really screwed up -- it always or'ed in the new bits thus keeping any old status, and blasting out any local bits. Fixed hopefully. - Made a new set of defines for setting/clearing/testing ups Status bits that is much easier to read. - Added Sergey Vlasov's second USB kernel patch to the examples directory. The two patches can be found in: linux-2.4.20-killpower.patch linux-2.4.20-USB-reject.patch The emails are also in that directory. - As suggested by Sergey for the 2.5 kernel, I have #ifdefed out the call to HIDIOCGREPORT in the int_write routine used for killpower. 07Jul03 - Lots of updates to the document. - Fixed a slave crash in master/slave mode. It was a missing setup_device, and was diagnosed and reported by Christian Schacht -- many thanks. 30May03 - Made non-existent header files non-fatal and added #ifdef around sys/socket.h so it will compile on IRIX. - Add Scott's latest apcupsd.conf with the hid-ups program code (actually I had done this some time ago ...). - Start a ReleaseNotes file 20May03 - Fixed a typo error (mine) that prevented Scott from building rpms. Strange, it worked for me???? 19May03 - More DESTDIR cleanup for building non-root rpms. 18May03 - Add DESTDIR everywhere so we can build rpms non-root - Additional documentation - Add Scott's new apcupsd.spec 06May03 - On Hilary Jones suggestion, I fixed the ./configure message that is printed when no libgd is found to direct the user to the main source. 01May03 - Add Sergey Vlasov's kernel patch to the examples directory, and it replaces the previous patch. This patch now solves the killpower problem on Linux USB. /examples/linux-2.4.20-alt-apc_usb_ups.patch notes are in: linux-usb-patch-email.txt 22Apr03 - Add TTY mode to apctest to communicated directly with UPS. - Apply patch to linux-usb.c in killpower supplied by Sergey Vlasov (thanks!). 19Apr03 - Eliminate pow() function in linux-usb.c so that -lm is not needed. 14Apr03 - Add automatic detection of socklen_t 11Apr03 - I received a kernel patch from Sergey Vlasov that fixes the killpower problem on CS UPSes. apcupsd can now shutdown these devices! I've removed some debug code that was in the killpower routine and is not needed or used. I have put the kernel patch in: /examples/linux-2.4.20-alt-hidups.patch 05Apr03 - When the Win32 version starts as a service, delete the NOLOGIN and PWRFAIL files to prevent later confusion. Thanks to Allen Crawford for pointing this out. 29Mar03 - Modify all Win32 program so that only windowed programs (apcupsd, popup) have the -mwindows flags. The others do not. - Tweak apctest.c a bit -- add EEPROM programming (still a bit kludgy), but at least it can be done. 21Mar03 - Lots of clean ups for Cygwin stuff. Events now work, and exit. - Clean up a few undefined symbols in building with everything on. - Eliminate pid and serial port lock file on Win32 systems. 10Mar03 - Modify init script to use daemon so that STDIN/OUT, ... are detached from the terminal and pointed to the log file. This prevents remotely logged in users who start apcupsd from being unable to log out. 06Mar03 - Made some mindor modifications to configure.in and aclocal.m4 to make consistent use of double quotes in test statements in response to problems with make install reported by Andrew Surratt. - Thanks to Richard Schwaninger for finding and submitting a patch to the tcp-wrappers code that prevented it from working because of an invalid name. Fixed. 05Mar03 - Thanks to Andrew Reid for pointing out that the child reaping code should be clearing the pid slot if a -1 is returned. The pid table was filling up on his system due to killed children. Fixed 21Feb03 - A bug report against the Mandrake version of apcupsd indicates that apcupsd is not releasing /dev/console. I've moved the close() of STDIN so that it is always executed to prevent this possibility. 12Feb03 - Implement very crude first cut of EEPROM programming in apctest. Set battery date, set UPS name, and print EEPROM values should work. apcupsd-3.14.10/doc/techlogs/2003/kes-3.10.70000664000076400007640000000407107761146306016431 0ustar adk0212adk0212 Technical notes on version 3.10.7 08 November 2003 Kern Sibbald General: Changes submitted this submission: 08Nov03 - Do automatic UPS detection in the USB code if no device is specified or if the specified device cannot be opened. - Include patch provided by Howard Wilkinson, but put the new apcnet.c in apcnet.c.new until I have a chance to examine it in detail. His notes: I attach a complete rewrite of the Master side of the mast/slave code to support asynchronous connections to slaves. I needed to do this as our network has a number of machines that tend to be powered off for long periods and the connect() calls were hanging around for more than nettime. I also, added a small patch for a new command line flag '-P|--pid-file' so that I can easily run multiple daemons on one machine. I needed this as I have a machine that acts as a multiple master while getting its power from another UPS managed by another machine. 07Nov03 - Lib wrappers was not building correctly on FreeBSD due to the library -lnls, so I copied over the Bacula code for configure. Thanks to Lars Kller for reporting this and for his patches. - Attempt to get mkinstalldirs called by an absolute path rather than relative. - Apply Lars' fixes to platforms/Makefile.in and platforms/etc/Makefile.in Install scripts with $(INSTALL_SCRIPT) instead of $(INSTALL_PROGRAM) - Close all file descriptors except stdin/out/err. - If there are no stdin/out/err (Windows), then create them and point them to /dev/null. This prevents the serial port from suddenly getting debug output sent to it -- chaos. - It seems that since the beginning of 3.10.x, the APCSMART_UPS never reported the proper status. This is because it was not in the case statement. Incredible since it is now the "standard" driver! Thanks to the user that brought this to my attention. - Fix a segfault in linux-usb.c due to reference one beyond the command table. This happens only on newer USB UPSes. Thanks to the user who pointed this out. apcupsd-3.14.10/doc/techlogs/2003/kes-3.10.80000664000076400007640000000757010001554621016421 0ustar adk0212adk0212 Technical notes on version 3.10.8 28 December 2003 Kern Sibbald General: Changes submitted this submission: 28Dec03 - Added upsBaiscOntrolConverveBattery change to smtp requested by Kastus Shchuka (kastus@list.sourceforge.net) - Move wall in killpower of apccontrol to after killpower to avoid errors stopping script. - Install apctest along with apcupsd. - Fix DISTVER for RH Enterprise 19Dec03 - Added patch by Adam Kropelin that ignores invalid samples. This eliminates the need for the wait, and seems to calm the system. Apparently, even though apcupsd did not use the bad samples, it would break from the wait loop, and request an update, which gave even more bad samples. With Adam's patch the samples are simply dropped and we continue waiting (if appropriate). Thanks Adam. 18Dec03 - Add Slackware updated patch submitted by Andrei Mamontov - Corrected the missing library dependencies in src/Makefile.in Thanks to Reg. Clemens for pushing me a bit on this. 06Dec03 - Added usleep(10000) provided by Reg. Clemens, which resolves the apcuspd USB problems on 2.6 kernels. Now removed by 19Dec03 patch. 24Nov03 - Added a ONBATTERYDELAY to the conf file. This is the time in seconds that apcupsd will wait after detecting a power failure until it sets the onbattery state. If you do not want to be annoyed by short power outages (usually less than 10 seconds), set the ONBATTRYDELAY appropriately and comment out the powerout) "echo ...|wall" statement. - I finally got the no driver configured error. It turns out that the Makefile detection of changes is all botched up. Since I don't understand how the author expected it to work, I used the sledgehammer approach and do a "make clean" on every ./configure. - Replaced apcnet.c with Howard Wilkinson's new master/slave code. If anyone *really* needs the old driver, it is in src/apcnet.c.old - Upgraded to Cygwin 1.5.5 Everything below this was done in 3.10.7 08Nov03 - Do automatic UPS detection in the USB code if no device is specified or if the specified device cannot be opened. - Include patch provided by Howard Wilkinson, but put the new apcnet.c in apcnet.c.new until I have a chance to examine it in detail. His notes: I attach a complete rewrite of the Master side of the mast/slave code to support asynchronous connections to slaves. I needed to do this as our network has a number of machines that tend to be powered off for long periods and the connect() calls were hanging around for more than nettime. I also, added a small patch for a new command line flag '-P|--pid-file' so that I can easily run multiple daemons on one machine. I needed this as I have a machine that acts as a multiple master while getting its power from another UPS managed by another machine. 07Nov03 - Lib wrappers was not building correctly on FreeBSD due to the library -lnls, so I copied over the Bacula code for configure. Thanks to Lars Kller for reporting this and for his patches. - Attempt to get mkinstalldirs called by an absolute path rather than relative. - Apply Lars' fixes to platforms/Makefile.in and platforms/etc/Makefile.in Install scripts with $(INSTALL_SCRIPT) instead of $(INSTALL_PROGRAM) - Close all file descriptors except stdin/out/err. - If there are no stdin/out/err (Windows), then create them and point them to /dev/null. This prevents the serial port from suddenly getting debug output sent to it -- chaos. - It seems that since the beginning of 3.10.x, the APCSMART_UPS never reported the proper status. This is because it was not in the case statement. Incredible since it is now the "standard" driver! Thanks to the user that brought this to my attention. - Fix a segfault in linux-usb.c due to reference one beyond the command table. This happens only on newer USB UPSes. Thanks to the user who pointed this out. apcupsd-3.14.10/doc/techlogs/2003/kes-3.10.90000664000076400007640000000051410001554621016411 0ustar adk0212adk0212 Technical notes on version 3.10.9 31 December 2003 Kern Sibbald General: 31Dec03 - Bartlomiej Krol found an unexpected interaction between the 6 second "debounce" code and the new ONBATTERY delay time that caused the USB and apcsmart drivers to sleep for a long time. apcupsd-3.14.10/doc/techlogs/2004/0000775000076400007640000000000011634011372015163 5ustar adk0212adk0212apcupsd-3.14.10/doc/techlogs/2004/RN-3.10.130000664000076400007640000001304110102163021016211 0ustar adk0212adk0212 Release Notes for Apcupsd 3.10.13 Release 3.10.13 20Apr04 - Added code to support net snmp configured with --enable-net-snmp based on patch sent by Sander Siemonsma. - Build smtp on Unix systems. - Update to most current smtp and make it easier to configure for apcupsd or Bacula - Start implementing native Win32 version. - Rename cmd -> ups_event and cmd_msg -> event_msg - Add user supplied code to make apcaccess read the conf file and self configure to proper port. Thanks to Martin Flack for this patch. - Start simplifying the Copyright and making the dates current. - Rework the net driver. It was really in poor shape. - Replace sprintf with asnprint. Replace strcpy with astrncpy - Apply a fix supplied by Jim Pick where syslog releases the usb port and then re-attaches it to /dev/log. - I finally took a careful look at the old master/slave networking code as well as ran it here, and it was sadly broken. Hopefully this commit fixes the problems. - Fix a few string functions using the new routines. - Added asys.c imported from Bacula, which contains a number of simple system routines such as astrncpy(), ... Release 3.10.12 04Mar04: - Apply patch from Adam that fixes OpenBSD and FreeBSD pthreads library bugs. - William King has made a number of commits to bring the cgi html up to current xhtml standards -- many thanks. - Add poll time to SNMP driver, and correct header file prototyping. - Make usb driver sleep for 1 second then retry up to 10 times if the device cannot be opened. There are two such loops so in the event of failure, it will occur 20 seconds later. This allows time for the hotplug program to initialize the USB devices after a boot. - Thanks to Joseph Sacco, we have Yellow dog support -- and he has tested and validated it! - Integrated Joseph Sacco's yellowdog patch -- some done by hand. - Fix a Makefile find that removes zero length files, which fails on some systems. - Web site update. - Turned on strict prototype checking. - Changed start level from 20 to 60 to ensure that DNS is started. Reported by David Walser. - Remove some unused code in the snmp directory. - Cleanup some compile errors in the snmp directory. - Cleanup crap generated by doc book for web manual - Move install.xml to install.kml and implement simpler html directives in docbook. Modify Makefile to convert html back into docbook. - Change references to serial port in apctest to device (USB included). - Minor updates to the documentation from user input. Release 3.10.11 26Jan04: - Correct apccontrol script to remove extra ;; that I inadvertantly left the last release -- apparently that prevented proper shutdown. - Updates to manual as requested by Adam and other users. - Fix localtime_r in configure.in as reported with patch by Adam. - Fixed bad html in multimoncss.c reported by an anonymous user. - Added new Mandrake apcupsd.spec.in submitted by David Walser. - Revert to using the old master/slave networking code bu default. Release 3.10.10 - This version has an additional fix to the USB driver based on work by Adam Kropelin -- it limits the rate at which apcupsd will poll the UPS for the volatile data, which in turn reduces the possiblity of flooding the kernel with control messages (hide-core.c: control queue full ...". - I added a new "offbattery" event that is only executed if the "onbattery" event was executed. This should allow users to easily control what messages they get and by using the ONBATTERYDELAY the time on batteries before the onbattery event is notified. The code is untested, so any feedback would be appreciated. Release 3.10.9 31Dec03 - Bartlomiej Krol found an unexpected interaction between the 6 second "debounce" code and the new ONBATTERY delay time that caused the USB and apcsmart drivers to sleep for a long time. 28Dec03 - Added upsBaiscOntrolConverveBattery change to smtp requested by Kastus Shchuka (kastus@list.sourceforge.net) - Move wall in killpower of apccontrol to after killpower to avoid errors stopping script. - Install apctest along with apcupsd. 19Dec03 - Added patch by Adam Kropelin that ignores invalid samples. This eliminates the need for the wait, and seems to calm the system. Apparently, even though apcupsd did not use the bad samples, it would break from the wait loop, and request an update, which gave even more bad samples. With Adam's patch the samples are simply dropped and we continue waiting (if appropriate). Thanks Adam. 18Dec03 - Add Slackware updated patch submitted by Andrei Mamontov - Corrected the missing library dependencies in src/Makefile.in Thanks to Reg. Clemens for pushing me a bit on this. 24Nov03 - Added a ONBATTERYDELAY to the conf file. This is the time in seconds that apcupsd will wait after detecting a power failure until it sets the onbattery state. If you do not want to be annoyed by short power outages (usually less than 10 seconds), set the ONBATTERYDELAY appropriately and comment out the powerout) "echo ...|wall" statement. - I finally got the no driver configured error. It turns out that the Makefile detection of changes is all botched up. Since I don't understand how the author expected it to work, I used the sledgehammer approach and do a "make clean" on every ./configure. - Replaced apcnet.c with Howard Wilkinson's new master/slave code. If anyone *really* needs the old driver, it is in src/apcnet.c.old - Upgraded to Cygwin 1.5.5 Items to note: !!!!! - The default NIS port has changed from 7000 to 3551. Port 3551 has been officially assigned to apcupsd by IANA. apcupsd-3.14.10/doc/techlogs/2004/RN-3.10.140000664000076400007640000001745010105141232016225 0ustar adk0212adk0212 Release Notes for Apcupsd 3.10.14 NOTE: The non-pthreaded version should work in this release, but will be removed in the next version. Main Points: - The NIS slave server code (net driver) should be much more efficient and robust than previous versions. - The code as a whole is much more resistant to buffer overflows since most all string copies are now protected. Release 3.10.14 28Jul04 - Add workaround from Adam for linux/hiddev.h missing define. - Bill King has made numerous changes to improve the code such as adding consts where appropriate. - Add ./configure detection of nanosleep() and usleep() - Updates to manual including fixing man page. - Integrate patch for Mandrake apcupsd.in forwarded by David Walser. - Found another store into the ups buffer so #ifdefed it. Cannot store into the ups buffer on non-pthreads systems. - Fiddle with apcconfig.c to correct astrncpy() problem noted by Adam. - #ifdef code in apcaccess that tries to write in the shared memory buffer. - Applied Adam's patch for fixing the pthreads dependencies in asys.c - Tweak the patch a bit hopefully so that OpenBSD will work. - Made a sweep through quite a few files updating the copyright, eliminating the disclaimer (now in DISCLAIMER), and adding as many astrncpy() and astrncat()s as I could find. There still remain some drivers and the cgi code to do. - Implemented true/false and bool. Started implementing it in many of the files I touched. - Updated the net driver and did a fairly good testing of it. - Made apcupsd remain in the foreground when doing a kill power. - Eliminated some of the error messages during kill power by not doing useless things. - Added back code to print what is happening during kill power in the USB code. - Corrected a few of the USB error messages that could have been missleading or confusing. - Eliminated some inappropriate usages of size_t. - Integrated a number of updates into the manual, particularly from Adam. - Put wall as ${WALL} in platforms/apccontrol.in - If the IP address is 0.0.0.0 force it to localhost in apcaccess. - Integrate Thomas Habets' changes to keep connect() from blocking in apcnet.c so that apcupsd can service more slaves. - Ensure that stdin/out/err are allocated in daemon_start() of apcuspd.c - Update snmp.c with bug fix from Bacula. Release 3.10.13 20Apr04 - Added code to support net snmp configured with --enable-net-snmp based on patch sent by Sander Siemonsma. - Build smtp on Unix systems. - Update to most current smtp and make it easier to configure for apcupsd or Bacula - Start implementing native Win32 version. - Rename cmd -> ups_event and cmd_msg -> event_msg - Add user supplied code to make apcaccess read the conf file and self configure to proper port. Thanks to Martin Flack for this patch. - Start simplifying the Copyright and making the dates current. - Rework the net driver. It was really in poor shape. - Replace sprintf with asnprint. Replace strcpy with astrncpy - Apply a fix supplied by Jim Pick where syslog releases the usb port and then re-attaches it to /dev/log. - I finally took a careful look at the old master/slave networking code as well as ran it here, and it was sadly broken. Hopefully this commit fixes the problems. - Fix a few string functions using the new routines. - Added asys.c imported from Bacula, which contains a number of simple system routines such as astrncpy(), ... Release 3.10.12 04Mar04: - Apply patch from Adam that fixes OpenBSD and FreeBSD pthreads library bugs. - William King has made a number of commits to bring the cgi html up to current xhtml standards -- many thanks. - Add poll time to SNMP driver, and correct header file prototyping. - Make usb driver sleep for 1 second then retry up to 10 times if the device cannot be opened. There are two such loops so in the event of failure, it will occur 20 seconds later. This allows time for the hotplug program to initialize the USB devices after a boot. - Thanks to Joseph Sacco, we have Yellow dog support -- and he has tested and validated it! - Integrated Joseph Sacco's yellowdog patch -- some done by hand. - Fix a Makefile find that removes zero length files, which fails on some systems. - Web site update. - Turned on strict prototype checking. - Changed start level from 20 to 60 to ensure that DNS is started. Reported by David Walser. - Remove some unused code in the snmp directory. - Cleanup some compile errors in the snmp directory. - Cleanup crap generated by doc book for web manual - Move install.xml to install.kml and implement simpler html directives in docbook. Modify Makefile to convert html back into docbook. - Change references to serial port in apctest to device (USB included). - Minor updates to the documentation from user input. Release 3.10.11 26Jan04: - Correct apccontrol script to remove extra ;; that I inadvertantly left the last release -- apparently that prevented proper shutdown. - Updates to manual as requested by Adam and other users. - Fix localtime_r in configure.in as reported with patch by Adam. - Fixed bad html in multimoncss.c reported by an anonymous user. - Added new Mandrake apcupsd.spec.in submitted by David Walser. - Revert to using the old master/slave networking code bu default. Release 3.10.10 - This version has an additional fix to the USB driver based on work by Adam Kropelin -- it limits the rate at which apcupsd will poll the UPS for the volatile data, which in turn reduces the possiblity of flooding the kernel with control messages (hide-core.c: control queue full ...". - I added a new "offbattery" event that is only executed if the "onbattery" event was executed. This should allow users to easily control what messages they get and by using the ONBATTERYDELAY the time on batteries before the onbattery event is notified. The code is untested, so any feedback would be appreciated. Release 3.10.9 31Dec03 - Bartlomiej Krol found an unexpected interaction between the 6 second "debounce" code and the new ONBATTERY delay time that caused the USB and apcsmart drivers to sleep for a long time. 28Dec03 - Added upsBaiscOntrolConverveBattery change to smtp requested by Kastus Shchuka (kastus@list.sourceforge.net) - Move wall in killpower of apccontrol to after killpower to avoid errors stopping script. - Install apctest along with apcupsd. 19Dec03 - Added patch by Adam Kropelin that ignores invalid samples. This eliminates the need for the wait, and seems to calm the system. Apparently, even though apcupsd did not use the bad samples, it would break from the wait loop, and request an update, which gave even more bad samples. With Adam's patch the samples are simply dropped and we continue waiting (if appropriate). Thanks Adam. 18Dec03 - Add Slackware updated patch submitted by Andrei Mamontov - Corrected the missing library dependencies in src/Makefile.in Thanks to Reg. Clemens for pushing me a bit on this. 24Nov03 - Added a ONBATTERYDELAY to the conf file. This is the time in seconds that apcupsd will wait after detecting a power failure until it sets the onbattery state. If you do not want to be annoyed by short power outages (usually less than 10 seconds), set the ONBATTERYDELAY appropriately and comment out the powerout) "echo ...|wall" statement. - I finally got the no driver configured error. It turns out that the Makefile detection of changes is all botched up. Since I don't understand how the author expected it to work, I used the sledgehammer approach and do a "make clean" on every ./configure. - Replaced apcnet.c with Howard Wilkinson's new master/slave code. If anyone *really* needs the old driver, it is in src/apcnet.c.old - Upgraded to Cygwin 1.5.5 Items to note: !!!!! - The default NIS port has changed from 7000 to 3551. Port 3551 has been officially assigned to apcupsd by IANA. apcupsd-3.14.10/doc/techlogs/2004/Release_Notes-3.10.10.txt0000664000076400007640000000340310003245333021245 0ustar adk0212adk0212Apcupsd-3.10.10-1 RPM Release Notes 18 January 2004 D. Scott Barninger These release notes detail changes in the rpm packages. Please see the release notes in the tarball for other changes. ***************************************************************** * This rpm release contains some important changes since 3.10.8 * ***************************************************************** The platform designator (rh7, rh8, rh9) has been REMOVED from the package names as this was creating some problems. Hence, you CAN NOT upgrade existing 3.10.8 or lower installations with these packages (rpm -U). To upgrade: 1. Backup your configuration file (/etc/apcupsd/apcupsd.conf) "just to be safe." 2. Uninstall the old apcupsd package, ie. rpm -e apcupsd-usb-rh9 If you are not sure what package name is installed do rpm -qa | grep apcupsd 3. Install the new package with rpm -i ***************** * Other Changes * ***************** - This release adds the net driver which was missing from previous builds. - The usb serial port device has been set to BLANK in the usb package which will cause apcupsd to search all known locations. This eliminates the problem with the "nonstandard" locations which were used in RedHat 7.x. The previous patch used to fix that has been eliminated. ****************** * Platform Notes * ****************** We now have a dedicated box dual-booting RedHat 7.3 and 8.0 for the purpose of providing continued packaging support as long as it is desired. All packages are built with all of the latest applicable updates applied. In the case of RedHat 7 and 8 we are pulling in the latest Progeny updates as well thanks to the folks at http://oss.redundant.com/pub/party-updates/ . apcupsd-3.14.10/doc/techlogs/2004/kes-3.10.100000664000076400007640000000113310003245333016457 0ustar adk0212adk0212 Technical notes on version 3.10.10 16 January 2004 Kern Sibbald General: - Based on observations that Adam Kropelin has made on a problem UPS, I've modified the USB driver to poll for the dynamic UPS data a maximum of once every 5 seconds, unless it is on batteries. - I added a new "offbattery" event that is only executed if the "onbattery" event was executed. This should allow users to easily control what messages they get and by using the ONBATTERYDELAY the time on batteries before the onbattery event is notified. apcupsd-3.14.10/doc/techlogs/2004/kes-3.10.110000664000076400007640000000112010037756462016475 0ustar adk0212adk0212 Technical notes on version 3.10.11 26 January 2004 Kern Sibbald General: - Correct apccontrol script to remove extra ;; that I inadvertantly left the last release -- apparently that prevented proper shutdown. - Updates to manual as requested by Adam and other users. - Fix localtime_r in configure.in as reported with patch by Adam. - Fixed bad html in multimoncss.c reported by an anonymous user. - Added new Mandrake apcupsd.spec.in submitted by David Walser. - Revert to using the old master/slave networking code bu default. apcupsd-3.14.10/doc/techlogs/2004/kes-3.10.120000664000076400007640000000274010037756462016507 0ustar adk0212adk0212 Technical notes on version 3.10.12 04 March 2004 Kern Sibbald General: - Thanks to Joseph Sacco, we have Yellow dog support -- and he has tested and validated it! - Integrated Joseph Sacco's yellowdog patch -- some done by hand. - Minor updates to the documentation from user input. - Fix a Makefile find that removes zero length files, which fails on some systems. - Web site update. - Apply patch from Adam that fixes OpenBSD and FreeBSD pthreads library bugs. - Add poll time to SNMP driver, and correct header file prototyping. - Make usb driver sleep for 1 second then retry up to 10 times if the device cannot be opened. There are two such loops so in the event of failure, it will occur 20 seconds later. This allows time for the hotplug program to initialize the USB devices after a boot. - Cleanup crap generated by doc book for web manual - Turned on strict prototype checking. - William King has made a number of commits to bring the cgi html up to current xhtml standards -- many thanks. - Changed start level from 20 to 60 to ensure that DNS is started. Reported by David Walser. - Remove some unused code in the snmp directory. - Cleanup some compile errors in the snmp directory. - Move install.xml to install.kml and implement simpler html directives in docbook. Modify Makefile to convert html back into docbook. - Change references to serial port in apctest to device (USB included). apcupsd-3.14.10/doc/techlogs/2004/kes-3.10.130000664000076400007640000000227610102163021016464 0ustar adk0212adk0212 Technical notes on version 3.10.13 Kern Sibbald General: 16Apr04 - Added code to support net snmp configured with --enable-net-snmp based on patch sent by Sander Siemonsma. - Build smtp on Unix systems. - Update to most current smtp and make it easier to configure for apcupsd or Bacula - Start implementing native Win32 version. - Rename cmd -> ups_event and cmd_msg -> event_msg - Add user supplied code to make apcaccess read the conf file and self configure to proper port. Thanks to Martin Flack for this patch. - Start simplifying the Copyright and making the dates current. - Rework the net driver. It was really in poor shape. - Replace sprintf with asnprint. Replace strcpy with astrncpy 06Apr04 - Apply a fix supplied by Jim Pick where syslog releases the usb port and then re-attaches it to /dev/log. 30Mar04 - I finally took a careful look at the old master/slave networking code as well as ran it here, and it was sadly broken. Hopefully this commit fixes the problems. 09Mar04 - Fix a few string functions using the new routines. - Added asys.c imported from Bacula, which contains a number of simple system routines such as astrncpy(), ... apcupsd-3.14.10/doc/techlogs/2004/kes-3.10.140000664000076400007640000000370010103722211016461 0ustar adk0212adk0212 Technical notes on version 3.10.14 Kern Sibbald General: 28Jul04 - Add workaround from Adam for linux/hiddev.h missing define. - Updates to manual. - Integrate patch for Mandrake apcupsd.in forwarded by David Walser. 18Jul04 - Found another store into the ups buffer so #ifdefed it. Cannot store into the ups buffer on non-pthreads systems. 17Jul04 - Fiddle with apcconfig.c to correct astrncpy() problem noted by Adam. - #ifdef code in apcaccess that tries to write in the shared memory buffer. - Applied Adam's patch for fixing the pthreads dependencies in asys.c - Tweak the patch a bit hopefully so that OpenBSD will work. 09Jul04 - Made a sweep through quite a few files updating the copyright, eliminating the disclaimer (now in DISCLAIMER), and adding as many astrncpy() and astrncat()s as I could find. There still remain some drivers and the cgi code to do. - Implemented true/false and bool. Started implementing it in many of the files I touched. - Updated the net driver and did a fairly good testing of it. - Made apcupsd remain in the foreground when doing a kill power. - Eliminated some of the error messages during kill power by not doing useless things. - Added back code to print what is happening during kill power in the USB code. - Corrected a few of the USB error messages that could have been missleading or confusing. - Eliminated some inappropriate usages of size_t. 20Jun04 - Integrated a number of updates into the manual, particularly from Adam. - Put wall as ${WALL} in platforms/apccontrol.in - If the IP address is 0.0.0.0 force it to localhost in apcaccess. - Integrat Thomas Habets' changes to keep connect() from blocking in apcnet.c so that apcupsd can service more slaves. - Ensure that stdin/out/err are allocated in daemon_start() of apcuspd.c - Update snmp.c with bug fix from Bacula. - Bill has made numerous changes to improve the code such as adding consts where appropriate. apcupsd-3.14.10/doc/techlogs/2004/kes-3.10.150000664000076400007640000000061510132567506016504 0ustar adk0212adk0212 Technical notes on version 3.10.15 Kern Sibbald General: 07Aug04 - Document Mandrake USB kernel problems. 04Aug04 - Fix HID_MAX_USAGES in the examples directory 03Aug04 - Apply David Walser's patch for missing colors in multimon. Reads the apcupsd.css file from the sysconf directory. 02Aug04 - Add EEPROM fix from Giuseppe Ghibo passed on by David Walser apcupsd-3.14.10/doc/techlogs/2004/kes-3.10.160000664000076400007640000000221510143157512016475 0ustar adk0212adk0212 Technical notes on version 3.10.16 Kern Sibbald General: 28Oct04 - Converted manual from docbook to texinfo format. 22Oct04 - Apply patch to fix aastr... supplied by Manfred Schwarb. 14Oct04 - Changed Solaris to use mailx by default at the suggestion of Neil Brookins. 06Oct04 - Add proper platform code so that configure will create the 4 platform specific apccontrol files (some were missing). - Apply fix from user to correct one of the shutdown sequences for the Smart UPS. During the conversion to drivers this was apparently mangled. Thanks to Alexander Naumov for the fix. 09Sep04 - Added code to close all file descriptors before becoming daemon unless debug turned on. 26Aug04 - Add APCBATTCapBeforeRestore found by Adam to hid-ups.c - Update copyright in apc_struct.h - Take Adam's new apc_defines.h with minor modification. - Correct a bug reported by a user (he also had the fix) to the snmp driver where Sensitivity was incorrectly reported. - Add astrncpy() to snmp driver. - Fix apcstatus.c to report Unknown for the sensitivity rather than High if the sense word cannot be read or is incorrect. apcupsd-3.14.10/doc/techlogs/2005/0000775000076400007640000000000011634011372015164 5ustar adk0212adk0212apcupsd-3.14.10/doc/techlogs/2005/kes-3.10.170000664000076400007640000000163310224436255016506 0ustar adk0212adk0212 Technical notes on version 3.10.17 Kern Sibbald General: 17Mar05 - Move docbook directory to old_documents - Modify Win32 Makefile to pull apcupsd.html from texi directory. It was still using the old docbook directory. 03Mar05 - Commit kernstodo 24Feb05 - Added an anonymous patch to powerflute.c and to the slack-apcupsd.in file. 09Jan05 - Add Whitebox to detected systems. 24Dec04 - Minor tweak to RedHat spec.in - Apply Carl Lindberg 's patch for apcaction.c to fix the network management card shutdown. 28Nov04 - Fix typo in targets.mak that prevents uninstall from working. 13Nov04 - Change name of thread_terminate to apc_thread_terminate to avoid conflict on AIX. - Put configure found SHUTDOWN in apccontrol.in 06Nov04 - Figured out how to scale the pdf images, so re-did them. - Some minor updates to the manual, particularly the title page. apcupsd-3.14.10/doc/techlogs/3.8.2/0000775000076400007640000000000011634011372015246 5ustar adk0212adk0212apcupsd-3.14.10/doc/techlogs/3.8.2/gdr01Mar010000664000076400007640000000232007474702776016732 0ustar adk0212adk0212From: Devin Reade [SMTP:gdr@gno.org] Sent: Thursday, 01 March 2001 8:02 AM To: kern@sibbald.com Cc: 'Neil Darlow'; Riccardo Facchetti (E-mail) Subject: Re: [Apcupsd-devel] A Master/Slave Bug? << File: diff-apcupsd-3.8.txt >> Kern Sibbald wrote: > I have posted an update to 3.8.1 that should > fix the problem of zombies on BSD type systems > as well as the problem of restarting the master > causing a spurious Replace Battery message. Thanks, Kern. I've tested it with a Linux RH 6.2 master and an OpenBSD 2.7 slave. Your 25 Feb snapshot fixes both issues. Thanks for your efforts. I have also attached a minor patch relative to your 25 Feb snapshot. It addresses the following issues: - elimination of an unnecessary lock file for OpenBSD - change of lockfile path for OpenBSD - allow for some Makefiles to not exist during - recursive makes (platform independent) - cleaned up restart code for OpenBSD FWIW, since I have (new)BackupsPro UPSes, I didn't use the exact test you mentioned (unplugging the serial cable), but rather killed the master, waited a bit, then restarted it. This shows the problem with 3.8.1, and shows it fixed with the 25 Feb patch. Devin apcupsd-3.14.10/doc/techlogs/3.8.2/kes03Jul010000664000076400007640000000073707474702776016767 0ustar adk0212adk0212 Technical notes on version 3.8.2 Official Release 3 July 2001 Kern Sibbald General: - Additional documentation. - Bug fix provided by Riccardo. - Update script for making RPMs. - Please remember that apcnetd has been renamed to apcnisd - Tweaked the pthreads flags for FreeBSD - Added Linux From Scratch hint file to unknown distribution. - Fixed Makefile in lib to use CFLAGS. Changes submitted this submission: apcupsd-3.14.10/doc/techlogs/3.8.2/kes05Mar010000664000076400007640000000255507474702776016756 0ustar adk0212adk0212 Technical notes on version 3.8.1-3 (5 Mar 01) Kern Sibbald General: - This version has a few bug fixes, and is for limited distribution to test bug fixes. - Some files have large diff files because they have been reformatted to apcupsd 4.0 standards. - I am in the process of integrating version 4.0 code into this stream, so many of the changes are related to this activity. - Modified code for handling 940-0095B cable. Hopefully, it will work now. Changes submitted this submission: - Added the Caldera code that was submitted by John Pinner. - Added more of Riccardo's 4.0 fixes to this version (apclist) renamed apcserver.c as apcnis.c, etc. - Added the KILLDELAY configuration directive, but the code to implement it will have to wait for the state machine apcaction.c code. - Merged apcexec.c up to version 4.0 code. - Added apclist.c from version 4.0. - Reindented apcnet.c - Changed calling sequence of detach_ipc() to agree with 4.0 - Removed unused code from apcnetlib.c - Reindented apcserial.c - Changed calling sequence to execute_command() to agree with version 4.0. - Implemented core_ups in limited way -- points to the only UPS. This allows much of 4.0 code to be integrated unchanged. - Changed calling sequence to start_thread() to agree with 4.0 - Integrated NetBSD patches that I received from Devin Reade -- thanks. apcupsd-3.14.10/doc/techlogs/3.8.2/kes06Apr010000664000076400007640000001307107474702776016755 0ustar adk0212adk0212 Technical notes on version 3.8.1-5 6 April 2001 Kern Sibbald General: - This version is a pre-release of version 3.8.2. It contains fixes for most known problems. - Major work has been done to include in this release much of the code that will go into version 4.0. - Addition merging of 3.8 and 4.0 will occur prior to the final release of 3.8.2 - The only major addition that I am planning to 3.8.2 for the next prerelease (3.8.1-6) will be pthread support (at least the first cut). - The name of apcnetd has been changed to apcnisd New Features: - New indenting standard (see code). Not yet uniformly applied -- work in progress. - New NetBSD support. - Updated Debian support. - apccontrol now called with additional arguments. - GNOME realtime monitoring program added in gupsc directory (not supported). - Improved shutdown on WinNT. - Self test detection. - TCP Wrapper support (untested). - New KILLDELAY configuration directive (untested) that causes apcupsd to wait after issuing a shutdown, and after the delay seconds have expired, it will issue a kill power to the UPS. Potentially useful on systems where apcupsd cannot regain control after completing a system shutdown (i.e. WinNT). - Multimon can now use css for more control by the user. Changes implemented since the 3.8.1 release: - Added NetBSD code submitted - Added submission for Debian release. - Corrected the make depend to only update the Makefile rather than both Makefile and Makefile.in - Added a new AVERSION define to version.h which is meant to allow us to maintain source code with multiple versions. - Reformatted many files to Riccardo's 4.0 standards. Indent 4 spaces at each level instead of 8. - Made important modifications to apcaction.c. This allows detection of Self-test. - In apcexec.c changed calling sequence of execute_command() to conform to version 4.0 (added UPSINFO argument). - To correct a problem with zombies on BSD systems, I added a UPSINFO variable that is the count of children created by execute_command(). do_action() in apcaction.c was modified to check this variable, do a non-blocking wait, and decrement it if any children were found. This should properly reap the zombies. - Added additional debug information (strerror) to failed semaphore and shared memory system call errors in apcipc.c - In apcnet.c, removed ChangeBatt from slave because it is apparently being set incorrectly on some BSD masters when apcupsd is restarted. - Added an O_NDELAY to the serial port open() in apcserial.c to avoid infinite waits on some BSD systems. This required the addition of an fcntl() after the open to reset the blocking read(), which is needed in apcupsd. - Removed an unwanted break in a switch in apcstatus.c that caused the status output for BackUPS Pros to be cut short. - Added a HAVE_POWERFLUTE define and changed powerflute.c to use it. This prevents a lot of the errors seen on systems that don't have ncurses. - configure.in, added HAVE_NETBSD_OS, HAVE_POWERFLUTE, and modified generation of makefiles to only configure the files in the recognized distribution. Modified the automatic make of the dependencies to use "make depend" - Removed the call on the shell to execute a script file in apccontrol. This permits execution of any type of file, but it now requires that the file be executable. - Corrected the error in the name of ANNOYDELAY in the man file as well as in the html manual. - Added a number of updates and corrections to the html manual, thanks to reports from users. - Updated all the script files in /etc to correct the DoS problem that was reported by one of our users - thanks. - added a new gupsc directory that has the GNOME realtime monitoring program with very pretty dials. - Added num_execed_children variable to UPSINFO structure. - Added .bat files to the win32/bin directory as they seem to be more reliable than the .pif files especially on WinNT. - Enhanced shutdown.c in win32 to try a simple shutdown, but on NT, it also does an InitiateSystemShutdown. - Moved many of the source files into the lib subdirectory and created a libapc.a library. - Added TCP Wrapper support. Configure it by adding: --with-libwrap[=DIR] to the ./configure command. The =DIR is an optional specification of a non-standard library path, otherwise it uses the defaults (/include and /lib). - Accumulate time on batteries and the number of transfers to batteries. The original version had some bug which are now fixed. - Fixed DoS problem with mail files. - Fixed several 4/8 byte problems. - Use .bat files in Win32 instead of .pif to reduce problems. - Fixed a segfault in kill_power() editing an error message (in the case the kill power was improperly issued). - Implemented fast poll when on batteries. - Modified code for handling the 940-0095B cable. Hopefully this will fix the problems. - Eliminate zombies on BSD systems after calling apccontrol - Eliminate powerflute errors if not configured. - Throw away errors during make depend during ./configure, but report the problem. This is for the Sun, which doesn't seem to generate dependencies correctly. - Experimenting with a new CGI multimon program submitted by Chris Evanco that uses cascading style sheets -- cool. It will probably replace the old multimon.cgi after we work out some of the final details. To try it, put the multimon.css in the correct directory and either execute multimoncss.cgi or replace multimon.cgi with multimoncss.cgi. apcupsd-3.14.10/doc/techlogs/3.8.2/kes09Apr010000664000076400007640000000516507474702776016765 0ustar adk0212adk0212 Technical notes on my code submission of 09 Apr 01 Kern Sibbald General: - I've been generally unhappy about how hard it is to configure apcupsd, especially for the beginner. In addition, the Debian people have been having problems with conflicting port numbers and pointed out that our default location for the EVENTS and STATUS files don't conform to norms (/etc should really be a read-only directory). After some thought, I have implemented a much more general configuration of apcupsd.conf via ./configure, which will simplfy greatly the task of configuring and allow a lot more flexibility between diffferent system configurations. I have now added the following items to the ./configure process (some existed previously): - The process id directory (PIDDIR) - The log directory (for EVENTS and STATUS files) (LOGDIR) - The serial port lock directory (LOCKDIR) - The serial port device name (SERIALDEV) - The Network Information Service port (NISPORT) - The Master/Slave network port (NETPORT) - The nologin directory (nologdir) - The UPS type (UPSTYPE) - The UPS cable (UPSCABLE) For each of these items, there is an apcupsd "default" specified in configure.in as follows: - PIDDIR /var/run if it exists; else /etc/apcupsd - LOGDIR /var/log if it exists; else /etc/apcupsd - LOCKDIR /var/lock if it exists; else /etc/apcupsd - SERIALDEV /dev/ttyS0 - NISPORT 7000 - NETPORT 6666 - nologdir /etc - UPSTYPE smartups - UPSCABLE smart Then each "distribution" can override these apcupsd default values. I have made the following overrides: Alpha SERIALDEV /dev/tty01 LOCKDIR /var/spool/locks LOGDIR /etc/apcupsd Debian NISPORT 6543 NETPORT 6544 FreeBSD SERIALDEV /dev/cua01 NetBSD SERIALDEV /dev/cua01 OpenBSD SERIALDEV /dev/cua01 LOCKDIR /var/spool/lock Win32 LOCKDIR /apcupsd/etc/apcupsd SERIALDEV /dev/com1 LOGDIR /apcupsd/etc/apcupsd nologdir /apcupsd/etc Finally, the user can explicitly override each value by specifying it on the ./configure command line: PIDDIR --with-pid-dir=DIR LOGDIR --with-log-dir=DIR LOCKDIR --with-lock-dir=DIR SERIALDEV --with-serial-dev=DEV NISPORT --with-nis-port=PORT NETPORT --with-net-port=PORT UPSTYPE --with-upstype=TYPE UPSCABLE --with-upscable=CABLE DISTNAME --with-distname=DISTNAME These values are then put into the appropriate in /etc/apcupsd.conf giving a pre-configured configuration file. apcupsd-3.14.10/doc/techlogs/3.8.2/kes10Apr010000664000076400007640000000476407474702776016761 0ustar adk0212adk0212 Technical notes on version 3.8.2Beta6 10 April 2001 Kern Sibbald General: - I've added a good number of new ./configure command line options that permit fairly detailed preconfiguration of apcupsd.conf - I've integrated (by hand) the new Debian code. - Changed the release name to apcupsd-3.8.2Beta6 to avoid conflicts with packagers who use -nn at the end. - NOTE! The default location (if it exists) for putting the apcupsd.events and apcupsd.status files is /var/log rather than /etc/apcupsd (see kes09Apr01 for details). Changes submitted this submission: - Added dependencies to the lib subdirectory. This was causing incorrect makes when header files changed. - I added the following variables to the ./configure command line. Type ./configure --help to see the full list --with-distname=NAME Specify DISTNAME --with-nologin=DIR Specify nologin file directory (default /etc) --with-pid-dir=DIR Specify PIDDIR directory --with-log-dir=DIR Specify EVENTS and STATUS directory --with-lock-dir=DIR Specify serial port lock directory --with-serial-dev=DEV Specify serial port device --with-nis-port=PORT Specify NIS (CGI) port --with-net-port=PORT Specify Master/slave port --with-upstype=TYPE Specify the UPS type --with-upscable=CABLE Specify the UPS cable See notes in kes09Apr01 for more details. The output from ./configure now includes all the ablve items. - We have been having a good number of shared memory problems, mostly due to old zombie apcupsds. I've made the code try 1000 different keys before giving up. Note, if it does use a different key, apcaccess will not function as it has no way of knowing the new key. - cgi/upsfetch.c now uses configure NISPORT - cgi/upsfetch.c now retrieves the last self test date (if available). - cgi/upsstats.c the self test date is now displayed (if available) - Added a lot of stuff to the Debian directory. Note, the apcupsd make files for proper building and installation are in /distributions/debian, and all the package information is in the debian subdirectory packageinfo. There is also a lot of stuff in the debian subdirectory examples. - Eliminated all the apcupsd.conf files the were contained in the distributions directory. - Made a generic apcupsd.conf.in that is modified according to the ./configure parameters to build /etc/apcupsd.conf. This allows pretty good pre-configuration of the apcupsd.conf apcupsd-3.14.10/doc/techlogs/3.8.2/kes20Jun010000664000076400007640000000263007474702777016763 0ustar adk0212adk0212 Technical notes on version 3.8.2Beta12 20 June 2001 Kern Sibbald General: - Minor bug fixes prior to 3.8.2 release. - Some documentation. Changes submitted this submission: - Brought ChangeLog up to date. - Moved old ChangeLog to ChangeLog.old - Removed the chmod +t apcnisd since it doesn't work on some systems. - In prior release: modified apcaccess to work with pthreaded apcupsd. It requires the NIS server and you can specify a host and port as an optional second argument. This works across the network providing the two machines are of identical architecture. apcaccess status host:port - Same for powerflute. - After generating an event (usually a message, possibly email) for change battery five times, apcupsd resets the change battery flag. This should help avoid false alarms which are extremely rare. Previously apcupsd had to be restarted to clear this condition. - Deleted a useless message in apcsetup.c - Ensure that argvalue is properly terminated. - Modified upsimage.c to produce slightly better looking graphs if the voltage or output voltage is less than 80 volts. - Fixed an installation problem (fat fingered data) in configure.in for SuSe systems. - Implement localtime_r() which is reentrant. - Moved old techlogs into subdirectories 1999 and 2000. This makes it easier to see the most recent techlogs. apcupsd-3.14.10/doc/techlogs/3.8.2/kes21Jun010000664000076400007640000000263607474702777016772 0ustar adk0212adk0212 Technical notes on version 3.8.2Beta13 21 June 2001 Kern Sibbald General: - Fixed bug in creation of PWRFAIL file. Thanks to Jos for his excellent testing efforts. - Cleaned up configuration of PWRFAILDIR in distribution files. - Fixed installation of multimon.css - Implemented localtime_r() for Win32 systems. Changes submitted this submission: - Due to inconsistencies in the way filenames were constructed, the powerfail path required a trailing slash. Without the slash, the path and the filename were run together, as was the default case. This is now fixed. This bug (since approximately Beta8) prevented the UPS power from being shutoff. - If the powerfail file or nologin file cannot be created, a log message is generated with the reason (e.g. read-only filesystem). - Cleaned up some PTHREADS flags on the FreeBSD system as suggested by Neil. - Noticed that a number of installation scripts did not get modified to handle the powerfail file configuration. (HPUX, Sun, unknown, Alpha, Debian, OpenBSD, RedHat, Slackware, SuSe) - Corrected the bug in the installation of the multimon.css file. It should now install corrrectly on all systems. - Added _THREAD_SAFE and _REENTRANT flags to compiles for threaded version (thanks Neil). - Added code to implement localtime_r() on Win32 systems since it does not exist in libc. apcupsd-3.14.10/doc/techlogs/3.8.2/kes27Feb010000664000076400007640000000565307474702777016742 0ustar adk0212adk0212 Technical notes on version 3.8.1-25Feb01 Kern Sibbald General: - This version has a few bug fixes, and is for limited distribution to test bug fixes. Changes submitted this submission: - Added NetBSD code submitted - Corrected the make depend to only update the Makefile rather than both Makefile and Makefile.in - Added a new AVERSION define to version.h which is meant to allow us to maintain source code with multiple versions. - Reformatted apcaction.c to Riccardo's 4.0 standards - Modified apcaction.c to be compatible with version 4.0 - Changed start_thread() to start_child(). - Changed clean_threads() to terminate_children(). - In apcexec.c changed calling sequence of execute_command() to conform to version 4.0 (added UPSINFO argument). - To correct a problem with zombies on BSD systems, I added a UPSINFO variable that is the count of children created by execute_command(). do_action() in apcaction.c was modified to check this variable, do a non-blocking wait, and decrement it if any children were found. This should properly reap the zombies. - Added additional debug information (strerror) to failed semaphore and shared memory system call errors in apcipc.c - In apcnet.c, removed ChangeBatt from slave because it is apparently being set incorrectly on some BSD masters when apcupsd is restarted. - Added an O_NDELAY to the serial port open() in apcserial.c to avoid infinite waits on some BSD systems. This required the addition of an fcntl() after the open to reset the blocking read(), which is needed in apcupsd. - Removed an unwanted break in a switch in apcstatus.c that caused the status output for BackUPS Pros to be cut short. - Added a HAVE_POWERFLUTE define and changed powerflute.c to use it. This prevents a lot of the errors seen on systems that don't have ncurses. - configure.in, added HAVE_NETBSD_OS, HAVE_POWERFLUTE, and modified generation of makefiles to only configure the files in the recognized distribution. Modified the automatic make of the dependencies to use "make depend" - Removed the call on the shell to execute a script file in apccontrol. This permits execution of any type of file, but it now requires that the file be executable. - Corrected the error in the name of ANNOYDELAY in the man file as well as in the html manual. - Added a number of updates and corrections to the html manual, thanks to reports from users. - Updated all the script files in /etc to correct the DoS problem that was reported by one of our users - thanks. - added a new gupsc directory that has the GNOME realtime monitoring program with very pretty dials. - Added num_execed_children variable to UPSINFO structure. - Added .bat files to the win32/bin directory as they seem to be more reliable than the .pif files especially on WinNT. - Enhanced shutdown.c in win32 to try a simple shutdown, but on NT, it also does an InitiateSystemShutdown. apcupsd-3.14.10/doc/techlogs/3.8.2/kes27Jun010000664000076400007640000000452307474702777016775 0ustar adk0212adk0212 Technical notes on version 3.8.2Beta14 24 June 2001 Kern Sibbald General: - Fixed stall in Network Information Server - Fixed possible race condition in pthreads Network Information Server. - Fixed a serious shutdown bug for BackUPS UPSes. - Tightened security for some scripts (thanks Neil). - More cleanups for --with-pwrfail-dir so it is properly configured. Changes submitted this submission: - I've been having Internet outages here due to the heat, and this created a situation where processes accessing the Network Information Server would become stuck. This turned out to be either related to the KEEPALIVE option being set or the fact that a shutdown() was not done on the connection. The problem occurred only after about 1500 accesses. Fixed by deleting the KEEPALIVE code and by adding shutdown() before closing the socket. - In examining the above problem, I realized that the pthreads code for STATUS uses a global buffer. Since it is a bit difficult to make this buffer local without a lot of coding, I serialized the accesses with a mutex. - John McSwain was experiencing a strange problem on his system with a BackUPS Office where apcupsd would issue the commands to shutoff the UPS power, it would then log a failure message, reboot the system, and a minute later during the reboot the power would be cut. This turned out to be very old code, dating back to at least 3.6.2 that assumed that a "dumb" UPS would instantantly cut the power when requested to do so, which was apparently the case. The newer UPSes however, typically wait one or two minutes before cutting the power. Apcupsd had a 10 second wait, after which it assumed the power would not be cut and rebooted the machine. I've removed this code. apcupsd now logs appropriate messages and then exits. Thanks to John for his perseverence in testing this! - Tightened security on mode bits for the daemon start script apcupsd, apccontrol, and ups-monitor (in Debian). Made the same changes in a number of other distributions. - Not all the files in all the distributions correctly accepted the ./configure --with-pwrfail-dir correctly. Quite a number of small distribution script modifications. Also added a few .in files so that they would be corrrectly configured. apcupsd-3.14.10/doc/techlogs/3.8.2/kes28Apr010000664000076400007640000000510307474702777016757 0ustar adk0212adk0212 Technical notes on version 3.8.2Beta9 28 April 2001 Kern Sibbald General: - I've added a first cut of pthreads support. Changes submitted this submission: - Pthreads now works on RedHat Linux and on Win32 machines. It is enabled with: ./configure --enable-pthreads I've provided new PTHREAD_CFLAGS and PTHREAD_LFLAGS defines so that pthreads can be adapted to different systems. Currently, no checks are made in ./configure to assure that pthreads really exists. The pthreads functions used are: pthread_create pthread_mutex_init pthread_mutex_lock pthread_mutex_unlock pthread_join pthread_self pthread_equal pthread_cancel pthread_detach pthread_mutex_destroy For the moment, I have not implemented multiple readers, single writer. It is simply single everything. I'm not sure that multiple readers will be necessary. If so, I will add: pthread_cond_init pthread_cond_broadcast pthread_cond_destroy pthread_cond_wait pthread_cond_signal to the list of pthreads functions used. On Sun systems, I set the concurrency to 4. On all other systems, it is assumed that this is not necessary, which is the case for Linux (some adjustments will probably be needed). I've looked at a number of other pthreads packages (MIT threads, Omnithreads, and Ralf Engelschall's PTH (GNU Portable Threads), and I don't exclude using one or more of them in a future version, but I don't have the energy to ramp up the learning curve for the moment. With pthreads enabled, there is only one process and a number of threads (on Linux this translates into light weight processes, which look like processes). Also, with pthreads enabled, there is no shared memory segment, which means that apcaccess now must communicate to the daemon using TCP/IP and hence if you want apcaccess to work, you must run the NIS server. - Modified apcaccess to use the NIS for the UPS information when no shared memory is configured. - Modified the NIS server to set SO_REUSEADDR on the socket (also SO_KEEPALIVE). This should reduce the number of bind failures. - Removed some old USE_TMP_DIRECTORY defines that are not used. - Added --with-pwrfail-dir=xxx as a ./configure option to be able to set the powerfail directory. - The SERVERPORT configuration directive is now NISPORT, for compatibility, I have left the old name as well. - I removed the compiled in default for status file directory since it is defined in apcupsd.conf apcupsd-3.14.10/doc/techlogs/3.8.4/0000775000076400007640000000000011634011372015250 5ustar adk0212adk0212apcupsd-3.14.10/doc/techlogs/3.8.4/go13Aug010000664000076400007640000000240507474702777016572 0ustar adk0212adk0212I (Kern) received the following code submission and applied it. Giulio is really very good with RPMs -- thanks. ========== Subject: apcupsd redhat rpm Date: Mon, 13 Aug 2001 21:00:04 +0200 From: Giulio Orsero To: kern@sibbald.com Hi, I've made some modification to the spec file to make it more general and able to produce the right rpm both on rh6x and rh7x: 1 spec file for all rpms. It produces rpms with the same name, it would be easy to change it to query the system where it's running and produce rpms with different names. I attach the diff in case you want to check it (just one spec for rh6 and rh7 saves time..). Differences with the official rpm (8.2-1): - the "release" (in the way it's used in the original spec) is something for rpm only, the tar.gz should be just 8.2.tar.gz - does not own /etc/rc.d/init.d /sbin /usr/man/man8 - uses rpm FHS macros (%{_mandir}, ...) - owns /etc/apcupsd /etc/apcupsd/cgi - uses "make install" to install all the stuff (note: "make install" does not install multimonnocss.cgi) - removes old stuff using less commands - preun only if uninstall and not for upgrade - all /etc/apcupsd/* scripts are marked config(noreplace) so that if someone customizes them, they are preserverd after an rpm upgrade. apcupsd-3.14.10/doc/techlogs/3.8.4/kes05Sep010000664000076400007640000000063707474702777016770 0ustar adk0212adk0212 Technical notes on version 3.8.3 05 September 2001 Kern Sibbald General: - Changed OpenBSD to use -pthread rather than -lpthread on compiles and links as suggested by Adam Kropelin. - Made the above change to NetBSD -- hoping it will work. - Merged the latest version of the manual (it has a bit of 3.9.x stuff). Changes submitted this submission: apcupsd-3.14.10/doc/techlogs/3.8.4/kes07Dec010000664000076400007640000000116707474702777016735 0ustar adk0212adk0212 Technical notes on version 3.8.4 07 December 2001 Kern Sibbald General: - Fixed multimoncss.c so that the Normal class is used in the Temperature and Humidity columns. - Added #include to multimon.c and multimoncss.c to avoid compiler warnings. - Modified a number of startup scripts (RedHat, HP, SuSe, Caldera, Slackware, and unknown). so that the subsystem lock file is created in /var/lock/subsys rather than /var/lock. - Added 940-0127A and 940-0128A cables to be the same as the 940-0119A cable. Changes submitted this submission: apcupsd-3.14.10/doc/techlogs/3.8.4/kes10Jul010000664000076400007640000000121107474702777016754 0ustar adk0212adk0212 Technical notes on version 3.8.3 10 July 2001 Kern Sibbald General: - Updated manual to include ideas/suggestions received from users installing 3.8.2. - Fixed safe.apccontrol to be a bit more system independent (thanks to Steven Orr for the idea). - Added safe.apccontrol.in so that it is configured properly. - Added a big warning message to the end of the ./configure output if /usr/ucb is on your path. - Fixed reference to lock file in Solaris apcupsd.in so it is properly configured. - Removed unused variable from Solaris apcupsd.in Changes submitted this submission: apcupsd-3.14.10/doc/techlogs/3.8.4/kes10Sep010000664000076400007640000000145107474702777016757 0ustar adk0212adk0212 Technical notes on version 3.8.3 10 September 2001 Kern Sibbald General: - Pulled in the latest copy of the manual, which corrects a number of errors reported by users. - updated all the distribution/apccontrol files to reboot the machine if the mains comes back after a power failure and the shutdown is cancelled. This will prevent the machine from being left in an unstable state. - updated all the halt scripts in the distributions script to remove the sleep commands after the killpower. This will allow the halt script to run to completion and to synchronize any raid devices (often done in the final steps by the kernel). - applied the RedHat apcupsd.spec patch supplied by Giulio Orsero. Changes submitted this submission: apcupsd-3.14.10/doc/techlogs/3.8.4/kes20Nov010000664000076400007640000000125307474702777016773 0ustar adk0212adk0212 Technical notes on version 3.8.3 20 November 2001 Kern Sibbald General: - Pulled in the latest copy of the manual. - Applied the changes as submitted by Carl Erhorn for Solaris. Most I pulled from Riccardo's integration into 3.9.7. - Applied a fix provided by a user to apcsetup.c that fixes the setup code for old Smart UPSes that are not so smart and that return a zero length capabilities string. - Fixed apctest.c so that it creates the powerfail file for the powerfail test prior to calling kill_power, then deletes it afterward. - Updated the version release date. Changes submitted this submission: apcupsd-3.14.10/doc/techlogs/3.8.4/kes24Nov010000664000076400007640000000044307474702777016777 0ustar adk0212adk0212 Technical notes on version 3.8.3 24 November 2001 Kern Sibbald General: - Applied the patch supplied by Marcus Redivo for supporting the Engarde Secure Linux version (very similar to RedHat). Changes submitted this submission: apcupsd-3.14.10/doc/techlogs/3.8.4/kes26Nov010000664000076400007640000000067307474702777017006 0ustar adk0212adk0212 Technical notes on version 3.8.3 26 November 2001 Kern Sibbald General: - Applied the the updates supplied by Carl Erhorn for adding Ambient Temperature and Humidity to multimon. - Tweaked the indenting a bit for some of the cgi programs touched by Carl. There is still more work to do to bring it in line with our new indenting standards. Changes submitted this submission: apcupsd-3.14.10/doc/techlogs/3.8.4/kes29Jul010000664000076400007640000000177407474702777017004 0ustar adk0212adk0212 Technical notes on version 3.8.3 29 July 2001 Kern Sibbald General: - Install apcupsd.conf with 644 permissions - Add --disable-install-distdir ./configure option. This allows easier installation of slaves or multiple copies of apcupsd. - Used makedepend if not gcc (Solaris fix). - Set SO_REUSEADDR in slave machines. - Add 940-0020C cable support (same as 20B). - UPSNAME now sets upsname if given. Otherwise, apcupsd attempts to get name from UPS, if not found, uses hostname, finally "default". - Implement CommLost NIS status. - Implement Shutdown NIS status. - Implement Slave NIS status. - Correct SmartTrim and SmartBoost detection code. - ./configure prints name of shutdown program. - Add port to hosts.conf. - Add new apccontrol arguments to script file. - Add UPSNAME to RedHat apccontrol. - Manual updates. - Eliminated all N/A fields in STATUS report. - Always construct STATFLAG in STATUS report. Changes submitted this submission: apcupsd-3.14.10/doc/techlogs/3.8.5/0000775000076400007640000000000011634011372015251 5ustar adk0212adk0212apcupsd-3.14.10/doc/techlogs/3.8.5/go13Aug010000664000076400007640000000240507474702777016573 0ustar adk0212adk0212I (Kern) received the following code submission and applied it. Giulio is really very good with RPMs -- thanks. ========== Subject: apcupsd redhat rpm Date: Mon, 13 Aug 2001 21:00:04 +0200 From: Giulio Orsero To: kern@sibbald.com Hi, I've made some modification to the spec file to make it more general and able to produce the right rpm both on rh6x and rh7x: 1 spec file for all rpms. It produces rpms with the same name, it would be easy to change it to query the system where it's running and produce rpms with different names. I attach the diff in case you want to check it (just one spec for rh6 and rh7 saves time..). Differences with the official rpm (8.2-1): - the "release" (in the way it's used in the original spec) is something for rpm only, the tar.gz should be just 8.2.tar.gz - does not own /etc/rc.d/init.d /sbin /usr/man/man8 - uses rpm FHS macros (%{_mandir}, ...) - owns /etc/apcupsd /etc/apcupsd/cgi - uses "make install" to install all the stuff (note: "make install" does not install multimonnocss.cgi) - removes old stuff using less commands - preun only if uninstall and not for upgrade - all /etc/apcupsd/* scripts are marked config(noreplace) so that if someone customizes them, they are preserverd after an rpm upgrade. apcupsd-3.14.10/doc/techlogs/3.8.5/kes03Jan020000664000076400007640000000245607474702777016752 0ustar adk0212adk0212 Technical notes on version 3.8.5 03 January 2002 Kern Sibbald General: - Added Battery Runtime Calibration to apctest. See the apctest chapter of the manual for details. - Added an apctest chapter to the manual. Changes submitted this submission: - apcserial.c check pwdf before attempting to close the file thus avoiding a segmentation fault if the user tries to do a kill power by hand in a non-power fail condition. A diligent user doing a lot of testing ran into this. - Added Battery Runtime Calibration to apctest for Smart UPSes. To do it "right" required a surprising amount of code. - A user pointed out that one slackware distribution had a two part name, which caused a DISTVER=@DISTVER@ to fail. So, I added quotes around all the @DISTVER@s in each distribution. Thanks to a user for point this out. - In doing a torture test of the NIS server (requesting hundreds of thousands of connects), I discovered if the connection was broken, apcupsd would get a pipe error causing the process to die, or in the case of a pthreaded apcupsd, all processes to die. This problem has existed since the begining of NIS. In addition, it has existed since the beginning of the master/slave code. Fixed by ignoring SIGPIPE signals. apcupsd-3.14.10/doc/techlogs/3.8.5/kes04Jan020000664000076400007640000000046007474702777016744 0ustar adk0212adk0212 Technical notes on version 3.8.5 04 January 2002 Kern Sibbald General: Changes submitted this submission: - Fixed Makefiles so that apctest builds on Win32 -- required a small patch to apctest. - Made apctest build and install by default. apcupsd-3.14.10/doc/techlogs/3.8.5/mb07Jan020000664000076400007640000000057107474702777016566 0ustar adk0212adk0212From: "Michel Brunette" To: Subject: Asmall mistake in the online user manual Date: Mon, 7 Jan 2002 15:35:32 -0500 You missed the "c" in the subtitle "Apupsd Reference Manual" in the online user manual. Good work! Michel Brunette University of Montreal ============= KES: Fixed! There were about 5 more such occurrences. apcupsd-3.14.10/doc/techlogs/3.8.5/ric30Oct010000664000076400007640000000351107474702777016752 0ustar adk0212adk0212- Added Carl's changes and implemented his requests for Sun distribution. - Minor cleanups to the core code. - Increased d_msg internal buffer size to 4096 to accomodate longer debug messages. - Made minor changes so that apctest now works with the new drivers code. - Completed the network driver. All the time variables are omitted from transfer as they should be determined by do_action. Keywords in front of each entry meaning: '*' means transferred to the slave '=' means not transferred but a duplicate (alias) has been transferred '-' means not transferred to the slave cmdtrans[] = { * {"model", "MODEL", 0}, * {"upsmode", "UPSMODE", 0}, - {"date", "DATE", 0}, = {"battcap", "BCHARGE", 1}, * {"mbattchg", "MBATTCHG", 1}, * {"battvolt", "BATTV", 1}, * {"nombattv", "NOMBATTV", 1}, * {"utility", "LINEV", 1}, = {"upsload", "LOADPCT", 1}, = {"loadpct", "LOADPCT", 1}, * {"outputv", "OUTPUTV", 1}, * {"status", "STATFLAG", 1}, * {"linemin", "MINLINEV", 1}, * {"linemax", "MAXLINEV", 1}, * {"upstemp", "ITEMP", 1}, * {"outputfreq", "LINEFREQ", 1}, = {"translo", "LOTRANS", 1}, = {"transhi", "HITRANS", 1}, * {"runtime", "TIMELEFT", 1}, * {"mintimel", "MINTIMEL", 1}, * {"maxtime", "MAXTIME", 1}, * {"retpct", "RETPCT", 1}, * {"sense", "SENSE", 1}, * {"hostname", "HOSTNAME", 1}, * {"battdate", "BATTDATE", 1}, * {"serialno", "SERIALNO", 1}, * {"lastxfer", "LASTXFER", 0}, * {"selftest", "SELFTEST", 1}, - {"laststest", "LASTSTEST",0}, * {"release", "RELEASE", 1}, * {"upsname", "UPSNAME", 1}, * {"lowbatt", "DLOWBATT", 1}, = {"battpct", "BCHARGE", 1}, = {"highxfer", "HITRANS", 1}, = {"lowxfer", "LOTRANS", 1}, * {"cable", "CABLE", 0}, * {"firmware", "FIRMWARE", 0}, apcupsd-3.14.10/examples/0000775000076400007640000000000011634011374014041 5ustar adk0212adk0212apcupsd-3.14.10/examples/gui/0000775000076400007640000000000011634011374014625 5ustar adk0212adk0212apcupsd-3.14.10/examples/gui/about.tcl0000664000076400007640000000116407474703540016457 0ustar adk0212adk0212proc AboutCmd {} { toplevel .about -class Dialog wm title .about "About Apcupsd" wm transient .about . image create photo .about.image -file "apcupsd_logo.gif" label .about.label -image .about.image -borderwidth 1 set msg "Copyright 2001, Kern Sibbald\n" append msg "Licensed under GPL version 2\n" append msg "Apcupsd release 3.9.6 (21 Sep 2001)" message .about.copyright -justify center -text $msg -width 400 button .about.ok -borderwidth 1 -text " OK " -command {destroy .about} pack .about.label -side top pack .about.copyright -side top -pady 5 pack .about.ok -side bottom -pady 5 } apcupsd-3.14.10/examples/gui/apcupsd.tcl0000664000076400007640000000153507474703540017006 0ustar adk0212adk0212# # Apcupsd Graphic Interface # proc MessageBox {msg type} { tk_messageBox -icon $type -message $msg } proc ExitCmd {} { exit 0 } proc RefreshCmd {} { GetStatus destroy .main.text destroy .main.image1 destroy .main.image2 destroy .main.image3 DisplayStatus GetEvents update } proc HelpCmd {} { exec netscape www.sibbald.com/apcupsd/manual/ & } wm title . "Apcupsd" # wm minsize . 600 390 foreach File [list \ mainwindow.tcl \ about.tcl \ dialog.tcl \ splash.tcl \ status.tcl \ events.tcl \ ] { if {![file exists "$File"]} { puts "Unable to find required source file $File" exit 1 } else { source $File } } unset File DisplaySplash CreateMainWindow GetStatus DisplayStatus GetEvents update after 1000 destroy .splash wm deiconify . apcupsd-3.14.10/examples/gui/dialog.tcl0000664000076400007640000000242707474703540016607 0ustar adk0212adk0212 proc dialog_create {class {win "auto"}} { if {$win == "auto"} { set count 0 set win ".dialog[incr count]" while {[winfo exists $win]} { set win ".dialog[incr count]" } } toplevel $win -class $class frame $win.info pack $win.info -expand yes -fill both -padx 4 -pady 4 frame $win.sep -height 2 -borderwidth 1 -relief sunken pack $win.sep -fill x -pady 4 frame $win.controls pack $win.controls -fill x -padx 4 -pady 4 wm title $win $class wm group $win . after idle [format { update idletasks wm minsize %s [winfo reqwidth %s] [winfo reqheight %s] } $win $win $win] return $win } proc dialog_info {win} { return "$win.info" } proc dialog_controls {win} { return "$win.controls" } proc dialog_wait {win varName} { dialog_safeguard $win set x [expr [winfo rootx .]+50] set y [expr [winfo rooty .]+50] wm geometry $win "+$x+$y" wm deiconify $win grab set $win vwait $varName grab release $win wm withdraw $win } bind modalDialog { wm deiconify %W raise %W } proc dialog_safeguard {win} { if {[lsearch [bindtags $win] modalDialog] < 0} { bindtags $win [linsert [bindtags $win] 0 modalDialog] } } apcupsd-3.14.10/examples/gui/events.tcl0000664000076400007640000000042207474703540016645 0ustar adk0212adk0212proc GetEvents {} { .events.text delete 0.0 end set fd [open "| ./client localhost:7000 events" "r"] while {[gets $fd line] > 0} { .events.text insert end "\n" .events.text insert end $line } catch {close $fd} .events.text delete 0.0 2.0 } apcupsd-3.14.10/examples/gui/mainwindow.tcl0000664000076400007640000000370507474703540017524 0ustar adk0212adk0212proc CreateMainWindow {} { global statustext StatusText set StatusText " Ready ..." . configure -menu .mbar menu .mbar .mbar add cascade -label "File" -underline 0 -menu .mbar.file menu .mbar.file .mbar.file add separator .mbar.file add command -label "Exit" -underline 0 -command {ExitCmd} .mbar add cascade -label "Options" -underline 0 -menu .mbar.options menu .mbar.options .mbar.options add command -label "Refresh Now" -underline 0 -command {RefreshCmd} .mbar add cascade -label "Help" -underline 0 -menu .mbar.help menu .mbar.help .mbar.help add command -label "About Apcupsd" -underline 0 -command {AboutCmd} .mbar.help add command -label "Help" -underline 0 -command {HelpCmd} frame .sep1 -height 10 -borderwidth 0 pack .sep1 -fill x -side top text .sep1.text -relief groove -height 1 .sep1.text configure -tabs {2.5i 4.5i 6.5i} .sep1.text insert end "\tBattery V\tMains V\tMains V" pack .sep1.text -side top -fill x frame .main -borderwidth 0 pack .main -side top -fill x frame .sep2 -height 2 -borderwidth 1 -relief sunken pack .sep2 -fill x -pady 4 frame .elab pack .elab -side top -fill x label .elab.lab1 -text "Events:" -anchor e pack .elab.lab1 -side left -padx 4 frame .events pack .events -fill x -padx 4 -pady 4 scrollbar .events.sbar -command ".events.text yview" pack .events.sbar -side right -fill y text .events.text -height 10 -wrap word -yscrollcommand ".events.sbar set" pack .events.text -side top -fill x frame .status -borderwidth 1 -relief raised pack .status -side bottom -fill x -pady 2 label .statusLabel -text "Status:" -anchor e -fg magenta set statustext [label .statusText -relief sunken \ -borderwidth 1 -textvariable StatusText -anchor w] grid columnconfigure .status 1 -weight 1 grid .statusLabel -in .status -row 0 -column 0 grid .statusText -in .status -row 0 -column 1 -sticky ew -padx 3 } apcupsd-3.14.10/examples/gui/pkgIndex.tcl0000664000076400007640000000111107474703540017106 0ustar adk0212adk0212# Tcl package index file, version 1.1 # This file is generated by the "pkg_mkIndex" command # and sourced either when an application starts up or # by a "package unknown" script. It invokes the # "package ifneeded" command to set up package-related # information so that packages will be loaded automatically # in response to "package require" commands. When this # script is sourced, the variable $dir must contain the # full path name of this file's directory. package ifneeded Bnet 1.0 [list tclPkgSetup $dir Bnet 1.0 {{tclbnet.so load {BnetClose BnetConnect BnetGet BnetPut}}}] apcupsd-3.14.10/examples/gui/splash.tcl0000664000076400007640000000103707474703540016636 0ustar adk0212adk0212proc DisplaySplash {} { wm withdraw . toplevel .splash -borderwidth 4 -relief raised wm overrideredirect .splash 1 after idle { update idletasks set xmax [winfo screenwidth .splash] set ymax [winfo screenheight .splash] set x0 [expr ($xmax-[winfo reqwidth .splash])/2] set y0 [expr ($ymax-[winfo reqheight .splash])/2] wm geometry .splash "+$x0+$y0" } image create photo .splash.image -file "apcupsd_logo.gif" label .splash.label -image .splash.image pack .splash.label update } apcupsd-3.14.10/examples/gui/status.tcl0000664000076400007640000001461207474703540016672 0ustar adk0212adk0212proc DrawTickLines {c imwid imhgt} { $c create line 50 60 150 60 -fill darkgrey $c create line 50 120 150 120 -fill darkgrey $c create line 50 180 150 180 -fill darkgrey $c create line 50 240 150 240 -fill darkgrey $c create line 50 300 150 300 -fill darkgrey $c create line 50 0 50 300 150 300 150 1 50 1 -fill black } proc DrawText {c min step imwid imhgt} { set next $min $c create text 46 300 -anchor se -text [format "%d" $next] set next [expr $next + $step] $c create text 46 240 -anchor e -text [format "%d" $next] set next [expr $next + $step] $c create text 46 180 -anchor e -text [format "%d" $next] set next [expr $next + $step] $c create text 46 120 -anchor e -text [format "%d" $next] set next [expr $next + $step] $c create text 46 60 -anchor e -text [format "%d" $next] set next [expr $next + $step] $c create text 46 0 -anchor ne -text [format "%d" $next] } proc DrawBattVolt {c imwid imhgt} { global BattV NomBattV switch -- $NomBattV { 12.0 { set minv 3 set maxv 18 set hip [expr 12 + 3] set lowp [expr 12 - 3] } 24.0 { set minv 15 set maxv 30 set hip [expr 24 + 5] set lowp [expr 24 - 5] } 48.0 { set minv 30 set maxv 60 set hip [expr 48 + 7] set lowp [expr 48 - 7] } default { set minv 0 set maxv [expr 10 * (($BattV / 10) + 1)] set hip [expr $BattV + 5] set lowp [expr $BattV -5] } } set deltav [expr $maxv - $minv] set battpos [expr $imhgt - (($BattV - $minv) * $imhgt / $deltav)] set hipos [expr $imhgt - (($hip - $minv) * $imhgt / $deltav)] set lowpos [expr $imhgt - (($lowp - $minv) * $imhgt / $deltav)] $c create rectangle 50 0 150 $imhgt -fill green $c create rectangle 50 0 150 $hipos -fill red -width 0 $c create rectangle 50 $lowpos 150 $imhgt -fill red -width 0 $c create rectangle 75 $battpos 125 $imhgt -fill black $c create text 75 [expr $imhgt + 10] -anchor w -text [format "%.1f VDC" $BattV] DrawTickLines $c $imwid $imhgt DrawText $c $minv [expr $deltav/5] $imwid $imhgt } proc DrawUtility {c imwid imhgt} { global LineV LowTrans HiTrans set minv 175 set deltav 75 set utilpos [expr $imhgt - (($LineV - $minv) * $imhgt / $deltav)] set hipos [expr $imhgt - (($HiTrans - $minv) * $imhgt / $deltav)] set lowpos [expr $imhgt - (($LowTrans - $minv) * $imhgt / $deltav)] $c create rectangle 50 0 150 $imhgt -fill green $c create rectangle 50 0 150 $hipos -fill red $c create rectangle 50 $lowpos 150 $imhgt -fill red $c create rectangle 75 $utilpos 125 $imhgt -fill black $c create text 75 [expr $imhgt + 10] -anchor w -text [format "%.1f VAC" $LineV] DrawTickLines $c $imwid $imhgt DrawText $c $minv [expr $deltav/5] $imwid $imhgt } proc DisplayStatus {} { global BattChg TimeLeft LoadPct HostName Release LineV RetPct global LineFreq BattV NomBattV ITemp global Model Status set imhgt 300 set imwid 100 frame .main.text -borderwidth 2 pack .main.text -side left -expand no -pady 4 label .main.text.lab00 -text "Host:" label .main.text.lab01 -text $HostName grid .main.text.lab00 -row 0 -column 0 -sticky e grid .main.text.lab01 -row 0 -column 1 -sticky ew label .main.text.lab10 -text "UPS Model:" label .main.text.lab11 -text $Model grid .main.text.lab10 -row 1 -column 0 -sticky e grid .main.text.lab11 -row 1 -column 1 -sticky ew label .main.text.lab20 -text "UPS Status:" label .main.text.lab21 -text $Status grid .main.text.lab20 -row 2 -column 0 -sticky e grid .main.text.lab21 -row 2 -column 1 -sticky ew label .main.text.lab30 -text "Internal Temp:" label .main.text.lab31 -text $ITemp grid .main.text.lab30 -row 3 -column 0 -sticky e grid .main.text.lab31 -row 3 -column 1 -sticky ew label .main.text.lab40 -text "Apcupsd Release:" label .main.text.lab41 -text $Release grid .main.text.lab40 -row 4 -column 0 -sticky e grid .main.text.lab41 -row 4 -column 1 -sticky ew grid columnconfigure .main.text 1 -weight 1 frame .main.image1 pack .main.image1 -side left -pady 4 canvas .main.image1.c -width [expr $imwid+50] -height [expr $imhgt + 20] DrawBattVolt .main.image1.c $imwid $imhgt pack .main.image1.c frame .main.image2 pack .main.image2 -side left -pady 4 canvas .main.image2.c -width [expr $imwid+50] -height [expr $imhgt + 20] DrawUtility .main.image2.c $imwid $imhgt pack .main.image2.c frame .main.image3 pack .main.image3 -side left -pady 4 canvas .main.image3.c -width [expr $imwid+75] -height [expr $imhgt + 20] DrawUtility .main.image3.c $imwid $imhgt pack .main.image3.c } proc GetStatus {} { global BattChg TimeLeft LoadPct HostName Release LineV RetPct global LineFreq BattV NomBattV ITemp LowTrans HiTrans global Model Status foreach {i} {BattChg TimeLeft LoadPct HostName Release LineV \ RetPct LineFreq BattV ITemp NomBattV LowTrans \ HiTrans Model Status} { set $i 0 } set fd [open "| ./client localhost:7000 status" "r"] while {[gets $fd line] > 0} { scan $line "%9s" label switch -- $label { BCHARGE { scan $line "%*s : %f Percent" BattChg } TIMELEFT { scan $line "%*s : %f Minutes" TimeLeft } LOADPCT { scan $line "%*s : %f Percent" LoadPct } HOSTNAME { scan $line "%*s : %s" HostName } RELEASE { scan $line "%*s : %s" Release } LINEV { scan $line "%*s : %f Volts" LineV } LOTRANS { scan $line "%*s : %f Volts" LowTrans } HITRANS { scan $line "%*s : %f Volts" HiTrans } RETPCT { scan $line "%*s : %f Percent" RetPct } ITEMP { scan $line "%*s : %f C Internal" ITemp } LINEFREQ { scan $line "%*s : %f Hz" LineFreq } BATTV { scan $line "%*s : %f Volts" BattV } NOMBATTV { scan $line "%*s : %f" NomBattV } MODEL { scan $line "%*s : %s" Model } STATUS { scan $line "%*s : %s" Status } default { } } } catch {close $fd} } apcupsd-3.14.10/examples/rpt/0000775000076400007640000000000011634011372014644 5ustar adk0212adk0212apcupsd-3.14.10/examples/rpt/Back-UPS-350-USB.rpt0000664000076400007640000000734510561416060017646 0ustar adk0212adk0212Found UPS at /dev/usb/hid/hiddev0 hiddev driver version is 1.0.2 HID: vendor 0x51d product 0x2 version 0x100 app UPS HID: bus: 1 devnum: 3 ifnum: 0 UPS HID device name: "American Power Conversion Back-UPS 350 FW: 5.2.I USB FW: c1 " Battery Chemistry: "PbAc" (4) InputReport 6 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 InputReport 12 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 1380 Seconds InputReport 19 Field 0, app UPS, phys PowerSummary Usage 0, ACPresent = 1 InputReport 20 Field 0, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 1, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 FeatureReport 1 Field 0, app UPS, phys PowerSummary Usage 0, iProduct = 1 Back-UPS 350 FW: 5.2.I USB FW: c1 FeatureReport 2 Field 0, app UPS, phys PowerSummary Usage 0, iSerialNumber = 2 BB0115017954 FeatureReport 3 Field 0, app UPS, phys PowerSummary Usage 0, iDeviceChemistry = 4 PbAc FeatureReport 4 Field 0, app UPS, phys PowerSummary Usage 0, iOEMInformation = 3 American Power Conversion FeatureReport 5 Field 0, app UPS, phys PowerSummary Usage 0, Rechargeable = 1 FeatureReport 6 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 FeatureReport 7 Field 0, app UPS, phys PowerSummary Usage 0, ManufactureDate = 10896 2001-04-16 FeatureReport 8 Field 0, app UPS, phys PowerSummary Usage 0, ConfigVoltage = 1200 CentiVolts FeatureReport 9 Field 0, app UPS, phys PowerSummary Usage 0, Voltage = 1342 CentiVolts FeatureReport 10 Field 0, app UPS, phys PowerSummary Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 11 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, CapacityMode = 2 percent FeatureReport 12 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 1380 Seconds FeatureReport 13 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, DesignCapacity = 100 percent FeatureReport 14 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, FullChargeCapacity = 100 percent FeatureReport 15 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, WarningCapacityLimit = 50 percent FeatureReport 16 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, CapacityGranularity2 = 1 percent FeatureReport 17 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, RemainingCapacityLimit = 10 percent FeatureReport 18 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, CapacityGranularity1 = 1 percent FeatureReport 19 Field 0, app UPS, phys PowerSummary Usage 0, ACPresent = 1 FeatureReport 20 Field 0, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 1, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 FeatureReport 53 Field 0, app UPS, phys PowerSummary Usage 0, APCPanelTest = 0 FeatureReport 28 Field 0, app UPS, phys PowerSummary Usage 0, APCBattReplacementDate = 267777 2001-04-16 FeatureReport 64 Field 0, app UPS, phys APCGeneralCollection Usage 0, APCForceShutdown = 0 Waiting for events ... (interrupt to exit) Event: Voltage = 1342 Event: RemainingCapacity = 95 Event: Charging = 1 Event: RunTimeToEmpty = 2580 apcupsd-3.14.10/examples/rpt/Back-UPS-350ES.rpt0000664000076400007640000000721210561416060017440 0ustar adk0212adk0212Found UPS at /dev/usb/hid/hiddev0 hiddev driver version is 1.0.2 HID: vendor 0x51d product 0x2 version 0x100 app UPS HID: bus: 1 devnum: 2 ifnum: 0 UPS HID device name: "American Power Conversion Back-UPS ES/CyberFort 350 FW: 3.1.I USB FW: d1" Battery Chemistry: "PbAc" (4) InputReport 6 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 InputReport 12 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 360 Seconds InputReport 19 Field 0, app UPS, phys PowerSummary Usage 0, ACPresent = 1 InputReport 20 Field 0, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 1, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 FeatureReport 1 Field 0, app UPS, phys PowerSummary Usage 0, iProduct = 1 Back-UPS ES/CyberFort 350 FW: 3.1.I USB FW: d1 FeatureReport 2 Field 0, app UPS, phys PowerSummary Usage 0, iSerialNumber = 2 AB0233221824 FeatureReport 3 Field 0, app UPS, phys PowerSummary Usage 0, iDeviceChemistry = 4 PbAc FeatureReport 4 Field 0, app UPS, phys PowerSummary Usage 0, iOEMInformation = 3 American Power Conversion FeatureReport 5 Field 0, app UPS, phys PowerSummary Usage 0, Rechargeable = 1 FeatureReport 6 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 FeatureReport 7 Field 0, app UPS, phys PowerSummary Usage 0, ManufactureDate = 11535 2002-08-15 FeatureReport 8 Field 0, app UPS, phys PowerSummary Usage 0, ConfigVoltage = 1200 CentiVolts FeatureReport 9 Field 0, app UPS, phys PowerSummary Usage 0, Voltage = 1327 CentiVolts FeatureReport 10 Field 0, app UPS, phys PowerSummary Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 11 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, CapacityMode = 2 percent FeatureReport 12 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 360 Seconds FeatureReport 13 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, DesignCapacity = 100 percent FeatureReport 14 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, FullChargeCapacity = 100 percent FeatureReport 15 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, WarningCapacityLimit = 50 percent FeatureReport 16 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, CapacityGranularity2 = 1 percent FeatureReport 17 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, RemainingCapacityLimit = 10 percent FeatureReport 18 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, CapacityGranularity1 = 1 percent FeatureReport 19 Field 0, app UPS, phys PowerSummary Usage 0, ACPresent = 1 FeatureReport 20 Field 0, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 1, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 FeatureReport 53 Field 0, app UPS, phys PowerSummary Usage 0, APCPanelTest = 0 FeatureReport 28 Field 0, app UPS, phys PowerSummary Usage 0, APCBattReplacementDate = 529666 2002-08-15 FeatureReport 64 Field 0, app UPS, phys APCGeneralCollection Usage 0, APCForceShutdown = 0 Waiting for events ... (interrupt to exit) apcupsd-3.14.10/examples/rpt/Back-UPS-500-USB.rpt0000664000076400007640000000734510561416060017643 0ustar adk0212adk0212Found UPS at /dev/usb/hid/hiddev0 hiddev driver version is 1.0.2 HID: vendor 0x51d product 0x2 version 0x100 app UPS HID: bus: 1 devnum: 4 ifnum: 0 UPS HID device name: "American Power Conversion Back-UPS 500 FW: 6.2.I USB FW: c1 " Battery Chemistry: "PbAc" (4) InputReport 6 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 16 0x10 InputReport 12 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 2580 Seconds InputReport 19 Field 0, app UPS, phys PowerSummary Usage 0, ACPresent = 1 InputReport 20 Field 0, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 1, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 FeatureReport 1 Field 0, app UPS, phys PowerSummary Usage 0, iProduct = 1 Back-UPS 500 FW: 6.2.I USB FW: c1 FeatureReport 2 Field 0, app UPS, phys PowerSummary Usage 0, iSerialNumber = 2 BB0134078947 FeatureReport 3 Field 0, app UPS, phys PowerSummary Usage 0, iDeviceChemistry = 4 PbAc FeatureReport 4 Field 0, app UPS, phys PowerSummary Usage 0, iOEMInformation = 3 American Power Conversion FeatureReport 5 Field 0, app UPS, phys PowerSummary Usage 0, Rechargeable = 1 FeatureReport 6 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 16 0x10 FeatureReport 7 Field 0, app UPS, phys PowerSummary Usage 0, ManufactureDate = 11035 2001-08-27 FeatureReport 8 Field 0, app UPS, phys PowerSummary Usage 0, ConfigVoltage = 1200 CentiVolts FeatureReport 9 Field 0, app UPS, phys PowerSummary Usage 0, Voltage = 1366 CentiVolts FeatureReport 10 Field 0, app UPS, phys PowerSummary Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 11 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, CapacityMode = 2 percent FeatureReport 12 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 2580 Seconds FeatureReport 13 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, DesignCapacity = 100 percent FeatureReport 14 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, FullChargeCapacity = 100 percent FeatureReport 15 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, WarningCapacityLimit = 50 percent FeatureReport 16 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, CapacityGranularity2 = 1 percent FeatureReport 17 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, RemainingCapacityLimit = 10 percent FeatureReport 18 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, CapacityGranularity1 = 1 percent FeatureReport 19 Field 0, app UPS, phys PowerSummary Usage 0, ACPresent = 1 FeatureReport 20 Field 0, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 1, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 FeatureReport 53 Field 0, app UPS, phys PowerSummary Usage 0, APCPanelTest = 0 FeatureReport 28 Field 0, app UPS, phys PowerSummary Usage 0, APCBattReplacementDate = 534273 2001-08-27 FeatureReport 64 Field 0, app UPS, phys APCGeneralCollection Usage 0, APCForceShutdown = 0 Waiting for events ... (interrupt to exit) Event: Voltage = 1366 Event: RemainingCapacity = 95 Event: Charging = 1 Event: APCStatusFlag = 8 apcupsd-3.14.10/examples/rpt/Back-UPS-500ES.rpt0000664000076400007640000001633310561416060017441 0ustar adk0212adk0212hiddev driver version is 1.0.2 HID: vendor 0x51d product 0x2 version 0x106 app UPS HID: bus: 4 devnum: 3 ifnum: 0 UPS HID device name: "APC Back-UPS ES 500 FW:2.e2.D USB FW:e2" Battery Chemistry: "PbAc" (4) InputReport 6 Field 0, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 InputReport 12 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 5017 Seconds InputReport 22 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, ACPresent = 1 Field 3, app UPS, phys PowerSummary Usage 0, BatteryPresent = 1 Field 4, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 Field 6, app UPS, phys PowerSummary Usage 0, RemainingTimeLimitExpired = 0 Field 7, app UPS, phys PowerSummary Usage 0, NeedReplacement = 0 Field 8, app UPS, phys PowerSummary Usage 0, Overload = 0 FeatureReport 1 Field 0, app UPS, phys PowerSummary Usage 0, iProduct = 1 Back-UPS ES 500 FW:2.e2.D USB FW:e2 FeatureReport 2 Field 0, app UPS, phys PowerSummary Usage 0, iSerialNumber = 2 JB0221019999 FeatureReport 3 Field 0, app UPS, phys PowerSummary Usage 0, iDeviceChemistry = 4 PbAc FeatureReport 4 Field 0, app UPS, phys PowerSummary Usage 0, iOEMInformation = 3 APC FeatureReport 5 Field 0, app UPS, phys PowerSummary Usage 0, Rechargeable = 1 FeatureReport 6 Field 0, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 FeatureReport 7 Field 0, app UPS, phys PowerSummary Usage 0, ManufactureDate = 11449 2002-05-25 FeatureReport 8 Field 0, app UPS, phys PowerSummary Usage 0, ConfigVoltage = 1200 CentiVolts FeatureReport 9 Field 0, app UPS, phys PowerSummary Usage 0, Voltage = 1359 CentiVolts FeatureReport 10 Field 0, app UPS, phys PowerSummary Usage 0, iManufacturer = 3 APC FeatureReport 11 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, CapacityMode = 2 percent FeatureReport 12 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 5017 Seconds FeatureReport 13 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, DesignCapacity = 100 percent FeatureReport 14 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, FullChargeCapacity = 100 percent FeatureReport 15 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, WarningCapacityLimit = 50 percent FeatureReport 16 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, CapacityGranularity2 = 1 percent FeatureReport 17 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, RemainingCapacityLimit = 10 percent FeatureReport 18 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, CapacityGranularity1 = 1 percent FeatureReport 22 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, ACPresent = 1 Field 3, app UPS, phys PowerSummary Usage 0, BatteryPresent = 1 Field 4, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 Field 6, app UPS, phys PowerSummary Usage 0, RemainingTimeLimitExpired = 0 Field 7, app UPS, phys PowerSummary Usage 0, NeedReplacement = 0 Field 8, app UPS, phys PowerSummary Usage 0, Overload = 0 FeatureReport 23 Field 0, app UPS, phys PowerSummary Usage 0, RemainingTimeLimit = 120 Seconds FeatureReport 24 Field 0, app UPS, phys PowerSummary Usage 0, AudibleAlarmControl = 2 FeatureReport 28 Field 0, app UPS, phys Battery Usage 0, APCBattReplacementDate = 0 2000-00-00 FeatureReport 32 Field 0, app UPS, phys Battery Usage 0, ManufactureDate = 11449 2002-05-25 FeatureReport 34 Field 0, app UPS, phys Battery Exponent 0 lost. Usage 0, RemainingCapacity = 100 percent FeatureReport 35 Field 0, app UPS, phys Battery Usage 0, RunTimeToEmpty = 5017 Seconds FeatureReport 36 Field 0, app UPS, phys Battery Usage 0, RemainingTimeLimit = 120 Seconds FeatureReport 37 Field 0, app UPS, phys Battery Usage 0, ConfigVoltage = 1200 CentiVolts FeatureReport 38 Field 0, app UPS, phys Battery Usage 0, Voltage = 1359 CentiVolts FeatureReport 39 Field 0, app UPS, phys Battery Usage 0, [ff860024] = 243 FeatureReport 40 Field 0, app UPS, phys Battery Usage 0, [ff860018] = 0 FeatureReport 48 Field 0, app UPS, phys Input Usage 0, ConfigVoltage = 120 Volts FeatureReport 49 Field 0, app UPS, phys Input Usage 0, Voltage = 119 Volts FeatureReport 50 Field 0, app UPS, phys Input Usage 0, LowVoltageTransfer = 88 Volts FeatureReport 51 Field 0, app UPS, phys Input Usage 0, HighVoltageTransfer = 138 Volts FeatureReport 52 Field 0, app UPS, phys Input Usage 0, [ff860024] = 176 FeatureReport 53 Field 0, app UPS, phys Input Usage 0, [ff860061] = 2 FeatureReport 54 Field 0, app UPS, phys Input Usage 0, [ff860052] = 3 FeatureReport 64 Field 0, app UPS, phys APCGeneralCollection Usage 0, APCForceShutdown = 0 FeatureReport 65 Field 0, app UPS, phys APCGeneralCollection Usage 0, [ff86007d] = -1 FeatureReport 80 Field 0, app UPS, phys PowerConverter Usage 0, PercentLoad = 0 FeatureReport 81 Field 0, app UPS, phys PowerConverter Usage 0, [ff860024] = 189 FeatureReport 96 Field 0, app UPS, phys [ff860001] Usage 0, [ff860023] = 0 FeatureReport 97 Field 0, app UPS, phys [ff860001] Usage 0, [ff860026] = -120 FeatureReport 98 Field 0, app UPS, phys [ff860001] Usage 0, [ff860025] = 0 FeatureReport 127 Field 0, app UPS, phys --- Usage 0, iProduct = 6 2.e2.D FeatureReport 126 Field 0, app UPS, phys --- Usage 0, APC_UPS_FirmwareRevision = 5 FeatureReport 125 Field 0, app UPS, phys --- Usage 0, iSerialNumber = 2 JB0221019999 FeatureReport 124 Field 0, app UPS, phys --- Usage 0, iManufacturer = 3 APC FeatureReport 123 Field 0, app UPS, phys --- Usage 0, ManufactureDate = 11449 2002-05-25 FeatureReport 122 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 6, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 7, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 8, app UPS, phys --- Usage 0, Overload = 0 FeatureReport 121 Field 0, app UPS, phys --- Usage 0, APCPanelTest = 0 FeatureReport 120 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 FeatureReport 117 Field 0, app UPS, phys --- Usage 0, [ff860029] = 3 FeatureReport 116 Field 0, app UPS, phys --- Usage 0, [ff86002a] = 0 apcupsd-3.14.10/examples/rpt/Back-UPS-BR-800.rpt0000664000076400007640000004723710561416735017535 0ustar adk0212adk0212FROM: Jorge Fbregas Found UPS at /dev/hiddev0 hiddev driver version is 1.0.4 HID: vendor 0x51d product 0x2 version 0x106 app UPS HID: bus: 4 devnum: 2 ifnum: 0 UPS HID device name: "American Power Conversion Back-UPS BR 800 FW:9.o2 .D USB FW:o2" Battery Chemistry: "" (0) InputReport 12 Field 0, app UPS, phys --- Exponent -1075460892 lost. Usage 0, RemainingCapacity = 100 maH InputReport 13 Field 0, app UPS, phys --- Usage 0, RunTimeToEmpty = 1807 Seconds InputReport 7 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 InputReport 22 Field 0, app UPS, phys Battery Usage 0, Test = 6 InputReport 51 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 0 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 0 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 FeatureReport 1 Field 0, app UPS, phys --- Usage 0, iProduct = 1 Back-UPS BR 800 FW:9.o2 .D USB FW:o2 FeatureReport 2 Field 0, app UPS, phys --- Usage 0, iSerialNumber = 2 QB0645337724 FeatureReport 3 Field 0, app UPS, phys --- Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 4 Field 0, app UPS, phys --- Usage 0, iOEMInformation = 0 FeatureReport 5 Field 0, app UPS, phys --- Usage 0, iDeviceChemistry = 0 FeatureReport 6 Field 0, app UPS, phys --- Usage 0, Rechargeable = 0 Field 1, app UPS, phys --- Exponent 0 lost. Usage 0, CapacityMode = 0 maH FeatureReport 14 Field 0, app UPS, phys --- Exponent 0 lost. Usage 0, DesignCapacity = 0 maH Field 1, app UPS, phys --- Exponent 0 lost. Usage 0, FullChargeCapacity = 0 maH FeatureReport 12 Field 0, app UPS, phys --- Exponent 0 lost. Usage 0, RemainingCapacity = 100 maH FeatureReport 16 Field 0, app UPS, phys --- Exponent 0 lost. Usage 0, CapacityGranularity1 = 0 maH Field 1, app UPS, phys --- Exponent 0 lost. Usage 0, CapacityGranularity2 = 0 maH FeatureReport 15 Field 0, app UPS, phys --- Exponent 0 lost. Usage 0, WarningCapacityLimit = 50 maH FeatureReport 17 Field 0, app UPS, phys --- Exponent 0 lost. Usage 0, RemainingCapacityLimit = 10 maH FeatureReport 9 Field 0, app UPS, phys --- Usage 0, ManufactureDate = 0 1980-00-00 FeatureReport 13 Field 0, app UPS, phys --- Usage 0, RunTimeToEmpty = 1807 Seconds FeatureReport 18 Field 0, app UPS, phys --- Usage 0, DelayBeforeShutdown = -1 FeatureReport 19 Field 0, app UPS, phys --- Usage 0, DelayBeforeReboot = 0 Seconds FeatureReport 8 Field 0, app UPS, phys --- Usage 0, RemainingTimeLimit = 120 Seconds FeatureReport 10 Field 0, app UPS, phys --- Usage 0, ConfigVoltage = 2400 CentiVolts FeatureReport 11 Field 0, app UPS, phys --- Usage 0, Voltage = 0 CentiVolts FeatureReport 20 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 1 FeatureReport 7 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 FeatureReport 22 Field 0, app UPS, phys Battery Usage 0, Test = 6 FeatureReport 23 Field 0, app UPS, phys Battery Usage 0, APCBattCapBeforeStartup = 0 FeatureReport 27 Field 0, app UPS, phys Battery Usage 0, [ff86001a] = 0 FeatureReport 28 Field 0, app UPS, phys Battery Usage 0, [ff86001b] = 0 FeatureReport 69 Field 0, app UPS, phys Battery Usage 0, APCBattReplacementDate = 599297 2001-09-25 FeatureReport 21 Field 0, app UPS, phys Battery Usage 0, ManufactureDate = 13671 2006-11-07 FeatureReport 24 Field 0, app UPS, phys Battery Exponent 0 lost. Usage 0, RemainingCapacity = 0 maH FeatureReport 26 Field 0, app UPS, phys Battery Usage 0, RemainingTimeLimit = 0 Seconds FeatureReport 25 Field 0, app UPS, phys Battery Usage 0, RunTimeToEmpty = 0 Seconds FeatureReport 30 Field 0, app UPS, phys Battery Usage 0, Temperature = 3023 Degrees K with -1 exponent FeatureReport 31 Field 0, app UPS, phys Battery Usage 0, ConfigVoltage = 0 CentiVolts FeatureReport 29 Field 0, app UPS, phys Battery Usage 0, Voltage = 2710 CentiVolts FeatureReport 71 Field 0, app UPS, phys Battery Usage 0, APC860024_?????? = 0 FeatureReport 72 Field 0, app UPS, phys Battery Usage 0, [ff860018] = 0 FeatureReport 32 Field 0, app UPS, phys Input Usage 0, Voltage = 591084 DeciVolts FeatureReport 70 Field 0, app UPS, phys Input Usage 0, ConfigVoltage = 0 Volts FeatureReport 33 Field 0, app UPS, phys Input Usage 0, APCLineFailCause = 1 FeatureReport 34 Field 0, app UPS, phys Input Usage 0, APC860061_?????? = 0 FeatureReport 66 Field 0, app UPS, phys Input Usage 0, APC860024_?????? = 0 FeatureReport 44 Field 0, app UPS, phys Output Usage 0, PercentLoad = 270 FeatureReport 82 Field 0, app UPS, phys Output Usage 0, ConfigActivePower = 0 Watts FeatureReport 42 Field 0, app UPS, phys Output Usage 0, Frequency = 6000 CentiHertz FeatureReport 43 Field 0, app UPS, phys Output Usage 0, Voltage = 1200 DeciVolts FeatureReport 45 Field 0, app UPS, phys Output Usage 0, ConfigVoltage = 0 Volts FeatureReport 35 Field 0, app UPS, phys Output Usage 0, HighVoltageTransfer = 138 Volts FeatureReport 36 Field 0, app UPS, phys Output Usage 0, LowVoltageTransfer = 97 Volts FeatureReport 37 Field 0, app UPS, phys Output Usage 0, APCDelayBeforeStartup = 0 Seconds FeatureReport 38 Field 0, app UPS, phys Output Usage 0, APCShutdownAfterDelay = 0 Seconds FeatureReport 39 Field 0, app UPS, phys Output Usage 0, DelayBeforeShutdown = 0 FeatureReport 40 Field 0, app UPS, phys Output Usage 0, DelayBeforeStartup = 0 Seconds FeatureReport 41 Field 0, app UPS, phys Output Usage 0, DelayBeforeReboot = 0 Seconds FeatureReport 64 Field 0, app UPS, phys Output Usage 0, APCForceShutdown = 0 FeatureReport 65 Field 0, app UPS, phys Output Usage 0, APCDelayBeforeShutdown = -1 Seconds FeatureReport 46 Field 0, app UPS, phys --- Usage 0, iProduct = 0 FeatureReport 47 Field 0, app UPS, phys --- Usage 0, iSerialNumber = 0 FeatureReport 48 Field 0, app UPS, phys --- Usage 0, iManufacturer = 0 FeatureReport 49 Field 0, app UPS, phys --- Usage 0, iName = 0 FeatureReport 52 Field 0, app UPS, phys --- Usage 0, APC_UPS_FirmwareRevision = 0 FeatureReport 55 Field 0, app UPS, phys --- Usage 0, APC_USB_FirmwareRevision = 0 FeatureReport 50 Field 0, app UPS, phys --- Usage 0, APCPanelTest = 0 FeatureReport 53 Field 0, app UPS, phys --- Usage 0, ManufactureDate = 0 1980-00-00 FeatureReport 62 Field 0, app UPS, phys --- Usage 0, [ff860027] = 0 FeatureReport 63 Field 0, app UPS, phys --- Usage 0, [ff860028] = 0 FeatureReport 54 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 0 FeatureReport 51 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 0 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 0 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 FeatureReport 96 Field 0, app UPS, phys [ff860001] Usage 0, APC860023_?????? = 0 FeatureReport 97 Field 0, app UPS, phys [ff860001] Usage 0, APC860026_?????? = 0 FeatureReport 98 Field 0, app UPS, phys [ff860001] Usage 0, APC860025_?????? = 0 FeatureReport 81 Field 0, app UPS, phys PowerConverter Usage 0, APC860024_?????? = 0 Waiting for events ... (interrupt to exit) Event: RunTimeToEmpty = 1807 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1845 Event: RunTimeToEmpty = 1845 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1845 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1807 Event: RunTimeToEmpty = 1807 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1807 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1807 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1807 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1845 Event: RunTimeToEmpty = 1845 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1845 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1845 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1845 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1845 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1845 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1845 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1845 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1807 Event: RunTimeToEmpty = 1807 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1807 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1807 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1807 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1807 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 Event: RunTimeToEmpty = 1807 Event: RemainingCapacity = 100 Event: Charging = 0 Event: Discharging = 0 Event: ACPresent = 1 Event: BatteryPresent = 1 Event: BelowRemainingCapacityLimit = 0 Event: ShutdownRequested = 0 Event: ShutdownImminent = 0 Event: RemainingTimeLimitExpired = 0 Event: CommunicationLost = 0 Event: NeedReplacement = 0 Event: Overload = 0 Event: VoltageNotRegulated = 0 Event: [ff860080] = 0 Event: Test = 6 apcupsd-3.14.10/examples/rpt/Back-UPS-CS-650.rpt0000664000076400007640000002554410561416735017537 0ustar adk0212adk0212FROM: Jan Ceuleers Found UPS at /dev/usb/hiddev0 hiddev driver version is 1.0.2 HID: vendor 0x51d product 0x2 version 0x6 app UPS HID: bus: 2 devnum: 2 ifnum: 0 UPS HID device name: "American Power Conversion Back-UPS CS 650 FW:817.v4.I USB FW:v4" Battery Chemistry: "PbAc" (4) InputReport 12 Field 0, app UPS, phys --- Exponent 0 lost. Usage 0, RemainingCapacity = 100 percent InputReport 13 Field 0, app UPS, phys --- Usage 0, RunTimeToEmpty = 1462 Seconds InputReport 7 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 InputReport 22 Field 0, app UPS, phys Battery Usage 0, Test = 6 InputReport 51 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 FeatureReport 1 Field 0, app UPS, phys --- Usage 0, iProduct = 1 Back-UPS CS 650 FW:817.v4.I USB FW:v4 FeatureReport 2 Field 0, app UPS, phys --- Usage 0, iSerialNumber = 2 QB0642232674 FeatureReport 3 Field 0, app UPS, phys --- Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 4 Field 0, app UPS, phys --- Usage 0, iOEMInformation = 3 American Power Conversion FeatureReport 5 Field 0, app UPS, phys --- Usage 0, iDeviceChemistry = 4 PbAc FeatureReport 6 Field 0, app UPS, phys --- Usage 0, Rechargeable = 1 Field 1, app UPS, phys --- Exponent 0 lost. Usage 0, CapacityMode = 2 percent FeatureReport 14 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, DesignCapacity = 100 percent Field 1, app UPS, phys --- Exponent 2 lost. Usage 0, FullChargeCapacity = 100 percent FeatureReport 12 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, RemainingCapacity = 100 percent FeatureReport 16 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, CapacityGranularity1 = 1 percent Field 1, app UPS, phys --- Exponent 2 lost. Usage 0, CapacityGranularity2 = 1 percent FeatureReport 15 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, WarningCapacityLimit = 50 percent FeatureReport 17 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, RemainingCapacityLimit = 10 percent FeatureReport 9 Field 0, app UPS, phys --- Usage 0, ManufactureDate = 13644 2006-10-12 FeatureReport 13 Field 0, app UPS, phys --- Usage 0, RunTimeToEmpty = 1530 Seconds FeatureReport 18 Field 0, app UPS, phys --- Usage 0, DelayBeforeShutdown = -1 FeatureReport 19 Field 0, app UPS, phys --- Usage 0, DelayBeforeReboot = 0 Seconds FeatureReport 8 Field 0, app UPS, phys --- Usage 0, RemainingTimeLimit = 120 Seconds FeatureReport 10 Field 0, app UPS, phys --- Usage 0, ConfigVoltage = 1200 CentiVolts FeatureReport 11 Field 0, app UPS, phys --- Usage 0, Voltage = 1351 CentiVolts FeatureReport 20 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 1 FeatureReport 7 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 FeatureReport 22 Field 0, app UPS, phys Battery Usage 0, Test = 6 FeatureReport 23 Field 0, app UPS, phys Battery Usage 0, APCBattCapBeforeStartup = 0 FeatureReport 27 Field 0, app UPS, phys Battery Usage 0, [ff86001a] = 0 FeatureReport 28 Field 0, app UPS, phys Battery Usage 0, [ff86001b] = 0 FeatureReport 69 Field 0, app UPS, phys Battery Usage 0, APCBattReplacementDate = 1053190 2006-10-12 FeatureReport 21 Field 0, app UPS, phys Battery Usage 0, ManufactureDate = 13644 2006-10-12 FeatureReport 24 Field 0, app UPS, phys Battery Exponent 0 lost. Usage 0, RemainingCapacity = 1000 percent FeatureReport 26 Field 0, app UPS, phys Battery Usage 0, RemainingTimeLimit = 120 Seconds FeatureReport 25 Field 0, app UPS, phys Battery Usage 0, RunTimeToEmpty = 1507 Seconds FeatureReport 30 Field 0, app UPS, phys Battery Usage 0, Temperature = 3023 Degrees K with -1 exponent FeatureReport 31 Field 0, app UPS, phys Battery Usage 0, ConfigVoltage = 1200 CentiVolts FeatureReport 29 Field 0, app UPS, phys Battery Usage 0, Voltage = 1351 CentiVolts FeatureReport 71 Field 0, app UPS, phys Battery Usage 0, APC860024_?????? = 240 FeatureReport 72 Field 0, app UPS, phys Battery Usage 0, [ff860018] = 0 FeatureReport 32 Field 0, app UPS, phys Input Usage 0, Voltage = 0 DeciVolts FeatureReport 70 Field 0, app UPS, phys Input Usage 0, ConfigVoltage = 230 Volts FeatureReport 33 Field 0, app UPS, phys Input Usage 0, APCLineFailCause = 12 FeatureReport 34 Field 0, app UPS, phys Input Usage 0, APC860061_?????? = 1 FeatureReport 66 Field 0, app UPS, phys Input Usage 0, APC860024_?????? = 126 FeatureReport 44 Field 0, app UPS, phys Output Usage 0, PercentLoad = 250 FeatureReport 82 Field 0, app UPS, phys Output Usage 0, ConfigActivePower = 400 Watts FeatureReport 42 Field 0, app UPS, phys Output Usage 0, Frequency = 5000 CentiHertz FeatureReport 43 Field 0, app UPS, phys Output Usage 0, Voltage = 2300 DeciVolts FeatureReport 45 Field 0, app UPS, phys Output Usage 0, ConfigVoltage = 0 Volts FeatureReport 35 Field 0, app UPS, phys Output Usage 0, HighVoltageTransfer = 260 Volts FeatureReport 36 Field 0, app UPS, phys Output Usage 0, LowVoltageTransfer = 0 Volts FeatureReport 37 Field 0, app UPS, phys Output Usage 0, APCDelayBeforeStartup = 0 Seconds FeatureReport 38 Field 0, app UPS, phys Output Usage 0, APCShutdownAfterDelay = 0 Seconds FeatureReport 39 Field 0, app UPS, phys Output Usage 0, DelayBeforeShutdown = -1 FeatureReport 40 Field 0, app UPS, phys Output Usage 0, DelayBeforeStartup = 0 Seconds FeatureReport 41 Field 0, app UPS, phys Output Usage 0, DelayBeforeReboot = 0 Seconds FeatureReport 64 Field 0, app UPS, phys Output Usage 0, APCForceShutdown = 0 FeatureReport 65 Field 0, app UPS, phys Output Usage 0, APCDelayBeforeShutdown = -1 Seconds FeatureReport 46 Field 0, app UPS, phys --- Usage 0, iProduct = 5 Back-UPS CS 650 FeatureReport 47 Field 0, app UPS, phys --- Usage 0, iSerialNumber = 2 QB0642232674 FeatureReport 48 Field 0, app UPS, phys --- Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 49 Field 0, app UPS, phys --- Usage 0, iName = 6 APC FeatureReport 52 Field 0, app UPS, phys --- Usage 0, APC_UPS_FirmwareRevision = 7 FeatureReport 55 Field 0, app UPS, phys --- Usage 0, APC_USB_FirmwareRevision = 8 FeatureReport 50 Field 0, app UPS, phys --- Usage 0, APCPanelTest = 0 FeatureReport 53 Field 0, app UPS, phys --- Usage 0, ManufactureDate = 13644 2006-10-12 FeatureReport 62 Field 0, app UPS, phys --- Usage 0, [ff860027] = 0 FeatureReport 63 Field 0, app UPS, phys --- Usage 0, [ff860028] = 0 FeatureReport 54 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 1 FeatureReport 51 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 FeatureReport 96 Field 0, app UPS, phys [ff860001] Usage 0, APC860023_?????? = 0 FeatureReport 97 Field 0, app UPS, phys [ff860001] Usage 0, APC860026_?????? = 14 FeatureReport 98 Field 0, app UPS, phys [ff860001] Usage 0, APC860025_?????? = 0 FeatureReport 81 Field 0, app UPS, phys PowerConverter Usage 0, APC860024_?????? = 148 Waiting for events ... (interrupt to exit) Event: RunTimeToEmpty = 1507 Event: RunTimeToEmpty = 1507 Event: RunTimeToEmpty = 1485 Event: RunTimeToEmpty = 1462 Event: RunTimeToEmpty = 1485 Event: RunTimeToEmpty = 1507 Event: RunTimeToEmpty = 1530 Event: RunTimeToEmpty = 1507 Event: RunTimeToEmpty = 1530 apcupsd-3.14.10/examples/rpt/Back-UPS-ES-550.rpt0000664000076400007640000002244410561416735017534 0ustar adk0212adk0212FROM: Jan Ceuleers Found UPS at /dev/usb/hid/hiddev0 hiddev driver version is 1.0.4 HID: vendor 0x51d product 0x2 version 0x106 app UPS HID: bus: 1 devnum: 2 ifnum: 0 UPS HID device name: "APC Back-UPS ES 550 FW:828.D2.I USB FW:D2" Battery Chemistry: "PbAc" (4) InputReport 6 Field 0, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 InputReport 12 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 1755 Seconds InputReport 22 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, ACPresent = 1 Field 3, app UPS, phys PowerSummary Usage 0, BatteryPresent = 1 Field 4, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 Field 6, app UPS, phys PowerSummary Usage 0, RemainingTimeLimitExpired = 0 Field 7, app UPS, phys PowerSummary Usage 0, NeedReplacement = 0 Field 8, app UPS, phys PowerSummary Usage 0, Overload = 0 Field 9, app UPS, phys PowerSummary Usage 0, --- = 0 Usage 1, --- = 0 Usage 2, --- = 0 Usage 3, --- = 0 Usage 4, --- = 0 Usage 5, --- = 0 Usage 6, --- = 0 Usage 7, --- = 0 Usage 8, --- = 0 Usage 9, --- = 0 Usage 10, --- = 0 Usage 11, --- = 0 Usage 12, --- = 0 Usage 13, --- = 0 Usage 14, --- = 0 Usage 15, --- = 0 Usage 16, --- = 0 Usage 17, --- = 0 Usage 18, --- = 0 Usage 19, --- = 0 Usage 20, --- = 0 Usage 21, --- = 0 Usage 22, --- = 0 FeatureReport 1 Field 0, app UPS, phys PowerSummary Usage 0, iProduct = 1 Back-UPS ES 550 FW:828.D2.I USB FW:D2 FeatureReport 2 Field 0, app UPS, phys PowerSummary Usage 0, iSerialNumber = 2 5B0649U02550 FeatureReport 3 Field 0, app UPS, phys PowerSummary Usage 0, iDeviceChemistry = 4 PbAc FeatureReport 4 Field 0, app UPS, phys PowerSummary Usage 0, iOEMInformation = 3 APC FeatureReport 5 Field 0, app UPS, phys PowerSummary Usage 0, Rechargeable = 1 FeatureReport 6 Field 0, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 FeatureReport 7 Field 0, app UPS, phys PowerSummary Usage 0, ManufactureDate = 13692 2006-11-28 FeatureReport 8 Field 0, app UPS, phys PowerSummary Usage 0, ConfigVoltage = 1200 CentiVolts FeatureReport 9 Field 0, app UPS, phys PowerSummary Usage 0, Voltage = 1353 CentiVolts FeatureReport 10 Field 0, app UPS, phys PowerSummary Usage 0, iManufacturer = 3 APC FeatureReport 11 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, CapacityMode = 2 percent FeatureReport 12 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 1755 Seconds FeatureReport 13 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, DesignCapacity = 100 percent FeatureReport 14 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, FullChargeCapacity = 100 percent FeatureReport 15 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, WarningCapacityLimit = 50 percent FeatureReport 16 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, CapacityGranularity2 = 1 percent FeatureReport 17 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, RemainingCapacityLimit = 10 percent FeatureReport 18 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, CapacityGranularity1 = 1 percent FeatureReport 22 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, ACPresent = 1 Field 3, app UPS, phys PowerSummary Usage 0, BatteryPresent = 1 Field 4, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 Field 6, app UPS, phys PowerSummary Usage 0, RemainingTimeLimitExpired = 0 Field 7, app UPS, phys PowerSummary Usage 0, NeedReplacement = 0 Field 8, app UPS, phys PowerSummary Usage 0, Overload = 0 Field 9, app UPS, phys PowerSummary Usage 0, --- = 0 Usage 1, --- = 0 Usage 2, --- = 0 Usage 3, --- = 0 Usage 4, --- = 0 Usage 5, --- = 0 Usage 6, --- = 0 Usage 7, --- = 0 Usage 8, --- = 0 Usage 9, --- = 0 Usage 10, --- = 0 Usage 11, --- = 0 Usage 12, --- = 0 Usage 13, --- = 0 Usage 14, --- = 0 Usage 15, --- = 0 Usage 16, --- = 0 Usage 17, --- = 0 Usage 18, --- = 0 Usage 19, --- = 0 Usage 20, --- = 0 Usage 21, --- = 0 Usage 22, --- = 0 FeatureReport 23 Field 0, app UPS, phys PowerSummary Usage 0, RemainingTimeLimit = 120 Seconds FeatureReport 24 Field 0, app UPS, phys PowerSummary Usage 0, AudibleAlarmControl = 1 FeatureReport 28 Field 0, app UPS, phys Battery Usage 0, APCBattReplacementDate = 0 2000-00-00 FeatureReport 32 Field 0, app UPS, phys Battery Usage 0, ManufactureDate = 13692 2006-11-28 FeatureReport 34 Field 0, app UPS, phys Battery Exponent 0 lost. Usage 0, RemainingCapacity = 100 percent FeatureReport 35 Field 0, app UPS, phys Battery Usage 0, RunTimeToEmpty = 1755 Seconds FeatureReport 36 Field 0, app UPS, phys Battery Usage 0, RemainingTimeLimit = 120 Seconds FeatureReport 37 Field 0, app UPS, phys Battery Usage 0, ConfigVoltage = 1200 CentiVolts FeatureReport 38 Field 0, app UPS, phys Battery Usage 0, Voltage = 1353 CentiVolts FeatureReport 39 Field 0, app UPS, phys Battery Usage 0, APC860024_?????? = 240 FeatureReport 40 Field 0, app UPS, phys Battery Usage 0, [ff860018] = 0 FeatureReport 48 Field 0, app UPS, phys Input Usage 0, ConfigVoltage = 230 Volts FeatureReport 49 Field 0, app UPS, phys Input Usage 0, Voltage = 230 Volts FeatureReport 50 Field 0, app UPS, phys Input Usage 0, LowVoltageTransfer = 190 Volts FeatureReport 51 Field 0, app UPS, phys Input Usage 0, HighVoltageTransfer = 260 Volts FeatureReport 52 Field 0, app UPS, phys Input Usage 0, APC860024_?????? = 128 FeatureReport 53 Field 0, app UPS, phys Input Usage 0, APC860061_?????? = 1 FeatureReport 54 Field 0, app UPS, phys Input Usage 0, APCLineFailCause = 0 FeatureReport 64 Field 0, app UPS, phys APCGeneralCollection Usage 0, APCForceShutdown = 0 FeatureReport 65 Field 0, app UPS, phys APCGeneralCollection Usage 0, APCDelayBeforeShutdown = -1 Seconds FeatureReport 80 Field 0, app UPS, phys PowerConverter Usage 0, PercentLoad = 14 FeatureReport 81 Field 0, app UPS, phys PowerConverter Usage 0, APC860024_?????? = 124 FeatureReport 96 Field 0, app UPS, phys [ff860001] Usage 0, APC860023_?????? = 0 FeatureReport 97 Field 0, app UPS, phys [ff860001] Usage 0, APC860026_?????? = 10 FeatureReport 98 Field 0, app UPS, phys [ff860001] Usage 0, APC860025_?????? = 0 FeatureReport 127 Field 0, app UPS, phys --- Usage 0, iProduct = 6 828.D2.I FeatureReport 126 Field 0, app UPS, phys --- Usage 0, APC_UPS_FirmwareRevision = 5 FeatureReport 125 Field 0, app UPS, phys --- Usage 0, iSerialNumber = 2 5B0649U02550 FeatureReport 124 Field 0, app UPS, phys --- Usage 0, iManufacturer = 3 APC FeatureReport 123 Field 0, app UPS, phys --- Usage 0, ManufactureDate = 13692 2006-11-28 FeatureReport 122 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 6, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 7, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 8, app UPS, phys --- Usage 0, Overload = 0 Field 9, app UPS, phys --- Usage 0, --- = 0 Usage 1, --- = 0 Usage 2, --- = 0 Usage 3, --- = 0 Usage 4, --- = 0 Usage 5, --- = 0 Usage 6, --- = 0 Usage 7, --- = 0 Usage 8, --- = 0 Usage 9, --- = 0 Usage 10, --- = 0 Usage 11, --- = 0 Usage 12, --- = 0 Usage 13, --- = 0 Usage 14, --- = 0 Usage 15, --- = 0 Usage 16, --- = 0 Usage 17, --- = 0 Usage 18, --- = 0 Usage 19, --- = 0 Usage 20, --- = 0 Usage 21, --- = 0 Usage 22, --- = 0 FeatureReport 121 Field 0, app UPS, phys --- Usage 0, APCPanelTest = 0 FeatureReport 120 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 1 Waiting for events ... (interrupt to exit) apcupsd-3.14.10/examples/rpt/Back-UPS-XS-1300-LCD.rpt0000664000076400007640000002623010561416735020226 0ustar adk0212adk0212FROM: Michael Guidero Found UPS at /dev/hiddev0 hiddev driver version is 1.0.4 HID: vendor 0x51d product 0x2 version 0x101 app UPS HID: bus: 2 devnum: 2 ifnum: 0 UPS HID device name: "American Power Conversion Back-UPS XS 1300 LCD FW:836.H4 .D USB" Battery Chemistry: "PbAc" (4) InputReport 6 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 InputReport 12 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 1356 Seconds InputReport 19 Field 0, app UPS, phys PowerSummary Usage 0, ACPresent = 1 InputReport 20 Field 0, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 1, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 InputReport 22 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, ACPresent = 1 Field 3, app UPS, phys PowerSummary Usage 0, BatteryPresent = 1 Field 4, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 Field 6, app UPS, phys PowerSummary Usage 0, RemainingTimeLimitExpired = 0 Field 7, app UPS, phys PowerSummary Usage 0, CommunicationLost = 0 Field 8, app UPS, phys PowerSummary Usage 0, NeedReplacement = 0 Field 9, app UPS, phys PowerSummary Usage 0, Overload = 0 Field 10, app UPS, phys PowerSummary Usage 0, VoltageNotRegulated = 0 Field 11, app UPS, phys PowerSummary Usage 0, --- = 0 Usage 1, --- = 0 Usage 2, --- = 0 Usage 3, --- = 0 Usage 4, --- = 0 Usage 5, --- = 0 Usage 6, --- = 0 Usage 7, --- = 0 Usage 8, --- = 0 Usage 9, --- = 0 Usage 10, --- = 0 Usage 11, --- = 0 Usage 12, --- = 0 Usage 13, --- = 0 Usage 14, --- = 0 Usage 15, --- = 0 Usage 16, --- = 0 Usage 17, --- = 0 Usage 18, --- = 0 Usage 19, --- = 0 Usage 20, --- = 0 InputReport 33 Field 0, app UPS, phys Battery Usage 0, Test = 6 FeatureReport 1 Field 0, app UPS, phys PowerSummary Usage 0, iProduct = 1 Back-UPS XS 1300 LCD FW:836.H4 .D USB FW:H4 FeatureReport 2 Field 0, app UPS, phys PowerSummary Usage 0, iSerialNumber = 2 JB0641011335 FeatureReport 3 Field 0, app UPS, phys PowerSummary Usage 0, iDeviceChemistry = 4 PbAc FeatureReport 4 Field 0, app UPS, phys PowerSummary Usage 0, iOEMInformation = 3 American Power Conversion FeatureReport 5 Field 0, app UPS, phys PowerSummary Usage 0, Rechargeable = 1 FeatureReport 6 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 FeatureReport 7 Field 0, app UPS, phys PowerSummary Usage 0, ManufactureDate = 16 1980-00-16 FeatureReport 8 Field 0, app UPS, phys PowerSummary Usage 0, ConfigVoltage = 2400 CentiVolts FeatureReport 9 Field 0, app UPS, phys PowerSummary Usage 0, Voltage = 2689 CentiVolts FeatureReport 10 Field 0, app UPS, phys PowerSummary Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 11 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, CapacityMode = 2 percent FeatureReport 12 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 1356 Seconds FeatureReport 13 Field 0, app UPS, phys PowerSummary Exponent 0 lost. Usage 0, DesignCapacity = 100 percent FeatureReport 14 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, FullChargeCapacity = 100 percent FeatureReport 15 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, WarningCapacityLimit = 50 percent FeatureReport 16 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, CapacityGranularity2 = 1 percent FeatureReport 17 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, RemainingCapacityLimit = 10 percent FeatureReport 18 Field 0, app UPS, phys PowerSummary Exponent 2 lost. Usage 0, CapacityGranularity1 = 1 percent FeatureReport 19 Field 0, app UPS, phys PowerSummary Usage 0, ACPresent = 1 FeatureReport 20 Field 0, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 1, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 FeatureReport 21 Field 0, app UPS, phys PowerSummary Usage 0, DelayBeforeShutdown = -1 FeatureReport 22 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, ACPresent = 0 Field 3, app UPS, phys PowerSummary Usage 0, BatteryPresent = 0 Field 4, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 Field 6, app UPS, phys PowerSummary Usage 0, RemainingTimeLimitExpired = 0 Field 7, app UPS, phys PowerSummary Usage 0, CommunicationLost = 0 Field 8, app UPS, phys PowerSummary Usage 0, NeedReplacement = 0 Field 9, app UPS, phys PowerSummary Usage 0, Overload = 0 Field 10, app UPS, phys PowerSummary Usage 0, VoltageNotRegulated = 0 Field 11, app UPS, phys PowerSummary Usage 0, --- = 0 Usage 1, --- = 0 Usage 2, --- = 0 Usage 3, --- = 0 Usage 4, --- = 0 Usage 5, --- = 0 Usage 6, --- = 0 Usage 7, --- = 0 Usage 8, --- = 0 Usage 9, --- = 0 Usage 10, --- = 0 Usage 11, --- = 0 Usage 12, --- = 0 Usage 13, --- = 0 Usage 14, --- = 0 Usage 15, --- = 0 Usage 16, --- = 0 Usage 17, --- = 0 Usage 18, --- = 0 Usage 19, --- = 0 Usage 20, --- = 0 FeatureReport 23 Field 0, app UPS, phys PowerSummary Usage 0, RemainingTimeLimit = 120 Seconds FeatureReport 24 Field 0, app UPS, phys PowerSummary Usage 0, AudibleAlarmControl = 2 FeatureReport 28 Field 0, app UPS, phys Battery Usage 0, APCBattReplacementDate = 0 2000-00-00 FeatureReport 32 Field 0, app UPS, phys Battery Usage 0, ManufactureDate = 13638 2006-10-06 FeatureReport 33 Field 0, app UPS, phys Battery Usage 0, Test = 6 FeatureReport 34 Field 0, app UPS, phys Battery Exponent 0 lost. Usage 0, RemainingCapacity = 100 percent FeatureReport 35 Field 0, app UPS, phys Battery Usage 0, RunTimeToEmpty = 1356 Seconds FeatureReport 36 Field 0, app UPS, phys Battery Usage 0, RemainingTimeLimit = 120 Seconds FeatureReport 37 Field 0, app UPS, phys Battery Usage 0, ConfigVoltage = 2400 CentiVolts FeatureReport 38 Field 0, app UPS, phys Battery Usage 0, Voltage = 2672 CentiVolts FeatureReport 39 Field 0, app UPS, phys Battery Usage 0, APC860024_?????? = 245 FeatureReport 40 Field 0, app UPS, phys Battery Usage 0, [ff860018] = 0 FeatureReport 48 Field 0, app UPS, phys Input Usage 0, ConfigVoltage = 120 Volts FeatureReport 49 Field 0, app UPS, phys Input Usage 0, Voltage = 116 Volts FeatureReport 50 Field 0, app UPS, phys Input Usage 0, LowVoltageTransfer = 88 Volts FeatureReport 51 Field 0, app UPS, phys Input Usage 0, HighVoltageTransfer = 139 Volts FeatureReport 52 Field 0, app UPS, phys Input Usage 0, APC860024_?????? = 127 FeatureReport 53 Field 0, app UPS, phys Input Usage 0, APCSensitivity = 1 FeatureReport 54 Field 0, app UPS, phys Input Usage 0, APCLineFailCause = 11 FeatureReport 64 Field 0, app UPS, phys APCGeneralCollection Usage 0, APCForceShutdown = 0 FeatureReport 65 Field 0, app UPS, phys APCGeneralCollection Usage 0, APCDelayBeforeShutdown = -1 Seconds FeatureReport 66 Field 0, app UPS, phys APCGeneralCollection Usage 0, DelayBeforeShutdown = -1 FeatureReport 80 Field 0, app UPS, phys PowerConverter Usage 0, PercentLoad = 26 FeatureReport 81 Field 0, app UPS, phys PowerConverter Usage 0, APC860024_?????? = 225 FeatureReport 82 Field 0, app UPS, phys PowerConverter Usage 0, ConfigActivePower = 780 Watts FeatureReport 96 Field 0, app UPS, phys [ff860001] Usage 0, APC860023_?????? = 0 FeatureReport 97 Field 0, app UPS, phys [ff860001] Usage 0, APC860026_?????? = 16 FeatureReport 98 Field 0, app UPS, phys [ff860001] Usage 0, APC860025_?????? = 0 FeatureReport 127 Field 0, app UPS, phys --- Usage 0, iProduct = 5 Back-UPS XS 1300 LCD FeatureReport 126 Field 0, app UPS, phys --- Usage 0, APC_UPS_FirmwareRevision = 7 FeatureReport 125 Field 0, app UPS, phys --- Usage 0, iSerialNumber = 2 JB0641011335 FeatureReport 124 Field 0, app UPS, phys --- Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 123 Field 0, app UPS, phys --- Usage 0, ManufactureDate = 13638 2006-10-06 FeatureReport 122 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 0 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 0 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 6, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 7, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 8, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 9, app UPS, phys --- Usage 0, Overload = 0 Field 10, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 11, app UPS, phys --- Usage 0, --- = 0 Usage 1, --- = 0 Usage 2, --- = 0 Usage 3, --- = 0 Usage 4, --- = 0 Usage 5, --- = 0 Usage 6, --- = 0 Usage 7, --- = 0 Usage 8, --- = 0 Usage 9, --- = 0 Usage 10, --- = 0 Usage 11, --- = 0 Usage 12, --- = 0 Usage 13, --- = 0 Usage 14, --- = 0 Usage 15, --- = 0 Usage 16, --- = 0 Usage 17, --- = 0 Usage 18, --- = 0 Usage 19, --- = 0 Usage 20, --- = 0 FeatureReport 121 Field 0, app UPS, phys --- Usage 0, APCPanelTest = 0 FeatureReport 120 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 FeatureReport 117 Field 0, app UPS, phys --- Usage 0, APC860029_?????? = 98 FeatureReport 116 Field 0, app UPS, phys --- Usage 0, APC86002A_?????? = 0 FeatureReport 128 Field 0, app UPS, phys --- Usage 0, [ff000055] = 157 FeatureReport 129 Field 0, app UPS, phys --- Usage 0, [ff000058] = 0 Usage 1, [ff000058] = 0 Usage 2, [ff000058] = 0 Usage 3, [ff000058] = 0 Usage 4, [ff000058] = 0 Usage 5, [ff000058] = 0 FeatureReport 130 Field 0, app UPS, phys --- Usage 0, [ff000059] = 157 FeatureReport 131 Field 0, app UPS, phys --- Usage 0, [ff000060] = 157 Waiting for events ... (interrupt to exit) Event: ManufactureDate = 13638 Event: Voltage = 2689 Event: Voltage = 2672 Event: [ff000055] = 157 Event: ManufactureDate = 16 Event: [ff000059] = 157 Event: [ff000060] = 157 apcupsd-3.14.10/examples/rpt/BackUPS.rpt0000664000076400007640000000670610561416060016635 0ustar adk0212adk0212hiddev driver version is 1.0.2 HID: vendor 0x51d product 0x2 version 0x100 app UPS HID: bus: 1 devnum: 22 ifnum: 0 UPS HID device name: "American Power Conversion Back-UPS 350 FW: 5.2.I USB FW: c1 " Battery Chemistry: "PbAc" (4) InputReport 6 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 InputReport 12 Field 0, app UPS, phys PowerSummary Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 2580 Seconds InputReport 19 Field 0, app UPS, phys PowerSummary Usage 0, ACPresent = 1 InputReport 20 Field 0, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 1, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 FeatureReport 1 Field 0, app UPS, phys PowerSummary Usage 0, iProduct = 1 Back-UPS 350 FW: 5.2.I USB FW: c1 FeatureReport 2 Field 0, app UPS, phys PowerSummary Usage 0, iSerialNumber = 2 B%0%0%0%0%0% FeatureReport 3 Field 0, app UPS, phys PowerSummary Usage 0, iDeviceChemistry = 4 PbAc FeatureReport 4 Field 0, app UPS, phys PowerSummary Usage 0, iOEMInformation = 3 American Power Conversion FeatureReport 5 Field 0, app UPS, phys PowerSummary Usage 0, Rechargeable = 1 FeatureReport 6 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 FeatureReport 7 Field 0, app UPS, phys PowerSummary Usage 0, ManufactureDate = 10896 2001-04-16 FeatureReport 8 Field 0, app UPS, phys PowerSummary Usage 0, ConfigVoltage = 1200 CentiVolts FeatureReport 9 Field 0, app UPS, phys PowerSummary Usage 0, Voltage = 1335 CentiVolts FeatureReport 10 Field 0, app UPS, phys PowerSummary Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 11 Field 0, app UPS, phys PowerSummary Usage 0, CapacityMode = 2 percent FeatureReport 12 Field 0, app UPS, phys PowerSummary Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 2580 Seconds FeatureReport 13 Field 0, app UPS, phys PowerSummary Usage 0, DesignCapacity = 100 percent FeatureReport 14 Field 0, app UPS, phys PowerSummary Usage 0, FullChargeCapacity = 100 percent FeatureReport 15 Field 0, app UPS, phys PowerSummary Usage 0, WarningCapacityLimit = 50 percent FeatureReport 16 Field 0, app UPS, phys PowerSummary Usage 0, CapacityGranularity2 = 1 percent FeatureReport 17 Field 0, app UPS, phys PowerSummary Usage 0, RemainingCapacityLimit = 10 percent FeatureReport 18 Field 0, app UPS, phys PowerSummary Usage 0, CapacityGranularity1 = 1 percent FeatureReport 19 Field 0, app UPS, phys PowerSummary Usage 0, ACPresent = 1 FeatureReport 20 Field 0, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 1, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 FeatureReport 53 Field 0, app UPS, phys PowerSummary Usage 0, APCPanelTest = 0 FeatureReport 28 Field 0, app UPS, phys PowerSummary Usage 0, APCBattReplacementDate = 267777 2001-04-16 FeatureReport 64 Field 0, app UPS, phys APCGeneralCollection Usage 0, APCForceShutdown = 0 Waiting for events ... (interrupt to exit) apcupsd-3.14.10/examples/rpt/Smart-UPS-1500.rpt0000664000076400007640000002623710562203676017534 0ustar adk0212adk0212FROM: Marc Swenson Found UPS at /dev/usb/hid/hiddev0 hiddev driver version is 1.0.4 HID: vendor 0x51d product 0x2 version 0x6 app UPS HID: bus: 2 devnum: 2 ifnum: 0 UPS HID device name: "American Power Conversion Smart-UPS 1500 FW:601.3.D USB FW:1.5" Battery Chemistry: "PbAc" (4) InputReport 12 Field 0, app UPS, phys --- Exponent 0 lost. Usage 0, RemainingCapacity = 76 percent InputReport 13 Field 0, app UPS, phys --- Usage 0, RunTimeToEmpty = 240 Seconds InputReport 8 Field 0, app UPS, phys --- Usage 0, RemainingTimeLimit = 0 Seconds InputReport 20 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 InputReport 7 Field 0, app UPS, phys --- Usage 0, Charging = 1 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 InputReport 22 Field 0, app UPS, phys Battery Usage 0, Test = 6 InputReport 23 Field 0, app UPS, phys Battery Usage 0, APCBattCapBeforeStartup = 15 InputReport 27 Field 0, app UPS, phys Battery Usage 0, [ff86001a] = 3 InputReport 28 Field 0, app UPS, phys Battery Usage 0, [ff86001b] = 0 InputReport 21 Field 0, app UPS, phys Battery Usage 0, ManufactureDate = 12409 2004-03-25 InputReport 26 Field 0, app UPS, phys Battery Usage 0, RemainingTimeLimit = 120 Seconds InputReport 33 Field 0, app UPS, phys Input Usage 0, APCLineFailCause = 4 InputReport 34 Field 0, app UPS, phys Input Usage 0, APCSensitivity = 2 InputReport 45 Field 0, app UPS, phys Output Usage 0, ConfigVoltage = 120 Volts InputReport 35 Field 0, app UPS, phys Output Usage 0, HighVoltageTransfer = 127 Volts InputReport 36 Field 0, app UPS, phys Output Usage 0, LowVoltageTransfer = 106 Volts InputReport 37 Field 0, app UPS, phys Output Usage 0, APCDelayBeforeStartup = 60 Seconds InputReport 38 Field 0, app UPS, phys Output Usage 0, APCShutdownAfterDelay = 180 Seconds InputReport 54 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 InputReport 51 Field 0, app UPS, phys --- Usage 0, Charging = 1 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 FeatureReport 1 Field 0, app UPS, phys --- Usage 0, iProduct = 1 Smart-UPS 1500 FW:601.3.D USB FW:1.5 FeatureReport 2 Field 0, app UPS, phys --- Usage 0, iSerialNumber = 2 AS0413231246 FeatureReport 3 Field 0, app UPS, phys --- Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 4 Field 0, app UPS, phys --- Usage 0, iOEMInformation = 3 American Power Conversion FeatureReport 5 Field 0, app UPS, phys --- Usage 0, iDeviceChemistry = 4 PbAc FeatureReport 6 Field 0, app UPS, phys --- Usage 0, Rechargeable = 1 Field 1, app UPS, phys --- Exponent 0 lost. Usage 0, CapacityMode = 2 percent FeatureReport 14 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, DesignCapacity = 100 percent Field 1, app UPS, phys --- Exponent 2 lost. Usage 0, FullChargeCapacity = 100 percent FeatureReport 12 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, RemainingCapacity = 76 percent FeatureReport 16 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, CapacityGranularity1 = 1 percent Field 1, app UPS, phys --- Exponent 2 lost. Usage 0, CapacityGranularity2 = 1 percent FeatureReport 15 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, WarningCapacityLimit = 50 percent FeatureReport 17 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, RemainingCapacityLimit = 10 percent FeatureReport 9 Field 0, app UPS, phys --- Usage 0, ManufactureDate = 12409 2004-03-25 FeatureReport 13 Field 0, app UPS, phys --- Usage 0, RunTimeToEmpty = 240 Seconds FeatureReport 18 Field 0, app UPS, phys --- Usage 0, DelayBeforeShutdown = -1 FeatureReport 19 Field 0, app UPS, phys --- Usage 0, DelayBeforeReboot = -1 Seconds FeatureReport 8 Field 0, app UPS, phys --- Usage 0, RemainingTimeLimit = 0 Seconds FeatureReport 10 Field 0, app UPS, phys --- Usage 0, ConfigVoltage = 2400 CentiVolts FeatureReport 11 Field 0, app UPS, phys --- Usage 0, Voltage = 2740 CentiVolts FeatureReport 20 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 FeatureReport 7 Field 0, app UPS, phys --- Usage 0, Charging = 1 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 FeatureReport 22 Field 0, app UPS, phys Battery Usage 0, Test = 6 FeatureReport 23 Field 0, app UPS, phys Battery Usage 0, APCBattCapBeforeStartup = 15 FeatureReport 27 Field 0, app UPS, phys Battery Usage 0, [ff86001a] = 3 FeatureReport 28 Field 0, app UPS, phys Battery Usage 0, [ff86001b] = 0 FeatureReport 21 Field 0, app UPS, phys Battery Usage 0, ManufactureDate = 12409 2004-03-25 FeatureReport 24 Field 0, app UPS, phys Battery Exponent 0 lost. Usage 0, RemainingCapacity = 760 percent FeatureReport 26 Field 0, app UPS, phys Battery Usage 0, RemainingTimeLimit = 120 Seconds FeatureReport 25 Field 0, app UPS, phys Battery Usage 0, RunTimeToEmpty = 240 Seconds FeatureReport 30 Field 0, app UPS, phys Battery Usage 0, Temperature = 3032 Degrees K with -1 exponent FeatureReport 31 Field 0, app UPS, phys Battery Usage 0, ConfigVoltage = 2400 CentiVolts FeatureReport 29 Field 0, app UPS, phys Battery Usage 0, Voltage = 2740 CentiVolts FeatureReport 32 Field 0, app UPS, phys Input Usage 0, Voltage = 1238 DeciVolts FeatureReport 33 Field 0, app UPS, phys Input Usage 0, APCLineFailCause = 4 FeatureReport 34 Field 0, app UPS, phys Input Usage 0, APCSensitivity = 2 FeatureReport 44 Field 0, app UPS, phys Output Usage 0, PercentLoad = 442 FeatureReport 42 Field 0, app UPS, phys Output Usage 0, Frequency = 6000 CentiHertz FeatureReport 43 Field 0, app UPS, phys Output Usage 0, Voltage = 1238 DeciVolts FeatureReport 45 Field 0, app UPS, phys Output Usage 0, ConfigVoltage = 120 Volts FeatureReport 35 Field 0, app UPS, phys Output Usage 0, HighVoltageTransfer = 127 Volts FeatureReport 36 Field 0, app UPS, phys Output Usage 0, LowVoltageTransfer = 106 Volts FeatureReport 37 Field 0, app UPS, phys Output Usage 0, APCDelayBeforeStartup = 60 Seconds FeatureReport 38 Field 0, app UPS, phys Output Usage 0, APCShutdownAfterDelay = 180 Seconds FeatureReport 39 Field 0, app UPS, phys Output Usage 0, DelayBeforeShutdown = -1 FeatureReport 40 Field 0, app UPS, phys Output Usage 0, DelayBeforeStartup = -1 Seconds FeatureReport 41 Field 0, app UPS, phys Output Usage 0, DelayBeforeReboot = -1 Seconds FeatureReport 46 Field 0, app UPS, phys --- Usage 0, iProduct = 5 Smart-UPS 1500 FeatureReport 47 Field 0, app UPS, phys --- Usage 0, iSerialNumber = 2 AS0413231246 FeatureReport 48 Field 0, app UPS, phys --- Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 49 Field 0, app UPS, phys --- Usage 0, iName = 6 UPS_IDEN FeatureReport 52 Field 0, app UPS, phys --- Usage 0, APC_UPS_FirmwareRevision = 7 FeatureReport 55 Field 0, app UPS, phys --- Usage 0, APC_USB_FirmwareRevision = 8 FeatureReport 50 Field 0, app UPS, phys --- Usage 0, APCPanelTest = 1 FeatureReport 53 Field 0, app UPS, phys --- Usage 0, ManufactureDate = 12409 2004-03-25 FeatureReport 62 Field 0, app UPS, phys --- Usage 0, [ff860027] = 0 FeatureReport 63 Field 0, app UPS, phys --- Usage 0, [ff860028] = 0 FeatureReport 54 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 FeatureReport 51 Field 0, app UPS, phys --- Usage 0, Charging = 1 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 Waiting for events ... (interrupt to exit) Event: RemainingCapacity = 76 Event: RunTimeToEmpty = 240 Event: AudibleAlarmControl = 2 Event: Charging = 1 Event: Discharging = 0 Event: ACPresent = 1 Event: RemainingTimeLimitExpired = 0 Event: [ff86001b] = 0 Event: RemainingCapacity = 760 Event: RunTimeToEmpty = 240 Event: AudibleAlarmControl = 2 Event: RemainingCapacity = 77 apcupsd-3.14.10/examples/rpt/SmartUPS-USB.rpt0000664000076400007640000002424010561416060017503 0ustar adk0212adk0212Found UPS at /dev/usb/hid/hiddev0 hiddev driver version is 1.0.2 HID: vendor 0x51d product 0x2 version 0x6 app UPS HID: bus: 2 devnum: 2 ifnum: 0 UPS HID device name: "American Power Conversion Smart-UPS 1000 FW:600.1.I USB FW:1.2" Battery Chemistry: "PbAc" (4) InputReport 12 Field 0, app UPS, phys --- Exponent 0 lost. Usage 0, RemainingCapacity = 100 percent InputReport 8 Field 0, app UPS, phys --- Usage 0, RemainingTimeLimit = 0 Seconds InputReport 20 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 InputReport 7 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 InputReport 22 Field 0, app UPS, phys Battery Usage 0, Test = 1 InputReport 23 Field 0, app UPS, phys Battery Usage 0, [ff860019] = 0 InputReport 27 Field 0, app UPS, phys Battery Usage 0, [ff86001a] = 3 InputReport 28 Field 0, app UPS, phys Battery Usage 0, [ff86001b] = 0 InputReport 21 Field 0, app UPS, phys Battery Usage 0, ManufactureDate = 11032 2001-08-24 InputReport 26 Field 0, app UPS, phys Battery Usage 0, RemainingTimeLimit = 120 InputReport 33 Field 0, app UPS, phys Input Usage 0, [ff860052] = 5 InputReport 34 Field 0, app UPS, phys Input Usage 0, [ff860061] = 2 InputReport 45 Field 0, app UPS, phys Output Usage 0, ConfigVoltage = 230 Volts InputReport 35 Field 0, app UPS, phys Output Usage 0, HighVoltageTransfer = 253 Volts InputReport 36 Field 0, app UPS, phys Output Usage 0, LowVoltageTransfer = 208 Volts InputReport 37 Field 0, app UPS, phys Output Usage 0, [ff86007e] = 0 InputReport 38 Field 0, app UPS, phys Output Usage 0, APCShutdownAfterDelay = 90 InputReport 54 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 InputReport 51 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 FeatureReport 1 Field 0, app UPS, phys --- Usage 0, iProduct = 1 Smart-UPS 1000 FW:600.1.I USB FW:1.2 FeatureReport 2 Field 0, app UPS, phys --- Usage 0, iSerialNumber = 2 AS0134132215 FeatureReport 3 Field 0, app UPS, phys --- Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 4 Field 0, app UPS, phys --- Usage 0, iOEMInformation = 3 American Power Conversion FeatureReport 5 Field 0, app UPS, phys --- Usage 0, iDeviceChemistry = 4 PbAc FeatureReport 6 Field 0, app UPS, phys --- Usage 0, Rechargeable = 1 Field 1, app UPS, phys --- Exponent 0 lost. Usage 0, CapacityMode = 2 percent FeatureReport 14 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, DesignCapacity = 100 percent Field 1, app UPS, phys --- Exponent 2 lost. Usage 0, FullChargeCapacity = 100 percent FeatureReport 12 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, RemainingCapacity = 100 percent FeatureReport 16 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, CapacityGranularity1 = 1 percent Field 1, app UPS, phys --- Exponent 2 lost. Usage 0, CapacityGranularity2 = 1 percent FeatureReport 15 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, WarningCapacityLimit = 50 percent FeatureReport 17 Field 0, app UPS, phys --- Exponent 2 lost. Usage 0, RemainingCapacityLimit = 10 percent FeatureReport 9 Field 0, app UPS, phys --- Usage 0, ManufactureDate = 11032 2001-08-24 FeatureReport 13 Field 0, app UPS, phys --- Usage 0, RunTimeToEmpty = 21000 Seconds FeatureReport 18 Field 0, app UPS, phys --- Usage 0, DelayBeforeShutdown = -1 FeatureReport 19 Field 0, app UPS, phys --- Usage 0, DelayBeforeReboot = -1 Seconds FeatureReport 8 Field 0, app UPS, phys --- Usage 0, RemainingTimeLimit = 0 Seconds FeatureReport 10 Field 0, app UPS, phys --- Usage 0, ConfigVoltage = 2400 CentiVolts FeatureReport 11 Field 0, app UPS, phys --- Usage 0, Voltage = 2754 CentiVolts FeatureReport 20 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 FeatureReport 7 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 FeatureReport 22 Field 0, app UPS, phys Battery Usage 0, Test = 1 FeatureReport 23 Field 0, app UPS, phys Battery Usage 0, [ff860019] = 0 FeatureReport 27 Field 0, app UPS, phys Battery Usage 0, [ff86001a] = 3 FeatureReport 28 Field 0, app UPS, phys Battery Usage 0, [ff86001b] = 0 FeatureReport 21 Field 0, app UPS, phys Battery Usage 0, ManufactureDate = 11032 2001-08-24 FeatureReport 24 Field 0, app UPS, phys Battery Exponent 0 lost. Usage 0, RemainingCapacity = 1000 percent FeatureReport 26 Field 0, app UPS, phys Battery Usage 0, RemainingTimeLimit = 120 FeatureReport 25 Field 0, app UPS, phys Battery Usage 0, RunTimeToEmpty = 21000 FeatureReport 30 Field 0, app UPS, phys Battery Usage 0, Temperature = 2996 Degrees K with -1 exponent FeatureReport 31 Field 0, app UPS, phys Battery Usage 0, ConfigVoltage = 2400 CentiVolts FeatureReport 29 Field 0, app UPS, phys Battery Usage 0, Voltage = 2754 CentiVolts FeatureReport 32 Field 0, app UPS, phys Input Usage 0, Voltage = 2347 DeciVolts FeatureReport 33 Field 0, app UPS, phys Input Usage 0, [ff860052] = 5 FeatureReport 34 Field 0, app UPS, phys Input Usage 0, [ff860061] = 2 FeatureReport 44 Field 0, app UPS, phys Output Usage 0, PercentLoad = 0 FeatureReport 42 Field 0, app UPS, phys Output Usage 0, Frequency = 5000 CentiHertz FeatureReport 43 Field 0, app UPS, phys Output Usage 0, Voltage = 2347 DeciVolts FeatureReport 45 Field 0, app UPS, phys Output Usage 0, ConfigVoltage = 230 Volts FeatureReport 35 Field 0, app UPS, phys Output Usage 0, HighVoltageTransfer = 253 Volts FeatureReport 36 Field 0, app UPS, phys Output Usage 0, LowVoltageTransfer = 208 Volts FeatureReport 37 Field 0, app UPS, phys Output Usage 0, [ff86007e] = 0 FeatureReport 38 Field 0, app UPS, phys Output Usage 0, APCShutdownAfterDelay = 90 FeatureReport 39 Field 0, app UPS, phys Output Usage 0, DelayBeforeShutdown = -1 FeatureReport 40 Field 0, app UPS, phys Output Usage 0, DelayBeforeStartup = -1 Seconds FeatureReport 41 Field 0, app UPS, phys Output Usage 0, DelayBeforeReboot = -1 Seconds FeatureReport 46 Field 0, app UPS, phys --- Usage 0, iProduct = 5 Smart-UPS 1000 FeatureReport 47 Field 0, app UPS, phys --- Usage 0, iSerialNumber = 2 AS0134132215 FeatureReport 48 Field 0, app UPS, phys --- Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 49 Field 0, app UPS, phys --- Usage 0, iName = 6 UPSIDEN FeatureReport 52 Field 0, app UPS, phys --- Usage 0, APC_UPS_FirmwareRevision = 7 FeatureReport 55 Field 0, app UPS, phys --- Usage 0, APC_USB_FirmwareRevision = 8 FeatureReport 50 Field 0, app UPS, phys --- Usage 0, APCPanelTest = 1 FeatureReport 53 Field 0, app UPS, phys --- Usage 0, ManufactureDate = 11032 2001-08-24 FeatureReport 62 Field 0, app UPS, phys --- Usage 0, [ff860027] = 0 FeatureReport 63 Field 0, app UPS, phys --- Usage 0, [ff860028] = 0 FeatureReport 54 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 FeatureReport 51 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 Waiting for events ... (interrupt to exit) apcupsd-3.14.10/examples/rpt/SmartUPS.rpt0000664000076400007640000002376610561416060017070 0ustar adk0212adk0212Found UPS at /dev/usb/hid/hiddev0 hiddev driver version is 1.0.2 HID: vendor 0x51d product 0x2 version 0x6 app UPS HID: bus: 2 devnum: 2 ifnum: 0 UPS HID device name: "American Power Conversion Smart-UPS 1000 FW:600.1.I USB FW:1.2" Battery Chemistry: "PbAc" (4) InputReport 12 Field 0, app UPS, phys --- Usage 0, RemainingCapacity = 100 percent InputReport 8 Field 0, app UPS, phys --- Usage 0, RemainingTimeLimit = 0 Seconds InputReport 20 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 InputReport 7 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 InputReport 22 Field 0, app UPS, phys Battery Usage 0, Test = 6 InputReport 23 Field 0, app UPS, phys Battery Usage 0, [ff860019] = 0 InputReport 27 Field 0, app UPS, phys Battery Usage 0, [ff86001a] = 3 InputReport 28 Field 0, app UPS, phys Battery Usage 0, [ff86001b] = 0 InputReport 21 Field 0, app UPS, phys Battery Usage 0, ManufactureDate = 11032 2001-08-24 InputReport 26 Field 0, app UPS, phys Battery Usage 0, RemainingTimeLimit = 120 InputReport 33 Field 0, app UPS, phys Input Usage 0, [ff860052] = 0 InputReport 34 Field 0, app UPS, phys Input Usage 0, [ff860061] = 2 InputReport 45 Field 0, app UPS, phys Output Usage 0, ConfigVoltage = 230 Volts InputReport 35 Field 0, app UPS, phys Output Usage 0, HighVoltageTransfer = 253 Volts InputReport 36 Field 0, app UPS, phys Output Usage 0, LowVoltageTransfer = 208 Volts InputReport 37 Field 0, app UPS, phys Output Usage 0, [ff86007e] = 0 InputReport 38 Field 0, app UPS, phys Output Usage 0, APCShutdownAfterDelay = 90 InputReport 54 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 InputReport 51 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 FeatureReport 1 Field 0, app UPS, phys --- Usage 0, iProduct = 1 Smart-UPS 1000 FW:600.1.I USB FW:1.2 FeatureReport 2 Field 0, app UPS, phys --- Usage 0, iSerialNumber = 2 AS0134132215 FeatureReport 3 Field 0, app UPS, phys --- Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 4 Field 0, app UPS, phys --- Usage 0, iOEMInformation = 3 American Power Conversion FeatureReport 5 Field 0, app UPS, phys --- Usage 0, iDeviceChemistry = 4 PbAc FeatureReport 6 Field 0, app UPS, phys --- Usage 0, Rechargeable = 1 Field 1, app UPS, phys --- Usage 0, CapacityMode = 2 percent FeatureReport 14 Field 0, app UPS, phys --- Usage 0, DesignCapacity = 100 percent Field 1, app UPS, phys --- Usage 0, FullChargeCapacity = 100 percent FeatureReport 12 Field 0, app UPS, phys --- Usage 0, RemainingCapacity = 100 percent FeatureReport 16 Field 0, app UPS, phys --- Usage 0, CapacityGranularity1 = 1 percent Field 1, app UPS, phys --- Usage 0, CapacityGranularity2 = 1 percent FeatureReport 15 Field 0, app UPS, phys --- Usage 0, WarningCapacityLimit = 50 percent FeatureReport 17 Field 0, app UPS, phys --- Usage 0, RemainingCapacityLimit = 10 percent FeatureReport 9 Field 0, app UPS, phys --- Usage 0, ManufactureDate = 11032 2001-08-24 FeatureReport 13 Field 0, app UPS, phys --- Usage 0, RunTimeToEmpty = 21000 Seconds FeatureReport 18 Field 0, app UPS, phys --- Usage 0, DelayBeforeShutdown = -1 FeatureReport 19 Field 0, app UPS, phys --- Usage 0, DelayBeforeReboot = -1 Seconds FeatureReport 8 Field 0, app UPS, phys --- Usage 0, RemainingTimeLimit = 0 Seconds FeatureReport 10 Field 0, app UPS, phys --- Usage 0, ConfigVoltage = 2400 CentiVolts FeatureReport 11 Field 0, app UPS, phys --- Usage 0, Voltage = 2754 CentiVolts FeatureReport 20 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 FeatureReport 7 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 FeatureReport 22 Field 0, app UPS, phys Battery Usage 0, Test = 6 FeatureReport 23 Field 0, app UPS, phys Battery Usage 0, [ff860019] = 0 FeatureReport 27 Field 0, app UPS, phys Battery Usage 0, [ff86001a] = 3 FeatureReport 28 Field 0, app UPS, phys Battery Usage 0, [ff86001b] = 0 FeatureReport 21 Field 0, app UPS, phys Battery Usage 0, ManufactureDate = 11032 2001-08-24 FeatureReport 24 Field 0, app UPS, phys Battery Usage 0, RemainingCapacity = 1000 percent FeatureReport 26 Field 0, app UPS, phys Battery Usage 0, RemainingTimeLimit = 120 FeatureReport 25 Field 0, app UPS, phys Battery Usage 0, RunTimeToEmpty = 21000 FeatureReport 30 Field 0, app UPS, phys Battery Usage 0, Temperature = 3001 Degrees K with -1 exponent FeatureReport 31 Field 0, app UPS, phys Battery Usage 0, ConfigVoltage = 2400 CentiVolts FeatureReport 29 Field 0, app UPS, phys Battery Usage 0, Voltage = 2754 CentiVolts FeatureReport 32 Field 0, app UPS, phys Input Usage 0, Voltage = 2304 DeciVolts FeatureReport 33 Field 0, app UPS, phys Input Usage 0, [ff860052] = 0 FeatureReport 34 Field 0, app UPS, phys Input Usage 0, [ff860061] = 2 FeatureReport 44 Field 0, app UPS, phys Output Usage 0, PercentLoad = 0 FeatureReport 42 Field 0, app UPS, phys Output Usage 0, Frequency = 5000 CentiHertz FeatureReport 43 Field 0, app UPS, phys Output Usage 0, Voltage = 2304 DeciVolts FeatureReport 45 Field 0, app UPS, phys Output Usage 0, ConfigVoltage = 230 Volts FeatureReport 35 Field 0, app UPS, phys Output Usage 0, HighVoltageTransfer = 253 Volts FeatureReport 36 Field 0, app UPS, phys Output Usage 0, LowVoltageTransfer = 208 Volts FeatureReport 37 Field 0, app UPS, phys Output Usage 0, [ff86007e] = 0 FeatureReport 38 Field 0, app UPS, phys Output Usage 0, APCShutdownAfterDelay = 90 FeatureReport 39 Field 0, app UPS, phys Output Usage 0, DelayBeforeShutdown = -1 FeatureReport 40 Field 0, app UPS, phys Output Usage 0, DelayBeforeStartup = -1 Seconds FeatureReport 41 Field 0, app UPS, phys Output Usage 0, DelayBeforeReboot = -1 Seconds FeatureReport 46 Field 0, app UPS, phys --- Usage 0, iProduct = 5 Smart-UPS 1000 FeatureReport 47 Field 0, app UPS, phys --- Usage 0, iSerialNumber = 2 AS0134132215 FeatureReport 48 Field 0, app UPS, phys --- Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 49 Field 0, app UPS, phys --- Usage 0, iName = 6 UPSIDEN FeatureReport 52 Field 0, app UPS, phys --- Usage 0, APC_UPS_FirmwareRevision = 7 FeatureReport 55 Field 0, app UPS, phys --- Usage 0, APC_USB_FirmwareRevision = 8 FeatureReport 50 Field 0, app UPS, phys --- Usage 0, APCPanelTest = 1 FeatureReport 53 Field 0, app UPS, phys --- Usage 0, ManufactureDate = 11032 2001-08-24 FeatureReport 62 Field 0, app UPS, phys --- Usage 0, [ff860027] = 0 FeatureReport 63 Field 0, app UPS, phys --- Usage 0, [ff860028] = 0 FeatureReport 54 Field 0, app UPS, phys --- Usage 0, AudibleAlarmControl = 2 FeatureReport 51 Field 0, app UPS, phys --- Usage 0, Charging = 0 Field 1, app UPS, phys --- Usage 0, Discharging = 0 Field 2, app UPS, phys --- Usage 0, ACPresent = 1 Field 3, app UPS, phys --- Usage 0, BatteryPresent = 1 Field 4, app UPS, phys --- Usage 0, BelowRemainingCapacityLimit = 0 Field 5, app UPS, phys --- Usage 0, ShutdownRequested = 0 Field 6, app UPS, phys --- Usage 0, ShutdownImminent = 0 Field 7, app UPS, phys --- Usage 0, RemainingTimeLimitExpired = 0 Field 8, app UPS, phys --- Usage 0, CommunicationLost = 0 Field 9, app UPS, phys --- Usage 0, NeedReplacement = 0 Field 10, app UPS, phys --- Usage 0, Overload = 0 Field 11, app UPS, phys --- Usage 0, VoltageNotRegulated = 0 Field 12, app UPS, phys --- Usage 0, [ff860080] = 0 Waiting for events ... (interrupt to exit) apcupsd-3.14.10/examples/rpt/hid-ups.rpt0000664000076400007640000000670610561416060016756 0ustar adk0212adk0212hiddev driver version is 1.0.2 HID: vendor 0x51d product 0x2 version 0x100 app UPS HID: bus: 1 devnum: 22 ifnum: 0 UPS HID device name: "American Power Conversion Back-UPS 350 FW: 5.2.I USB FW: c1 " Battery Chemistry: "PbAc" (4) InputReport 6 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 InputReport 12 Field 0, app UPS, phys PowerSummary Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 2580 Seconds InputReport 19 Field 0, app UPS, phys PowerSummary Usage 0, ACPresent = 1 InputReport 20 Field 0, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 1, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 FeatureReport 1 Field 0, app UPS, phys PowerSummary Usage 0, iProduct = 1 Back-UPS 350 FW: 5.2.I USB FW: c1 FeatureReport 2 Field 0, app UPS, phys PowerSummary Usage 0, iSerialNumber = 2 B%0%0%0%0%0% FeatureReport 3 Field 0, app UPS, phys PowerSummary Usage 0, iDeviceChemistry = 4 PbAc FeatureReport 4 Field 0, app UPS, phys PowerSummary Usage 0, iOEMInformation = 3 American Power Conversion FeatureReport 5 Field 0, app UPS, phys PowerSummary Usage 0, Rechargeable = 1 FeatureReport 6 Field 0, app UPS, phys PowerSummary Usage 0, Charging = 0 Field 1, app UPS, phys PowerSummary Usage 0, Discharging = 0 Field 2, app UPS, phys PowerSummary Usage 0, APCStatusFlag = 8 0x8 FeatureReport 7 Field 0, app UPS, phys PowerSummary Usage 0, ManufactureDate = 10896 2001-04-16 FeatureReport 8 Field 0, app UPS, phys PowerSummary Usage 0, ConfigVoltage = 1200 CentiVolts FeatureReport 9 Field 0, app UPS, phys PowerSummary Usage 0, Voltage = 1335 CentiVolts FeatureReport 10 Field 0, app UPS, phys PowerSummary Usage 0, iManufacturer = 3 American Power Conversion FeatureReport 11 Field 0, app UPS, phys PowerSummary Usage 0, CapacityMode = 2 percent FeatureReport 12 Field 0, app UPS, phys PowerSummary Usage 0, RemainingCapacity = 100 percent Field 1, app UPS, phys PowerSummary Usage 0, RunTimeToEmpty = 2580 Seconds FeatureReport 13 Field 0, app UPS, phys PowerSummary Usage 0, DesignCapacity = 100 percent FeatureReport 14 Field 0, app UPS, phys PowerSummary Usage 0, FullChargeCapacity = 100 percent FeatureReport 15 Field 0, app UPS, phys PowerSummary Usage 0, WarningCapacityLimit = 50 percent FeatureReport 16 Field 0, app UPS, phys PowerSummary Usage 0, CapacityGranularity2 = 1 percent FeatureReport 17 Field 0, app UPS, phys PowerSummary Usage 0, RemainingCapacityLimit = 10 percent FeatureReport 18 Field 0, app UPS, phys PowerSummary Usage 0, CapacityGranularity1 = 1 percent FeatureReport 19 Field 0, app UPS, phys PowerSummary Usage 0, ACPresent = 1 FeatureReport 20 Field 0, app UPS, phys PowerSummary Usage 0, BelowRemainingCapacityLimit = 0 Field 1, app UPS, phys PowerSummary Usage 0, ShutdownImminent = 0 FeatureReport 53 Field 0, app UPS, phys PowerSummary Usage 0, APCPanelTest = 0 FeatureReport 28 Field 0, app UPS, phys PowerSummary Usage 0, APCBattReplacementDate = 267777 2001-04-16 FeatureReport 64 Field 0, app UPS, phys APCGeneralCollection Usage 0, APCForceShutdown = 0 Waiting for events ... (interrupt to exit) apcupsd-3.14.10/examples/Makefile0000664000076400007640000000056411255502546015513 0ustar adk0212adk0212topdir:=.. SUBDIRS = include $(topdir)/autoconf/targets.mak TARGETS = hid-ups hid-set client megaclient newslave upsapm \ smartsim snoopdecode SRCS = $(foreach target,$(TARGETS),$(target).c) all-targets: client megaclient newslave upsapm smartsim snoopdecode $(TARGETS): %: $(call SRC2OBJ,%.c) $(APCLIBS) $(LINK) # Include dependencies -include $(DEPS) apcupsd-3.14.10/examples/SmartUPS1400.snmp0000664000076400007640000004200007505065730016726 0ustar adk0212adk0212enterprises.apc.products.hardware.ups.upsIdent.upsBasicIdent.upsBasicIdentModel.0 = "SMART-UPS 1400" enterprises.apc.products.hardware.ups.upsIdent.upsBasicIdent.upsBasicIdentName.0 = "UPS_IDEN" enterprises.apc.products.hardware.ups.upsIdent.upsAdvIdent.upsAdvIdentFirmwareRevision.0 = "70.11.I" enterprises.apc.products.hardware.ups.upsIdent.upsAdvIdent.upsAdvIdentDateOfManufacture.0 = "11/11/99" enterprises.apc.products.hardware.ups.upsIdent.upsAdvIdent.upsAdvIdentSerialNumber.0 = "QS9946315184" enterprises.apc.products.hardware.ups.upsBattery.upsBasicBattery.upsBasicBatteryStatus.0 = batteryNormal(2) enterprises.apc.products.hardware.ups.upsBattery.upsBasicBattery.upsBasicBatteryTimeOnBattery.0 = Timeticks: (0) 0:0 enterprises.apc.products.hardware.ups.upsBattery.upsBasicBattery.upsBasicBatteryLastReplaceDate.0 = "11/11/99" enterprises.apc.products.hardware.ups.upsBattery.upsAdvBattery.upsAdvBatteryCapacity.0 = Gauge32: 100 enterprises.apc.products.hardware.ups.upsBattery.upsAdvBattery.upsAdvBatteryTemperature.0 = Gauge32: 39 enterprises.apc.products.hardware.ups.upsBattery.upsAdvBattery.upsAdvBatteryRunTimeRemaining.0 = Timeticks: (468000) 1:1 enterprises.apc.products.hardware.ups.upsBattery.upsAdvBattery.upsAdvBatteryReplaceIndicator.0 = noBatteryNeedsReplacing(1) enterprises.apc.products.hardware.ups.upsBattery.upsAdvBattery.upsAdvBatteryNumOfBattPacks.0 = 0 enterprises.apc.products.hardware.ups.upsBattery.upsAdvBattery.upsAdvBatteryNumOfBadBattPacks.0 = 0 enterprises.apc.products.hardware.ups.upsInput.upsBasicInput.upsBasicInputPhase.0 = 1 enterprises.apc.products.hardware.ups.upsInput.upsAdvInput.upsAdvInputLineVoltage.0 = Gauge32: 231 enterprises.apc.products.hardware.ups.upsInput.upsAdvInput.upsAdvInputMaxLineVoltage.0 = Gauge32: 231 enterprises.apc.products.hardware.ups.upsInput.upsAdvInput.upsAdvInputMinLineVoltage.0 = Gauge32: 228 enterprises.apc.products.hardware.ups.upsInput.upsAdvInput.upsAdvInputFrequency.0 = Gauge32: 50 enterprises.apc.products.hardware.ups.upsInput.upsAdvInput.upsAdvInputLineFailCause.0 = selfTest(9) enterprises.apc.products.hardware.ups.upsOutput.upsBasicOutput.upsBasicOutputStatus.0 = onLine(2) enterprises.apc.products.hardware.ups.upsOutput.upsBasicOutput.upsBasicOutputPhase.0 = 1 enterprises.apc.products.hardware.ups.upsOutput.upsAdvOutput.upsAdvOutputVoltage.0 = Gauge32: 231 enterprises.apc.products.hardware.ups.upsOutput.upsAdvOutput.upsAdvOutputFrequency.0 = Gauge32: 50 enterprises.apc.products.hardware.ups.upsOutput.upsAdvOutput.upsAdvOutputLoad.0 = Gauge32: 21 enterprises.apc.products.hardware.ups.upsOutput.upsAdvOutput.upsAdvOutputCurrent.0 = Gauge32: 0 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigNumDevices.0 = 4 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.deviceIndex.1 = 1 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.deviceIndex.2 = 2 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.deviceIndex.3 = 3 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.deviceIndex.4 = 4 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.deviceName.1 = Hex: 44 65 76 69 63 65 20 31 00 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.deviceName.2 = Hex: 44 65 76 69 63 65 20 32 00 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.deviceName.3 = Hex: 44 65 76 69 63 65 20 33 00 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.deviceName.4 = Hex: 44 65 76 69 63 65 20 34 00 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.vaRating.1 = 0 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.vaRating.2 = 0 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.vaRating.3 = 0 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.vaRating.4 = 0 enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.acceptThisDevice.1 = yes(1) enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.acceptThisDevice.2 = yes(1) enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.acceptThisDevice.3 = yes(1) enterprises.apc.products.hardware.ups.upsConfig.upsBasicConfig.upsBasicConfigDeviceTable.upsBasicConfigDeviceEntry.acceptThisDevice.4 = yes(1) enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigRatedOutputVoltage.0 = 230 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigHighTransferVolt.0 = 253 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigLowTransferVolt.0 = 196 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAlarm.0 = timed(1) enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAlarmTimer.0 = Timeticks: (0) 0:0 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigMinReturnCapacity.0 = 0 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigSensitivity.0 = high(4) enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigLowBatteryRunTime.0 = Timeticks: (12000) 0:0 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigReturnDelay.0 = Timeticks: (0) 0:0 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigShutoffDelay.0 = Timeticks: (2000) 0:0 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigUpsSleepTime.0 = Timeticks: (0) 0:0 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigSetEEPROMDefaults.0 = noSetEEPROMDefaults(1) enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigBattExhaustThresh.0 = Timeticks: (0) 0:0 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigPassword.0 = " " enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldIndex.1 = 1 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldIndex.2 = 2 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldIndex.3 = 3 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldIndex.4 = 4 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldIndex.5 = 5 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldIndex.6 = 6 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldIndex.7 = 7 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldIndex.8 = 8 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldIndex.9 = 9 enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldOID.1 = OID: enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigRatedOutputVoltage enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldOID.2 = OID: enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigHighTransferVolt enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldOID.3 = OID: enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigLowTransferVolt enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldOID.4 = OID: enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAlarmTimer enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldOID.5 = OID: enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigMinReturnCapacity enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldOID.6 = OID: enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigLowBatteryRunTime enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldOID.7 = OID: enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigReturnDelay enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldOID.8 = OID: enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigShutoffDelay enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldOID.9 = OID: enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigBattExhaustThresh enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldValueRange.1 = "Not Configurable" enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldValueRange.2 = "253, 264, 271, 280 Vac" enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldValueRange.3 = "188, 196, 204, 208 Vac" enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldValueRange.4 = "0 , 30 seconds" enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldValueRange.5 = "00, 15, 50, 90 percent" enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldValueRange.6 = "02, 05, 07, 10 minutes" enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldValueRange.7 = "000, 060, 180, 300 seconds" enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldValueRange.8 = "020, 180, 300, 600 seconds" enterprises.apc.products.hardware.ups.upsConfig.upsAdvConfig.upsAdvConfigAllowedSetTable.apcUpsConfigEntry.apcUpsConfigFieldValueRange.9 = "Not Configurable" enterprises.apc.products.hardware.ups.upsControl.upsBasicControl.upsBasicControlConserveBattery.0 = noTurnOffUps(1) enterprises.apc.products.hardware.ups.upsControl.upsAdvControl.upsAdvControlUpsOff.0 = noTurnUpsOff(1) enterprises.apc.products.hardware.ups.upsControl.upsAdvControl.upsAdvControlRebootUps.0 = noRebootUps(1) enterprises.apc.products.hardware.ups.upsControl.upsAdvControl.upsAdvControlUpsSleep.0 = noPutUpsToSleep(1) enterprises.apc.products.hardware.ups.upsControl.upsAdvControl.upsAdvControlSimulatePowerFail.0 = noSimulatePowerFailure(1) enterprises.apc.products.hardware.ups.upsControl.upsAdvControl.upsAdvControlFlashAndBeep.0 = noFlashAndBeep(1) enterprises.apc.products.hardware.ups.upsControl.upsAdvControl.upsAdvControlTurnOnUPS.0 = noTurnOnUPS(1) enterprises.apc.products.hardware.ups.upsControl.upsAdvControl.upsAdvControlBypassSwitch.0 = noBypassSwitch(1) enterprises.apc.products.hardware.ups.upsTest.upsAdvTest.upsAdvTestDiagnosticSchedule.0 = biweekly(2) enterprises.apc.products.hardware.ups.upsTest.upsAdvTest.upsAdvTestDiagnostics.0 = noTestDiagnostics(1) enterprises.apc.products.hardware.ups.upsTest.upsAdvTest.upsAdvTestDiagnosticsResults.0 = ok(1) enterprises.apc.products.hardware.ups.upsTest.upsAdvTest.upsAdvTestLastDiagnosticsDate.0 = "05/04/1998" enterprises.apc.products.hardware.ups.upsTest.upsAdvTest.upsAdvTestRuntimeCalibration.0 = noPerformCalibration(1) enterprises.apc.products.hardware.ups.upsTest.upsAdvTest.upsAdvTestCalibrationResults.0 = ok(1) enterprises.apc.products.hardware.ups.upsTest.upsAdvTest.upsAdvTestCalibrationDate.0 = "Unknown" enterprises.apc.products.hardware.ups.upsComm.upsCommStatus.0 = ok(1) enterprises.apc.products.hardware.miniSNMPadapter.serialPort.serialPort2.serialPort2Config.serialPort2Mode.0 = passthrough(2) enterprises.apc.products.hardware.miniSNMPadapter.serialPort.serialPort2.serialPort2Control.setPulseOnTXD.0 = noSetPulseOnTXD(1) enterprises.apc.apcmgmt.mconfig.mconfigNumTrapReceivers.0 = 4 enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.trapIndex.1 = 1 enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.trapIndex.2 = 2 enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.trapIndex.3 = 3 enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.trapIndex.4 = 4 enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.receiverAddr.1 = IpAddress: 0.0.0.0 enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.receiverAddr.2 = IpAddress: 0.0.0.0 enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.receiverAddr.3 = IpAddress: 0.0.0.0 enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.receiverAddr.4 = IpAddress: 0.0.0.0 enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.communityString.1 = "public" enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.communityString.2 = "public" enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.communityString.3 = "public" enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.communityString.4 = "public" enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.severity.1 = information(1) enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.severity.2 = information(1) enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.severity.3 = information(1) enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.severity.4 = information(1) enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.acceptThisReceiver.1 = yes(1) enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.acceptThisReceiver.2 = yes(1) enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.acceptThisReceiver.3 = yes(1) enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.acceptThisReceiver.4 = yes(1) enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.receiveTrapType.1 = powernet(1) enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.receiveTrapType.2 = powernet(1) enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.receiveTrapType.3 = powernet(1) enterprises.apc.apcmgmt.mconfig.mconfigTrapReceiverTable.mconfigTrapReceiverEntry.receiveTrapType.4 = powernet(1) enterprises.apc.apcmgmt.mconfig.mconfigBOOTPEnabled.0 = no(2) enterprises.apc.apcmgmt.mconfig.mconfigClock.mconfigClockDate.0 = "05/04/1998" enterprises.apc.apcmgmt.mconfig.mconfigClock.mconfigClockTime.0 = "16:02:54" enterprises.apc.apcmgmt.mcontrol.mcontrolRestartAgent.0 = continueCurrentAgent(2) enterprises.apc.apcmgmt.mtrapargs.mtrapargsInteger.0 = 6766 enterprises.apc.apcmgmt.mtrapargs.mtrapargsIpAddress.0 = IpAddress: 0.0.0.0 enterprises.apc.apcmgmt.mtrapargs.mtrapargsString.0 = Hex: 00 enterprises.apc.apcmgmt.mtrapargs.mtrapargsGauge.0 = Gauge32: 10620 enterprises.apc.apcmgmt.mtrapargs.mtrapargsTimeTicks.0 = Timeticks: (0) 0:0 enterprises.apc.apcmgmt.mfiletransfer.mfiletransferStatus.mfiletransferStatusLastTransferResult.0 = lastFileTransferResultNotAvailable(2) enterprises.apc.apcmgmt.mfiletransfer.mfiletransferConfig.mfiletransferConfigSettings.mfiletransferConfigSettingsFilename.0 = "Unknown" enterprises.apc.apcmgmt.mfiletransfer.mfiletransferConfig.mfiletransferConfigTFTP.mfiletransferConfigTFTPServerAddress.0 = "0.0.0.0" enterprises.apc.apcmgmt.mfiletransfer.mfiletransferConfig.mfiletransferConfigFTP.mfiletransferConfigFTPServerAddress.0 = "0.0.0.0" enterprises.apc.apcmgmt.mfiletransfer.mfiletransferConfig.mfiletransferConfigFTP.mfiletransferConfigFTPServerUser.0 = "apc" enterprises.apc.apcmgmt.mfiletransfer.mfiletransferConfig.mfiletransferConfigFTP.mfiletransferConfigFTPServerPassword.0 = "apc" enterprises.apc.apcmgmt.mfiletransfer.mfiletransferControl.mfiletransferControlInitiateFileTransfer.0 = doNotInitiateFileTransfer(1) End of MIB apcupsd-3.14.10/examples/client.c0000664000076400007640000000533211323200315015454 0ustar adk0212adk0212/* * Client test program for apcnetd * This program reads from standard input and passes the * commands to the apcupsd network information server. * It then prints to stdout the responses from the server. * * Build it with: cc -I../include client.c ../src/lib/libapc.a -o client * * Execute: ./client [host[:port]] [command] * reads commands from STDIN if command is not present * if command is present, it is sent to the daemon, * the output is retrieved, then the program exits. * * The two commands currently (Apr 2001) accepted by the * server are "status" and "events". * * For additional examples of code, see cgi/upsfetch.c */ #include "apc.h" #ifdef HAVE_NISLIB /* Default values, can be changed on command line */ #define SERV_TCP_PORT 3551 #define SERV_HOST_ADDR "127.0.0.1" void handle_client(FILE *fp, int sockfd, char *cmd); void error_abort(const char *msg) { fprintf(stderr, msg); exit(1); } int main(int argc, char *argv[]) { int sockfd, port; char host[200]; char msg[200], *p, *cmd; strcpy(host, SERV_HOST_ADDR); port = SERV_TCP_PORT; if (argc > 1) { strcpy(host, argv[1]); /* get host from command line */ p = strchr(host, ':'); if (p) { *p++ = 0; port = atoi(p); } } if (argc > 2) { cmd = argv[2]; } else { cmd = NULL; } if ((sockfd = net_open(host, NULL, port)) < 0) { sprintf(msg, "client: tcp_open for host %s on %d failed\n", host, port); error_abort(msg); } handle_client(stdin, sockfd, cmd); /* do it all */ net_close(sockfd); exit(0); } /* * Read the contents of the FILE *fp, write each line to the * stream socket (to the server process), then read a line back from * the socket and write it to the standard output. * * Return to the caller when an EOF is encountered on the input file. */ #define MAXLINE 5000 void handle_client(FILE *fp, int sockfd, char *cmd) { int n; char sendline[MAXLINE]; char recvline[MAXLINE+1]; int quit = 0; while (!quit) { if (cmd) { strcpy(sendline, cmd); /* one shot command */ quit = 1; } else if (fgets(sendline, MAXLINE, fp) == NULL) { break; } n = strlen(sendline); if (net_send(sockfd, sendline, n) != n) error_abort("handle_client: write error on socket"); while ((n = net_recv(sockfd, recvline, sizeof(recvline))) > 0) { recvline[n] = 0; fputs(recvline, stdout); } if (n < 0) { char msg[200]; sprintf(msg, "handle_client: net_recv error: %s\n", strerror(-n)); error_abort(msg); } } } #else /* HAVE_NISLIB */ int main(int argc, char *argv[]) { printf("Sorry, NIS code is not compiled in apcupsd.\n"); return 1; } #endif /* HAVE_NISLIB */ apcupsd-3.14.10/examples/hid-set.c0000664000076400007640000000532610104244577015554 0ustar adk0212adk0212/* * Copyright (c) 2002 Paul Stewart * * UPS (HID) set values in UPS */ /* * 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 * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to . */ #define HID_MAX_USAGES 1024 #include #include #include #include #include #include #include #include #include #include #include #define UPS_USAGE 0x840004 static inline int find_application(int fd, unsigned usage) { int i = 0; unsigned ret; while ((ret = ioctl(fd, HIDIOCAPPLICATION, i)) != -1 && ret != usage) { printf("App: %08x\n", ret); i++; } if (ret < 0) { fprintf(stderr, "GUSAGE returns %x", ret); perror(""); } return (ret == usage); } int main (int argc, char **argv) { int fd = -1, i, is_ups = 0; struct hiddev_report_info rinfo; struct hiddev_usage_ref uref; char evdev[20]; for (i = 0; i < 4; i++) { sprintf(evdev, "/dev/usb/hid/hiddev%d", i); if ((fd = open(evdev, O_RDONLY)) >= 0) { if (find_application(fd, UPS_USAGE)) { printf("It's a UPS!\n"); is_ups = 1; } break; } } if (i >= 4) { fprintf(stderr, "Couldn't find hiddev device.\n"); exit(1); } /* Usage: 00840057 val -1 (Feature/53/0/0) [DelayBeforeShutdown] Usage: 00840056 val -1 (Feature/54/0/0) [DelayBeforeStartup] */ memset(&uref, 0, sizeof(uref)); uref.report_type = HID_REPORT_TYPE_FEATURE; if (argc > 1 && strcmp(argv[1], "off")) { uref.report_id = 54; } else { uref.report_id = 53; } uref.field_index = 0; uref.usage_index = 0; uref.value = 5; if (ioctl(fd, HIDIOCSUSAGE, &uref) != 0) perror("SUSAGE/S"); rinfo.report_type = uref.report_type; rinfo.report_id = uref.report_id; if (ioctl(fd, HIDIOCSREPORT, &rinfo) != 0) perror("SREPORT/S"); printf("Set 5 in report id %d\n", uref.report_id); exit(0); } apcupsd-3.14.10/examples/hid-ups.c0000664000076400007640000004772710647244241015603 0ustar adk0212adk0212/* * $Id: hid-ups.c,v 1.13.2.2 2007/07/17 22:54:25 adk0212 Exp $ * * Copyright (c) 2001 Vojtech Pavlik * Copyright (c) 2001 Paul Stewart * * Tweaked by Kern Sibbald to learn * about USB UPSes. * * HID UPS device test program */ /* * 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 * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1492, Prague 8, 182 00 Czech Republic */ #define DEBUG 1 /* if set prints full reports */ #define TESTING 1 /* if set disables actual operation */ #define HID_MAX_USAGES 1024 #include #include #include #include #include #include #include #include #include #include #include #include #include #define PWRSTAT "/etc/powerstatus" #define DEBOUNCE_TIMEOUT 15 /* increase this if you get false alerts */ #define UPS_USAGE 0x840000 #define UPS_SERIAL 0x8400fe #define BAT_CHEMISTRY 0x850089 #define UPS_CAPACITY_MODE 0x85002c #define UPS_SHUTDOWN_IMMINENT 0x840069 #define UPS_BATTERY_VOLTAGE 0x840030 #define UPS_BELOW_RCL 0x840042 #define UPS_CHARING 0x840044 #define UPS_DISCHARGING 0x850045 #define UPS_REMAINING_CAPACITY 0x850066 #define UPS_RUNTIME_TO_EMPTY 0x850068 #define UPS_AC_PRESENT 0x8500d0 #define STATE_NORMAL 0 /* unit powered */ #define STATE_DEBOUNCE 1 /* power failure */ #define STATE_BATTERY 2 /* power failure confirmed */ /* USB Vendor ID's */ #define Vendor_APC 0x51D #define Vendor_MGE 0x463 #ifdef DEBUG /* * The type field indicates the type or units to be * applied to the value. */ #define T_NONE 0 /* No units */ #define T_INDEX 1 /* String index */ #define T_CAPACITY 2 /* Capacity (usually %) */ #define T_BITS 3 /* bit field */ #define T_UNITS 4 /* use units/exponent field */ #define T_DATE 5 /* date */ #define T_APCDATE 6 /* APC date format */ struct s_ups_info { unsigned usage; int type; char *label; } ups_info[] = { /* MGE & APC */ { 0x000000, T_NONE, "---" }, /* Page 0x84 is the Power Device Page */ { 0x840000, T_NONE, "UPS-Power" }, { 0x840001, T_INDEX, "iName" }, { 0x840004, T_NONE, "UPS" }, { 0x840012, T_NONE, "Battery" }, { 0x840016, T_NONE, "PowerConverter" }, { 0x840018, T_NONE, "OutletSystem" }, { 0x840017, T_NONE, "PowerConverterID" }, { 0x840019, T_NONE, "OutletSystemID" }, { 0x84001a, T_NONE, "Input" }, { 0x84001c, T_NONE, "Output" }, { 0x84001e, T_NONE, "Flow" }, { 0x84001d, T_NONE, "OutputID" }, { 0x84001f, T_NONE, "FlowID" }, { 0x840020, T_NONE, "Outlet" }, { 0x840021, T_NONE, "OutletID" }, { 0x840024, T_NONE, "PowerSummary" }, { 0x840025, T_NONE, "PowerSummaryID" }, { 0x840030, T_UNITS, "Voltage" }, { 0x840031, T_UNITS, "Current" }, { 0x840032, T_UNITS, "Frequency" }, { 0x840033, T_UNITS, "ApparentPower" }, { 0x840034, T_UNITS, "ActivePower" }, { 0x840035, T_UNITS, "PercentLoad" }, { 0x840036, T_UNITS, "Temperature" }, { 0x840037, T_UNITS, "Humidity" }, { 0x840040, T_UNITS, "ConfigVoltage" }, { 0x840042, T_UNITS, "ConfigFrequency" }, { 0x840043, T_UNITS, "ConfigApparentPower" }, { 0x840044, T_UNITS, "ConfigActivePower" }, { 0x840053, T_UNITS, "LowVoltageTransfer" }, { 0x840054, T_UNITS, "HighVoltageTransfer" }, { 0x840055, T_UNITS, "DelayBeforeReboot" }, { 0x840056, T_UNITS, "DelayBeforeStartup" }, { 0x840057, T_NONE, "DelayBeforeShutdown" }, { 0x840058, T_NONE, "Test" }, { 0x84005a, T_NONE, "AudibleAlarmControl" }, { 0x840061, T_NONE, "Good" }, { 0x840062, T_NONE, "InternalFailure" }, { 0x840065, T_NONE, "Overload" }, { 0x840068, T_NONE, "ShutdownRequested" }, { 0x840069, T_NONE, "ShutdownImminent" }, { 0x84006b, T_NONE, "Switch On/Off" }, { 0x84006c, T_NONE, "Switchable" }, { 0x84006e, T_NONE, "Boost" }, { 0x84006f, T_NONE, "Trim" }, { 0x840073, T_NONE, "CommunicationLost" }, { 0x8400fd, T_INDEX, "iManufacturer" }, { 0x8400fe, T_INDEX, "iProduct" }, { 0x8400ff, T_INDEX, "iSerialNumber" }, /* Page 0x85 is the Battery System Page */ { 0x850000, T_NONE, "UPS-Batt" }, { 0x850029, T_CAPACITY, "RemainingCapacityLimit" }, { 0x85002a, T_UNITS, "RemainingTimeLimit" }, { 0x85002c, T_CAPACITY, "CapacityMode" }, { 0x850042, T_NONE, "BelowRemainingCapacityLimit" }, { 0x850043, T_NONE, "RemainingTimeLimitExpired" }, { 0x850044, T_NONE, "Charging" }, { 0x850045, T_NONE, "Discharging" }, { 0x85004b, T_NONE, "NeedReplacement" }, { 0x850058, T_NONE, "BUPHibernate" }, /* APC proprietary */ { 0x850066, T_CAPACITY, "RemainingCapacity" }, { 0x850067, T_CAPACITY, "FullChargeCapacity" }, { 0x850068, T_UNITS, "RunTimeToEmpty" }, { 0x85006b, T_NONE, "CycleCount" }, { 0x850080, T_NONE, "BattPackLevel" }, { 0x850083, T_CAPACITY, "DesignCapacity" }, { 0x850085, T_DATE, "ManufactureDate" }, { 0x850088, T_INDEX, "iDeviceName" }, { 0x850089, T_INDEX, "iDeviceChemistry" }, { 0x85008b, T_NONE, "Rechargeable" }, { 0x85008c, T_CAPACITY, "WarningCapacityLimit" }, { 0x85008d, T_CAPACITY, "CapacityGranularity1" }, { 0x85008e, T_CAPACITY, "CapacityGranularity2" }, { 0x85008f, T_INDEX, "iOEMInformation" }, { 0x8500d0, T_NONE, "ACPresent" }, { 0x8500d1, T_NONE, "BatteryPresent" }, { 0x8500db, T_NONE, "VoltageNotRegulated" }, /* * Page 0x86 is reserved for Power Devices, but not defined in the HID * standard. APC has defined a few usages on this page for themselves. */ { 0x860010, T_NONE, "BUPSelfTest" }, /* APC proprietary */ { 0x860012, T_NONE, "BUPBattCapBeforeStartup" }, /* APC proprietary */ { 0x860076, T_NONE, "BUPDelayBeforeStartup" }, /* APC proprietary */ /* Pages 0xFF00 to 0xFFFF are vendor specific */ { 0xFF860005, T_NONE, "APCGeneralCollection" }, { 0xFF860013, T_NONE, "APC860013_SetMinReturn?" }, { 0xFF860016, T_APCDATE,"APCBattReplacementDate" }, { 0xFF860019, T_UNITS, "APCBattCapBeforeStartup" }, { 0xFF860023, T_NONE, "APC860023_??????" }, { 0xFF860024, T_NONE, "APC860024_??????" }, { 0xFF860025, T_NONE, "APC860025_??????" }, { 0xFF860026, T_NONE, "APC860026_??????" }, { 0xFF860029, T_NONE, "APC860029_??????" }, { 0xFF86002A, T_NONE, "APC86002A_??????" }, { 0xFF860042, T_NONE, "APC_UPS_FirmwareRevision" }, { 0xFF860052, T_NONE, "APCLineFailCause" }, { 0xFF860060, T_BITS, "APCStatusFlag" }, { 0xFF860061, T_NONE, "APCSensitivity" }, { 0xFF860062, T_NONE, "APC860062_SetHiTransV?" }, { 0xFF860064, T_NONE, "APC860064_SetLoTransV?" }, { 0xFF860072, T_NONE, "APCPanelTest" }, { 0xFF860074, T_NONE, "APC860074_SetSens?" }, { 0xFF860076, T_UNITS, "APCShutdownAfterDelay" }, { 0xFF860077, T_NONE, "APC860077_SetWakeUpDelay?" }, { 0xFF860079, T_NONE, "APC_USB_FirmwareRevision" }, { 0xFF86007C, T_NONE, "APCForceShutdown" }, { 0xFF86007D, T_UNITS, "APCDelayBeforeShutdown" }, { 0xFF86007E, T_UNITS, "APCDelayBeforeStartup" }, }; #define UPS_INFO_SZ (sizeof(ups_info)/sizeof(ups_info[0])) char *reports[] = { "Unknown", "Input", "Output", "Feature" }; static int CapacityMode = 2; /* default = % */ char unknown[24]; #define MADDR "stewart@wetlogic.net" void log_status(char *msg) { #ifndef TESTING char buf[256]; printf("[Log message \"%s\"]\n", msg); sprintf(buf, "/bin/echo %s | /bin/mail -s \"UPS System\" %s", msg, MADDR); system(buf); #else printf("[Log message \"%s\"]\n", msg); #endif } static inline char* info(unsigned int detail) { int i; for (i = 0; i < UPS_INFO_SZ; i++) { if (ups_info[i].usage == detail) { return ups_info[i].label; } } sprintf(unknown, "[%06x]", detail); return unknown; } static struct s_ups_info *info_entry(unsigned int detail) { int i; static struct s_ups_info info = {0, T_NONE, unknown}; for (i = 0; i < UPS_INFO_SZ; i++) { if (ups_info[i].usage == detail) { return &ups_info[i]; } } sprintf(unknown, "[%06x]", detail); return &info; } #else /* DEBUG */ #define log_status(s) #endif /* DEBUG */ /* Tell init the power has either gone or is back. */ void powerfail(int state) { #ifndef TESTING int fd; /* Create an info file needed by init to shutdown/cancel shutdown */ unlink(PWRSTAT); if ((fd = open(PWRSTAT, O_CREAT|O_WRONLY, 0644)) >= 0) { if (state > 0) write(fd, "FAIL\n", 5); else if (state < 0) write(fd, "LOW\n", 4); else write(fd, "OK\n", 3); close(fd); } kill(1, SIGPWR); #else printf("We are in powerfail() with state=%d ", state); if (state > 0) printf("POWER FAILURE\n"); else if (state < 0) printf("BATTERY LOW\n"); else printf("OK\n"); #endif } static inline int find_application(int fd, unsigned usage) { int i = 0, ret; while ((ret = ioctl(fd, HIDIOCAPPLICATION, i)) > 0 && (ret & 0xffff0000) != (usage & 0xffff0000)) i++; return ((ret & 0xffff000) == (usage & 0xffff0000)); } /* * Get a string from the device given the string's index */ static char *get_string(int fd, int sindex) { static struct hiddev_string_descriptor sdesc; static char buf[200]; if (sindex == 0) { return ""; } sdesc.index = sindex; if (ioctl(fd, HIDIOCGSTRING, &sdesc) < 0) { sprintf(buf, "String index %d returned ERR=%s\n", sindex, strerror(errno)); return buf; } return sdesc.value; } /* * Give units code and exponent, returns string * describing the units used. (doesn't work for percentages). */ static char *get_units(unsigned unit, unsigned exponent) { static char buf[200]; if (exponent > 7) { exponent = exponent - 16; } switch (unit) { case 1: /* special kludge for CapacityMode */ switch (exponent) { case 0: return "maH"; case 1: return "mwH"; case 2: return "percent"; case 3: return "boolean"; default: return ""; } case 0x00F0D121: if (exponent == 7) { return "Volts"; } else if (exponent == 5) { return "CentiVolts"; } else if (exponent == 6) { return "DeciVolts"; } else { sprintf(buf, "Volts with %d exponent", exponent); return buf; } case 0x00100001: if (exponent == -2) { return "CentiAmps"; } else if (exponent == 0) { return "Amps"; } else { sprintf(buf, "Amps with %d exponent", exponent); return buf; } case 0xF001: if (exponent == 0) { return "Hertz"; } else if (exponent == -2) { return "CentiHertz"; } else { sprintf(buf, "Hertz with %d exponent", exponent); return buf; } case 0x1001: if (exponent == 0) { return "Seconds"; } else { sprintf(buf, "Seconds with %d exponent", exponent); return buf; } case 0xD121: return "Watts"; case 0x010001: if (exponent == 0) { return "Degrees K"; } else { sprintf(buf, "Degrees K with %d exponent", exponent); return buf; } case 0x0101001: return "AmpSecs"; case 0: return ""; default: sprintf(buf, "0x%x", unit); return buf; } } static char evdev[50]; static int vendor = 0; int main (int argc, char **argv) { time_t start_seconds; int fd = -1, rd, i, j, RemainingCapacity; struct hiddev_event ev[64]; struct hiddev_devinfo dinfo; char name[256] = "Unknown"; int state = 0; fd_set fdset; struct timeval timev, *tv = NULL; struct hiddev_usage_ref uref; if (argc < 2) { struct hiddev_usage_ref uref; /* deal with either standard location or Red Hat's */ const char *hid_dirs[] = {"/dev/usb/hid", "/dev/usb","/dev"}; for (i = 0; i < sizeof(hid_dirs)/sizeof(hid_dirs[0]); i++) { for (j = 0; j < 4; j++) { sprintf(evdev, "%s/hiddev%d", hid_dirs[i], j); if ((fd = open(evdev, O_RDONLY)) < 0) { if (errno == EACCES) { fprintf(stderr, "No permission, try this as root.\n"); exit(1); } } else { if (find_application(fd, UPS_USAGE)) goto foundit; close(fd); } } } fprintf(stderr, "Couldn't find USB UPS device, check your /dev.\n"); exit(1); foundit: printf("Found UPS at %s\n", evdev); } else { strncpy(evdev, argv[argc -1], sizeof(evdev)-1); printf("Found UPS at %s\n", evdev); if ((fd = open(evdev, O_RDONLY)) < 0) { perror("hiddev open"); exit(1); } if (!find_application(fd, UPS_USAGE)) { fprintf(stderr, "%s is not a UPS\n", argv[argc - 1]); exit(1); } } #ifdef DEBUG { unsigned version; ioctl(fd, HIDIOCGVERSION, &version); printf("hiddev driver version is %d.%d.%d\n", version >> 16, (version >> 8) & 0xff, version & 0xff); ioctl(fd, HIDIOCGDEVINFO, &dinfo); printf("HID: vendor 0x%x product 0x%x version 0x%x ", dinfo.vendor, dinfo.product & 0xffff, dinfo.version); printf("app %s", info(ioctl(fd, HIDIOCAPPLICATION, 0))); for (i = 1; i < dinfo.num_applications; i++) printf(", %s", info(ioctl(fd, HIDIOCAPPLICATION, i))); printf("\n"); printf("HID: bus: %d devnum: %d ifnum: %d\n", dinfo.busnum, dinfo.devnum, dinfo.ifnum); vendor = dinfo.vendor; } #endif ioctl(fd, HIDIOCINITREPORT, 0); ioctl(fd, HIDIOCGNAME(sizeof(name)), name); printf("UPS HID device name: \"%s\"\n", name); memset(&uref, 0, sizeof(uref)); uref.report_type = HID_REPORT_TYPE_FEATURE; uref.report_id = HID_REPORT_ID_UNKNOWN; uref.usage_code = BAT_CHEMISTRY; if (ioctl(fd, HIDIOCGUSAGE, &uref) == 0) { printf("Battery Chemistry: \"%s\" (%d)\n", get_string(fd, uref.value), uref.value); } memset(&uref, 0, sizeof(uref)); uref.report_type = HID_REPORT_TYPE_FEATURE; uref.report_id = HID_REPORT_ID_UNKNOWN; uref.usage_code = UPS_CAPACITY_MODE; if (ioctl(fd, HIDIOCGUSAGE, &uref) == 0) { CapacityMode = uref.value; } #ifdef DEBUG /* To traverse the report descriptor info */ { struct hiddev_report_info rinfo; struct hiddev_field_info finfo; struct hiddev_usage_ref uref; int rtype, i, j; for (rtype = HID_REPORT_TYPE_MIN; rtype <= HID_REPORT_TYPE_MAX; rtype++) { rinfo.report_type = rtype; rinfo.report_id = HID_REPORT_ID_FIRST; while (ioctl(fd, HIDIOCGREPORTINFO, &rinfo) >= 0) { printf("\n%sReport %d\n", reports[rinfo.report_type], rinfo.report_id); for (i = 0; i < rinfo.num_fields; i++) { struct s_ups_info *p; memset(&finfo, 0, sizeof(finfo)); finfo.report_type = rinfo.report_type; finfo.report_id = rinfo.report_id; finfo.field_index = i; ioctl(fd, HIDIOCGFIELDINFO, &finfo); printf(" Field %d, app %s, phys %s\n", i, info(finfo.application), info(finfo.physical)); memset(&uref, 0, sizeof(uref)); for (j = 0; j < finfo.maxusage; j++) { unsigned unit, exponent; int v, yy, mm, dd; uref.report_type = finfo.report_type; uref.report_id = finfo.report_id; uref.field_index = i; uref.usage_index = j; ioctl(fd, HIDIOCGUCODE, &uref); ioctl(fd, HIDIOCGUSAGE, &uref); p = info_entry(uref.usage_code); switch (p->type) { case T_CAPACITY: unit = 1; printf("Exponent %d lost.\n", exponent); exponent = CapacityMode; break; case T_UNITS: unit = finfo.unit; exponent = finfo.unit_exponent; break; default: unit = 0; exponent = 0; break; } printf(" Usage %d, %s = %d %s", j, p->label, uref.value, get_units(unit, exponent)); switch (p->type) { case T_INDEX: printf(" %s\n", get_string(fd, uref.value)); break; case T_BITS: /* binary bits */ printf(" 0x%x\n", uref.value); break; case T_DATE: /* packed integer date */ printf(" %4d-%02d-%02d\n", (uref.value >> 9) + 1980, (uref.value >> 5) & 0xF, uref.value & 0x1F); break; case T_APCDATE: /* APC date */ v = uref.value; yy = ((v>>4) & 0xF)*10 + (v&0xF) + 2000; v >>= 8; dd = ((v>>4) & 0xF)*10 + (v&0xF); v >>= 8; mm = ((v>>4) & 0xF)*10 + (v&0xF); printf(" %4d-%02d-%02d\n", yy, mm, dd); default: printf("\n"); break; } } } rinfo.report_id |= HID_REPORT_ID_NEXT; } } } printf("\nWaiting for events ... (interrupt to exit)\n"); fflush(stdout); #endif start_seconds = time(NULL); FD_ZERO(&fdset); while (1) { if (fd < 0) { sleep(5); fd = open(evdev, O_RDONLY); if (fd < 0) { perror("\nOpen error"); continue; } if (!find_application(fd, UPS_USAGE)) { fprintf(stderr, "\nCould not find_application.\n"); close(fd); fd = -1; } continue; } switch (state) { case STATE_NORMAL: tv = NULL; break; case STATE_BATTERY: case STATE_DEBOUNCE: timev.tv_sec = DEBOUNCE_TIMEOUT; timev.tv_usec = 0; tv = &timev; break; } FD_SET(fd, &fdset); rd = select(fd+1, &fdset, NULL, NULL, tv); if (rd > 0) { rd = read(fd, ev, sizeof(ev)); if (rd < (int) sizeof(ev[0])) { if (rd < 0) perror("\nevtest: error reading"); else fprintf(stderr, "\nevtest: got short read from device!\n"); // exit (1); close(fd); fd = -1; continue; } else { printf("time %lu\n", time(NULL) - start_seconds); } for (i = 0; i < rd / sizeof(ev[0]); i++) { #ifdef DEBUG printf("Event: %s = %d\n", info(ev[i].hid), ev[i].value); #endif /* DEBUG */ if (ev[i].hid == UPS_SHUTDOWN_IMMINENT && ev[i].value == 1) { log_status("UPS shutdown imminent!"); powerfail(-1); state = STATE_BATTERY; RemainingCapacity = -1; } switch (state) { case STATE_BATTERY: if (ev[i].hid == UPS_DISCHARGING && ev[i].value == 0) { log_status("System back on AC power"); powerfail(0); state = STATE_NORMAL; RemainingCapacity = -1; } break; case STATE_DEBOUNCE: if (ev[i].hid == UPS_DISCHARGING && ev[i].value == 0) { state = STATE_NORMAL; RemainingCapacity = -1; } break; case STATE_NORMAL: if (ev[i].hid == UPS_DISCHARGING && ev[i].value == 1) { state = STATE_DEBOUNCE; RemainingCapacity = -1; } break; } } } else { /* Our timer has expired */ switch (state) { case STATE_DEBOUNCE: log_status("System switched to battery power"); state = STATE_BATTERY; powerfail(1); break; default: break; } } fflush(stdout); } } apcupsd-3.14.10/examples/hiddev-hiddev.h-cleanup-2.4.patch0000664000076400007640000000155510076226252021752 0ustar adk0212adk0212--- linux-2.4.26/include/linux/hiddev.h.orig Sun Jul 4 23:11:15 2004 +++ linux-2.4.26/include/linux/hiddev.h Sun Jul 4 23:14:51 2004 @@ -128,10 +128,11 @@ /* hiddev_usage_ref_multi is used for sending multiple bytes to a control. * It really manifests itself as setting the value of consecutive usages */ +#define HID_MAX_MULTI_USAGES 1024 struct hiddev_usage_ref_multi { struct hiddev_usage_ref uref; __u32 num_values; - __s32 values[HID_MAX_USAGES]; + __s32 values[HID_MAX_MULTI_USAGES]; }; /* FIELD_INDEX_NONE is returned in read() data from the kernel when flags @@ -213,6 +214,11 @@ */ #ifdef CONFIG_USB_HIDDEV +struct hid_device; +struct hid_usage; +struct hid_field; +struct hid_report; + int hiddev_connect(struct hid_device *); void hiddev_disconnect(struct hid_device *); void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, apcupsd-3.14.10/examples/hiddev.h0000664000076400007640000001324007474703535015473 0ustar adk0212adk0212#ifndef _HIDDEV_H #define _HIDDEV_H /* * $Id: hiddev.h,v 1.1.1.1 2002/05/28 13:34:21 kerns Exp $ * * Copyright (c) 1999-2000 Vojtech Pavlik * * Sponsored by SuSE */ /* * 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 * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ /* * The event structure itself */ struct hiddev_event { unsigned hid; signed int value; }; struct hiddev_devinfo { unsigned int bustype; unsigned int busnum; unsigned int devnum; unsigned int ifnum; short vendor; short product; short version; unsigned num_applications; }; #define HID_STRING_SIZE 256 struct hiddev_string_descriptor { int index; char value[HID_STRING_SIZE]; }; struct hiddev_report_info { unsigned report_type; unsigned report_id; unsigned num_fields; }; /* To do a GUSAGE/SUSAGE, fill in at least usage_code, report_type and * report_id. Set report_id to REPORT_ID_UNKNOWN if the rest of the fields * are unknown. Otherwise use a usage_ref struct filled in from a previous * successful GUSAGE/SUSAGE call to save time. To actually send a value * to the device, perform a SUSAGE first, followed by a SREPORT. If an * INITREPORT is done, a GREPORT isn't necessary before a GUSAGE. */ #define HID_REPORT_ID_UNKNOWN 0xffffffff #define HID_REPORT_ID_FIRST 0x00000100 #define HID_REPORT_ID_NEXT 0x00000200 #define HID_REPORT_ID_MASK 0x000000ff #define HID_REPORT_ID_MAX 0x000000ff #define HID_REPORT_TYPE_INPUT 1 #define HID_REPORT_TYPE_OUTPUT 2 #define HID_REPORT_TYPE_FEATURE 3 #define HID_REPORT_TYPE_MIN 1 #define HID_REPORT_TYPE_MAX 3 struct hiddev_field_info { unsigned report_type; unsigned report_id; unsigned field_index; unsigned maxusage; unsigned flags; unsigned physical; /* physical usage for this field */ unsigned logical; /* logical usage for this field */ unsigned application; /* application usage for this field */ __s32 logical_minimum; __s32 logical_maximum; __s32 physical_minimum; __s32 physical_maximum; unsigned unit_exponent; unsigned unit; }; /* Fill in report_type, report_id and field_index to get the information on a * field. */ #define HID_FIELD_CONSTANT 0x001 #define HID_FIELD_VARIABLE 0x002 #define HID_FIELD_RELATIVE 0x004 #define HID_FIELD_WRAP 0x008 #define HID_FIELD_NONLINEAR 0x010 #define HID_FIELD_NO_PREFERRED 0x020 #define HID_FIELD_NULL_STATE 0x040 #define HID_FIELD_VOLATILE 0x080 #define HID_FIELD_BUFFERED_BYTE 0x100 struct hiddev_usage_ref { unsigned report_type; unsigned report_id; unsigned field_index; unsigned usage_index; unsigned usage_code; __s32 value; }; /* * Protocol version. */ #define HID_VERSION 0x010002 /* * IOCTLs (0x00 - 0x7f) */ #define HIDIOCGVERSION _IOR('H', 0x01, int) #define HIDIOCAPPLICATION _IO('H', 0x02) #define HIDIOCGDEVINFO _IOR('H', 0x03, struct hiddev_devinfo) #define HIDIOCGSTRING _IOR('H', 0x04, struct hiddev_string_descriptor) #define HIDIOCINITREPORT _IO('H', 0x05) #define HIDIOCGNAME(len) _IOC(_IOC_READ, 'H', 0x06, len) #define HIDIOCGREPORT _IOW('H', 0x07, struct hiddev_report_info) #define HIDIOCSREPORT _IOW('H', 0x08, struct hiddev_report_info) #define HIDIOCGREPORTINFO _IOWR('H', 0x09, struct hiddev_report_info) #define HIDIOCGFIELDINFO _IOWR('H', 0x0A, struct hiddev_field_info) #define HIDIOCGUSAGE _IOWR('H', 0x0B, struct hiddev_usage_ref) #define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref) #define HIDIOCGUCODE _IOWR('H', 0x0D, struct hiddev_usage_ref) /* To traverse the input report descriptor info for a HID device, perform the * following: * * rinfo.report_type = HID_REPORT_TYPE_INPUT; * rinfo.report_id = HID_REPORT_ID_FIRST; * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); * * while (ret >= 0) { * for (i = 0; i < rinfo.num_fields; i++) { * finfo.report_type = rinfo.report_type; * finfo.report_id = rinfo.report_id; * finfo.field_index = i; * ioctl(fd, HIDIOCGFIELDINFO, &finfo); * for (j = 0; j < finfo.maxusage; j++) { * uref.field_index = i; * uref.usage_index = j; * ioctl(fd, HIDIOCGUCODE, &uref); * ioctl(fd, HIDIOCGUSAGE, &uref); * } * } * uref.report_id |= HID_REPORT_ID_NEXT; * ret = ioctl(fd, HIDIOCGREPORTINFO, &uref); * } */ #ifdef __KERNEL__ /* * In-kernel definitions. */ #ifdef CONFIG_USB_HIDDEV int hiddev_connect(struct hid_device *); void hiddev_disconnect(struct hid_device *); void hiddev_hid_event(struct hid_device *, unsigned int usage, int value); int __init hiddev_init(void); void __exit hiddev_exit(void); #else static inline void *hiddev_connect(struct hid_device *hid) { return NULL; } static inline void hiddev_disconnect(struct hid_device *hid) { } static inline void hiddev_event(struct hid_device *hid, unsigned int usage, int value) { } static inline int hiddev_init(void) { return 0; } static inline void hiddev_exit(void) { } #endif #endif #endif apcupsd-3.14.10/examples/hiddev.txt0000664000076400007640000001460607474703540016066 0ustar adk0212adk0212Care and feeding of your Human Interface Devices INTRODUCTION In addition to the normal input type HID devices, USB also uses the human interface device protocols for things that are not really human interfaces, but have similar sorts of communication needs. The two big examples for this are power devices (especially uninterruptable power supplies) and monitor control on higher end monitors. To support these disparite requirements, the Linux USB system provides HID events to two seperate interfaces: * the input subsystem, which converts HID events into normal input device interfaces (such as keyboard, mouse and joystick) and a normalised event interface - see Documentation/input/input.txt * the hiddev interface, which provides fairly raw HID events The data flow for a HID event produced by a device is something like the following : usb.c ---> hid.c ----> input.c ----> [keyboard/mouse/joystick/event] | | --> hiddev.c ----> POWER / MONITOR CONTROL In addition, other subsystems (apart from USB) can potentially feed events into the input subsystem, but these have no effect on the hid device interface. USING THE HID DEVICE INTERFACE The hiddev interface is a char interface using the normal USB major, with the minor numbers starting at 96 and finishing at 111. Therefore, you need the following commands: mknod /dev/usb/hiddev0 c 180 96 mknod /dev/usb/hiddev1 c 180 97 mknod /dev/usb/hiddev2 c 180 98 mknod /dev/usb/hiddev3 c 180 99 mknod /dev/usb/hiddev4 c 180 100 mknod /dev/usb/hiddev5 c 180 101 mknod /dev/usb/hiddev6 c 180 102 mknod /dev/usb/hiddev7 c 180 103 mknod /dev/usb/hiddev8 c 180 104 mknod /dev/usb/hiddev9 c 180 105 mknod /dev/usb/hiddev10 c 180 106 mknod /dev/usb/hiddev11 c 180 107 mknod /dev/usb/hiddev12 c 180 108 mknod /dev/usb/hiddev13 c 180 109 mknod /dev/usb/hiddev14 c 180 110 mknod /dev/usb/hiddev15 c 180 111 So you point your hiddev compliant user-space program at the correct interface for your device, and it all just works. Assuming that you have a hiddev compliant user-space program, of course. If you need to write one, read on. THE HIDDEV API This description should be read in conjunction with the HID specification, freely available from http://www.usb.org, and conveniently linked of http://www.linux-usb.org. The hiddev API uses a read() interface, and a set of ioctl() calls. read(): This is the event interface. When the HID device performs an interrupt transfer, indicating a change of state, data will be made available at the associated hiddev device with the content of a struct hiddev_event: struct hiddev_event { unsigned hid; signed int value; }; containing the HID usage identifier for the status that changed, and the value that it was changed to. Note that the structure is defined within , along with some other useful #defines and structures. ioctl(): This is the control interface. There are a number of controls: HIDIOCGVERSION - int (read) Gets the version code out of the hiddev driver. HIDIOCAPPLICATION - (none) This ioctl call returns the HID application usage associated with the hid device. The third argument to ioctl() specifies which application index to get. This is useful when the device has more than one application collection. If the index is invalid (greater or equal to the number of application collections this device has) the ioctl returns -1. You can find out beforehand how many application collections the device has from the num_applications field from the hiddev_devinfo structure. HIDIOCGDEVINFO - struct hiddev_devinfo (read) Gets a hiddev_devinfo structure which describes the device. HIDIOCGSTRING - struct struct hiddev_string_descriptor (read/write) Gets a string descriptor from the device. The caller must fill in the "index" field to indicate which descriptor should be returned. HIDIOCINITREPORT - (none) Instructs the kernel to retrieve all input and feature report values from the device. At this point, all the usage structures will contain current values for the device, and will maintain it as the device changes. HIDIOCGNAME - string (variable length) Gets the device name HIDIOCGREPORT - struct hiddev_report_info (write) Instructs the kernel to get a feature or input report from the device, in order to selectively update the usage structures (in contrast to INITREPORT). HIDIOCSREPORT - struct hiddev_report_info (write) Instructs the kernel to send a report to the device. This report can be filled in by the user through HIDIOCSUSAGE calls (below) to fill in individual usage values in the report beforesending the report in full to the device. HIDIOCGREPORTINFO - struct hiddev_report_info (read/write) Fills in a hiddev_report_info structure for the user. The report is looked up by type (input, output or feature) and id, so these fields must be filled in by the user. The ID can be absolute -- the actual report id as reported by the device -- or relative -- HID_REPORT_ID_FIRST for the first report, and (HID_REPORT_ID_NEXT | report_id) for the next report after report_id. Without a-priori information about report ids, the right way to use this ioctl is to use the relative IDs above to enumerate the valid IDs. The ioctl returns non-zero when there is no more next ID. The real report ID is filled into the returned hiddev_report_info structure. HIDIOCGFIELDINFO - struct hiddev_field_info (read/write) Returns the field information associated with a report in a hiddev_field_info structure. The user must fill in report_id and report_type in this structure, as above. The field_index should also be filled in, which should be a number from 0 and maxfield-1, as returned from a previous HIDIOCGREPORTINFO call. HIDIOCGUCODE - struct hiddev_usage_ref (read/write) Returns the usage_code in a hiddev_usage_ref structure, given that given its report type, report id, field index, and index within the field have already been filled into the structure. HIDIOCGUSAGE - struct hiddev_usage_ref (read/write) Returns the value of a usage in a hiddev_usage_ref structure. The usage to be retrieved can be specified as above, or the user can choose to fill in the report_type field and specify the report_id as HID_REPORT_ID_UNKNOWN. In this case, the hiddev_usage_ref will be filled in with the report and field infomation associated with this usage if it is found. HIDIOCSUSAGE - struct hiddev_usage_ref (write) Sets the value of a usage in an output report. apcupsd-3.14.10/examples/index.php0000664000076400007640000001514311177662210015670 0ustar adk0212adk0212 \n"; echo "\n"; if (file_exists($statusfile_location)) { // Open the Status file. $statusfile = file($statusfile_location); // Get the word status ("ONLINE", "ON-BATT", etc.) $dumbvar = split(":", $statusfile[10]); $status = $dumbvar[1]; if (eregi('online', $status)) { $statusbg = $goodcolour; } else $statusbg = $warncolour; // Get the current UPS load $dumbvar = split(":", $statusfile[12]); $load = floatval($dumbvar[1]); if ($load > 75) { $loadbg = $badcolour; } else if ($load > 25) { $loadbg = $warncolour; } else $loadbg = $goodcolour; // Get the battery charge level $dumbvar = split(":", $statusfile[13]); $charge = floatval($dumbvar[1]); if ($charge > 60) { $chargebg = $goodcolour; } else if ($charge > 25) { $chargebg = $warncolour; } else $chargebg = $badcolour; // Get the estimated time remaining $dumbvar = split(":", $statusfile[14]); $etl = $dumbvar[1]; // Draw the table entry. echo "\n"; }; if (file_exists($logfile_location)) { // Open the log file. $logfile = file($logfile_location); $loglines = count($logfile); if ($loglines < $showloglines) $showloglines = $loglines; // Draw the table echo "\n"; echo "\n"; } else { // By default, just show the last X lines. Save some screen real estate. echo "
APCUPSD UPS Network Monitor
Sun Jan 16 12:07:27 CET 2000
System Model Status
UPS Status
\n"; echo "
\n"; echo "Battery Status:" . $status . "
\n"; echo "UPS Load:" . $load . "
\n"; echo "Battery Charge:". $charge . "
\n"; echo "Estimated time left:" . $etl . "
"; if ($showlog == "yes") { // If the user has clicked the "Show entire log" link, show the whole shebang in reverse order. echo ""; for ($i = 0; $i <= $loglines; $i++) { $newline = $logfile[($loglines - $i - 1)]; $notifycolour = "white"; if (eregi("power is back", $newline)) { $notifycolour = $goodcolour; } else if (eregi("power failure", $newline)) { $notifycolour = $badcolour; } else if (eregi("startup succeeded", $newline)) { $notifycolour = $goodcolour; } else if (eregi("exiting", $newline)) { $notifycolour = $warncolour; } else if (eregi("shutdown succeeded", $newline)) { $notifycolour = $goodcolour; } else if (eregi("ups batteries", $newline)) { $notifycolour = $warncolour; } else if (eregi("exhausted", $newline)) { $notifycolour = $badcolour; } else { $notifycolour = $warncolour; }; echo "\n"; } echo "
"; echo $newline; echo "
\n"; echo "
\n"; // Add a link so that the user can switch this view off. echo "Hide old log entries
"; for ($i = 0; $i < $showloglines; $i++) { $newline = $logfile[($loglines - $i - 1)]; $notifycolour = "white"; if (eregi("power is back", $newline)) { $notifycolour = $goodcolour; } else if (eregi("power failure", $newline)) { $notifycolour = $badcolour; } else if (eregi("startup succeeded", $newline)) { $notifycolour = $goodcolour; } else if (eregi("exiting", $newline)) { $notifycolour = $warncolour; } else if (eregi("shutdown succeeded", $newline)) { $notifycolour = $goodcolour; } else if (eregi("ups batteries", $newline)) { $notifycolour = $warncolour; } else if (eregi("exhausted", $newline)) { $notifycolour = $badcolour; } else { $notifycolour = $warncolour; }; echo "\n"; } echo "
"; echo $newline; echo "
\n"; echo "
\n"; // Add a link so the user can see the entire log from the beginning. echo "Show entire log
"; ?> apcupsd-3.14.10/examples/libusb.h0000664000076400007640000000640507474703537015517 0ustar adk0212adk0212/* $NetBSD: usb.h,v 1.7 2000/04/02 11:10:53 augustss Exp $ */ /* * Copyright (c) 1999 Lennart Augustsson * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: src/lib/libusb/libusb.h,v 1.1.2.1 2000/07/02 13:14:00 n_hibma Exp $ * */ typedef struct report_desc *report_desc_t; typedef struct hid_data *hid_data_t; typedef enum hid_kind { hid_input, hid_output, hid_feature, hid_collection, hid_endcollection }hid_kind_t; typedef struct hid_item { /* Global */ int _usage_page; int logical_minimum; int logical_maximum; int physical_minimum; int physical_maximum; int unit_exponent; int unit; int report_size; int report_ID; #define NO_REPORT_ID 0 int report_count; /* Local */ unsigned int usage; int usage_minimum; int usage_maximum; int designator_index; int designator_minimum; int designator_maximum; int string_index; int string_minimum; int string_maximum; int set_delimiter; /* Misc */ int collection; int collevel; enum hid_kind kind; unsigned int flags; /* Absolute data position (bits) */ unsigned int pos; /* */ struct hid_item *next; } hid_item_t; #define HID_PAGE(u) ((u) >> 16) #define HID_USAGE(u) ((u) & 0xffff) /* Obtaining a report descriptor, descr.c: */ report_desc_t hid_get_report_desc __P((int file)); void hid_dispose_report_desc __P((report_desc_t)); /* Parsing of a HID report descriptor, parse.c: */ hid_data_t hid_start_parse __P((report_desc_t d, int kindset)); void hid_end_parse __P((hid_data_t s)); int hid_get_item __P((hid_data_t s, hid_item_t *h)); int hid_report_size __P((report_desc_t d, enum hid_kind k, int *idp)); int hid_locate __P((report_desc_t d, unsigned int usage, enum hid_kind k, hid_item_t *h)); /* Conversion to/from usage names, usage.c: */ const char *hid_usage_page __P((int i)); const char *hid_usage_in_page __P((unsigned int u)); void hid_init __P((const char *file)); /* Extracting/insertion of data, data.c: */ int hid_get_data __P((const void *p, const hid_item_t *h)); void hid_set_data __P((void *p, const hid_item_t *h, int data)); apcupsd-3.14.10/examples/linux-2.4.20-USB-reject.patch0000664000076400007640000000173707702532346020663 0ustar adk0212adk0212Some UPSes have logical minimum and maximum value in HID descriptors the same. The HID driver rejects such devices. This patch fixes this. Please apply for 2.4, I'll take care of a 2.5 patch. ChangeSet@1.1202, 2003-06-14 23:38:54+02:00, vojtech@suse.cz Logical minumum and maximum may be the same value per spec. This fixes some UPSes not getting detected properly. hid-core.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -Nru a/drivers/usb/hid-core.c b/drivers/usb/hid-core.c --- a/drivers/usb/hid-core.c Sat Jun 14 23:39:05 2003 +++ b/drivers/usb/hid-core.c Sat Jun 14 23:39:05 2003 @@ -202,7 +202,7 @@ return -1; } - if (parser->global.logical_maximum <= parser->global.logical_minimum) { + if (parser->global.logical_maximum < parser->global.logical_minimum) { dbg("logical range invalid %d %d", parser->global.logical_minimum, parser->global.logical_maximum); return -1; } apcupsd-3.14.10/examples/linux-2.4.20-killpower.patch0000664000076400007640000000232007702561211020746 0ustar adk0212adk0212ChangeSet 1.1258, 2003/06/18 16:55:46-07:00, vsu@altlinux.ru [PATCH] USB: HIDDEV / UPS patches drivers/usb/hid-core.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff -Nru a/drivers/usb/hid-core.c b/drivers/usb/hid-core.c --- a/drivers/usb/hid-core.c Wed Jun 18 17:34:51 2003 +++ b/drivers/usb/hid-core.c Wed Jun 18 17:34:51 2003 @@ -1067,10 +1067,16 @@ void hid_write_report(struct hid_device *hid, struct hid_report *report) { - hid_output_report(report, hid->out[hid->outhead].buffer); + if (hid->report_enum[report->type].numbered) { + hid->out[hid->outhead].buffer[0] = report->id; + hid_output_report(report, hid->out[hid->outhead].buffer + 1); + hid->out[hid->outhead].dr.wLength = cpu_to_le16(((report->size + 7) >> 3) + 1); + } else { + hid_output_report(report, hid->out[hid->outhead].buffer); + hid->out[hid->outhead].dr.wLength = cpu_to_le16((report->size + 7) >> 3); + } - hid->out[hid->outhead].dr.wValue = cpu_to_le16(0x200 | report->id); - hid->out[hid->outhead].dr.wLength = cpu_to_le16((report->size + 7) >> 3); + hid->out[hid->outhead].dr.wValue = cpu_to_le16(((report->type + 1) << 8) | report->id); hid->outhead = (hid->outhead + 1) & (HID_CONTROL_FIFO_SIZE - 1); apcupsd-3.14.10/examples/linux-2.6.0-USB-queue-overflow.patch0000664000076400007640000000122607773523637022320 0ustar adk0212adk0212This is the patch by Adam Kropelin that corrects the control queue overflows in the kernel. This patch has been accepted to be applied. However, with the current version of apcupsd, we have applied a workaround that does not require this patch. --- linux-2.6.0-test11/drivers/usb/input/hiddev.c Fri Oct 17 23:23:08 2003 +++ linux-2.6.0-test11-adk/drivers/usb/input/hiddev.c Wed Dec 17 23:38:24 2003 @@ -213,6 +213,7 @@ ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0)); uref.report_id = report->id; + uref.field_index = HID_FIELD_INDEX_NONE; hiddev_send_event(hid, &uref); } apcupsd-3.14.10/examples/linux-usb-patch-email.txt0000664000076400007640000001553207654151342020727 0ustar adk0212adk0212From vsu@altlinux.ru Tue Apr 22 16:39:58 2003 Return-Path: Received: from mail.mivlgu.ru (mivlgu.ru [81.18.140.87]) by matou.sibbald.com (8.11.6/8.11.6) with ESMTP id h3MEdw615608 for ; Tue, 22 Apr 2003 16:39:58 +0200 Received: by mail.mivlgu.ru (Postfix, from userid 112) id 5667E817DD; Tue, 22 Apr 2003 18:39:53 +0400 (MSD) Received: from vcserver.mivlgu.local (vcserver.mivlgu.local [192.168.1.251]) by mail.mivlgu.ru (Postfix) with SMTP id 0D7B5817DD; Tue, 22 Apr 2003 18:39:44 +0400 (MSD) Date: Tue, 22 Apr 2003 18:39:39 +0400 From: Sergey Vlasov To: stewart@wetlogic.net Cc: stewart@inverse.wetlogic.net, kern@sibbald.com, vojtech@ucw.cz Subject: Re: [Fwd: [Apcupsd-users] Success - APC BackUPS CS 500 shutdown over USB] Message-Id: <20030422183939.08cd1c13.vsu@altlinux.ru> In-Reply-To: References: <1050086110.13768.163.camel@rufus> X-Mailer: Sylpheed version 0.8.11 (GTK+ 1.2.10; i586-alt-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="=.rPW3CATQ/UTztX" X-Annoyance-Filter-Junk-Probability: 0.5 X-Annoyance-Filter-Classification: Mail --=.rPW3CATQ/UTztX Content-Type: multipart/mixed; boundary="Multipart_Tue__22_Apr_2003_18:39:39_+0400_083029a8" --Multipart_Tue__22_Apr_2003_18:39:39_+0400_083029a8 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 13 Apr 2003 11:17:30 -0700 Paul Stewart wrote: > I think it is definitely worth putting this in as a quirk. I know for a > fact that the MGE UPSes work fine without this patch, but works only after > a long delay (4 seconds or so) with this patch. I'm guessing that this > may be a more substantial problem with other HID devices -- note that > this function is used with all sorts of devices. > > I agree -- from reading the spec, that the current code is wrong -- there > is a hard-coded "report->id | 0x200" there that should really be 0x200 for > Output and 0x300 for feature reports (now that we realize that Feature > reports are settable too). However, the mode of access in the patch > looks nothing at all like the spec, and more like a mirror image of the > interrupt transfer. The prepended report ID byte looks to be a > requirement specific to APC UPSes and could easily wreak havoc with other > devices. This is why I suggest the patch be re-submitted as a quirk: > > - Add a new HID_QUIRK_ to hid.h > - Add the vendor and device IDs to hid_blacklist, with this new > quirk. > - Make the changes in the patch conditional on > (hid->quirks & HID_QUIRK_WEIRD_SETREPORT) != 0 > > It would be nice to fix the 0x200 issue while you're in that part of the > code. I'd have written the patch myself, but I don't have the vendor/device > IDs in question. This patch should appply cleanly on top of the other > changes (I think) I have in the queue WRT HID collections. Thanks for the > good work. (Sorry for the delay - I was busy with other things) OK, I did this (added a quirk and fixed the report type problem); it works here, but I have only one USB device - the UPS (APC Back-UPS CS 500). I have named the device ID USB_DEVICE_ID_APC_UPS_0002, because this identifier seems to be used for most of the APC USB UPSes (in fact, all hid-ups report files from apcupsd have this ID). Hope they all behave the same way (otherwise the code in hid-core.c will need to be extended to use more fields for matching). --Multipart_Tue__22_Apr_2003_18:39:39_+0400_083029a8 Content-Type: application/octet-stream; name="linux-2.4.20-alt-apc_usb_ups.patch" Content-Disposition: attachment; filename="linux-2.4.20-alt-apc_usb_ups.patch" Content-Transfer-Encoding: base64 LS0tIGxpbnV4LTIuNC4yMC9kcml2ZXJzL3VzYi9oaWQtY29yZS5jLmFsdC1hcGNfdXNiX3Vwcwky MDAzLTA0LTIxIDE5OjM5OjI3ICswNDAwCisrKyBsaW51eC0yLjQuMjAvZHJpdmVycy91c2IvaGlk LWNvcmUuYwkyMDAzLTA0LTIxIDE5OjU0OjIxICswNDAwCkBAIC0xMDE2LDEwICsxMDE2LDE4IEBA CiAKIHZvaWQgaGlkX3dyaXRlX3JlcG9ydChzdHJ1Y3QgaGlkX2RldmljZSAqaGlkLCBzdHJ1Y3Qg aGlkX3JlcG9ydCAqcmVwb3J0KQogewotCWhpZF9vdXRwdXRfcmVwb3J0KHJlcG9ydCwgaGlkLT5v dXRbaGlkLT5vdXRoZWFkXS5idWZmZXIpOwotCi0JaGlkLT5vdXRbaGlkLT5vdXRoZWFkXS5kci53 VmFsdWUgPSBjcHVfdG9fbGUxNigweDIwMCB8IHJlcG9ydC0+aWQpOwotCWhpZC0+b3V0W2hpZC0+ b3V0aGVhZF0uZHIud0xlbmd0aCA9IGNwdV90b19sZTE2KChyZXBvcnQtPnNpemUgKyA3KSA+PiAz KTsKKwlpZiAoKGhpZC0+cXVpcmtzICYgSElEX1FVSVJLX1NFVFJFUE9SVF9ORUVEU19JRCkgJiYg cmVwb3J0LT5pZCkgeworCQloaWQtPm91dFtoaWQtPm91dGhlYWRdLmJ1ZmZlclswXSA9IHJlcG9y dC0+aWQ7CisJCWhpZF9vdXRwdXRfcmVwb3J0KHJlcG9ydCwgaGlkLT5vdXRbaGlkLT5vdXRoZWFk XS5idWZmZXIgKyAxKTsKKwkJaGlkLT5vdXRbaGlkLT5vdXRoZWFkXS5kci53TGVuZ3RoID0KKwkJ CWNwdV90b19sZTE2KCgocmVwb3J0LT5zaXplICsgNykgPj4gMykgKyAxKTsKKwl9IGVsc2Ugewor CQloaWRfb3V0cHV0X3JlcG9ydChyZXBvcnQsIGhpZC0+b3V0W2hpZC0+b3V0aGVhZF0uYnVmZmVy KTsKKwkJaGlkLT5vdXRbaGlkLT5vdXRoZWFkXS5kci53TGVuZ3RoID0KKwkJCWNwdV90b19sZTE2 KChyZXBvcnQtPnNpemUgKyA3KSA+PiAzKTsKKwl9CisJaGlkLT5vdXRbaGlkLT5vdXRoZWFkXS5k ci53VmFsdWUgPQorCQljcHVfdG9fbGUxNigoKHJlcG9ydC0+dHlwZSArIDEpIDw8IDgpIHwgcmVw b3J0LT5pZCk7CiAKIAloaWQtPm91dGhlYWQgPSAoaGlkLT5vdXRoZWFkICsgMSkgJiAoSElEX0NP TlRST0xfRklGT19TSVpFIC0gMSk7CiAKQEAgLTEwOTAsNiArMTA5OCw5IEBACiAjZGVmaW5lIFVT Ql9ERVZJQ0VfSURfUE9XRVJNQVRFCQkweDA0MTAgLyogR3JpZmZpbiBQb3dlck1hdGUgKi8KICNk ZWZpbmUgVVNCX0RFVklDRV9JRF9TT1VOREtOT0IJCTB4MDRBQSAvKiBHcmlmZmluIFNvdW5kS25v YiAqLwogCisjZGVmaW5lIFVTQl9WRU5ET1JfSURfQVBDCQkweDA1MWQKKyNkZWZpbmUgVVNCX0RF VklDRV9JRF9BUENfVVBTXzAwMDIJMHgwMDAyIC8qIEFQQyBVUFMgLSBtYW55IG1vZGVscyAqLwor CiBzdHJ1Y3QgaGlkX2JsYWNrbGlzdCB7CiAJX191MTYgaWRWZW5kb3I7CiAJX191MTYgaWRQcm9k dWN0OwpAQCAtMTEyMSw2ICsxMTMyLDcgQEAKIAl7IFVTQl9WRU5ET1JfSURfQVRFTiwgVVNCX0RF VklDRV9JRF9BVEVOXzRQT1JUS1ZNLCBISURfUVVJUktfTk9HRVQgfSwKIAl7IFVTQl9WRU5ET1Jf SURfR1JJRkZJTiwgVVNCX0RFVklDRV9JRF9QT1dFUk1BVEUsIEhJRF9RVUlSS19JR05PUkUgfSwK IAl7IFVTQl9WRU5ET1JfSURfR1JJRkZJTiwgVVNCX0RFVklDRV9JRF9TT1VOREtOT0IsIEhJRF9R VUlSS19JR05PUkUgfSwKKwl7IFVTQl9WRU5ET1JfSURfQVBDLCBVU0JfREVWSUNFX0lEX0FQQ19V UFNfMDAwMiwgSElEX1FVSVJLX1NFVFJFUE9SVF9ORUVEU19JRCB9LAogCXsgMCwgMCB9CiB9Owog Ci0tLSBsaW51eC0yLjQuMjAvZHJpdmVycy91c2IvaGlkLmguYWx0LWFwY191c2JfdXBzCTIwMDIt MTEtMjkgMDI6NTM6MTQgKzAzMDAKKysrIGxpbnV4LTIuNC4yMC9kcml2ZXJzL3VzYi9oaWQuaAky MDAzLTA0LTIxIDE5OjQyOjMyICswNDAwCkBAIC0xODYsNiArMTg2LDcgQEAKICNkZWZpbmUgSElE X1FVSVJLX05PVE9VQ0gJMHgwMgogI2RlZmluZSBISURfUVVJUktfSUdOT1JFCTB4MDQKICNkZWZp bmUgSElEX1FVSVJLX05PR0VUCQkweDA4CisjZGVmaW5lIEhJRF9RVUlSS19TRVRSRVBPUlRfTkVF RFNfSUQJMHgxMAogCiAvKgogICogVGhpcyBpcyB0aGUgZ2xvYmFsIGVudmlyb21lbnQgb2YgdGhl IHBhcnNlci4gVGhpcyBpbmZvcm1hdGlvbiBpcwo= --Multipart_Tue__22_Apr_2003_18:39:39_+0400_083029a8-- --=.rPW3CATQ/UTztX Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+pVQvW82GfkQfsqIRAsFoAJ4hQtrQVfe97ZioFF8d7HAvp++ZHwCfUztJ lguft7SZDdYYOrN2tfaDTZE= =mIxq -----END PGP SIGNATURE----- --=.rPW3CATQ/UTztX-- apcupsd-3.14.10/examples/linux-usb-patch2-email.txt0000664000076400007640000001414707702532346021013 0ustar adk0212adk0212From apcupsd-users-admin@lists.sourceforge.net Tue Jul 8 11:59:49 2003 Return-Path: Received: from sc8-sf-list2.sourceforge.net (lists.sourceforge.net [66.35.250.206]) by matou.sibbald.com (8.11.6/8.11.6) with ESMTP id h689xn812370 for ; Tue, 8 Jul 2003 11:59:49 +0200 Received: from sc8-sf-list1-b.sourceforge.net ([10.3.1.13] helo=sc8-sf-list1.sourceforge.net) by sc8-sf-list2.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian)) id 19ZpFI-0007ch-00; Tue, 08 Jul 2003 02:58:48 -0700 Received: from mivlgu.ru ([81.18.140.87] helo=mail.mivlgu.ru) by sc8-sf-list1.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian)) id 19ZpES-0008QV-00 for ; Tue, 08 Jul 2003 02:57:57 -0700 Received: by mail.mivlgu.ru (Postfix, from userid 112) id 8D58581780; Tue, 8 Jul 2003 13:57:47 +0400 (MSD) Received: from vcserver.mivlgu.local (vcserver.mivlgu.local [192.168.1.251]) by mail.mivlgu.ru (Postfix) with SMTP id 5B04381771; Tue, 8 Jul 2003 13:57:43 +0400 (MSD) From: Sergey Vlasov To: "Ching-Hwa Yu" Cc: apcupsd-users Subject: Re: [Apcupsd-users] Problems using SmartUPS 1500 via USB w/3.10.5 Message-Id: <20030708135742.1aead379.vsu@altlinux.ru> In-Reply-To: References: X-Mailer: Sylpheed version 0.9.2 (GTK+ 1.2.10; i586-alt-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: apcupsd-users-admin@lists.sourceforge.net Errors-To: apcupsd-users-admin@lists.sourceforge.net X-BeenThere: apcupsd-users@lists.sourceforge.net X-Mailman-Version: 2.0.9-sf.net Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Apcupsd user's email list for support and discussions List-Unsubscribe: , List-Archive: Date: Tue, 8 Jul 2003 13:57:42 +0400 Content-Transfer-Encoding: 8bit On Mon, 7 Jul 2003 18:27:02 -0700 "Ching-Hwa Yu" wrote: > T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 5 Spd=1.5 MxCh= 0 > D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 > P: Vendor=051d ProdID=0002 Rev= 0.06 > S: Manufacturer=American Power Conversion > S: Product=Smart-UPS 1500 FW:601.3.D USB FW:1.5 > S: SerialNumber=AS0236331657 > C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 30mA > I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=(none) > E: Ad=81(I) Atr=03(Int.) MxPS= 6 Ivl=100ms This looks like a known bug in the HID driver - it does not recognize the UPS as a valid HID device. It should be fixed by the following kernel patch: http://marc.theaimsgroup.com/?l=linux-usb-devel&m=105562727703359&w=2 ================================================================= Some UPSes have logical minimum and maximum value in HID descriptors the same. The HID driver rejects such devices. This patch fixes this. Please apply for 2.4, I'll take care of a 2.5 patch. ChangeSet@1.1202, 2003-06-14 23:38:54+02:00, vojtech@suse.cz Logical minumum and maximum may be the same value per spec. This fixes some UPSes not getting detected properly. hid-core.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -Nru a/drivers/usb/hid-core.c b/drivers/usb/hid-core.c --- a/drivers/usb/hid-core.c Sat Jun 14 23:39:05 2003 +++ b/drivers/usb/hid-core.c Sat Jun 14 23:39:05 2003 @@ -202,7 +202,7 @@ return -1; } - if (parser->global.logical_maximum <= parser->global.logical_minimum) { + if (parser->global.logical_maximum < parser->global.logical_minimum) { dbg("logical range invalid %d %d", parser->global.logical_minimum, parser->global.logical_maximum); return -1; } ================================================================= Also you will need to apply another patch to get killpower working: ================================================================= ChangeSet 1.1258, 2003/06/18 16:55:46-07:00, vsu@altlinux.ru [PATCH] USB: HIDDEV / UPS patches drivers/usb/hid-core.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff -Nru a/drivers/usb/hid-core.c b/drivers/usb/hid-core.c --- a/drivers/usb/hid-core.c Wed Jun 18 17:34:51 2003 +++ b/drivers/usb/hid-core.c Wed Jun 18 17:34:51 2003 @@ -1067,10 +1067,16 @@ void hid_write_report(struct hid_device *hid, struct hid_report *report) { - hid_output_report(report, hid->out[hid->outhead].buffer); + if (hid->report_enum[report->type].numbered) { + hid->out[hid->outhead].buffer[0] = report->id; + hid_output_report(report, hid->out[hid->outhead].buffer + 1); + hid->out[hid->outhead].dr.wLength = cpu_to_le16(((report->size + 7) >> 3) + 1); + } else { + hid_output_report(report, hid->out[hid->outhead].buffer); + hid->out[hid->outhead].dr.wLength = cpu_to_le16((report->size + 7) >> 3); + } - hid->out[hid->outhead].dr.wValue = cpu_to_le16(0x200 | report->id); - hid->out[hid->outhead].dr.wLength = cpu_to_le16((report->size + 7) >> 3); + hid->out[hid->outhead].dr.wValue = cpu_to_le16(((report->type + 1) << 8) | report->id); hid->outhead = (hid->outhead + 1) & (HID_CONTROL_FIFO_SIZE - 1); ================================================================= ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 _______________________________________________ Apcupsd-users mailing list Apcupsd-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/apcupsd-users apcupsd-3.14.10/examples/make-hiddev0000775000076400007640000000116207474703535016163 0ustar adk0212adk0212#!/bin/sh mkdir -p /dev/usb/hid mknod /dev/usb/hid/hiddev0 c 180 96 mknod /dev/usb/hid/hiddev1 c 180 97 mknod /dev/usb/hid/hiddev2 c 180 98 mknod /dev/usb/hid/hiddev3 c 180 99 mknod /dev/usb/hid/hiddev4 c 180 100 mknod /dev/usb/hid/hiddev5 c 180 101 mknod /dev/usb/hid/hiddev6 c 180 102 mknod /dev/usb/hid/hiddev7 c 180 103 mknod /dev/usb/hid/hiddev8 c 180 104 mknod /dev/usb/hid/hiddev9 c 180 105 mknod /dev/usb/hid/hiddev10 c 180 106 mknod /dev/usb/hid/hiddev11 c 180 107 mknod /dev/usb/hid/hiddev12 c 180 108 mknod /dev/usb/hid/hiddev13 c 180 109 mknod /dev/usb/hid/hiddev14 c 180 110 mknod /dev/usb/hid/hiddev15 c 180 111 apcupsd-3.14.10/examples/megaclient.c0000664000076400007640000000625011323200342016306 0ustar adk0212adk0212/* * Client test program for apcnet * * This program beats the living daylights out of your * server by sending it one million requests. * * Optionally, it can send one million requests, connecting * and disconnecting each time. * * * Build it with: cc megaclient.c ../lib/libapc.a -o megaclient * * Execute: ./megaclient [host[:port]] * * For additional examples of code, see cgi/upsfetch.c */ /* * If RECONNECT is defined, megaclient will disconnect * and reconnect for every request (iteration), which is the normal * way that apcupsd is currently accessed. * * If RECONNECT is not defined, a single connection * is made with multiple requests. */ #define RECONNECT 1 #define ITERATIONS 80000 #include "apc.h" #ifdef HAVE_NISLIB /* Default values, can be changed on command line */ #define SERV_TCP_PORT 3551 #define SERV_HOST_ADDR "127.0.0.1" #define MAXLINE 5000 void error_abort(const char *msg) { fprintf(stderr, msg); exit(1); } int main(int argc, char *argv[]) { int sockfd, port; char host[200]; char msg[200], *p, *cmd; int i, n, line; time_t now, done; char recvline[MAXLINE+1]; strcpy(host, SERV_HOST_ADDR); port = SERV_TCP_PORT; if (argc > 1) { strcpy(host, argv[1]); /* get host from command line */ p = strchr(host, ':'); if (p) { *p++ = 0; port = atoi(p); } } if (argc > 2) { cmd = argv[2]; } else { cmd = NULL; } #ifdef RECONNECT now = time(NULL); for (i=0; i 0) { recvline[n] = 0; line++; /* fputs(recvline, stdout); */ } if (n < 0) { char msg[200]; sprintf(msg, "handle_client: net_recv error: %s\n", strerror(-n)); error_abort(msg); } if ( (i % 100) == 0) { printf("%d lines=%d\n", i, line); } net_close(sockfd); } #else /* Open once only */ if ((sockfd = net_open(host, NULL, port)) < 0) { sprintf(msg, "client: tcp_open for host %s on %d failed\n", host, port); error_abort(msg); } now = time(NULL); for (i=0; i 0) { recvline[n] = 0; line++; /* fputs(recvline, stdout); */ } if (n < 0) { char msg[200]; sprintf(msg, "handle_client: net_recv error: %s\n", strerror(-n)); error_abort(msg); } if ( (i % 100) == 0) { printf("%d lines=%d\n", i, line); } } net_close(sockfd); #endif done = time(NULL); printf("Total time = %ld secs.\n", done - now); exit(0); } #else /* HAVE_NISLIB */ int main(int argc, char *argv[]) { printf("Sorry, NIS code is not compiled in apcupsd.\n"); return 1; } #endif /* HAVE_NISLIB */ apcupsd-3.14.10/examples/nagios_plugin_check_apcupsd.c0000664000076400007640000002176311174620757021742 0ustar adk0212adk0212/* * Check-Plugin for Nagios to check status of an APC-UPS * monitored by APCUPSD * * Written by Christian Masopust, November 2005 * * Build it with: cc check_apcupsd.c ../lib/libapc.a -o check_apcupsd * * Execute: ./check_apcupsd [host[:port]] * */ #include "apc.h" #ifdef HAVE_NISLIB /* Default values, can be changed on command line */ #define SERV_TCP_PORT 3551 #define SERV_HOST_ADDR "127.0.0.1" #define BIGBUF 4096 char statbuf[BIGBUF]; int statlen = BIGBUF; #define NAGIOS_OK 0 #define NAGIOS_WARNING 1 #define NAGIOS_CRITICAL 2 #define NAGIOS_UNKNOWN 3 #define S_NAGIOS_OK "OK: " #define S_NAGIOS_WARNING "WARNING: " #define S_NAGIOS_CRITICAL "CRITICAL: " #define S_NAGIOS_UNKNOWN "UNKNOWN: " /* List of variables that can be read by getupsvar() * First field is that name given to getupsvar(), * Second field is our internal name as produced by the STATUS * output from apcupsd. * Third field, if 0 returns everything to the end of the * line, and if 1 returns only to first space (e.g. integers, * and floating point values. */ static struct { char *request; char *upskeyword; int nfields; } cmdtrans[] = { {"model", "MODEL", 0}, {"upsmodel", "UPSMODEL", 0}, {"date", "DATE", 0}, {"battcap", "BCHARGE", 1}, {"mbattchg", "MBATTCHG", 1}, {"battvolt", "BATTV", 1}, {"nombattv", "NOMBATTV", 1}, {"utility", "LINEV", 1}, {"upsload", "LOADPCT", 1}, {"loadpct", "LOADPCT", 1}, {"outputv", "OUTPUTV", 1}, {"status", "STATFLAG", 1}, {"linemin", "MINLINEV", 1}, {"linemax", "MAXLINEV", 1}, {"upstemp", "ITEMP", 1}, {"outputfreq", "LINEFREQ", 1}, {"translo", "LOTRANS", 1}, {"transhi", "HITRANS", 1}, {"runtime", "TIMELEFT", 1}, {"mintimel", "MINTIMEL", 1}, {"retpct", "RETPCT", 1}, /* min batt to turn on UPS */ {"sense", "SENSE", 1}, {"hostname", "HOSTNAME", 1}, {"battdate", "BATTDATE", 1}, {"serialno", "SERIALNO", 1}, {"lastxfer", "LASTXFER", 0}, /* reason for last xfer to batteries */ {"selftest", "SELFTEST", 1}, /* results of last self test */ {"laststest", "LASTSTEST", 0}, {"version", "VERSION", 1}, {"upsname", "UPSNAME", 1}, {"lowbatt", "DLOWBATT", 1}, /* low battery power off delay */ {"battpct", "BCHARGE", 1}, {"highxfer", "HITRANS", 1}, {"lowxfer", "LOTRANS", 1}, {"cable", "CABLE", 0}, {"firmware", "FIRMWARE", 0}, {NULL, NULL} }; int fetch_data(char *host, int port); int getupsvar(char *host, int port, char *request, char *answer, int anslen); int fill_buffer(int sockfd); extern int net_errno; struct sockaddr_in tcp_serv_addr; void error_abort(char *msg) { fprintf(stdout, msg); exit(NAGIOS_CRITICAL); } int main(int argc, char *argv[]) { int port; char host[200]; char msg[200], *p; char hostname[100]; char model[100]; char upsname[100]; char status[1000]; int iStatus; char sStatus[10]; char loadpct[100]; char runtime[100]; int retVal; retVal = NAGIOS_UNKNOWN; strcpy (sStatus, S_NAGIOS_UNKNOWN); strcpy(host, SERV_HOST_ADDR); port = SERV_TCP_PORT; if (argc > 1) { strcpy(host, argv[1]); /* get host from command line */ p = strchr(host, ':'); if (p) { *p++ = 0; port = atoi(p); } } if (getupsvar(host, port, "hostname", msg, sizeof(msg)) <= 0) { printf("%scannot get hostname from UPS-Server\n", S_NAGIOS_CRITICAL); exit(NAGIOS_CRITICAL); } strcpy(hostname, msg); if (getupsvar(host, port, "model", msg, sizeof(msg)) <= 0) { printf("%scannot get model from UPS-Server\n", S_NAGIOS_CRITICAL); exit(NAGIOS_CRITICAL); } strcpy(model, msg); if (getupsvar(host, port, "upsname", msg, sizeof(msg)) <= 0) { printf("%scannot get upsname from UPS-Server\n", S_NAGIOS_CRITICAL); exit(NAGIOS_CRITICAL); } strcpy(upsname, msg); if (getupsvar(host, port, "status", msg, sizeof(msg)) <= 0) { printf("%scannot get status from UPS-Server\n", S_NAGIOS_CRITICAL); exit(NAGIOS_CRITICAL); } iStatus = strtol(msg, 0, 16); status[0] = '\0'; if (iStatus & UPS_calibration) { strcat(status, "CALIBRATION "); retVal = NAGIOS_OK; strcpy(sStatus, S_NAGIOS_OK); } if (iStatus & UPS_trim) { strcat(status, "SMART TRIM "); retVal = NAGIOS_OK; strcpy(sStatus, S_NAGIOS_OK); } if (iStatus & UPS_boost) { strcat(status, "SMART BOOST "); retVal = NAGIOS_OK; strcpy(sStatus, S_NAGIOS_OK); } if (iStatus & UPS_online) { strcat(status, "ONLINE "); retVal = NAGIOS_OK; strcpy(sStatus, S_NAGIOS_OK); } if (iStatus & UPS_onbatt) { strcat(status, "ON BATTERY "); retVal = NAGIOS_WARNING; strcpy(sStatus, S_NAGIOS_WARNING); } if (iStatus & UPS_overload) { strcat(status, "OVERLOADED "); retVal = NAGIOS_CRITICAL; strcpy(sStatus, S_NAGIOS_CRITICAL); } if (iStatus & UPS_battlow) { strcat(status, "BATTERY LOW "); retVal = NAGIOS_CRITICAL; strcpy(sStatus, S_NAGIOS_CRITICAL); } if (iStatus & UPS_replacebatt) { strcat(status, "REPLACE BATTERY "); retVal = NAGIOS_WARNING; strcpy(sStatus, S_NAGIOS_WARNING); } if (iStatus & UPS_commlost) { strcat(status, "COMMUNICATION LOST "); retVal = NAGIOS_CRITICAL; strcpy(sStatus, S_NAGIOS_CRITICAL); } if (iStatus & UPS_shutdown) { strcat(status, "SHUTDOWN "); retVal = NAGIOS_OK; strcpy(sStatus, S_NAGIOS_OK); } if (iStatus & UPS_slave) { strcat(status, "SLAVE "); retVal = NAGIOS_OK; strcpy(sStatus, S_NAGIOS_OK); } if (strlen(status) > 0) { status[strlen(status) - 1] = '\0'; } if (getupsvar(host, port, "loadpct", msg, sizeof(msg)) <= 0) { printf("%scannot get loadpct from UPS-Server\n", S_NAGIOS_CRITICAL); exit(NAGIOS_CRITICAL); } strcpy(loadpct, msg); if (getupsvar(host, port, "runtime", msg, sizeof(msg)) <= 0) { printf("%scannot get runtime from UPS-Server\n", S_NAGIOS_CRITICAL); exit(NAGIOS_CRITICAL); } strcpy(runtime, msg); printf ("%sUPS: %s, Load: %s%%, Runtime: %smin, Status: %s\n", sStatus, model, loadpct, runtime, status); /* printf("For host=%s ups=%s model=%s, the Status=%s, loadpct=%s, runtime=%s\n", hostname, upsname, model, status, loadpct, runtime); */ exit(retVal); } /* * Read data into memory buffer to be used by getupsvar() * Returns 0 on error * Returns 1 if data fetched */ int fetch_data(char *host, int port) { int sockfd; int stat; if ((sockfd = net_open(host, NULL, port)) < 0) { printf("fetch_data: tcp_open failed for %s port %d", host, port); return 0; } stat = fill_buffer(sockfd); /* fill statbuf */ net_close(sockfd); return stat; } /* * * Returns 1 if var found * answer has var * Returns 0 if variable name not found * answer has "Not found" is variable name not found * answer may have "N/A" if the UPS does not support this * feature * Returns -1 if network problem * answer has "N/A" if host is not available or network error */ int getupsvar(char *host, int port, char *request, char *answer, int anslen) { int i; char *stat_match = NULL; char *find; int nfields = 0; if (!fetch_data(host, port)) { strcpy(answer, "N/A"); return -1; } for (i=0; cmdtrans[i].request; i++) if (!(strcmp(cmdtrans[i].request, request))) { stat_match = cmdtrans[i].upskeyword; nfields = cmdtrans[i].nfields; } if (stat_match != NULL) { if ((find=strstr(statbuf, stat_match)) != NULL) { if (nfields == 1) /* get one field */ sscanf (find, "%*s %*s %s", answer); else { /* get everything to eol */ i = 0; find += 11; /* skip label */ while (*find != '\n') answer[i++] = *find++; answer[i] = 0; } if (strcmp(answer, "N/A") == 0) return 0; return 1; } } strcpy(answer, "Not found"); return 0; } #define MAXLINE 512 /* Fill buffer with data from UPS network daemon * Returns 0 on error * Returns 1 if OK */ int fill_buffer(int sockfd) { int n, stat = 1; char buf[1000]; statbuf[0] = 0; statlen = 0; if (net_send(sockfd, "status", 6) != 6) { printf("fill_buffer: write error on socket\n"); return 0; } while ((n = net_recv(sockfd, buf, sizeof(buf)-1)) > 0) { buf[n] = 0; strcat(statbuf, buf); } if (n < 0) stat = 0; statlen = strlen(statbuf); return stat; } #else /* HAVE_NISLIB */ int main(int argc, char *argv[]) { printf("Sorry, NIS code is not compiled in apcupsd.\n"); return 1; } #endif /* HAVE_NISLIB */ apcupsd-3.14.10/examples/newslave.c0000664000076400007640000001401511323200342016020 0ustar adk0212adk0212/* * Client test program for apcnisd to be used * as a base for the new master/slave code. * * Build it with: cc newslave.c ../lib/libapc.a -o newclient * * Execute: ./newslave [host[:port]] * * The two commands currently (Apr 2001) accepted by the * server are "status" and "events". * */ #include "apc.h" #ifdef HAVE_NISLIB /* Default values, can be changed on command line */ #define SERV_TCP_PORT 3551 #define SERV_HOST_ADDR "127.0.0.1" #define BIGBUF 4096 char statbuf[BIGBUF]; int statlen = BIGBUF; /* List of variables that can be read by getupsvar() * First field is that name given to getupsvar(), * Second field is our internal name as produced by the STATUS * output from apcupsd. * Third field, if 0 returns everything to the end of the * line, and if 1 returns only to first space (e.g. integers, * and floating point values. */ static struct { const char *request; const char *upskeyword; int nfields; } cmdtrans[] = { {"model", "MODEL", 0}, {"upsmodel", "UPSMODEL", 0}, {"date", "DATE", 0}, {"battcap", "BCHARGE", 1}, {"mbattchg", "MBATTCHG", 1}, {"battvolt", "BATTV", 1}, {"nombattv", "NOMBATTV", 1}, {"utility", "LINEV", 1}, {"upsload", "LOADPCT", 1}, {"loadpct", "LOADPCT", 1}, {"outputv", "OUTPUTV", 1}, {"status", "STATFLAG", 1}, {"linemin", "MINLINEV", 1}, {"linemax", "MAXLINEV", 1}, {"upstemp", "ITEMP", 1}, {"outputfreq", "LINEFREQ", 1}, {"translo", "LOTRANS", 1}, {"transhi", "HITRANS", 1}, {"runtime", "TIMELEFT", 1}, {"mintimel", "MINTIMEL", 1}, {"retpct", "RETPCT", 1}, /* min batt to turn on UPS */ {"sense", "SENSE", 1}, {"hostname", "HOSTNAME", 1}, {"battdate", "BATTDATE", 1}, {"serialno", "SERIALNO", 1}, {"lastxfer", "LASTXFER", 0}, /* reason for last xfer to batteries */ {"selftest", "SELFTEST", 1}, /* results of last self test */ {"laststest", "LASTSTEST", 0}, {"version", "VERSION", 1}, {"upsname", "UPSNAME", 1}, {"lowbatt", "DLOWBATT", 1}, /* low battery power off delay */ {"battpct", "BCHARGE", 1}, {"highxfer", "HITRANS", 1}, {"lowxfer", "LOTRANS", 1}, {"cable", "CABLE", 0}, {"firmware", "FIRMWARE", 0}, {NULL, NULL} }; int fetch_data(char *host, int port); int getupsvar(char *host, int port, const char *request, char *answer, int anslen); int fill_buffer(int sockfd); extern int net_errno; void error_abort(char *msg) { fprintf(stderr, msg); exit(1); } int main(int argc, char *argv[]) { int port; char host[200]; char msg[200], *p; char hostname[100]; char release[100]; char upsname[100]; char status[100]; strcpy(host, SERV_HOST_ADDR); port = SERV_TCP_PORT; if (argc > 1) { strcpy(host, argv[1]); /* get host from command line */ p = strchr(host, ':'); if (p) { *p++ = 0; port = atoi(p); } } if (getupsvar(host, port, "hostname", msg, sizeof(msg)) <= 0) { printf("Error getting variable\n"); exit(1); } strcpy(hostname, msg); if (getupsvar(host, port, "version", msg, sizeof(msg)) <= 0) { printf("Error getting variable\n"); exit(1); } strcpy(release, msg); if (getupsvar(host, port, "upsname", msg, sizeof(msg)) <= 0) { printf("Error getting variable\n"); exit(1); } strcpy(upsname, msg); if (getupsvar(host, port, "status", msg, sizeof(msg)) <= 0) { printf("Error getting variable\n"); exit(1); } strcpy(status, msg); printf("For host=%s ups=%s apcupsd version=%s, the Status=%s\n", hostname, upsname, release, status); exit(0); } /* * Read data into memory buffer to be used by getupsvar() * Returns 0 on error * Returns 1 if data fetched */ int fetch_data(char *host, int port) { int sockfd; int stat; if ((sockfd = net_open(host, NULL, port)) < 0) { printf("fetch_data: tcp_open failed for %s port %d", host, port); return 0; } stat = fill_buffer(sockfd); /* fill statbuf */ net_close(sockfd); return stat; } /* * * Returns 1 if var found * answer has var * Returns 0 if variable name not found * answer has "Not found" is variable name not found * answer may have "N/A" if the UPS does not support this * feature * Returns -1 if network problem * answer has "N/A" if host is not available or network error */ int getupsvar(char *host, int port, const char *request, char *answer, int anslen) { int i; const char *stat_match = NULL; char *find; int nfields = 0; if (!fetch_data(host, port)) { strcpy(answer, "N/A"); return -1; } for (i=0; cmdtrans[i].request; i++) if (!(strcmp(cmdtrans[i].request, request))) { stat_match = cmdtrans[i].upskeyword; nfields = cmdtrans[i].nfields; } if (stat_match != NULL) { if ((find=strstr(statbuf, stat_match)) != NULL) { if (nfields == 1) /* get one field */ sscanf (find, "%*s %*s %s", answer); else { /* get everything to eol */ i = 0; find += 11; /* skip label */ while (*find != '\n') answer[i++] = *find++; answer[i] = 0; } if (strcmp(answer, "N/A") == 0) return 0; return 1; } } strcpy(answer, "Not found"); return 0; } #define MAXLINE 512 /* Fill buffer with data from UPS network daemon * Returns 0 on error * Returns 1 if OK */ int fill_buffer(int sockfd) { int n, stat = 1; char buf[1000]; statbuf[0] = 0; statlen = 0; if (net_send(sockfd, "status", 6) != 6) { printf("fill_buffer: write error on socket\n"); return 0; } while ((n = net_recv(sockfd, buf, sizeof(buf)-1)) > 0) { buf[n] = 0; strcat(statbuf, buf); } if (n < 0) stat = 0; statlen = strlen(statbuf); return stat; } #else /* HAVE_NISLIB */ int main(int argc, char *argv[]) { printf("Sorry, NIS code is not compiled in apcupsd.\n"); return 1; } #endif /* HAVE_NISLIB */ apcupsd-3.14.10/examples/offbattery.cpufreq0000775000076400007640000000223410313175110017571 0ustar adk0212adk0212#!/bin/sh # # This shell script if placed in /etc/apcupsd will be # called by /etc/apcupsd/apccontrol when the UPS goes # back on to the mains after a power failure. # # We scale the CPU clock frequency to maximum and # send an email message to root to notify him. # # NOTE: Assumes Linux-2.6.x kernel with CPUFREQ # support for your chipset. SYSADMIN=root APCUPSD_MAIL="/bin/mail" # Iterate over all CPUs, enabling the userspace governor # and programming the current clock speed to the maximum. # This is redundant on hyperthread siblings, but it # doesn't hurt anything and it keeps the code simple. for CPU in /sys/devices/system/cpu/cpu*/cpufreq ; do echo -n userspace > $CPU/scaling_governor cat $CPU/scaling_max_freq > $CPU/scaling_setspeed done # Send an email to root HOSTNAME=`hostname` MSG="$HOSTNAME Power has returned" # ( echo "Subject: $MSG" echo " " echo "$MSG" echo " " for CPU in `ls -1 /sys/devices/system/cpu` ; do echo -n "$CPU freq scaled to " cat /sys/devices/system/cpu/$CPU/cpufreq/scaling_setspeed | tr -d '\n' echo " MHz" done echo " " /sbin/apcaccess status ) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN exit 0 apcupsd-3.14.10/examples/onbattery.cpufreq0000775000076400007640000000275710313175110017445 0ustar adk0212adk0212#!/bin/sh # # This shell script if placed in /etc/apcupsd will be # called by /etc/apcupsd/apccontrol when the UPS goes # on batteries. # # We scale the CPU clock frequency back to save power # and send an email message to root to notify him. # # NOTE: Assumes Linux-2.6.x kernel with CPUFREQ # support for your chipset. Enable appropriate # modprobe line below to match your hardware. SYSADMIN=root APCUPSD_MAIL="/bin/mail" # Load the appropriate cpufreq module. This is best done # in boot scripts, but throw it here to make sure it has # been done. modprobe p4_clockmod #modprobe cpufreq-nforce2 #modprobe powernow-k6 #modprobe powernow-k8 #modprobe speedstep-smi # Give the cpufreq module a chance to initialize sleep 1 # Iterate over all CPUs, enabling the userspace governor # and programming the current clock speed to the minimum. # This is redundant on hyperthread siblings, but it # doesn't hurt anything and it keeps the code simple. for CPU in /sys/devices/system/cpu/cpu*/cpufreq ; do echo -n userspace > $CPU/scaling_governor cat $CPU/scaling_min_freq > $CPU/scaling_setspeed done # Send an email to root HOSTNAME=`hostname` MSG="$HOSTNAME Power Failure!" # ( echo "Subject: $MSG" echo " " echo "$MSG" echo " " for CPU in `ls -1 /sys/devices/system/cpu` ; do echo -n "$CPU freq scaled to " cat /sys/devices/system/cpu/$CPU/cpufreq/scaling_setspeed | tr -d '\n' echo " MHz" done echo " " /sbin/apcaccess status ) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN exit 0 apcupsd-3.14.10/examples/php-monitor.txt0000664000076400007640000000314010241323362017050 0ustar adk0212adk0212From rob@killerbob.ca Tue Apr 26 14:27:01 2005 Date: Tue, 26 Apr 2005 08:27:01 -0400 From: Rob Kroll To: Gerry Kroll CC: Kern Sibbald , gkroll@killerbob.ca, Adam Kropelin Subject: Re: apcupsd And here it is again, with a logic fix and some handling for events I hadn't tested yet. (behaviour when the battery dies completely) Thanks, again, -RK Gerry Kroll wrote: > Kern: > Sorry, here's the file again. > > The attachment is now a ZIP file, apcupsd_rk.zip containing index.php. > > I hope that's satisfactory. > > Regards, > Gerry Kroll (canajun2eh) for > Rob Kroll. > > Kern Sibbald wrote: > >> Hello Rob, >> >> Thanks for your thanks. :-) >> >> This looks like a really nice contribution. Could you resend me your >> file, but as an attachment? -- that will avoid lines getting messed >> up due to wrapping by browsers. >> >> On Tuesday 26 April 2005 03:33, Rob Kroll wrote: >> >> >>> Hi, Kern, >>> >>> I'd like to start by thanking you for the work you and your team have >>> put into this project. It's an excellent piece of software, and I'm >>> glad >>> that I was able to find it. >>> >>> That said, I've written a php script that parses the apcupsd.events and >>> apcupsd.status files, and displays the most important information for >>> the user. I thought you folks might like to include it with the >>> distribution, as it allows for web-based monitoring of the UPS status. >>> >>> I've attached the file to this e-mail. >>> >>> >>> Thanks again, >>> -RK >>> >> Included file is in apcupsd-source/examples/index.php apcupsd-3.14.10/examples/safe.apccontrol.in0000775000076400007640000000526311002376736017470 0ustar adk0212adk0212#!@SCRIPTSHELL@ # # Safe apccontrol for testing. # # This apccontrol can be used for testing without fear # that it will bring your system down # @configure_input@ # prefix=@prefix@ exec_prefix=@exec_prefix@ APCUPSD=@sbindir@/apcupsd SHUTDOWN=@SHUTDOWN@ SCRIPTDIR=@sysconfdir@ # case "$1" in killpower) wall < #include #include #include #include #include #include #include #define DEFAULT_LINEF 60.0 #define DEFAULT_LOADPCT 25.0 #define DEFAULT_BATTPCT 100.0 #define DEfAULT_TIMELEFT 20.0 #define DEFAULT_BATTV 24.0 #define DEFAULT_LINEV 120.0 #define DEFAULT_OUTV 120.0 #define DEFAULT_REG2 0x00 int debug = 1; int ups = -1; /* UPS variables */ float linefreq = DEFAULT_LINEF; float loadpct = DEFAULT_LOADPCT; float battpct = DEFAULT_BATTPCT; float timeleft = DEfAULT_TIMELEFT; float battv = DEFAULT_BATTV; float linev = DEFAULT_LINEV; float outv = DEFAULT_OUTV; unsigned char reg2 = DEFAULT_REG2; char xfercause[] = "O"; char selftest[] = "OK"; int onbatt = 0; int online = 1; int overload = 0; int battlow = 0; int rebatt = 0; int trim = 0; int boost = 0; int commfail = 0; #define dbg(str, args...) \ do \ { \ if (debug) \ { \ printf(str, ## args); \ fflush(stdout); \ } \ } \ while(0) /* Response callbacks */ static void rsp_string(const void* arg); static void rsp_float(const void* arg); static void rsp_cmds(const void* arg); static void rsp_status(const void* arg); static void rsp_hex(const void *arg); /* Mapping of UPS commands to response callbacks */ struct upscmd { char cmd; void (*func)(const void*); const void* arg; } upscmds[] = { { 'Y', rsp_string, "SM" }, { '\x01', rsp_string, "SMART-UPS Simulator" }, { 'c', rsp_string, "SMARTSIM" }, { 'F', rsp_float, &linefreq }, { 'Q', rsp_status, NULL }, { 'P', rsp_float, &loadpct }, { 'f', rsp_float, &battpct }, { 'a', rsp_cmds, NULL }, { 'j', rsp_float, &timeleft }, { 'G', rsp_string, xfercause }, { 'X', rsp_string, selftest }, { 'B', rsp_float, &battv }, { 'L', rsp_float, &linev }, { 'O', rsp_float, &outv }, { '\'', rsp_hex, ®2 }, { 'V', rsp_string, "Lzy" }, { '\0', NULL, NULL } }; /* The alert characters we support */ const char alerts[] = "!$%+#"; static void key_toggle(const void* arg); static void key_onbatt(const void* arg); static void key_battlow(const void* arg); static void key_inc(const void* arg); static void key_dec(const void* arg); static void key_selftest(const void* arg); static void key_rebatt(const void* arg); static void key_batdet(const void *arg); static void key_commfail(const void *arg); static void key_help(const void *arg); /* Mapping of keyboard commands to callbacks */ struct keycmd { char key; void (*func)(const void*); void* arg; } keycmds[] = { { 'b', key_onbatt, NULL }, { 'o', key_toggle, &overload }, { 't', key_toggle, &trim }, { 's', key_toggle, &boost }, { 'l', key_battlow, NULL }, { '7', key_inc, &battpct }, { '4', key_dec, &battpct }, { '8', key_inc, &loadpct }, { '5', key_dec, &loadpct }, { '9', key_inc, &timeleft }, { '6', key_dec, &timeleft }, { 'x', key_selftest, NULL }, { 'r', key_rebatt, NULL }, { 'd', key_batdet, NULL }, { 'c', key_commfail, NULL }, { '?', key_help, NULL }, { '\0', NULL, NULL } }; /* Defaults */ #define DEFAULT_DEVICE "/dev/ttyS0"; void wups(const char* str, int len) { if (debug) write(fileno(stdout), str, len); write(ups, str, len); } void rsp_string(const void* arg) { wups((char*)arg, strlen((char*)arg)); wups("\r\n", 2); } void rsp_float(const void* arg) { char buf[20]; sprintf(buf, "%03.3f\r\n", *(float*)arg); wups(buf, strlen(buf)); } void rsp_hex(const void* arg) { char buf[20]; sprintf(buf, "%02x\r\n", *(unsigned char*)arg); wups(buf, strlen(buf)); } void rsp_cmds(const void* arg) { int x; /* Protocol version */ wups("3.", 2); /* Supported alert characters */ wups(alerts, sizeof(alerts)-1); wups(".", 1); /* Supported commands */ for (x=0; upscmds[x].func; x++) wups(&upscmds[x].cmd, 1); wups("\r\n", 2); } void rsp_status(const void* arg) { char buf[20]; sprintf(buf, "%02x\r\n", (trim << 1) | (boost << 2) | (online << 3) | (onbatt << 4) | (overload << 5) | (battlow << 6) | (rebatt << 7)); wups(buf, strlen(buf)); } static void key_toggle(const void* arg) { *(int *)arg = !*(int *)arg; } static void key_onbatt(const void* arg) { if (!onbatt) { online = 0; onbatt = 1; xfercause[0] = 'L'; linev = 0; dbg("ALERT: "); wups("!", 1); dbg("\n"); } else { online = 1; onbatt = 0; linev = DEFAULT_LINEV; dbg("ALERT: "); wups("$", 1); dbg("\n"); } } static void key_battlow(const void* arg) { if (!battlow) { battlow = 1; dbg("ALERT: "); wups("%", 1); dbg("\n"); } else { battlow = 0; dbg("ALERT: "); wups("+", 1); dbg("\n"); } } static void key_inc(const void* arg) { *(float*)arg += 1; dbg("%3.3f\n", *(float*)arg); } static void key_dec(const void* arg) { *(float*)arg -= 1; dbg("%3.3f\n", *(float*)arg); } static void key_selftest(const void* arg) { key_onbatt(NULL); if (onbatt) xfercause[0] = 'S'; } static void key_rebatt(const void* arg) { if (!rebatt) { rebatt = 1; dbg("ALERT: "); wups("#", 1); dbg("\n"); } else { rebatt = 0; } } static void key_batdet(const void *arg) { if (reg2 & 0x20) reg2 &= ~0x20; else reg2 |= 0x20; } static void key_commfail(const void *arg) { if (commfail) { commfail = 0; dbg("COMMFAIL disabled\n"); } else { commfail = 1; dbg("COMMFAIL enabled\n"); } } static void key_help(const void *arg) { dbg("Commands:\n"); dbg("? Help\n"); dbg("b Onbattery toggle\n"); dbg("o Overload toggle\n"); dbg("t Trim toggle\n"); dbg("s Boost toggle\n"); dbg("l BattLow toggle\n"); dbg("x Selftest toggle\n"); dbg("r ReplaceBatt toggle\n"); dbg("d BattDetach toggle\n"); dbg("c CommFail toggle\n"); dbg("7/4 BattPct (inc/dec) (use numeric keypad)\n"); dbg("8/5 LoadPct (inc/dec) (use numeric keypad)\n"); dbg("9/6 TimeLeft (inc/dec) (use numeric keypad)\n"); } void handle_ups_cmd(char cmd) { int x; if (commfail) { dbg("\n"); return; } for (x=0; upscmds[x].func; x++) { if (upscmds[x].cmd == cmd) { upscmds[x].func(upscmds[x].arg); break; } } if (!upscmds[x].func) rsp_string("NA"); } void handle_key_cmd(char cmd) { int x; for (x=0; keycmds[x].func; x++) { if (keycmds[x].key == cmd) { keycmds[x].func(keycmds[x].arg); break; } } } #define max(a,b) \ ( ((a) > (b)) ? (a) : (b) ) int main(int argc, char* argv[]) { fd_set fds; int rc; char cmd; struct termios tio; const char* dev; int con; /* Allow serial port device to be supplied on command line */ if (argc == 2) dev = argv[1]; else dev = DEFAULT_DEVICE; /* Open serial port device */ ups = open(dev, O_RDWR | O_NOCTTY); if (ups < 0) { perror("open"); return 1; } /* Set serial port for 2400 baud, N81 */ tio.c_cflag = B2400 | CS8 | CLOCAL | CREAD; tio.c_iflag = IGNPAR; /* Ignore errors, raw input */ tio.c_oflag = 0; /* Raw output */ tio.c_lflag = 0; /* No local echo */ cfsetospeed(&tio, B2400); cfsetispeed(&tio, B2400); tcflush(ups, TCIFLUSH); tcsetattr(ups, TCSANOW, &tio); tcflush(ups, TCIFLUSH); /* Disable echo and line buffering on stdin */ con = fileno(stdin); tcgetattr(con, &tio); tio.c_lflag &= ~(ECHO|ICANON); tcsetattr(con, TCSANOW, &tio); while (1) { FD_ZERO(&fds); FD_SET(ups, &fds); FD_SET(con, &fds); do { rc = select(max(con,ups)+1, &fds, NULL, NULL, NULL); } while (rc == -1 && (errno == EAGAIN || errno == EINTR)); if (rc == -1) { perror("select"); return 1; } if (FD_ISSET(ups, &fds)) { do { rc = read(ups, &cmd, 1); } while (rc != 1 && (errno == EAGAIN || errno == EINTR)); if (rc != 1) { perror("read"); return 1; } dbg("CMD: "); if (cmd == 0) dbg(""); else if (cmd >= 1 && cmd <= 26) dbg("^%c", cmd+64); else dbg("%c", cmd); dbg("\nRSP: "); handle_ups_cmd(cmd); } if (FD_ISSET(con, &fds)) { do { rc = read(con, &cmd, 1); } while (rc != 1 && (errno == EAGAIN || errno == EINTR)); if (rc != 1) { perror("read"); return 1; } handle_key_cmd(cmd); } } return 0; } apcupsd-3.14.10/examples/snoopdecode.c0000664000076400007640000002462011011575400016505 0ustar adk0212adk0212/* * snoopdecode.c * * Decodes traces captured by 'usbsnoop' * (http://benoit.papillault.free.fr/usbsnoop/index.php) * * See usbsnoop.txt for details. */ /* * Copyright (C) 2004-2005 Adam Kropelin * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #include #include #include #define MAX_LINE 1024 char line[MAX_LINE] = ""; FILE* file; enum { DIR_UNKNOWN = 0, DIR_TO_DEVICE, DIR_FROM_DEVICE }; enum { FUNC_UNKNOWN = 0, FUNC_CONTROL_TXFER, FUNC_CLASS_INTERFACE, FUNC_GET_DESC, FUNC_SELECT_CONFIG, FUNC_GET_DESC_FROM_IFACE, FUNC_BULK_TXFER, FUNC_RESET_PIPE, FUNC_ABORT_PIPE, }; enum { REQ_GET_REPORT = 1, REQ_GET_IDLE = 2, REQ_GET_PROTOCOL = 3, REQ_SET_REPORT = 9, REQ_SET_IDLE = 10, REQ_SET_PROTOCOL = 11 }; struct urb { int seq; unsigned long len; unsigned char* data; unsigned long flags; unsigned long index; unsigned long type; unsigned long reserved; unsigned long request; unsigned long value; int time; int dir; int func; }; struct rpt { struct rpt* next; unsigned char* data; int seq; unsigned short len; unsigned char id; unsigned long value; }; struct rpt* rpts = NULL; /* [197 ms] >>> URB 1 going down >>> -- URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE: TransferBufferLength = 00000012 TransferBuffer = 864c9208 TransferBufferMDL = 00000000 Index = 00000000 DescriptorType = 00000001 (USB_DEVICE_DESCRIPTOR_TYPE) LanguageId = 00000000 [203 ms] UsbSnoop - MyInternalIOCTLCompletion(f7b91db0) : fido=00000000, Irp=863df850, Context=86405d10, IRQL=2 [203 ms] <<< URB 1 coming back <<< -- URB_FUNCTION_CONTROL_TRANSFER: PipeHandle = 863e4150 TransferFlags = 0000000b (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK) TransferBufferLength = 00000012 TransferBuffer = 864c9208 TransferBufferMDL = 8640f108 00000000: 12 01 10 01 00 00 00 08 1d 05 02 00 06 00 03 01 00000010: 02 01 UrbLink = 00000000 */ /* [59563 ms] >>> URB 346 going down >>> -- URB_FUNCTION_CLASS_INTERFACE: TransferFlags = 00000001 (USBD_TRANSFER_DIRECTION_IN, ~USBD_SHORT_TRANSFER_OK) TransferBufferLength = 00000005 TransferBuffer = f7f12ba0 TransferBufferMDL = 00000000 UrbLink = 00000000 RequestTypeReservedBits = 00000022 Request = 00000001 Value = 0000032f Index = 00000000 [59567 ms] UsbSnoop - MyInternalIOCTLCompletion(f7b91db0) : fido=86397288, Irp=85ff4b40, Context=85f4b3d8, IRQL=2 [59567 ms] <<< URB 346 coming back <<< -- URB_FUNCTION_CONTROL_TRANSFER: PipeHandle = 863e4150 TransferFlags = 0000000b (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK) TransferBufferLength = 00000002 TransferBuffer = f7f12ba0 TransferBufferMDL = 85f102f0 00000000: 2f 02 UrbLink = 00000000 SetupPacket = 00000000: a1 01 2f 03 00 00 05 00 */ int fetch_line() { return !!fgets(line, sizeof(line), file); } int find_urb() { do { if (line[0] == '[' && strstr(line, " URB ") && (strstr(line, "going down") || strstr(line, "coming back"))) { return 1; } } while( fetch_line() ); return 0; } int init_urb(struct urb* urb) { memset(urb, 0, sizeof(*urb)); if (!find_urb()) return 0; urb->time = atoi(line+1); if (strstr(line, "going down")) urb->dir = DIR_TO_DEVICE; else if(strstr(line, "coming back")) urb->dir = DIR_FROM_DEVICE; else urb->dir = DIR_UNKNOWN; urb->seq = atoi(strstr(line,"URB ")+4); return 1; } unsigned long get_hex_value() { char* ptr = strchr(line, '='); if (!ptr) return 0xffff; return strtoul(ptr+2, NULL, 16); } unsigned char* parse_data_dump(int len) { int count = 0; char* ptr= NULL; unsigned char* data = (unsigned char *)malloc(len); if (!data) return NULL; while(count < len) { if ((count % 16) == 0) { if (count) { if (!fetch_line()) { free(data); return NULL; } } ptr = strchr(line, ':'); if (!ptr) { free(data); return NULL; } ptr += 2; } data[count++] = strtoul(ptr, NULL, 16); ptr += 3; } return data; } void parse_urb_body(struct urb* urb) { int setup_packet = 0; while (fetch_line()) { if (line[0] == '[') break; if (strstr(line, "TransferBufferLength")) { urb->len = get_hex_value(); } else if (strstr(line, "TransferFlags")) { urb->flags = get_hex_value(); } else if (strstr(line, "Index")) { urb->index = get_hex_value(); } else if (strstr(line, "DescriptorType")) { urb->type = get_hex_value(); } else if (strstr(line, "RequestTypeReservedBits")) { urb->reserved = get_hex_value(); } else if (strstr(line, "Request")) { urb->request = get_hex_value(); } else if (strstr(line, "Value")) { urb->value = get_hex_value(); } else if (strstr(line, "SetupPacket")) { setup_packet = 1; } else if (strstr(line, "00000000:")) { if (!setup_packet && !urb->data) urb->data = parse_data_dump(urb->len); } else if (strstr(line, "-- URB_FUNCTION_")) { if (strstr(line, "URB_FUNCTION_CONTROL_TRANSFER")) urb->func = FUNC_CONTROL_TXFER; else if (strstr(line, "URB_FUNCTION_CLASS_INTERFACE")) urb->func = FUNC_CLASS_INTERFACE; else if (strstr(line, "URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE")) urb->func = FUNC_GET_DESC; else if (strstr(line, "URB_FUNCTION_SELECT_CONFIGURATION")) urb->func = FUNC_SELECT_CONFIG; else if (strstr(line, "URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE")) urb->func = FUNC_GET_DESC_FROM_IFACE; else if (strstr(line, "URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER")) urb->func = FUNC_BULK_TXFER; else if (strstr(line, "URB_FUNCTION_RESET_PIPE")) urb->func = FUNC_RESET_PIPE; else if (strstr(line, "URB_FUNCTION_ABORT_PIPE")) urb->func = FUNC_ABORT_PIPE; else { urb->func = FUNC_UNKNOWN; printf("Unknown FUNC: %s\n", line); exit(0); } } } } void free_urb(struct urb* urb) { free(urb->data); } void print_urb(struct urb* urb) { unsigned int x; printf("[%08d ms] %05d %c ", urb->time, urb->seq, (urb->dir == DIR_TO_DEVICE) ? '>' : (urb->dir == DIR_FROM_DEVICE) ? '<' : '?'); printf("req=%04lx value=%04lx", urb->request, urb->value); if( urb->data ) { printf(" ["); for(x=0; xlen; x++) { printf( "%02x", urb->data[x] ); if (x < urb->len-1) printf(" "); } printf("]"); } printf("\n"); } struct rpt* find_report_by_seq(int seq) { struct rpt* rpt = rpts; while( rpt ) { if (rpt->seq == seq) break; rpt = rpt->next; } return rpt; } struct rpt* find_report_by_id(unsigned char id) { struct rpt* rpt = rpts; while( rpt ) { if (rpt->id == id) break; rpt = rpt->next; } return rpt; } void del_report(struct urb* urb) { unsigned char id = urb->data[0]; struct rpt* rpt = rpts; struct rpt** prev = &rpts; while( rpt ) { if (rpt->id == id) break; prev = &(rpt->next); rpt = rpt->next; } if (rpt) { *prev = rpt->next; free(rpt); } } void add_report(struct urb* urb) { struct rpt* rpt; unsigned char id; if (urb->data) id = urb->data[0]; else id = urb->value & 0xff; if ((rpt = find_report_by_id(id))) { rpt->seq = urb->seq; rpt->value = urb->value; return; } rpt = (struct rpt*)malloc(sizeof(*rpt)); memset(rpt, 0, sizeof(*rpt)); rpt->id = id; rpt->seq = urb->seq; rpt->value = urb->value; rpt->next = rpts; rpts = rpt; } int check_and_update_report(struct urb* urb) { struct rpt* rpt; rpt = find_report_by_seq(urb->seq); if (!rpt) return 0; if (rpt->data && !memcmp(rpt->data, urb->data+1, urb->len-1)) return 0; free(rpt->data); rpt->len = urb->len-1; rpt->data = (unsigned char *)malloc(rpt->len); memcpy(rpt->data, urb->data+1, rpt->len); return 1; } void display_report(struct urb* urb) { unsigned long data = 0; char buf[9]; unsigned int n; n = printf( "[%04d s] %05d %c %s 0x%02x (%03u) ", urb->time/1000, urb->seq, urb->func == FUNC_BULK_TXFER ? '*' : ' ', urb->dir==DIR_TO_DEVICE ? "WRITE" : " READ", urb->data[0], urb->data[0]); switch (urb->len) { case 5: data = (data << 8) | urb->data[4]; case 4: data = (data << 8) | urb->data[3]; case 3: data = (data << 8) | urb->data[2]; case 2: data = (data << 8) | urb->data[1]; sprintf(buf, "%0*lx", (int)(urb->len-1)*2, data); n += printf( "%8s (%lu)", buf, data ); break; default: n += printf( "-------- (----------)" ); break; } printf( "%*c", 55-n, ' '); for (n=0; nlen-1; n++) printf("%02x ", urb->data[n+1]); printf("\n"); fflush(stdout); } void update_reports(struct urb* urb) { if (urb->dir == DIR_TO_DEVICE) { // Only care about class requests if (urb->func != FUNC_CLASS_INTERFACE) return; if (urb->request == REQ_GET_REPORT) { add_report(urb); } else if (urb->request == REQ_SET_REPORT) { display_report(urb); del_report(urb); } } else { if (urb->func == FUNC_CONTROL_TXFER) { if (check_and_update_report(urb)) display_report(urb); } else if (urb->data && urb->func == FUNC_BULK_TXFER) { add_report(urb); if (check_and_update_report(urb)) display_report(urb); } } } int main(int argc, char* argv[]) { struct urb urb; file = stdin; while(init_urb(&urb)) { parse_urb_body(&urb); update_reports(&urb); free_urb(&urb); } return 0; } apcupsd-3.14.10/examples/upsapm.c0000664000076400007640000001314511323200342015504 0ustar adk0212adk0212/* * Client test program for apcnisd to be used * as a base for the new master/slave code. * * Build it with: cc upsapm.c ../lib/libapc.a -o newclient * * Execute: ./upsapm [host[:port]] * * The two commands currently (Apr 2001) accepted by the * server are "status" and "events". * * Format of /proc/apm is when online and no apm: * 1.14 1.2 0x03 0x01 0xff 0x80 -1% -1 ? * * 1.14 = kernel driver version * 1.2 = apm_major_version.apm_minor_version * 0x03 = apm_flags * 0x01 = on_line_status * 0 = off line * 1 = on line * 2 = on back * 0xff = battery status * ff = (none?) * 0 = high * 1 = low * 2 = crit * 3 = charg * 0x80 = battery_flags * -1% = battery percentage * -1 = battery time * ? = (if min battery minutes otherwise seconds) * * */ #include "apc.h" #ifdef HAVE_NISLIB /* Default values, can be changed on command line */ #define SERV_TCP_PORT 3551 #define SERV_HOST_ADDR "127.0.0.1" #define BIGBUF 4096 char statbuf[BIGBUF]; int statlen = BIGBUF; /* List of variables that can be read by getupsvar() * First field is that name given to getupsvar(), * Second field is our internal name as produced by the STATUS * output from apcupsd. * Third field, if 0 returns everything to the end of the * line, and if 1 returns only to first space (e.g. integers, * and floating point values. */ static struct { const char *request; const char *upskeyword; int nfields; } cmdtrans[] = { {"date", "DATE", 0}, {"battcap", "BCHARGE", 1}, {"mbattchg", "MBATTCHG", 1}, {"status", "STATFLAG", 1}, {"runtime", "TIMELEFT", 1}, {"battpct", "BCHARGE", 1}, {NULL, NULL} }; int fetch_data(char *host, int port); int getupsvar(char *host, int port, const char *request, char *answer, int anslen); int fill_buffer(int sockfd); extern int net_errno; void error_abort(const char *msg) { fprintf(stderr, msg); exit(1); } int main(int argc, char *argv[]) { int port; char host[200]; char msg[200], *p; long stat_flag; int battchg; int runtime; strcpy(host, SERV_HOST_ADDR); port = SERV_TCP_PORT; if (argc > 1) { strcpy(host, argv[1]); /* get host from command line */ p = strchr(host, ':'); if (p) { *p++ = 0; port = atoi(p); } } /* make sure we are communicating */ if (getupsvar(host, port, "date", msg, sizeof(msg)) <= 0) { printf("1.14 1.2 0x03 0x01 0xff 0x80 -1%% -1 ? : Cannot get date\n"); exit(1); } if (getupsvar(host, port, "status", msg, sizeof(msg)) <= 0) { printf("1.14 1.2 0x03 0x01 0xff 0x80 -1%% -1 ? : Cannot get status\n"); exit(1); } stat_flag = strtol(msg, NULL, 16); if (getupsvar(host, port, "battcap", msg, sizeof(msg)) <= 0) { printf("1.14 1.2 0x03 0x01 0xff 0x80 -1%% -1 ? : Cannot get battcap\n"); exit(1); } battchg = (int)strtod(msg, NULL); if (getupsvar(host, port, "runtime", msg, sizeof(msg)) <= 0) { printf("1.14 1.2 0x03 0x01 0xff 0x80 -1%% -1 ? : Cannot get runtime\n"); exit(1); } runtime = (int)strtod(msg, NULL); if (stat_flag & 0x8) { printf("1.14 1.2 0x03 0x01 0x03 0x09 %d%% -1 ?\n", battchg); } else { printf("1.14 1.2 0x03 0x00 0x00 0x01 %d%% %d min\n", battchg, runtime); } exit(0); } /* * Read data into memory buffer to be used by getupsvar() * Returns 0 on error * Returns 1 if data fetched */ int fetch_data(char *host, int port) { int sockfd; int stat; if ((sockfd = net_open(host, NULL, port)) < 0) { printf("fetch_data: tcp_open failed for %s port %d", host, port); return 0; } stat = fill_buffer(sockfd); /* fill statbuf */ net_close(sockfd); return stat; } /* * * Returns 1 if var found * answer has var * Returns 0 if variable name not found * answer has "Not found" is variable name not found * answer may have "N/A" if the UPS does not support this * feature * Returns -1 if network problem * answer has "N/A" if host is not available or network error */ int getupsvar(char *host, int port, const char *request, char *answer, int anslen) { int i; const char *stat_match = NULL; char *find; int nfields = 0; if (!fetch_data(host, port)) { strcpy(answer, "N/A"); return -1; } for (i=0; cmdtrans[i].request; i++) if (!(strcmp(cmdtrans[i].request, request))) { stat_match = cmdtrans[i].upskeyword; nfields = cmdtrans[i].nfields; } if (stat_match != NULL) { if ((find=strstr(statbuf, stat_match)) != NULL) { if (nfields == 1) /* get one field */ sscanf (find, "%*s %*s %s", answer); else { /* get everything to eol */ i = 0; find += 11; /* skip label */ while (*find != '\n') answer[i++] = *find++; answer[i] = 0; } if (strcmp(answer, "N/A") == 0) return 0; return 1; } } strcpy(answer, "Not found"); return 0; } #define MAXLINE 512 /* Fill buffer with data from UPS network daemon * Returns 0 on error * Returns 1 if OK */ int fill_buffer(int sockfd) { int n, stat = 1; char buf[1000]; statbuf[0] = 0; statlen = 0; if (net_send(sockfd, "status", 6) != 6) { printf("fill_buffer: write error on socket\n"); return 0; } while ((n = net_recv(sockfd, buf, sizeof(buf)-1)) > 0) { buf[n] = 0; strcat(statbuf, buf); } if (n < 0) stat = 0; statlen = strlen(statbuf); return stat; } #else /* HAVE_NISLIB */ int main(int argc, char *argv[]) { printf("Sorry, NIS code is not compiled in apcupsd.\n"); return 1; } #endif /* HAVE_NISLIB */ apcupsd-3.14.10/examples/usb_hid_usages0000664000076400007640000005272707474703537017005 0ustar adk0212adk0212# $NetBSD: usb_hid_usages,v 1.3 1999/07/02 15:46:53 simonb Exp $ # $FreeBSD: src/share/misc/usb_hid_usages,v 1.1.2.1 2000/07/02 13:13:55 n_hibma Exp $ # # USB HID usage table # Syntax: # - lines that do not start with a white space give the number and name of # a usage page. # - lines that start with a white space give the number and name of # a usage with the last given page. # If the number is * then the line matches all usages and the name # is a printf formatting string that will be given the usage number. # 1 Generic Desktop 0x00 Undefined 0x01 Pointer 0x02 Mouse 0x03 Reserved 0x04 Joystick 0x05 Game Pad 0x06 Keyboard 0x07 Keypad 0x08 Multi-axis Controller 0x30 X 0x31 Y 0x32 Z 0x33 Rx 0x34 Ry 0x35 Rz 0x36 Slider 0x37 Dial 0x38 Wheel 0x39 Hat Switch 0x3A Counted Buffer 0x3B Byte Count 0x3C Motion Wakeup 0x40 Vx 0x41 Vy 0x42 Vz 0x43 Vbrx 0x44 Vbry 0x45 Vbrx 0x46 Vno 0x80 System Control 0x81 System Power Down 0x82 System Sleep 0x83 System Wake Up 0x84 System Context Menu 0x85 System Main Menu 0x86 System App Menu 0x87 System Menu Help 0x88 System Menu Exit 0x89 System Menu Select 0x8A System Menu Right 0x8B System Menu Left 0x8C System Menu Up 0x8D System Menu Down 0x90 D-pad Up 0x91 D-pad Down 0x92 D-pad Right 0x93 D-pad Left 2 Simulation Controls 0x00 Undefined 0x01 Flight Simulation Device 0x02 Automobile Simulation Device 0x03 Tank Simulation Device 0x04 Spaceship Simulation Device 0x05 Submarine Simulation Device 0x06 Sailing Simulation Device 0x07 Motorcycle Simulation Device 0x08 Sports Simulation Device 0x09 Airplane Simulation Device 0x0A Helicopter Simulation Device 0x0B Magic Carpet Simulation Device 0x0C Bicycle 0x20 Flight Control Stick 0x21 Flight Stick 0x22 Cyclic Control 0x23 Cyclic Trim 0x24 Flight Yoke 0x25 Track Control 0x26 Driving Control 0xB0 Aileron 0xB1 Aileron Trim 0xB2 Anti-Torque Control 0xB3 Auto-pilot Enable 0xB4 Chaff Release 0xB5 Collective Control 0xB6 Dive Brake 0xB7 Electronic Counter Measures 0xB8 Elevator 0xB9 Elevator Trim 0xBA Rudder 0xBB Throttle 0xBC Flight Communication 0xBD Flare Release 0xBE Landing Gear 0xBF Toe Brake 0xC0 Trigger 0xC1 Weapons Arm 0xC2 Weapons Select 0xC3 Wing Flaps 0xC4 Accelerator 0xC5 Brake 0xC6 Clutch 0xC7 Shifter 0xC8 Steering 0xC9 Turret Direction 0xCA Barrel Elevation 0xCB Dive Plane 0xCC Ballast 0xCD Bicycle Crank 0xCE Handle Bars 0xCF Front Brake 0xD0 Rear Brake 3 VR Controls 0x00 Unidentified 0x01 Belt 0x02 Body Suit 0x03 Flexor 0x04 Glove 0x05 Head Tracker 0x06 Head Mounted Display 0x07 Hand Tracker 0x08 Oculometer 0x09 Vest 0x0A Animatronic Device 0x20 Stereo Enable 0x21 Display Enable 4 Sports Controls 0x00 Unidentified 0x01 Baseball Bat 0x02 Golf Club 0x03 Rowing Machine 0x04 Treadmill 0x30 Oar 0x31 Slope 0x32 Rate 0x33 Stick Speed 0x34 Stick Face Angle 0x35 Stick Heel/Toe 0x36 Stick Follow Through 0x37 Stick Tempo 0x38 Stick Type 0x39 Stick Height 0x50 Putter 0x51 1 Iron 0x52 2 Iron 0x53 3 Iron 0x54 4 Iron 0x55 5 Iron 0x56 6 Iron 0x57 7 Iron 0x58 8 Iron 0x59 9 Iron 0x5A 10 Iron 0x5B 11 Iron 0x5C Sand Wedge 0x5D Loft Wedge 0x5E Power Wedge 0x5F 1 Wood 0x60 3 Wood 0x61 5 Wood 0x62 7 Wood 0x63 9 Wood 5 Game Controls 0x00 Undefined 0x01 3D Game Controller 0x02 Pinball Device 0x03 Gun Device 0x20 Point of View 0x21 Turn Right/Left 0x22 Pitch Right/Left 0x23 Roll Forward/Backward 0x24 Move Right/Left 0x25 Move Forward/Backward 0x26 Move Up/Down 0x27 Lean Right/Left 0x28 Lean Forward/Backward 0x29 Height of POV 0x2A Flipper 0x2B Secondary Flipper 0x2C Bump 0x2D New Game 0x2E Shoot Ball 0x2F Player 0x30 Gun Bolt 0x31 Gun Clip 0x32 Gun Selector 0x33 Gun Single Shot 0x34 Gun Burst 0x35 Gun Automatic 0x36 Gun Safety 0x37 Gamepad Fire/Jump 0x39 Gamepad Trigger 7 Keyboard 0x00 Reserved (no event indicated) 0x01 Keyboard ErrorRollOver 0x02 Keyboard POSTFail 0x03 Keyboard ErrorUndefined 0x04 Keyboard a and A 0x05 Keyboard b and B 0x06 Keyboard c and C 0x07 Keyboard d and D 0x08 Keyboard e and E 0x09 Keyboard f and F 0x0A Keyboard g and G 0x0B Keyboard h and H 0x0C Keyboard i and I 0x0D Keyboard j and J 0x0E Keyboard k and K 0x0F Keyboard l and L 0x10 Keyboard m and M 0x11 Keyboard n and N 0x12 Keyboard o and O 0x13 Keyboard p and P 0x14 Keyboard q and Q 0x15 Keyboard r and R 0x16 Keyboard s and S 0x17 Keyboard t and T 0x18 Keyboard u and U 0x19 Keyboard v and V 0x1A Keyboard w and W 0x1B Keyboard x and X 0x1C Keyboard y and Y 0x1D Keyboard z and Z 0x1E Keyboard 1 and ! 0x1F Keyboard 2 and @ 0x20 Keyboard 3 and # 0x21 Keyboard 4 and $ 0x22 Keyboard 5 and % 0x23 Keyboard 6 and ^ 0x24 Keyboard 7 and & 0x25 Keyboard 8 and * 0x26 Keyboard 9 and ( 0x27 Keyboard 0 and ) 0x28 Keyboard Return (ENTER) 0x29 Keyboard ESCAPE 0x2A Keyboard DELETE (Backspace) 0x2B Keyboard Tab 0x2C Keyboard Spacebar 0x2D Keyboard - and (underscore) 0x2E Keyboard = and + 0x2F Keyboard [ and { 0x30 Keyboard ] and } 0x31 Keyboard \ and | 0x32 Keyboard Non-US # and ~ 0x33 Keyboard ; and : 0x34 Keyboard ' and " 0x35 Keyboard Grave Accent and Tilde 0x36 Keyboard, and < 0x37 Keyboard . and > 0x38 Keyboard / and ? 0x39 Keyboard Caps Lock 0x3A Keyboard F1 0x3B Keyboard F2 0x3C Keyboard F3 0x3D Keyboard F4 0x3E Keyboard F5 0x3F Keyboard F6 0x40 Keyboard F7 0x41 Keyboard F8 0x42 Keyboard F9 0x43 Keyboard F10 0x44 Keyboard F11 0x45 Keyboard F12 0x46 Keyboard PrintScreen 0x47 Keyboard Scroll Lock 0x48 Keyboard Pause 0x49 Keyboard Insert 0x4A Keyboard Home 0x4B Keyboard PageUp 0x4C Keyboard Delete Forward 0x4D Keyboard End 0x4E Keyboard PageDown 0x4F Keyboard RightArrow 0x50 Keyboard LeftArrow 0x51 Keyboard DownArrow 0x52 Keyboard UpArrow 0x53 Keypad Num Lock and Clear 0x54 Keypad / 0x55 Keypad * 0x56 Keypad - 0x57 Keypad + 0x58 Keypad ENTER 0x59 Keypad 1 and End 0x5A Keypad 2 and Down Arrow 0x5B Keypad 3 and PageDn 0x5C Keypad 4 and Left Arrow 0x5D Keypad 5 0x5E Keypad 6 and Right Arrow 0x5F Keypad 7 and Home 0x60 Keypad 8 and Up Arrow 0x61 Keypad 9 and PageUp 0x62 Keypad 0 and Insert 0x63 Keypad . and Delete 0x64 Keyboard Non-US \ and | 0x65 Keyboard Application 0x66 Keyboard Power 0x67 Keypad = 0x68 Keyboard F13 0x69 Keyboard F14 0x6A Keyboard F15 0x6B Keyboard F16 0x6C Keyboard F17 0x6D Keyboard F18 0x6E Keyboard F19 0x6F Keyboard F20 0x70 Keyboard F21 0x71 Keyboard F22 0x72 Keyboard F23 0x73 Keyboard F24 0x74 Keyboard Execute 0x75 Keyboard Help 0x76 Keyboard Menu 0x77 Keyboard Select 0x78 Keyboard Stop 0x79 Keyboard Again 0x7A Keyboard Undo 0x7B Keyboard Cut 0x7C Keyboard Copy 0x7D Keyboard Paste 0x7E Keyboard Find 0x7F Keyboard Mute 0x80 Keyboard Volume Up 0x81 Keyboard Volume Down 0x82 Keyboard Locking Caps Lock 0x83 Keyboard Locking Num Lock 0x84 Keyboard Locking Scroll Lock 0x85 Keypad Comma 0x86 Keypad Equal Sign 0x87 Keyboard International1 0x88 Keyboard International2 0x89 Keyboard International3 0x8A Keyboard International4 0x8B Keyboard International5 0x8C Keyboard International6 0x8D Keyboard International7 0x8E Keyboard International8 0x8F Keyboard International9 0x90 Keyboard LANG1 0x91 Keyboard LANG2 0x92 Keyboard LANG3 0x93 Keyboard LANG4 0x94 Keyboard LANG5 0x95 Keyboard LANG6 0x96 Keyboard LANG7 0x97 Keyboard LANG8 0x98 Keyboard LANG9 0x99 Keyboard Alternate Erase 0x9A Keyboard SysReq/Attention 0x9B Keyboard Cancel 0x9C Keyboard Clear 0x9D Keyboard Prior 0x9E Keyboard Return 0x9F Keyboard Separator 0xA0 Keyboard Out 0xA1 Keyboard Oper 0xA2 Keyboard Clear/Again 0xA3 Keyboard CrSel/Props 0xA4 Keyboard ExSel 0xE0 Keyboard LeftControl 0xE1 Keyboard LeftShift 0xE2 Keyboard LeftAlt 0xE3 Keyboard Left GUI 0xE4 Keyboard RightControl 0xE5 Keyboard RightShift 0xE6 Keyboard RightAlt 0xE7 Keyboard Right GUI 8 LEDs 0x00 Undefined 0x01 Num Lock 0x02 Caps Lock 0x03 Scroll Lock 0x04 Compose 0x05 Kana 0x06 Power 0x07 Shift 0x08 Do Not Disturb 0x09 Mute 0x0A Tone Enable 0x0B High Cut Filter 0x0C Low Cut Filter 0x0D Equalizer Enable 0x0E Sound Field On 0x0F Surround Field On 0x10 Repeat 0x11 Stereo 0x12 Sampling Rate Detect 0x13 Spinning 0x14 CAV 0x15 CLV 0x16 Recording Format Detect 0x17 Off-Hook 0x18 Ring 0x19 Message Waiting 0x1A Data Mode 0x1B Battery Operation 0x1C Battery OK 0x1D Battery Low 0x1E Speaker 0x1F Head Set 0x20 Hold 0x21 Microphone 0x22 Coverage 0x23 Night Mode 0x24 Send Calls 0x25 Call Pickup 0x26 Conference 0x27 Stand-by 0x28 Camera On 0x29 Camera Off 0x2A On-Line 0x2B Off-Line 0x2C Busy 0x2D Ready 0x2E Paper-Out 0x2F Paper-Jam 0x30 Remote 0x31 Forward 0x32 Reverse 0x33 Stop 0x34 Rewind 0x35 Fast Forward 0x36 Play 0x37 Pause 0x38 Record 0x39 Error 0x3A Usage Selected Indicator 0x3B Usage In Use Indicator 0x3C Usage Multi Mode Indicator 0x3D Indicator On 0x3E Indicator Flash 0x3F Indicator Slow Blink 0x40 Indicator Fast Blink 0x41 Indicator Off 0x42 Flash On Time 0x43 Slow Blink On Time 0x44 Slow Blink Off Time 0x45 Fast Blink On Time 0x46 Fast Blink Off Time 0x47 Usage Indicator Color 0x48 Red 0x49 Green 0x4A Amber 0x4B Generic Indicator 0x4C System Suspend 0x4D External Power Connected 0x4C-FFFF Reserved 9 Button 0x00 No Button Pressed * Button %d 10 Ordinal 0x00 Unused * Instance %d 11 Telephony 0x00 Unassigned 0x01 Phone 0x02 Answering Machine 0x03 Message Controls 0x04 Handset 0x05 Headset 0x06 Telephony Key Pad 0x07 Programmable Button 0x20 Hook Switch 0x21 Flash 0x22 Feature 0x23 Hold 0x24 Redial 0x25 Transfer 0x26 Drop 0x27 Park 0x28 Forward Calls 0x29 Alternate Function 0x2A Line 0x2B Speaker Phone 0x2C Conference 0x2D Ring Enable 0x2E Ring Select 0x2F Phone Mute 0x30 Caller ID 0x50 Speed Dial 0x51 Store Number 0x52 Recall Number 0x53 Phone Directory 0x70 Voice Mail 0x71 Screen Calls 0x72 Do Not Disturb 0x73 Message 0x74 Answer On/Off 0x90 Inside Dial Tone 0x91 Outside Dial Tone 0x92 Inside Ring Tone 0x93 Outside Ring Tone 0x94 Priority Ring Tone 0x95 Inside Ringback 0x96 Priority Ringback 0x97 Line Busy Tone 0x98 Reorder Tone 0x99 Call Waiting Tone 0x9A Confirmation Tone 1 0x9B Confirmation Tone 2 0x9C Tones Off 0xB0 Phone Key 0 0xB1 Phone Key 1 0xB2 Phone Key 2 0xB3 Phone Key 3 0xB4 Phone Key 4 0xB5 Phone Key 5 0xB6 Phone Key 6 0xB7 Phone Key 7 0xB8 Phone Key 8 0xB9 Phone Key 9 0xBA Phone Key Star 0xBB Phone Key Pound 0xBC Phone Key A 0xBD Phone Key B 0xBE Phone Key C 0xBF Phone Key D 12 Consumer 0x00 Unassigned 0x01 Consumer Control 0x02 Numeric Key Pad 0x03 Programmable Buttons 0x20 +10 0x21 +100 0x22 AM/PM 0x30 Power 0x31 Reset 0x32 Sleep 0x33 Sleep After 0x34 Sleep Mode 0x35 Illumination 0x36 Function Buttons 0x40 Menu 0x41 Menu Pick 0x42 Menu Up 0x43 Menu Down 0x44 Menu Left 0x45 Menu Right 0x46 Menu Escape 0x47 Menu Value Increase 0x48 Menu Value Decrease 0x60 Data On Screen 0x61 Closed Caption 0x62 Closed Caption Select 0x63 VCR/TV 0x64 Broadcast Mode 0x65 Snapshot 0x66 Still 0x80 Selection 0x81 Assign Selection 0x82 Mode Step 0x83 Recall Last 0x84 Enter Channel 0x85 Order Movie 0x86 Channel 0x87 Media Selection 0x88 Media Select Computer 0x89 Media Select TV 0x8A Media Select WWW 0x8B Media Select DVD 0x8C Media Select Telephone 0x8D Media Select Program Guide 0x8E Media Select Video Phone 0x8F Media Select Games 0x90 Media Select Messages 0x91 Media Select CD 0x92 Media Select VCR 0x93 Media Select Tuner 0x94 Quit 0x95 Help 0x96 Media Select Tape 0x97 Media Select Cable 0x98 Media Select Satellite 0x99 Media Select Security 0x9A Media Select Home 0x9B Media Select Call 0x9C Channel Increment 0x9D Channel Decrement 0x9E Media Select SAP 0xA0 VCR Plus 0xA1 Once 0xA2 Daily 0xA3 Weekly 0xA4 Monthly 0xB0 Play 0xB1 Pause 0xB2 Record 0xB3 Fast Forward 0xB4 Rewind 0xB5 Scan Next Track 0xB6 Scan Previous Track 0xB7 Stop 0xB8 Eject 0xB9 Random Play 0xBA Select DisC 0xBB Enter Disc 0xBC Repeat 0xBD Tracking 0xBE Track Normal 0xBF Slow Tracking 0xC0 Frame Forward 0xC1 Frame Back 0xC2 Mark 0xC3 Clear Mark 0xC4 Repeat From Mark 0xC5 Return To Mark 0xC6 Search Mark Forward 0xC7 Search Mark Backwards 0xC8 Counter Reset 0xC9 Show Counter 0xCA Tracking Increment 0xCB Tracking Decrement 0xE0 Volume 0xE1 Balance 0xE2 Mute 0xE3 Bass 0xE4 Treble 0xE5 Bass Boost 0xE6 Surround Mode 0xE7 Loudness 0xE8 MPX 0xE9 Volume Up 0xEA Volume Down 0xF0 Speed Select 0xF1 Playback Speed 0xF2 Standard Play 0xF3 Long Play 0xF4 Extended Play 0xF5 Slow 0x100 Fan Enable 0x101 Fan Speed 0x102 Light 0x103 Light Illumination Level 0x104 Climate Control Enable 0x105 Room Temperature 0x106 Security Enable 0x107 Fire Alarm 0x108 Police Alarm 0x150 Balance Right 0x151 Balance Left 0x152 Bass Increment 0x153 Bass Decrement 0x154 Treble Increment 0x155 Treble Decrement 0x160 Speaker System 0x161 Channel Left 0x162 Channel Right 0x163 Channel Center 0x164 Channel Front 0x165 Channel Center Front 0x166 Channel Side 0x167 Channel Surround 0x168 Channel Low Frequency Enhancement 0x169 Channel Top 0x16A Channel Unknown 0x170 Sub-channel 0x171 Sub-channel Increment 0x172 Sub-channel Decrement 0x173 Alternate Audio Increment 0x174 Alternate Audio Decrement 0x180 Application Launch Buttons 0x181 AL Launch Button Configuration Tool 0x182 AL Programmable Button Configuration 0x183 AL Consumer Control Configuration 0x184 AL Word Processor 0x185 AL Text Editor 0x186 AL Spreadsheet 0x187 AL Graphics Editor 0x188 AL Presentation App 0x189 AL Database App 0x18A AL Email Reader 0x18B AL Newsreader 0x18C AL Voicemail 0x18D AL Contacts/Address Book 0x18E AL Calendar/Schedule 0x18F AL Task/Project Manager 0x190 AL Log/Journal/Timecard 0x191 AL Checkbook/Finance 0x192 AL Calculator 0x193 AL A/V Capture/Playback 0x194 AL Local Machine Browser 0x195 AL LAN/WAN Browser 0x196 AL Internet Browser 0x197 AL Remote Networking/ISP Connect 0x198 AL Network Conference 0x199 AL Network Chat 0x19A AL Telephony/Dialer 0x19B AL Logon 0x19C AL Logoff 0x19D AL Logon/Logoff 0x19E AL Terminal Lock/Screensaver 0x19F AL Control Panel 0x1A0 AL Command Line Processor/Run 0x1A1 AL Process/Task Manager 0x1A2 AL Select Tast/Application 0x1A3 AL Next Task/Application 0x1A4 AL Previous Task/Application 0x1A5 AL Preemptive Halt Task/Application 0x200 Generic GUI Application Controls 0x201 AC New 0x202 AC Open 0x203 AC Close 0x204 AC Exit 0x205 AC Maximize 0x206 AC Minimize 0x207 AC Save 0x208 AC Print 0x209 AC Properties 0x21A AC Undo 0x21B AC Copy 0x21C AC Cut 0x21D AC Paste 0x21E AC Select All 0x21F AC Find 0x220 AC Find and Replace 0x221 AC Search 0x222 AC Go To 0x223 AC Home 0x224 AC Back 0x225 AC Forward 0x226 AC Stop 0x227 AC Refresh 0x228 AC Previous Link 0x229 AC Next Link 0x22A AC Bookmarks 0x22B AC History 0x22C AC Subscriptions 0x22D AC Zoom In 0x22E AC Zoom Out 0x22F AC Zoom 0x230 AC Full Screen View 0x231 AC Normal View 0x232 AC View Toggle 0x233 AC Scroll Up 0x234 AC Scroll Down 0x235 AC Scroll 0x236 AC Pan Left 0x237 AC Pan Right 0x238 AC Pan 0x239 AC New Window 0x23A AC Tile Horizontally 0x23B AC Tile Vertically 0x23C AC Format 13 Digitizer 0x00 Undefined 0x01 Digitizer 0x02 Pen 0x03 Light Pen 0x04 Touch Screen 0x05 Touch Pad 0x06 White Board 0x07 Coordinate Measuring Machine 0x08 3-D Digitizer 0x09 Stereo Plotter 0x0A Articulated Arm 0x0B Armature 0x0C Multiple Point Digitizer 0x0D Free Space Wand 0x20 Stylus 0x21 Puck 0x22 Finger 0x30 Tip Pressure 0x31 Barrel Pressure 0x32 In Range 0x33 Touch 0x34 Untouch 0x35 Tap 0x36 Quality 0x37 Data Valid 0x38 Transducer Index 0x39 Tablet Function Keys 0x3A Program Change Keys 0x3B Battery Strength 0x3C Invert 0x3D X Tilt 0x3E Y Tilt 0x3F Azimuth 0x40 Altitude 0x41 Twist 0x42 Tip Switch 0x43 Secondary Tip Switch 0x44 Barrel Switch 0x45 Eraser 0x46 Tablet Pick 15 Physical Interface Device 16 Unicode * Unicode Char u%04x 20 Alphnumeric Display 0x00 Undefined 0x01 Alphanumeric Display 0x20 Display Attributes Report 0x21 ASCII Character Set 0x22 Data Read Back 0x23 Font Read Back 0x24 Display Control Report 0x25 Clear Display 0x26 Display Enable 0x27 Screen Saver Delay 0x28 Screen Saver Enable 0x29 Vertical Scroll 0x2A Horizontal Scroll 0x2B Character Report 0x2C Display Data 0x2D Display Status 0x2E Stat Not Ready 0x2F Stat Ready 0x30 Err Not a loadable character 0x31 Err Font data cannot be read 0x32 Cursor Position Report 0x33 Row 0x34 Column 0x35 Rows 0x36 Columns 0x37 Cursor Pixel Positioning 0x38 Cursor Mode 0x39 Cursor Enable 0x3A Cursor Blink 0x3B Font Report 0x3C Font Data 0x3D Character Width 0x3E Character Height 0x3F Character Spacing Horizontal 0x40 Character Spacing Vertical 0x41 Unicode Character Set 128 Monitor 0x00 Undefined 0x01 Monitor Control 0x02 EDID Information 0x03 VDIF Information 0x04 VESA Version 0x05 On Screen Display 0x06 Auto Size Center 0x07 Polarity Horz Synch 0x08 Polarity Vert Synch 0x09 Sync Type 0x0A Screen Position 0x0B Horizontal Frequency 0x0C Vertical Frequency 129 Monitor Enumerated Values 0x00 unassigned * ENUM %d 130 VESA Virtual Controls 0x10 Brightness 0x12 Contrast 0x16 Video Gain Red 0x18 Video Gain Green 0x1A Video Gain Blue 0x1C Focus 0x20 Horizontal Position 0x22 Horizontal Size 0x24 Horizontal Pincushion 0x26 Horizontal Pincushion Balance 0x28 Horizontal Misconvergence 0x2A Horizontal Linearity 0x2C Horizontal Linearity Balance 0x30 Vertical Position 0x32 Vertical Size 0x34 Vertical Pincushion 0x36 Vertical Pincushion Balance 0x38 Vertical Misconvergence 0x3A Vertical Linearity 0x3C Vertical Linearity Balance 0x40 Parallelogram Distortion 0x42 Trapezoidal Distortion 0x44 Tilt 0x46 Top Corner Distortion Control 0x48 Top Corner Distortion Balance 0x4A Bottom Corner Distortion Control 0x4C Bottom Corner Distortion Balance 0x56 Moir Horizontal 0x58 Moir Vertical 0x5E Input Level Select 0x60 Input Source Select 0x62 Stereo Mode 0x6C Video Black Level Red 0x6E Video Black Level Green 0x70 Video Black Level Blue 131 VESA Command 0x00 Undefined 0x01 Settings 0x02 Degauss 132 Power Device 0x00 Undefined 0x01 iName 0x02 PresentStatus 0x03 ChangedStatus 0x04 UPS 0x05 PowerSupply 0x10 BatterySystem 0x11 BatterySystemID 0x12 Battery 0x13 BatteryID 0x14 Charger 0x15 ChargerID 0x16 PowerConverter 0x17 PowerConverterID 0x18 OutletSystem 0x19 OutletSystemID 0x1A Input 0x1B InputID 0x1C Output 0x1D OutputID 0x1E Flow 0x1F FlowID 0x20 Outlet 0x21 OutletID 0x22 Gang 0x23 GangID 0x24 Sink 0x25 SinkID 0x30 Voltage 0x31 Current 0x32 Frequency 0x33 ApparentPower 0x34 ActivePower 0x35 PercentLoad 0x36 Temperature 0x37 Humidity 0x40 ConfigVoltage 0x41 ConfigCurrent 0x42 ConfigFrequency 0x43 ConfigApparentPower 0x44 ConfigActivePower 0x45 ConfigPercentLoad 0x46 ConfigTemperature 0x47 ConfigHumidity 0x50 SwitchOnControl 0x51 SwitchOffControl 0x52 ToggleControl 0x53 LowVoltageTransfer 0x54 HighVoltageTransfer 0x55 DelayBeforeReboot 0x56 DelayBeforeStartup 0x57 DelayBeforeShutdown 0x58 Test 0x59 Vendorspecificcommand 0x60 Present 0x61 Good 0x62 InternalFailure 0x63 VoltageOutOfRange 0x64 FrequencyOutOfRange 0x65 Overload 0x66 OverCharged 0x67 OverTemperature 0x68 ShutdownRequested 0x69 ShutdownImminent 0x6A VendorSpecificAnswerValid 0x6B SwitchOn/Off 0x6C Switcheble 0x6D Used 0x6E Boost 0x6F Buck 0x70 Initialized 0x71 Tested 133 Battery System 0x00 Undefined 0x01 SMBBatteryMode 0x02 SMBBatteryStatus 0x03 SMBAlarmWarning 0x04 SMBChargerMode 0x05 SMBChargerStatus 0x06 SMBChargerSpecInfo 0x07 SMBSelectorState 0x08 SMBSelectorPreset 0x09 SMBSelectorInfo 0x10 OptionalMfgFunction1 0x11 OptionalMfgFunction2 0x12 OptionalMfgFunction3 0x13 OptionalMfgFunction4 0x14 OptionalMfgFunction5 0x15 ConnectionToSMBus 0x16 OutputConnection 0x17 ChargerConnection 0x18 BatteryInsertion 0x19 Usenext 0x1A OKToUse 0x28 ManufacturerAccess 0x29 RemainingCapacityLimit 0x2A RemainingTimeLimit 0x2B AtRate 0x2C CapacityMode 0x2D BroadcastToCharger 0x2E PrimaryBattery 0x2F ChargeController 0x40 TerminateCharge 0x41 TermminateDischarge 0x42 BelowRemainingCapacityLimit 0x43 RemainingTimeLimitExpired 0x44 Charging 0x45 Discharging 0x46 FullyCharged 0x47 FullyDischarged 0x48 ConditionningFlag 0x49 AtRateOK 0x4A SMBErrorCode 0x4B NeedReplacement 0x60 AtRateTimeToFull 0x61 AtRateTimeToEmpty 0x62 AverageCurrent 0x63 Maxerror 0x64 RelativeStateOfCharge 0x65 AbsoluteStateOfCharge 0x66 RemainingCapacity 0x67 FullChargeCapacity 0x68 RunTimeToEmpty 0x69 AverageTimeToEmpty 0x6A AverageTimeToFull 0x6B CycleCount 0x80 BattPackModelLevel 0x81 InternalChargeController 0x82 PrimaryBatterySupport 0x83 DesignCapacity 0x84 SpecificationInfo 0x85 ManufacturerDate 0x86 SerialNumber 0x87 iManufacturerName 0x88 iDevicename 0x89 iDeviceChemistery 0x8A iManufacturerData 0x8B Rechargeable 0x8C WarningCapacityLimit 0x8D CapacityGranularity1 0x8E CapacityGranularity2 0xC0 InhibitCharge 0xC1 EnablePolling 0xC2 ResetToZero 0xD0 ACPresent 0xD1 BatteryPresent 0xD2 PowerFail 0xD3 AlarmInhibited 0xD4 ThermistorUnderRange 0xD5 ThermistorHot 0xD6 ThermistorCold 0xD7 ThermistorOverRange 0xD8 VoltageOutOfRange 0xD9 CurrentOutOfRange 0xDA CurrentNotRegulated 0xDB VoltageNotRegulated 0xDC MasterMode 0xDD ChargerBattery/HostControlled 0xF0 ChargerSpecInfo 0xF1 ChargerSpecRef 0xF2 Level2 0xF3 Level3 140 Bar Code Scanner 141 Scale Device 144 Camera Control 145 Arcade Device # Some Micro$oft non-standard extensions 0xff00 Microsoft 0xe9 Base Up 0xea Base Down apcupsd-3.14.10/examples/usbsnoop.txt0000664000076400007640000001602410113325506016451 0ustar adk0212adk0212From: "Adam Kropelin" To: "Kern Sibbald" Cc: "Apcupsd-users" Subject: Reading a usbsnoop trace Date: Mon, 23 Aug 2004 21:51:50 -0400 Some users have had good luck using the 'usbsnoop' tool (http://benoit.papillault.free.fr/usbsnoop/index.php) to capture USB traces of PowerChute on Windows. The output from usbsnoop is a text file containing a transcript of all the USB communication with a particular device. The format is a bit wonky, but it generally contains enough information to see how PowerChute sets various UPS parameters and how the UPS responds. The traces consist of a series of request/response pairs (called "URBs" in USB lingo). First a request from the host to the device and then a response from the device to the host. The request URB is always sent first and is followed by the response. Note that more than one request may be outstanding at a time so the response is not always the very next URB in the trace, although it usually is. The URB number can be used to match responses with requests. Here is an example URB, number 108: [4945 ms] UsbSnoop - DispatchAny(f7c08610) : IRP_MJ_INTERNAL_DEVICE_CONTROL [4945 ms] UsbSnoop - MyDispatchInternalIOCTL(f7c09e80) : fdo=8602b460, Irp=85e84cb0, IRQL=0 [4945 ms] >>> URB 108 going down >>> -- URB_FUNCTION_CLASS_INTERFACE: TransferFlags = 00000001 (USBD_TRANSFER_DIRECTION_IN, ~USBD_SHORT_TRANSFER_OK) TransferBufferLength = 00000005 TransferBuffer = f7f1efd0 TransferBufferMDL = 00000000 UrbLink = 00000000 RequestTypeReservedBits = 00000022 Request = 00000001 Value = 00000323 Index = 00000000 [4950 ms] UsbSnoop - MyInternalIOCTLCompletion(f7c09db0) : fido=863b9030, Irp=85e84cb0, Context=86001650, IRQL=2 [4950 ms] <<< URB 108 coming back <<< -- URB_FUNCTION_CONTROL_TRANSFER: PipeHandle = 86109ac8 TransferFlags = 0000000b (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK) TransferBufferLength = 00000003 TransferBuffer = f7f1efd0 TransferBufferMDL = 860ba270 00000000: 23 7f 00 UrbLink = 00000000 SetupPacket = 00000000: a1 01 23 03 00 00 05 00 usbsnoop uses the term "going down" to refer to the host->device request and "coming back" to refer to the device->host response. The request and response are both timestamped with an offset in msec since usbsnoop started up. Several lines can be safely ignored. Lines starting with a timestamp and "UsbSnoop - ..." generally contain Windows-specific usbsnoop debugging info and are of no use to us. Also, PipeHandle, TransferBuffer, TransferBufferMDL, UrbLink, and SetupPacket fields are not particularly useful, either. Also, keep in mind that usbsnoop will not display fields that it considers "uninteresting" and it will display additional fields sometimes if it thinks they are interesting. For example, some packets will not show the RequestTypeReservedBits field if the bits are set to indicate a standard USB transaction. This fluctuation of displayed fields can be really aggravating since it makes comparison and trend-spotting harder. The URBs can be of different transfer types and often the request and response are not the same type. I'm going to vastly over-simplify and talk about what we care about for apcupsd. Generally speaking, all the interesting data for apcupsd is in one of two pairs. Either URB_FUNCTION_CLASS_INTERFACE (request) -> URB_FUNCTION_CONTROL_TRANSFER (response) or URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER (both request & response) URBs. The CONTROL_TRANSFERs are when a specific data item is read from or written to the UPS by the host. The INTERRUPT_TRANSFERs are when the UPS spontaneously sends the host some information. Note that even INTERRUPT_TRANSFERs have both a request and a response; the request is basically empty and the response comes back filled in. CONTROL_TRANSFER: The CONTROL_TRANSFER URBs begin with a CLASS_INTERFACE request in which the host identifies what report it wants to access from the ups. The reports consist of a one byte tag which identifies the report in question and a multi-byte (generally 1, 2, or 3 byte) data section. For us, the CLASS_INTERFACE transfers of interest have RequestTypeReservedBits=00000022 (this indicates a class-specific command and all UPS commands are specific to the HID class) and have a Request=00000001 (read) or Request=0000000a (write). The example above shows a read request. The actual report tag number is the last byte in the Value line (0x23 in the example above). Down in the response packet the line after "TransferBufferMDL" contains the data sent back by the UPS: "23 7f 00". The 0x23 is the report tag again and 0x007f is the value (little endian). From hid-ups we can look up report 0x23 (decimal 35): FeatureReport 35 Field 0, app UPS, phys Output Usage 0, HighVoltageTransfer = XYZ Volts So we can see that in the example packet the UPS is reporting a HighVoltageTransfer of 127 V (0x007f). Note that the report tags differ between UPS models so you need to look at hid-ups output for the same basic model as you're tracing. A write looks about the same except the request packet says "Request=0000000a" and the data line containing the report tag and value is in the request packet instead of the response packet. INTERRUPT_TRANSFER: Interrupt transfers in our case are all reads. You can basically ignore the request part of the URB because it contains no useful data. The response will have a data line just like a CONTROL_TRANSFER response and you can decode the report tag and value from that. THE EASY WAY: Ok, so now that I've dragged you through the hard way I'll tell you how to cheat. I wrote a tool that parses the trace and produces output showing one URB per line and clearly stating the report tag, value, and whether it's a read or a write. It also suppresses all reads that don't show a change in state, so the trace isn't cluttered with repetitive reads of the same value. The output looks like this: [0001 s] 00058 READ 0x23 007f (127) [0001 s] 00060 READ 0x24 006a (106) [0001 s] 00052 * READ 0x1c 00 (0) [0002 s] 00061 READ 0x40 0000 (0) [0002 s] 00063 READ 0x41 0000 (0) The columns are: timestamp (in seconds), URB number (so you can correlate it to the full trace), READ/WRITE, report tag, and value in hex and (decimal). A * between the URB number and transaction type indicates an interrupt transfer as opposed to polling. I've attached the code for the parsing tool "snoopdecode". It reads from stdin and writes to stdout so you can do things like "cat mytrace.log | snoopdecode | grep 0x23" and watch how a particular value changed over time. Builds with plain old 'gcc -o snoopdecode snoopdecode.c'. It leaks memory. It has no error checking. There are probably more than a few snoop traces that will crash it terribly. But it's still easier than reading snoop output by hand. Hope this was useful; Feel free to ask questions... --Adam apcupsd-3.14.10/examples/status/0000775000076400007640000000000011634011372015362 5ustar adk0212adk0212apcupsd-3.14.10/examples/status/Back-UPS-BX-1500.status0000664000076400007640000000162510561416061021034 0ustar adk0212adk0212APC : 001,035,0897 DATE : Sun Jun 05 21:20:37 PDT 2005 HOSTNAME : linux RELEASE : 3.10.17 VERSION : 3.10.17 (18 March 2005) suse UPSNAME : APC_BX1500 CABLE : USB Cable MODEL : Back-UPS RS 1500 UPSMODE : Stand Alone STARTTIME: Sun Jun 05 20:29:25 PDT 2005 STATUS : ONLINE LINEV : 118.0 Volts LOADPCT : 0.0 Percent Load Capacity BCHARGE : 100.0 Percent TIMELEFT : 737.5 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds LOTRANS : 097.0 Volts HITRANS : 138.0 Volts ALARMDEL : Always BATTV : 26.8 Volts NUMXFERS : 2 XONBATT : Sun Jun 05 20:49:18 PDT 2005 TONBATT : 0 seconds CUMONBATT: 7 seconds XOFFBATT : Sun Jun 05 20:49:19 PDT 2005 SELFTEST : NO STATFLAG : 0x02000008 Status Flag MANDATE : 2005-02-15 SERIALNO : JB0416347259 BATTDATE : 2001-09-25 NOMBATTV : 24.0 FIRMWARE : .g9 .D USB FW:g9 APCMODEL : Back-UPS RS 1500 END APC : Sun Jun 05 21:21:22 PDT 2005 apcupsd-3.14.10/examples/status/Back-UPS-Pro-1000.status0000664000076400007640000000212010561416061021245 0ustar adk0212adk0212APC : 001,056,1080 DATE : Thu Mar 08 11:22:30 EST 2001 HOSTNAME : doc RELEASE : 3.8.1-3 CABLE : Custom Cable Smart MODEL : BACK-UPS PRO 1000 UPSMODE : Net Master STARTTIME: Thu Mar 08 11:22:12 EST 2001 SHARE : NetworkUPS UPSNAME : N/A STATUS : ONLINE LINEV : N/A LOADPCT : N/A BCHARGE : N/A TIMELEFT : N/A MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 900 Seconds MAXLINEV : N/A MINLINEV : N/A OUTPUTV : N/A SENSE : N/A DWAKE : N/A DSHUTD : N/A DLOWBATT : N/A LOTRANS : N/A HITRANS : N/A RETPCT : N/A ITEMP : N/A ALARMDEL : N/A BATTV : N/A LINEFREQ : N/A LASTXFER : Line voltage notch or spike NUMXFERS : 0 XONBATT : N/A TONBATT : 0 seconds CUMONBATT: 0 seconds XOFFBATT : N/A SELFTEST : NO STESTI : N/A STATFLAG : 0x08 Status Flag DIPSW : N/A REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : N/A SERIALNO : QB0030120516 BATTDATE : N/A NOMOUTV : N/A NOMBATTV : N/A HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : N/A BADBATTS : N/A FIRMWARE : 13.J.D APCMODEL : N/A END APC : Thu Mar 08 11:22:33 EST 2001 apcupsd-3.14.10/examples/status/BackUPS-USB.status0000664000076400007640000000141510561416061020511 0ustar adk0212adk0212APC : 001,029,0757 DATE : Thu Dec 06 10:02:37 CET 2001 HOSTNAME : rufus.sibbald.com RELEASE : 3.9.7 VERSION : 3.9.7 (12 November 2001) redhat UPSNAME : rufus.usb CABLE : USB Cable MODEL : Back-UPS 350 UPSMODE : Stand Alone STARTTIME: Mon Dec 03 17:18:29 CET 2001 STATUS : ONLINE BCHARGE : 100.0 Percent TIMELEFT : 43.0 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds BATTV : 13.3 Volts NUMXFERS : 70 XONBATT : Thu Dec 06 08:39:31 CET 2001 TONBATT : 0 seconds CUMONBATT: 246 seconds XOFFBATT : Thu Dec 06 08:39:32 CET 2001 STATFLAG : 0x008 Status Flag MANDATE : 2001-04-16 SERIALNO : BB0115017954 BATTDATE : 2001-04-16 NOMBATTV : 12.0 FIRMWARE : 5.2.I USB FW: c1 APCMODEL : Back-UPS 350 END APC : Thu Dec 06 10:03:19 CET 2001 apcupsd-3.14.10/examples/status/JapaneseUPS.status0000664000076400007640000000214510561416061020751 0ustar adk0212adk0212APC : 001,050,1103 DATE : Mon Sep 11 13:51:14 JST 2000 HOSTNAME : master RELEASE : 3.7.2 CABLE : Custom Cable Smart MODEL : APC Smart-UPS 1250 UPSMODE : Net Master SHARE : NetworkUPS UPSNAME : UPS_IDEN STATUS : ONLINE LINEV : 098.5 Volts LOADPCT : 20.8 Percent Load Capacity BCHARGE : 100.0 Percent TIMELEFT : 70.0 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 300 Seconds MAXLINEV : 098.5 Volts MINLINEV : 097.9 Volts OUTPUTV : 098.5 Volts SENSE : High DWAKE : 000 Seconds DSHUTD : 020 Seconds DLOWBATT : 02 Minutes LOTRANS : 085.0 Volts HITRANS : 112.0 Volts RETPCT : 090.0 Percent ITEMP : 49.0 C Internal ALARMDEL : 30 seconds BATTV : 27.7 Volts LINEFREQ : 50.0 Hz LASTXFER : High line voltage SELFTEST : NO STESTI : 336 STATFLAG : 0x08 Status Flag DIPSW : 0x00 Dip Switch REG1 : N/A REG2 : N/A REG3 : 0x00 Register 3 MANDATE : 11/14/94 SERIALNO : 01234567 BATTDATE : 10/24/95 NOMOUTV : 100 NOMBATTV : 24.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : N/A BADBATTS : N/A FIRMWARE : N/A APCMODEL : 8VA END APC : Mon Sep 11 13:51:16 JST 2000 apcupsd-3.14.10/examples/status/PowerStack450.status0000664000076400007640000000235510561416061021151 0ustar adk0212adk0212APC : 001,051,1237 DATE : Sun Apr 14 05:52:47 PDT 2002 HOSTNAME : PSI RELEASE : 3.8.5 UPSNAME : UPS_IDEN CABLE : Custom Cable Smart MODEL : PowerStack 450 UPSMODE : Net Master STARTTIME: Sun Mar 31 01:23:34 PST 2002 SHARE : NetworkUPS STATUS : ONLINE LINEV : 122.4 Volts LOADPCT : 44.8 Percent Load Capacity BCHARGE : 100.0 Percent TIMELEFT : 25.0 Minutes MBATTCHG : 5 Percent MINTIMEL : 10 Minutes MAXTIME : 0 Seconds MAXLINEV : 123.8 Volts MINLINEV : 121.6 Volts OUTPUTV : 122.4 Volts SENSE : High DWAKE : 000 Seconds DSHUTD : 020 Seconds DLOWBATT : 02 Minutes LOTRANS : 106.0 Volts HITRANS : 127.0 Volts RETPCT : 000.0 Percent ALARMDEL : 5 seconds BATTV : 13.6 Volts LINEFREQ : 60.0 Hz LASTXFER : Line voltage notch or spike NUMXFERS : 2 XONBATT : Wed Apr 10 00:52:03 PDT 2002 TONBATT : 0 seconds CUMONBATT: 9 seconds XOFFBATT : Wed Apr 10 00:52:09 PDT 2002 LASTSTEST: Wed Apr 10 00:52:03 PDT 2002 SELFTEST : NO STESTI : 336 STATFLAG : 0x008 Status Flag REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : 12/18/01 SERIALNO : NS0151240614 BATTDATE : 12/18/01 NOMOUTV : 115 NOMBATTV : 12.0 FIRMWARE : 26.5.D APCMODEL : DWD END APC : Sun Apr 14 05:52:52 PDT 2002 apcupsd-3.14.10/examples/status/SmartUPS-vs-650.status0000664000076400007640000000204210561416061021243 0ustar adk0212adk0212APC : 001,052,0981 DATE : Tue Dec 14 20:43:59 CET 1999 HOSTNAME : azuth RELEASE : 3.7.0-beta-1 CABLE : Custom Cable Smart MODEL : Smart-UPS v/s 650 UPSMODE : Stand Alone LINEFAIL : OK BATTSTAT : OK LINEVOLT : OK UPSNAME : N/A LINEV : N/A MAXLINEV : N/A MINLINEV : N/A LINEFREQ : N/A OUTPUTV : N/A LOADPCT : N/A BATTV : N/A BCHARGE : N/A MBATTCHG : 5 Percent TIMELEFT : N/A MINTIMEL : 3 Minutes MAXTIME : 0 Seconds SENSE : N/A DWAKE : N/A DSHUTD : N/A LOTRANS : N/A HITRANS : N/A RETPCT : N/A STATFLAG : 0x08 Status Flag STATUS : ONLINE ITEMP : N/A ALARMDEL : N/A LASTXFER : Line voltage notch or spike SELFTEST : NO STESTI : N/A DLOWBATT : N/A DIPSW : N/A REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : N/A SERIALNO : gs9734969448 BATTDATE : N/A NOMOUTV : N/A NOMBATTV : N/A HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : N/A BADBATTS : N/A FIRMWARE : 62.J.I APCMODEL : N/A END APC : Tue Dec 14 20:44:00 CET 1999 apcupsd-3.14.10/examples/status/SmartUPS1000.status0000664000076400007640000000236510561416061020616 0ustar adk0212adk0212DATE : Mon Sep 18 09:34:14 CEST 2000 HOSTNAME : polymatou.sibbald.com RELEASE : 3.7.3-20000911 CABLE : Custom Cable Smart MODEL : SMART-UPS 1000 UPSMODE : Stand Alone STARTTIME: Sat Sep 16 17:13:00 CEST 2000 UPSNAME : UPS_IDEN STATUS : ONLINE LINEV : 235.3 Volts LOADPCT : 12.4 Percent Load Capacity BCHARGE : 100.0 Percent TIMELEFT : 105.0 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds MAXLINEV : 237.9 Volts MINLINEV : 234.0 Volts OUTPUTV : 235.3 Volts SENSE : High DWAKE : 000 Seconds DSHUTD : 020 Seconds DLOWBATT : 02 Minutes LOTRANS : 196.0 Volts HITRANS : 253.0 Volts RETPCT : 000.0 Percent ITEMP : 32.8 C Internal ALARMDEL : 5 seconds BATTV : 27.9 Volts LINEFREQ : 50.0 Hz LASTXFER : Automatic or explicit self test NUMXFERS : 0 XONBATT : N/A TONBATT : 0 seconds CUMONBATT: 0 seconds XOFFBATT : N/A SELFTEST : NO STESTI : 336 STATFLAG : 0x08 Status Flag DIPSW : 0x00 Dip Switch REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : 07/31/99 SERIALNO : QS9931125245 BATTDATE : 07/31/99 NOMOUTV : 230 NOMBATTV : 24.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : 0 BADBATTS : N/A FIRMWARE : 60.11.I APCMODEL : IWI END APC : Mon Sep 18 09:34:21 CEST 2000 apcupsd-3.14.10/examples/status/SmartUPS1400.status0000664000076400007640000000214210561416061020613 0ustar adk0212adk0212DATE : Fri Jan 14 17:20:31 MET 2000 HOSTNAME : diesse RELEASE : 3.7.0-beta3 CABLE : Custom Cable Smart MODEL : SMART-UPS 1400 UPSMODE : Stand Alone UPSNAME : UPS_IDEN STATUS : ONLINE LINEV : 235.3 Volts LOADPCT : 33.2 Percent Load Capacity BCHARGE : 096.0 Percent TIMELEFT : 39.0 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds MAXLINEV : 236.6 Volts MINLINEV : 234.0 Volts OUTPUTV : 235.3 Volts SENSE : High DWAKE : 060 Seconds DSHUTD : 020 Seconds DLOWBATT : 05 Minutes LOTRANS : 196.0 Volts HITRANS : 253.0 Volts RETPCT : 015.0 Percent ITEMP : 30.6 C Internal ALARMDEL : 30 seconds BATTV : 28.0 Volts LINEFREQ : 50.0 Hz LASTXFER : Line voltage notch or spike SELFTEST : NO STESTI : OFF STATFLAG : 0x08 Status Flag DIPSW : 0x00 Dip Switch REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : 05/19/97 SERIALNO : gs9720551835 BATTDATE : 05/19/97 NOMOUTV : 230 NOMBATTV : 24.0 HUMIDITY : 25.6 AMBTEMP : 22.1 EXTBATTS : 0 BADBATTS : N/A FIRMWARE : 70.9.I APCMODEL : KWI END APC : Fri Jan 14 17:20:39 MET 2000 apcupsd-3.14.10/examples/status/SmartUPS3000.status0000664000076400007640000000132210561416061020610 0ustar adk0212adk0212DATE : Wed Dec 29 19:11:16 PST 1999 HOSTNAME : adsl-63-195-162-81 RELEASE : 3.7.0-beta2 CABLE : APC Cable 940-0024C MODEL : SMART-UPS 3000 UPSMODE : Stand Alone UPSNAME : UPS_IDEN LINEV : 120.9 Volts MAXLINEV : 121.5 Volts MINLINEV : 120.2 Volts LINEFREQ : 60.0 Hz OUTPUTV : 120.9 Volts LOADPCT : 21.8 Percent Load Capacity BATTV : 54.5 Volts BCHARGE : 100.0 Percent MBATTCHG : 5 Percent TIMELEFT : 31.0 Minutes MINTIMEL : 3 Minutes MAXTIME : 0 Seconds STATFLAG : 0x08 Status Flag STATUS : ONLINE ITEMP : 37.3 C Internal LASTXFER : Line voltage notch or spike HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : 0 BADBATTS : N/A FIRMWARE : 90.11.D APCMODEL : OWD END APC : Wed Dec 29 19:11:20 PST 1999 apcupsd-3.14.10/examples/status/SmartUPS5000.status0000664000076400007640000000222010561416061020610 0ustar adk0212adk0212APC : 001,050,1145 DATE : Tue Aug 29 13:35:43 CEST 2000 HOSTNAME : net-master RELEASE : 3.7.2 CABLE : Custom Cable Smart MODEL : SMART-UPS 5000 RM UPSMODE : Net Master SHARE : NetworkUPS UPSNAME : UPS_IDEN STATUS : ONLINE LINEV : 230.1 Volts LOADPCT : 31.7 Percent Load Capacity BCHARGE : 100.0 Percent TIMELEFT : 40.0 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds MAXLINEV : 230.1 Volts MINLINEV : 228.8 Volts OUTPUTV : 230.1 Volts SENSE : High DWAKE : 000 Seconds DSHUTD : 020 Seconds DLOWBATT : 02 Minutes LOTRANS : 196.0 Volts HITRANS : 253.0 Volts RETPCT : 000.0 Percent ITEMP : 19.3 C Internal ALARMDEL : 5 seconds BATTV : 55.0 Volts LINEFREQ : 50.0 Hz LASTXFER : Line voltage notch or spike SELFTEST : NO STESTI : 336 STATFLAG : 0x08 Status Flag DIPSW : 0x00 Dip Switch REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : 11/29/99 SERIALNO : GS9999999999 BATTDATE : 11/29/99 NOMOUTV : 230 NOMBATTV : 48.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : 0 BADBATTS : N/A FIRMWARE : 112.13.I APCMODEL : PWI END APC : Tue Aug 29 13:35:44 CEST 2000 apcupsd-3.14.10/examples/status/SmartUPS600.status0000664000076400007640000000213010561416061020531 0ustar adk0212adk0212APC : 001,048,1088 DATE : Fri Dec 03 16:49:24 EST 1999 HOSTNAME : infarc RELEASE : 3.7.0-beta-1 CABLE : APC Cable 940-0024C MODEL : APC Smart-UPS 600 UPSMODE : Stand Alone UPSNAME : SU600 LINEV : 122.1 Volts MAXLINEV : 123.3 Volts MINLINEV : 122.1 Volts LINEFREQ : 60.0 Hz OUTPUTV : 122.1 Volts LOADPCT : 32.7 Percent Load Capacity BATTV : 26.6 Volts BCHARGE : 095.0 Percent MBATTCHG : 15 Percent TIMELEFT : 19.0 Minutes MINTIMEL : 3 Minutes SENSE : Medium DWAKE : 000 Seconds DSHUTD : 020 Seconds LOTRANS : 106.0 Volts HITRANS : 129.0 Volts RETPCT : 010.0 Percent STATFLAG : 0x08 Status Flag STATUS : ONLINE ITEMP : 34.6 C Internal ALARMDEL : Low Battery LASTXFER : Unacceptable Utility Voltage Change SELFTEST : NO STESTI : 336 DLOWBATT : 05 Minutes DIPSW : 0x00 Dip Switch REG1 : N/A REG2 : N/A REG3 : 0x00 Register 3 MANDATE : 03/30/95 SERIALNO : 13035861 BATTDATE : 05/05/98 NOMOUTV : 115.0 NOMBATTV : 24.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : N/A BADBATTS : N/A FIRMWARE : N/A APCMODEL : 6TD END APC : Fri Dec 03 16:49:25 EST 1999 apcupsd-3.14.10/examples/status/SmartUPS700-2.status0000664000076400007640000000217110561416061020676 0ustar adk0212adk0212APC : 001,049,1121 DATE : Mon Dec 13 09:21:18 MET 1999 HOSTNAME : kaa RELEASE : 3.7.0-beta-1 CABLE : APC Cable 940-0024C MODEL : SMART-UPS 700 UPSMODE : Stand Alone UPSNAME : UPS_KAA4 LINEV : 234.0 Volts MAXLINEV : 236.6 Volts MINLINEV : 232.7 Volts LINEFREQ : 50.0 Hz OUTPUTV : 234.0 Volts LOADPCT : 25.4 Percent Load Capacity BATTV : 27.7 Volts BCHARGE : 100.0 Percent MBATTCHG : 10 Percent TIMELEFT : 46.0 Minutes MINTIMEL : 2 Minutes MAXTIME : 0 Seconds SENSE : High DWAKE : 060 Seconds DSHUTD : 020 Seconds LOTRANS : 323.0 Volts HITRANS : 253.0 Volts RETPCT : 015.0 Percent STATFLAG : 0x08 Status Flag STATUS : ONLINE ITEMP : 41.4 C Internal ALARMDEL : Low Battery LASTXFER : Line voltage notch or spike SELFTEST : NO STESTI : 336 DLOWBATT : 02 Minutes DIPSW : 0x00 Dip Switch REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : 07/06/98 SERIALNO : NS9828020773 BATTDATE : 07/06/98 NOMOUTV : 230.0 NOMBATTV : 24.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : 1 BADBATTS : N/A FIRMWARE : 50.9.I APCMODEL : GWI END APC : Mon Dec 13 09:21:21 MET 1999 apcupsd-3.14.10/examples/status/SmartUPS700.status0000664000076400007640000000216010561416061020535 0ustar adk0212adk0212APC : 001,048,1112 DATE : Sun Dec 05 01:24:10 EST 1999 HOSTNAME : infarc RELEASE : 3.7.0-beta-1 CABLE : APC Cable 940-0024C MODEL : SMART-UPS 700 UPSMODE : Stand Alone UPSNAME : SU700-1 LINEV : 007.1 Volts MAXLINEV : 000.0 Volts MINLINEV : 007.8 Volts LINEFREQ : 60.0 Hz OUTPUTV : 119.6 Volts LOADPCT : 27.0 Percent Load Capacity BATTV : 24.6 Volts BCHARGE : 074.0 Percent MBATTCHG : 15 Percent TIMELEFT : 17.0 Minutes MINTIMEL : 3 Minutes SENSE : Medium DWAKE : 000 Seconds DSHUTD : 020 Seconds LOTRANS : 103.0 Volts HITRANS : 132.0 Volts RETPCT : 000.0 Percent STATFLAG : 0x10 Status Flag STATUS : ONBATT ITEMP : 45.9 C Internal ALARMDEL : 30 seconds LASTXFER : Unacceptable Utility Voltage Change SELFTEST : NO STESTI : 336 DLOWBATT : 02 Minutes DIPSW : 0x00 Dip Switch REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : 05/25/98 SERIALNO : NS9822059313 BATTDATE : 05/25/98 NOMOUTV : 115.0 NOMBATTV : 24.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : 0 BADBATTS : N/A FIRMWARE : 50.9.D APCMODEL : GWD END APC : Sun Dec 05 01:24:11 EST 1999 apcupsd-3.14.10/examples/status/newbackupspro1.status0000664000076400007640000000202410561416061021573 0ustar adk0212adk0212UPSCABLE smart UPSTYPE newbackupspro /etc/apcupsd/apcupsd.status reads: APC : 001,049,0937 DATE : Sun Sep 17 20:41:37 PDT 2000 HOSTNAME : broken-machine RELEASE : 3.7.0 CABLE : Custom Cable Smart MODEL : BACK-UPS PRO 1000 UPSMODE : Stand Alone UPSNAME : N/A STATUS : ONLINE LINEV : N/A LOADPCT : N/A BCHARGE : N/A TIMELEFT : N/A MBATTCHG : 15 Percent MINTIMEL : 3 Minutes MAXTIME : 180 Seconds MAXLINEV : N/A MINLINEV : N/A OUTPUTV : N/A SENSE : N/A DWAKE : N/A DSHUTD : N/A DLOWBATT : N/A LOTRANS : N/A HITRANS : N/A RETPCT : N/A ITEMP : N/A ALARMDEL : N/A BATTV : N/A LINEFREQ : N/A LASTXFER : Automatic or explicit SelfTest SELFTEST : NO STESTI : N/A STATFLAG : 0x08 Status Flag DIPSW : N/A REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : N/A SERIALNO : QB1234123412 BATTDATE : N/A NOMOUTV : N/A NOMBATTV : N/A HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : N/A BADBATTS : N/A FIRMWARE : 13.J.D APCMODEL : N/A END APC : Sun Sep 17 20:41:37 PDT 2000 apcupsd-3.14.10/examples/status/newbackupspro2.status0000664000076400007640000000214010561416061021573 0ustar adk0212adk0212DATE : Thu Sep 21 15:20:43 BST 2000 HOSTNAME : good-machine RELEASE : 3.7.2 CABLE : APC Cable 940-0095A MODEL : BACK-UPS PRO 420 UPSMODE : Net Master SHARE : NetworkUPS UPSNAME : UPS_IDEN STATUS : ONLINE LINEV : 243.3 Volts LOADPCT : 41.6 Percent Load Capacity BCHARGE : 100.0 Percent TIMELEFT : 12.0 Minutes MBATTCHG : 5 Percent MINTIMEL : 6 Minutes MAXTIME : 0 Seconds MAXLINEV : 246.2 Volts MINLINEV : 243.3 Volts OUTPUTV : 243.3 Volts SENSE : High DWAKE : 060 Seconds DSHUTD : 180 Seconds DLOWBATT : 02 Minutes LOTRANS : 208.0 Volts HITRANS : 253.0 Volts RETPCT : 050.0 Percent ITEMP : N/A ALARMDEL : Low Battery BATTV : 13.9 Volts LINEFREQ : 50.0 Hz LASTXFER : No transfers since turnon SELFTEST : NO STESTI : OFF STATFLAG : 0x08 Status Flag DIPSW : N/A REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : 07/25/98 SERIALNO : GB1234123412 BATTDATE : 07/25/98 NOMOUTV : 230 NOMBATTV : 12.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : N/A BADBATTS : N/A FIRMWARE : 11.2.I APCMODEL : DWI END APC : Thu Sep 21 15:20:47 BST 2000 apcupsd-3.14.10/include/0000775000076400007640000000000011634011374013646 5ustar adk0212adk0212apcupsd-3.14.10/include/aarray.h0000664000076400007640000000341511270654126015305 0ustar adk0212adk0212/* * aarray.h * * Simple dynamic array template class. */ /* * Copyright (C) 2009 Adam Kropelin * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef __AARRAY_H #define __AARRAY_H template class aarray { public: aarray() : _data(NULL), _size(0) {} aarray(const aarray &rhs) : _data(NULL), _size(0) { *this = rhs; } ~aarray() { delete [] _data; } aarray &operator=(const aarray &rhs) { if (this != &rhs) { delete [] _data; _size = 0; if (rhs._size) { _size = rhs._size; _data = new T[_size]; for (unsigned int i = 0; i < _size; i++) _data[i] = rhs._data[i]; } } return *this; } void append(const T& t) { T *tmp = new T[_size+1]; for (unsigned int i = 0; i < _size; i++) tmp[i] = _data[i]; delete [] _data; _data = tmp; _data[_size++] = t; } unsigned int size() const { return _size; } T& operator[](unsigned int idx) { return _data[idx]; } const T& operator[](unsigned int idx) const { return _data[idx]; } private: T *_data; unsigned int _size; }; #endif apcupsd-3.14.10/include/aiter.h0000775000076400007640000000357411273054245015142 0ustar adk0212adk0212/* * aiter.h * * Iterator functions for aXXX classes. */ /* * Copyright (C) 2008 Adam Kropelin * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef __AITER_H #define __AITER_H template class const_iterator { public: const_iterator() {} const_iterator(const const_iterator &rhs) : _iter(rhs._iter) {} const_iterator(const I &rhs) : _iter(rhs) {} const_iterator &operator++() { ++_iter; return *this; } const_iterator operator++(int) { const_iterator tmp(_iter); ++_iter; return tmp; } const_iterator &operator--() { --_iter; return *this; } const_iterator operator--(int) { const_iterator tmp(_iter); --_iter; return tmp; } const T& operator*() const { return *_iter; } bool operator==(const const_iterator &rhs) const { return _iter == rhs._iter; } bool operator!=(const const_iterator &rhs) const { return !(*this == rhs); } bool operator==(const I &rhs) const { return _iter == rhs; } bool operator!=(const I &rhs) const { return !(*this == rhs); } const_iterator &operator=(const const_iterator &rhs) { if (&rhs != this) _iter = rhs._iter; return *this; } const_iterator &operator=(const I &rhs) { if (&rhs != &_iter) _iter = rhs; return *this; } private: I _iter; }; #endif // __AITER_H apcupsd-3.14.10/include/alist.h0000664000076400007640000001220211273054245015133 0ustar adk0212adk0212/* * alist.h * * Simple double linked list template class. */ /* * Copyright (C) 2007 Adam Kropelin * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef __ALIST_H #define __ALIST_H #include #include "aiter.h" template class alist { private: class node { public: node(const T& elem) : _next(NULL), _prev(NULL), _elem(elem) {} ~node() { if (_prev) _prev->_next = _next; if (_next) _next->_prev = _prev; } operator T&() { return _elem; } T& operator*() { return _elem; } void next(node *link) { link->_next = _next; link->_prev = this; if (_next) _next->_prev = link; _next = link; } void prev(node *link) { link->_next = this; link->_prev = _prev; if (_prev) _prev->_next = link; _prev = link; } node *next() { return _next; } node *prev() { return _prev; } bool operator==(const node &rhs) const { return _next == rhs._next && _prev == rhs._prev; } private: node *_next, *_prev; T _elem; }; public: alist() : _head(NULL), _tail(NULL), _size(0) {} alist(const alist &rhs) : _head(NULL), _tail(NULL), _size(0) { append(rhs); } virtual ~alist() { while (!empty()) remove(begin()); _size = 0; } T& first() { return *_head; } T& last() { return *_tail; } bool empty() const { return _size <= 0; } unsigned int size() const { return _size; } T& append(const T& elem) { node *nd = new node(elem); if (_tail) _tail->next(nd); else _head = nd; _tail = nd; _size++; return *_tail; } T& prepend(const T& elem) { node *nd = new node(elem); if (_head) _head->prev(nd); else _tail = nd; _head = nd; _size++; return *_head; } T& append(const alist& rhs) { if (&rhs != this) { for(const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter) { append(*iter); } } return *_tail; } alist& operator+=(const alist& rhs) { append(rhs); return *this; } alist& operator=(const alist& rhs) { if (&rhs != this) { clear(); append(rhs); } return *this; } void remove_first() { if (!empty()) remove(_head); } void remove_last() { if (!empty()) remove(_tail); } void clear() { while (!empty()) remove(_head); } class iterator { public: iterator() : _node(NULL) {} iterator(const iterator &rhs) : _node(rhs._node) {} iterator &operator++() { _node = _node->next(); return *this; } iterator operator++(int) { iterator tmp(_node); ++(*this); return tmp; } iterator &operator--() { _node = _node->prev(); return *this; } iterator operator--(int) { iterator tmp(_node); --(*this); return tmp; } T& operator*() { return *_node; } const T& operator*() const { return *_node; } T* operator->() { return &(**_node); } const T* operator->() const { return &(**_node); } bool operator==(const iterator &rhs) const { return _node == rhs._node; } bool operator!=(const iterator &rhs) const { return !(*this == rhs); } iterator &operator=(const iterator &rhs) { if (&rhs != this) _node = rhs._node; return *this; } private: friend class alist; iterator(node *node) : _node(node) {} node *_node; }; typedef ::const_iterator const_iterator; iterator begin() { return iterator(_head); } iterator end() { return iterator(NULL); } const_iterator begin() const { return iterator(_head); } const_iterator end() const { return iterator(NULL); } iterator remove(iterator iter) { if (iter == _head) _head = iter._node->next(); if (iter == _tail) _tail = iter._node->prev(); iterator newiter(iter._node->next()); delete iter._node; _size--; return newiter; } iterator find(const T& needle) { iterator iter; for (iter = begin(); iter != end(); ++iter) if (*iter == needle) break; return iter; } const_iterator find(const T& needle) const { const_iterator iter; for (iter = begin(); iter != end(); ++iter) if (*iter == needle) break; return iter; } private: node *_head, *_tail; unsigned int _size; }; #endif apcupsd-3.14.10/include/amap.h0000664000076400007640000001000111273054245014730 0ustar adk0212adk0212/* * amap.h * * Simple map template class build on alist. */ /* * Copyright (C) 2007 Adam Kropelin * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef __AMAP_H #define __AMAP_H #include "alist.h" #include "aiter.h" template class amap { private: struct keyval { keyval() {} keyval(const K& key) : _key(key) {} bool operator==(const keyval &rhs) const { return _key == rhs._key; } K _key; V _val; }; public: amap() {} ~amap() {} V& operator[](const K& key) { typename alist::iterator iter = _map.find(key); return (iter == _map.end()) ? _map.append(key)._val : (*iter)._val; } bool contains(const K& key) const { return _map.find(key) != _map.end(); } bool empty() const { return _map.empty(); } class iterator { public: iterator() {} iterator(const iterator &rhs) : _iter(rhs._iter) {} iterator &operator++() { ++_iter; return *this; } iterator operator++(int) { iterator tmp(_iter); ++(*this); return tmp; } iterator &operator--() { --_iter; return *this; } iterator operator--(int) { iterator tmp(_iter); --(*this); return tmp; } V& value() { return (*_iter)._val; } K& key() { return (*_iter)._key; } V& operator*() { return value(); } bool operator==(const iterator &rhs) const { return _iter == rhs._iter; } bool operator!=(const iterator &rhs) const { return !(*this == rhs); } iterator &operator=(const iterator &rhs) { if (&rhs != this) _iter = rhs._iter; return *this;} protected: friend class amap; iterator(const typename alist::iterator &iter) : _iter(iter) {} typename alist::iterator _iter; }; class const_iterator { public: const_iterator() {} const_iterator(const const_iterator &rhs) : _iter(rhs._iter) {} const_iterator &operator++() { ++_iter; return *this; } const_iterator operator++(int) { const_iterator tmp(_iter); ++(*this); return tmp; } const_iterator &operator--() { --_iter; return *this; } const_iterator operator--(int) { const_iterator tmp(_iter); --(*this); return tmp; } const V& value() const { return (*_iter)._val; } const K& key() const { return (*_iter)._key; } const V& operator*() const { return value(); } bool operator==(const const_iterator &rhs) const { return _iter == rhs._iter; } bool operator!=(const const_iterator &rhs) const { return !(*this == rhs); } const_iterator &operator=(const const_iterator &rhs) { if (&rhs != this) _iter = rhs._iter; return *this;} protected: friend class amap; const_iterator(const typename alist::const_iterator &iter) : _iter(iter) {} typename alist::const_iterator _iter; }; iterator end() { return iterator(_map.end()); } iterator begin() { return iterator(_map.begin()); } const_iterator end() const { return _map.end(); } const_iterator begin() const { return _map.begin(); } iterator find(const K& key) { return iterator(_map.find(key)); } const_iterator find(const K& key) const { return _map.find(key); } private: // Should really use a hash table for efficient random lookups, // but for now we'll take the easy route and use alist. alist _map; // Prevent use amap(const amap &rhs); amap &operator=(const amap &rhs); }; #endif // __AMAP_H apcupsd-3.14.10/include/amutex.h0000664000076400007640000000362311273054245015331 0ustar adk0212adk0212/* * amutex.h * * Simple mutex wrapper class. */ /* * Copyright (C) 2007 Adam Kropelin * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef __AMUTEX_H #define __AMUTEX_H #include #include "astring.h" // Wrappers for debug trace #define LOCK(m) \ do { \ Dmsg3(500, "lock 0x%p @ %s:%d\n", &m, __FILE__, __LINE__); \ m.lock(); \ } while(0) #define UNLOCK(m) \ do { \ Dmsg3(500, "unlock 0x%p @ %s:%d\n", &m, __FILE__, __LINE__); \ m.unlock(); \ } while(0) class amutex { public: amutex(const char *name = DEFAULT_NAME, bool recursive = false); ~amutex(); // Basic lock/unlock are inlined for efficiency inline void lock() const { pthread_mutex_lock(&_mutex); } inline void unlock() const { pthread_mutex_unlock(&_mutex); } protected: mutable pthread_mutex_t _mutex; astring _name; private: static const char *DEFAULT_NAME; // Prevent use amutex(const amutex &rhs); amutex &operator=(const amutex &rhs); }; #endif apcupsd-3.14.10/include/apc.h0000664000076400007640000000626411442156520014572 0ustar adk0212adk0212/* * apc.h * * Main header file for apcupsd package */ /* * Copyright (C) 1999-2005 Kern Sibbald * Copyright (C) 1999 Brian Schau * Copyright (C) 1996-99 Andre M. Hedrick * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef APC_H #define APC_H 1 #ifdef HAVE_WIN32 # include "winconfig.h" #else # include "config.h" #endif /* * Solaris needs BSD_COMP set in order to get FIONBIO * For simplicity, we set it across the board. */ #define BSD_COMP /* * Note, on the Alpha, we must include stdarg to get * the GNU version before stdio or we get multiple * definitions. This order could probably be used * on all systems, but is untested so I #ifdef it. * KES 9/2000 */ #ifdef HAVE_OSF1_OS # include # include # include #else # include # include # include #endif #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_GETOPTLONG # include #else # include "getopt.h" #endif #define _THREAD_SAFE 1 #define _REENTRANT 1 #include #ifdef HAVE_SUN_OS # include # define set_thread_concurrency() thr_setconcurrency(4) #else # define set_thread_concurrency() #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include # ifdef HAVE_SYS_IPC_H # include # endif # ifdef HAVE_SYS_SEM_H # include # endif # ifdef HAVE_SYS_SHM_H # include # endif #ifdef HAVE_SYS_SOCKET_H # include #endif #include #ifdef HAVE_UNISTD_H # include #endif #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #ifdef HAVE_SYS_WAIT_H # include #endif #ifdef HAVE_HPUX_OS # include #endif #ifdef HAVE_QNX_OS # include # include #endif #include #include /* Include apcupsd stuff */ #include "apc_config.h" #include "version.h" #include "defines.h" #include "struct.h" #include "drivers.h" #include "nis.h" #include "extern.h" /* System includes conditionally included */ /* Pull in our local copy because the library does not have correct protos */ #ifdef HAVE_LIBWRAP # include "tcpd.h" #endif /* Solaris doesn't define this */ #ifndef INADDR_NONE #define INADDR_NONE ((in_addr_t)-1) #endif #endif apcupsd-3.14.10/include/apc_config.h0000664000076400007640000001166510505271027016117 0ustar adk0212adk0212/* * apc_config.h * * Platform compatibility cruft. * * Contributed by Riccardo Facchetti * Modify it accordingly to configure.in file. Do _not_ use it for * apcupsd-specific things, just for configure. */ /* * Copyright (C) 1999-2002 Riccardo Facchetti * Copyright (C) 1996-1999 Andre M. Hedrick * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef _APC_CONFIG_H #define _APC_CONFIG_H #ifndef HAVE_STRFTIME # define strftime(msg, max, format, tm) \ strncpy(msg, "time not available", max) #endif /* !HAVE_STRFTIME */ /* * wait macros. */ #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif #ifndef HAVE_SOCKLEN_T # define socklen_t unsigned int #endif /* Alpha Tru64 */ #ifdef HAVE_OSF1_OS # define _SEM_SEMUN_UNDEFINED 1 #endif #ifdef HAVE_HPUX_OS # define _SEM_SEMUN_UNDEFINED 1 /* * These defines, related to serial devices, need to be clarified for HP-UX * operating system. */ # define TIOCM_LE 0 # define TIOCM_ST 0 # define TIOCM_SR 0 #endif /* NetBSD */ #ifdef HAVE_NETBSD_OS # define _SEM_SEMUN_UNDEFINED 1 #endif #ifdef HAVE_SUN_OS # define _SEM_SEMUN_UNDEFINED 1 #endif #ifdef HAVE_AIX_OS # define _SEM_SEMUN_UNDEFINED 1 #endif #ifdef HAVE_OPENSERVER_OS # define _SEM_SEMUN_UNDEFINED 1 #endif #ifndef SHUT_RDWR # define SHUT_RDWR 2 /* for socket shutdown() calls */ #endif #ifdef SETPGRP_VOID # define SETPGRP_ARGS(x, y) /* No arguments */ #else # define SETPGRP_ARGS(x, y) x,y #endif /* If we have it, the init is not needed */ #ifdef HAVE_SETPROCTITLE # undef init_proctitle # define init_proctitle(x) #endif #ifndef ENABLE_NLS # define textdomain(x) #endif #ifndef O_NDELAY # define O_NDELAY 0 #endif /* * For HP-UX the definition of FILENAME_MAX seems not conformant with * POSIX standard. To avoid any problem we are forced to define a * private macro. This accounts also for other possible problematic OSes. * If none of the standard macros is defined, fall back to 256. */ #if defined(FILENAME_MAX) && FILENAME_MAX > 255 # define APC_FILENAME_MAX FILENAME_MAX #elif defined(PATH_MAX) && PATH_MAX > 255 # define APC_FILENAME_MAX PATH_MAX #elif defined(MAXPATHLEN) && MAXPATHLEN > 255 # define APC_FILENAME_MAX MAXPATHLEN #else # define APC_FILENAME_MAX 256 #endif /* ETIME not on BSD, incl. Darwin */ #ifndef ETIME # define ETIME ETIMEDOUT #endif /* * apcupsd requires SHM_RDONLY even if compiling for pthreads: the * attach_ipc interface is a wrapper for both. */ #if !defined(HAVE_SYS_SHM_H) && !defined SHM_RDONLY # define SHM_RDONLY O_RDONLY #endif /* If no system localtime_r(), forward declaration of our internal substitute. */ #if !defined(HAVE_LOCALTIME_R) extern struct tm *localtime_r(const time_t *timep, struct tm *tm); #endif /* If no system inet_pton(), forward declaration of our internal substitute. */ #if !defined(HAVE_INETPTON) /* Define constants based on RFC 883, RFC 1034, RFC 1035 */ #define NS_PACKETSZ 512 /* maximum packet size */ #define NS_MAXDNAME 1025 /* maximum domain name */ #define NS_MAXCDNAME 255 /* maximum compressed domain name */ #define NS_MAXLABEL 63 /* maximum length of domain label */ #define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ #define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ #define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ #define NS_INT32SZ 4 /* #/bytes of data in a u_int32_t */ #define NS_INT16SZ 2 /* #/bytes of data in a u_int16_t */ #define NS_INT8SZ 1 /* #/bytes of data in a u_int8_t */ #define NS_INADDRSZ 4 /* IPv4 T_A */ #define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */ #define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ #define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ extern int inet_pton(int af, const char *src, void *dst); #endif /* Determine if the C(++) compiler requires complete function prototype */ #ifndef __P # if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) # define __P(x) x # else # define __P(x) () # endif #endif #ifndef __cplusplus #define bool int #define true 1 #define false 0 #endif #endif /* _APC_CONFIG */ apcupsd-3.14.10/include/aqueue.h0000775000076400007640000000374111273054245015317 0ustar adk0212adk0212#ifndef __AQUEUE_H #define __AQUEUE_H #include #include #include "alist.h" #include "autil.h" template class aqueue { public: aqueue() { pthread_mutex_init(&_mutex, NULL); pthread_cond_init(&_condvar, NULL); } ~aqueue() { pthread_cond_destroy(&_condvar); pthread_mutex_destroy(&_mutex); } void enqueue(const T &elem) { pthread_mutex_lock(&_mutex); _queue.append(elem); pthread_mutex_unlock(&_mutex); pthread_cond_signal(&_condvar); } bool dequeue(T& elem, int msec = TIMEOUT_FOREVER) { int rc = 0; pthread_mutex_lock(&_mutex); if (msec != TIMEOUT_FOREVER) { struct timespec abstime; calc_abstimeout(msec, &abstime); while (rc == 0 && _queue.empty()) rc = pthread_cond_timedwait(&_condvar, &_mutex, &abstime); } else { while (rc == 0 && _queue.empty()) rc = pthread_cond_wait(&_condvar, &_mutex); } if (rc) { pthread_mutex_unlock(&_mutex); return false; } elem = _queue.first(); _queue.remove_first(); pthread_mutex_unlock(&_mutex); return true; } T dequeue() { pthread_mutex_lock(&_mutex); int rc = 0; while (rc == 0 && _queue.empty()) rc = pthread_cond_wait(&_condvar, &_mutex); T elem = _queue.first(); _queue.remove_first(); pthread_mutex_unlock(&_mutex); return elem; } bool empty() { pthread_mutex_lock(&_mutex); bool tmp = _queue.empty(); pthread_mutex_unlock(&_mutex); return tmp; } void clear() { pthread_mutex_lock(&_mutex); _queue.clear(); pthread_mutex_unlock(&_mutex); } private: static const int TIMEOUT_FOREVER = -1; pthread_mutex_t _mutex; pthread_cond_t _condvar; alist _queue; // Prevent use aqueue(const aqueue &rhs); aqueue &operator=(const aqueue &rhs); }; #endif apcupsd-3.14.10/include/astring.h0000664000076400007640000000516111273054245015474 0ustar adk0212adk0212/* * astring.h * * Simple string management class. Like STL, but lighter. */ /* * Copyright (C) 2007 Adam Kropelin * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef __ASTRING_H #define __ASTRING_H #include #include class astring { public: astring() : _data(NULL) { assign(""); } astring(const char *str) : _data(NULL) { assign(str); } astring(const astring &str) : _data(NULL) { assign(str._data); } ~astring() { delete [] _data; } int len() const { return _len; } int format(const char *format, ...); int vformat(const char *format, va_list args); astring &operator=(const astring &rhs); astring &operator=(const char *rhs); astring &operator=(const char rhs); const char &operator[](int index) const; char &operator[](int index); astring &operator+(const char *rhs); astring &operator+=(const char *rhs) { return *this + rhs; } astring &operator+(const astring &rhs); astring &operator+=(const astring &rhs) { return *this + rhs; } astring &operator+(const char rhs); astring &operator+=(const char rhs) { return *this + rhs; } bool operator==(const char *rhs) const { return !strcmp(_data, rhs); } bool operator==(const astring &rhs) const { return *this == rhs._data; } bool operator!=(const char *rhs) const { return !(*this == rhs); } bool operator!=(const astring &rhs) const { return !(*this == rhs); } astring substr(int start, int len = -1) const; int strchr(char ch) const; operator const char *() const { return _data; } const char *str() const { return _data; } astring &rtrim(); astring <rim(); astring &trim() { ltrim(); return rtrim(); } bool empty() const { return _len == 0; } int compare(const char *rhs) const { return strcmp(_data, rhs); } private: void realloc(unsigned int newlen); void assign(const char *str, int len = -1); char *_data; int _len; }; inline astring operator+(const char *lhs, const astring &rhs) { return astring(lhs) + rhs; } #endif apcupsd-3.14.10/include/athread.h0000775000076400007640000000066311273054245015442 0ustar adk0212adk0212#ifndef __ATHREAD_H #define __ATHREAD_H #include class athread { public: athread(int prio = PRIORITY_INHERIT) : _prio(prio), _running(false) {} virtual ~athread() {} virtual bool run(); virtual bool join(); protected: virtual void body() = 0; static void *springboard(void *arg); static const int PRIORITY_INHERIT; pthread_t _tid; int _prio; bool _running; }; #endif apcupsd-3.14.10/include/atimer.h0000775000076400007640000000122011273054245015301 0ustar adk0212adk0212#ifndef __ATIMER_H #define __ATIMER_H #include #include "athread.h" class atimer: public athread { public: class client { public: virtual void HandleTimeout(int id) = 0; protected: client() {} virtual ~client() {} }; atimer(client &cli, int id = 0); ~atimer(); void start(unsigned long msec); void stop(); private: virtual void body(); client &_client; int _id; pthread_mutex_t _mutex; pthread_cond_t _condvar; bool _started; struct timespec _abstimeout; // Prevent use atimer(const atimer &rhs); atimer &operator=(const atimer &rhs); }; #endif // __ATIMER_H apcupsd-3.14.10/include/autil.h0000664000076400007640000000156711273054245015151 0ustar adk0212adk0212/* * autil.h * * Common helper routines for a* classes. */ /* * Copyright (C) 2007 Adam Kropelin * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef __AUTIL_H #define __AUTIL_H #include void calc_abstimeout(int msec, struct timespec *abstime); #endif apcupsd-3.14.10/include/defines.h0000664000076400007640000004226511617047445015456 0ustar adk0212adk0212/* * defines.h * * Public definitions used throughout apcupsd */ /* * Copyright (C) 1999-2005 Kern Sibbald * Copyright (C) 1996-1999 Andre M. Hedrick * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef _DEFINES_H #define _DEFINES_H #ifndef APCCONTROL_FILE # define APCCONTROL_FILE "/apccontrol" #endif #ifndef APCCONF_FILE # define APCCONF_FILE "/apcupsd.conf" #endif #ifndef PWRFAIL_FILE # define PWRFAIL_FILE "/powerfail" #endif #ifndef NOLOGIN_FILE # define NOLOGIN_FILE "/nologin" #endif #define APCPID PIDDIR "/apcupsd.pid" /* * These two are not to be touched: we can not be sure how the user will * insert the locks directory path so we have to prepend the '/' just to be * sure: is better have /blah//LCK.. than /blahLCK.. */ #define APC_LOCK_PREFIX "/LCK.." #define LOCK_DEFAULT "/var/lock" /* * This string should be the first line of the configuration file. * Then if we change the format later, we can just change this string. * Also, we could write code to use/convert out-of-date config files. */ #define APC_CONFIG_MAGIC "## apcupsd.conf v1.1 ##" #define POWERFAIL "POWER FAILURE\n" /* put in nologin file */ #define MAXSTRING 256 #define MESSAGELEN 256 #define MAXTOKENLEN 100 #define UPSNAMELEN 100 #define DEFAULT_SPEED B2400 /* bit values for APC UPS Status Byte (ups->Status) */ #define UPS_calibration 0x00000001 #define UPS_trim 0x00000002 #define UPS_boost 0x00000004 #define UPS_online 0x00000008 #define UPS_onbatt 0x00000010 #define UPS_overload 0x00000020 #define UPS_battlow 0x00000040 #define UPS_replacebatt 0x00000080 /* Extended bit values added by apcupsd */ #define UPS_commlost 0x00000100 /* Communications with UPS lost */ #define UPS_shutdown 0x00000200 /* Shutdown in progress */ #define UPS_slave 0x00000400 /* Set if this is a slave */ #define UPS_slavedown 0x00000800 /* Slave not responding */ #define UPS_onbatt_msg 0x00020000 /* Set when UPS_ONBATT message is sent */ #define UPS_fastpoll 0x00040000 /* Set on power failure to poll faster */ #define UPS_shut_load 0x00080000 /* Set when BatLoad <= percent */ #define UPS_shut_btime 0x00100000 /* Set when time on batts > maxtime */ #define UPS_shut_ltime 0x00200000 /* Set when TimeLeft <= runtime */ #define UPS_shut_emerg 0x00400000 /* Set when battery power has failed */ #define UPS_shut_remote 0x00800000 /* Set when remote shutdown */ #define UPS_plugged 0x01000000 /* Set if computer is plugged into UPS */ #define UPS_dev_setup 0x02000000 /* Set if UPS's driver did the setup() */ #define UPS_battpresent 0x04000000 /* Indicates if battery is connected */ #define UPS_LOCAL_BITS (UPS_commlost|UPS_shutdown|UPS_slave|UPS_slavedown| \ UPS_onbatt_msg|UPS_fastpoll|UPS_plugged|UPS_dev_setup| \ UPS_shut_load|UPS_shut_btime|UPS_shut_ltime|UPS_shut_emerg) /* * CI_ is Capability or command index * * If the command is valid for this UPS, UPS_Cap[CI_xxx] * will be true. */ enum { CI_UPSMODEL = 0, /* Model number */ CI_STATUS, /* status function */ CI_LQUAL, /* line quality status */ CI_WHY_BATT, /* why transferred to battery */ CI_ST_STAT, /* self test stat */ CI_VLINE, /* line voltage */ CI_VMAX, /* max voltage */ CI_VMIN, /* min line voltage */ CI_VOUT, /* Output voltage */ CI_BATTLEV, /* Battery level percentage */ CI_VBATT, /* Battery voltage */ CI_LOAD, /* UPS Load */ CI_FREQ, /* Line Frequency */ CI_RUNTIM, /* Est. Runtime left */ CI_ITEMP, /* Internal UPS temperature */ CI_DIPSW, /* Dip switch settings */ CI_SENS, /* Sensitivity */ CI_DWAKE, /* Wakeup delay */ CI_DSHUTD, /* Shutdown delay */ CI_LTRANS, /* Low transfer voltage */ CI_HTRANS, /* High transfer voltage */ CI_RETPCT, /* Return percent threshhold */ CI_DALARM, /* Alarm delay */ CI_DLBATT, /* low battery warning, mins */ CI_IDEN, /* UPS Identification (name) */ CI_STESTI, /* Self test interval */ CI_MANDAT, /* Manufacture date */ CI_SERNO, /* serial number */ CI_BATTDAT, /* Last battery change */ CI_NOMBATTV, /* Nominal battery voltage */ CI_HUMID, /* UPS Humidity percentage */ CI_REVNO, /* Firmware revision */ CI_REG1, /* Register 1 */ CI_REG2, /* Register 2 */ CI_REG3, /* Register 3 */ CI_EXTBATTS, /* Number of external batteries */ CI_ATEMP, /* Ambient temp */ CI_NOMOUTV, /* Nominal output voltage */ CI_BADBATTS, /* Number of bad battery packs */ CI_EPROM, /* Valid eprom values */ CI_ST_TIME, /* hours since last self test */ CI_TESTALARM, /* Test alarm */ CI_Manufacturer, CI_ShutdownRequested, CI_ShutdownImminent, CI_DelayBeforeReboot, CI_BelowRemCapLimit, CI_RemTimeLimitExpired, CI_Charging, CI_Discharging, CI_RemCapLimit, CI_RemTimeLimit, CI_WarningCapacityLimit, CI_CapacityMode, CI_BattPackLevel, CI_CycleCount, CI_ACPresent, CI_Boost, CI_Trim, CI_Overload, CI_NeedReplacement, CI_BattReplaceDate, CI_APCForceShutdown, CI_DelayBeforeShutdown, CI_APCDelayBeforeStartup, CI_APCDelayBeforeShutdown, CI_APCLineFailCause, CI_NOMINV, CI_NOMPOWER, CI_LowBattery, CI_Calibration, CI_AlarmTimer, /* Only seen on the BackUPS Pro USB (so far) */ CI_BUPBattCapBeforeStartup, CI_BUPDelayBeforeStartup, CI_BUPSelfTest, CI_BUPHibernate, /* * We don't actually handle these, but use them as a signal * to re-examine the other UPS data items. (USB only) */ CI_IFailure, /* Internal failure */ CI_PWVoltageOOR, /* Power sys voltage out of range */ CI_PWFrequencyOOR, /* Power sys frequency out of range */ CI_OverCharged, /* Battery overcharged */ CI_OverTemp, /* Over temperature */ CI_CommunicationLost, /* USB comms with subsystem lost */ CI_ChargerVoltageOOR, /* Charger voltage our of range */ CI_ChargerCurrentOOR, /* Charger current our of range */ CI_CurrentNotRegulated, /* Charger current not regulated */ CI_VoltageNotRegulated, /* Charger voltage not regulated */ CI_BatteryPresent, /* Battery is present */ CI_LAST_PROBE, /* MUST BE LAST IN SECTION */ /* Items below this line are not "probed" for */ CI_CYCLE_EPROM, /* Cycle programmable EPROM values */ CI_UPS_CAPS, /* Get UPS capabilities (command) string */ CI_LAST /* MUST BE LAST */ }; #define CI_MAXCI (CI_LAST-1) /* maximum UPS commands we handle */ #define CI_MAX_CAPS (CI_LAST_PROBE-1) #define CI_RemainingCapacity CI_BATTLEV #define CI_RunTimeToEmpty CI_RUNTIM /* * APC_CMD_ is the command code sent to UPS for APC Smart UPSes * * NOTE: the APC_CMD_s are never used in the actual code, * except to initialize the UPS_Cmd[] structure. This way, * we will be able to support other UPSes later. The actual * command is obtained by reference to UPS_Cmd[CI_xxx] */ #define APC_CMD_UPSMODEL 0x1 #define APC_CMD_OLDFWREV 'V' #define APC_CMD_STATUS 'Q' #define APC_CMD_LQUAL '9' #define APC_CMD_WHY_BATT 'G' #define APC_CMD_ST_STAT 'X' #define APC_CMD_VLINE 'L' #define APC_CMD_VMAX 'M' #define APC_CMD_VMIN 'N' #define APC_CMD_VOUT 'O' #define APC_CMD_BATTLEV 'f' #define APC_CMD_VBATT 'B' #define APC_CMD_LOAD 'P' #define APC_CMD_FREQ 'F' #define APC_CMD_RUNTIM 'j' #define APC_CMD_ITEMP 'C' #define APC_CMD_DIPSW '7' #define APC_CMD_SENS 's' #define APC_CMD_DWAKE 'r' #define APC_CMD_DSHUTD 'p' #define APC_CMD_LTRANS 'l' #define APC_CMD_HTRANS 'u' #define APC_CMD_RETPCT 'e' #define APC_CMD_DALARM 'k' #define APC_CMD_DLBATT 'q' #define APC_CMD_IDEN 'c' #define APC_CMD_STESTI 'E' #define APC_CMD_MANDAT 'm' #define APC_CMD_SERNO 'n' #define APC_CMD_BATTDAT 'x' #define APC_CMD_NOMBATTV 'g' #define APC_CMD_HUMID 'h' #define APC_CMD_REVNO 'b' #define APC_CMD_REG1 '~' #define APC_CMD_REG2 '\'' #define APC_CMD_REG3 '8' #define APC_CMD_EXTBATTS '>' #define APC_CMD_ATEMP 't' #define APC_CMD_NOMOUTV 'o' #define APC_CMD_BADBATTS '<' #define APC_CMD_EPROM 0x1a #define APC_CMD_ST_TIME 'd' #define APC_CMD_CYCLE_EPROM '-' #define APC_CMD_UPS_CAPS 'a' #define GO_ON_BATT 'W' #define GO_ON_LINE 'X' #define LIGHTS_TEST 'A' #define FAILURE_TEST 'U' /* * Future additions for contolled discharing of batteries * extend lifetimes. */ #define DISCHARGE 'D' #define CHARGE_LIM 25 #define UPS_ENABLED '?' #define UPS_ON_BATT '!' #define UPS_ON_LINE '$' #define UPS_REPLACE_BATTERY '#' #define BATT_LOW '%' #define BATT_OK '+' #define UPS_EPROM_CHANGE '|' #define UPS_TRAILOR ':' #define UPS_LF '\n' #define UPS_CR '\r' /* For apclock.c functions */ #define LCKSUCCESS 0 /* lock file does not exist so go */ #define LCKERROR 1 /* lock file not our own and error encountered */ #define LCKEXIST 2 /* lock file is our own lock file */ #define LCKNOLOCK 3 /* lock file not needed: APC_NET */ /* Generic defines for boolean return values. */ #define SUCCESS 0 /* Function successfull */ #define FAILURE 1 /* Function failure */ /* These seem unavoidable :-( */ #ifndef TRUE # define TRUE 1 #endif #ifndef FALSE # define FALSE 0 #endif /* * We have a timer for the read() for Win32. * We have a timer for the select when nothing is expected, * i.e. we prefer waiting for an state change. * We have a fast timer, when we are on batteries or when * we expect a response (i.e. we sent a character). * And we have a timer for dumb UPSes for doing the sleep(). */ #define TIMER_READ 10 /* read() timeout, max 25 sec */ #define TIMER_SELECT 60 /* Select when not expecting anything */ #define TIMER_FAST 1 /* Value for fast poll */ #define TIMER_DUMB 5 /* for Dumb (ioctl) UPSes -- keep short */ /* Make the size of these strings the next multiple of 4 */ #define APC_MAGIC "apcupsd-linux-6.0" #define APC_MAGIC_SIZE 4 * ((sizeof(APC_MAGIC) + 3) / 4) #define ACCESS_MAGIC "apcaccess-linux-4.0" #define ACCESS_MAGIC_SIZE 4 * ((sizeof(APC_MAGIC) + 3) / 4) #define MAX_THREADS 7 /* Find members position in the UPSINFO and GLOBALCFG structures. */ #define WHERE(MEMBER) ((size_t) &((UPSINFO *)0)->MEMBER) #define AT(UPS,OFFSET) ((size_t)UPS + OFFSET) #define SIZE(MEMBER) ((GENINFO *)sizeof(((UPSINFO *)0)->MEMBER)) /* * These are the commands understood by the apccontrol shell script. * You _must_ keep the #defines in sync with the commands[] array in * action.c */ enum { CMDPOWEROUT = 0, CMDONBATTERY, CMDFAILING, CMDTIMEOUT, CMDLOADLIMIT, CMDRUNLIMIT, CMDDOSHUTDOWN, CMDMAINSBACK, CMDANNOYME, CMDEMERGENCY, CMDCHANGEME, CMDREMOTEDOWN, CMDCOMMFAILURE, CMDCOMMOK, CMDSTARTSELFTEST, CMDENDSELFTEST, CMDOFFBATTERY, /* off battery power */ CMDBATTDETACH, /* Battery disconnected */ CMDBATTATTACH /* Battery reconnected */ }; /* * Simple way of handling varargs for those compilers that * don't support varargs in #defines. */ #define Error_abort0(fmd) error_out(__FILE__, __LINE__, fmd) #define Error_abort1(fmd, arg1) error_out(__FILE__, __LINE__, fmd, arg1) #define Error_abort2(fmd, arg1,arg2) error_out(__FILE__, __LINE__, fmd, arg1,arg2) #define Error_abort3(fmd, arg1,arg2,arg3) error_out(__FILE__, __LINE__, fmd, arg1,arg2,arg3) #define Error_abort4(fmd, arg1,arg2,arg3,arg4) error_out(__FILE__, __LINE__, fmd, arg1,arg2,arg3,arg4) #define Error_abort5(fmd, arg1,arg2,arg3,arg4,arg5) error_out(__FILE__, __LINE__, fmd, arg1,arg2,arg3,arg4,arg5) #define Error_abort6(fmd, arg1,arg2,arg3,arg4,arg5,arg6) error_out(__FILE__, __LINE__, fmd, arg1,arg2,arg3,arg4,arg5,arg5) /* * The digit following Dmsg and Emsg indicates the number of substitutions in * the message string. We need to do this kludge because non-GNU compilers * do not handle varargs #defines. */ /* Debug Messages that are printed */ #ifdef DEBUG #define Dmsg0(lvl, msg) d_msg(__FILE__, __LINE__, lvl, msg) #define Dmsg1(lvl, msg, a1) d_msg(__FILE__, __LINE__, lvl, msg, a1) #define Dmsg2(lvl, msg, a1, a2) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2) #define Dmsg3(lvl, msg, a1, a2, a3) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3) #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4) d_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4) #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5) #define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6) #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7) #define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) #define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) void d_msg(const char *file, int line, int level, const char *fmt, ...); #else #define Dmsg0(lvl, msg) #define Dmsg1(lvl, msg, a1) #define Dmsg2(lvl, msg, a1, a2) #define Dmsg3(lvl, msg, a1, a2, a3) #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4) #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5) #define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) #define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) #define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) #endif /* These probably should be subroutines */ #define P(x) \ do { \ int errstat; \ if ((errstat=pthread_mutex_lock(&(x)))) \ error_out(__FILE__, __LINE__, "Mutex lock failure. ERR=%s\n", strerror(errstat)); \ } while(0) #define V(x) \ do { \ int errstat; \ if ((errstat=pthread_mutex_unlock(&(x)))) \ error_out(__FILE__, __LINE__, "Mutex unlock failure. ERR=%s\n", strerror(errstat)); \ } while(0) /* Send terminate signal to itself. */ #define sendsig_terminate() \ { \ kill(getpid(), SIGTERM); \ exit(0); \ } /* Determine the difference, in milliseconds, between two struct timevals. */ #define TV_DIFF_MS(a, b) \ (((b).tv_sec - (a).tv_sec) * 1000 + ((b).tv_usec - (a).tv_usec) / 1000) /* * Some platforms, like Solaris, hide MIN/MAX in an obscure header. * It's easiest just to define them ourselves instead of trying to * find the right thing to include. */ #ifndef MIN #define MIN(a,b) ( (a) < (b) ? (a) : (b) ) #endif #ifndef MAX #define MAX(a,b) ( (a) > (b) ? (a) : (b) ) #endif #endif /* _DEFINES_H */ apcupsd-3.14.10/include/drivers.h0000664000076400007640000001337011153061071015474 0ustar adk0212adk0212/* * drivers.h * * Header file for exporting UPS drivers. */ /* * Copyright (C) 1999-2001 Riccardo Facchetti * Copyright (C) 1996-1999 Andre M. Hedrick * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef _DRIVERS_H #define _DRIVERS_H /* * This is the generic drivers structure. It contain any routine needed for * managing a device (or family of devices, like Smart UPSes). * * Routines defined: * * open() * Opens the device and setup the file descriptor. Returns a working file * descriptor. This function does not interact with hardware functionality. * In case of error, this function does not return. It simply exit. * * setup() * Setup the device for operations. This function interacts with hardware to * make sure on the other end there is an UPS and that the link is working. * In case of error, this function does not return. It simply exit. * * close() * Closes the device returning it to the original status. * This function always returns. * * kill_power() * Put the UPS into hibernation mode, killing output power. * This function always returns. * * shutdown() * Turn off the UPS completely. * This function always returns. * * read_ups_static_data() * Gets the static data from UPS like the UPS name. * This function always returns. * * read_ups_volatile_data() * Fills UPSINFO with dynamic UPS data. * This function always returns. * This function must lock the UPSINFO structure. * * get_ups_capabilities() * Try to understand what capabilities the UPS is able to perform. * This function always returns. * * check_ups_state() * Check if the UPS changed state. * This function always returns. * This function must lock the UPSINFO structure. * * ups_program_eeprom(ups, command, data) * Commit changes to the internal UPS eeprom. * This function performs the eeprom change command (using data), * then returns. * * ups_generic_entry_point() * This is a generic entry point into the drivers for specific driver * functions called from inside the apcupsd core. * This function always return. * This function must lock the UPSINFO structure. * This function gets a void * that contain data. This pointer can be used * to pass data to the function or to get return values from the function, * depending on the value of "command" and the general design of the specific * command to be executed. * Each driver will have its specific functions and will ignore any * function that does not understand. */ typedef struct upsdriver { /* Data side of the driver structure. */ const char *driver_name; /* Functions side of the driver structure. */ int (*open) (UPSINFO *ups); int (*setup) (UPSINFO *ups); int (*close) (UPSINFO *ups); int (*kill_power) (UPSINFO *ups); int (*shutdown) (UPSINFO *ups); int (*read_ups_static_data) (UPSINFO *ups); int (*read_ups_volatile_data) (UPSINFO *ups); int (*get_ups_capabilities) (UPSINFO *ups); int (*check_ups_state) (UPSINFO *ups); int (*ups_program_eeprom) (UPSINFO *ups, int command, const char *data); int (*ups_entry_point) (UPSINFO *ups, int command, void *data); } UPSDRIVER; /* Some defines that helps code readability. */ #define device_open(ups) \ do { \ if (ups->driver) ups->driver->open(ups); \ } while(0) #define device_setup(ups) \ do { \ if (ups->driver) ups->driver->setup(ups); \ } while(0) #define device_close(ups) \ do { \ if (ups->driver) ups->driver->close(ups); \ } while(0) #define device_kill_power(ups) \ do { \ if (ups->driver) ups->driver->kill_power(ups); \ } while(0) #define device_shutdown(ups) \ do { \ if (ups->driver) { \ if (ups->driver->shutdown) { \ ups->driver->shutdown(ups); \ } else { \ Dmsg1(000, "Power off not supported for %s driver\n", \ ups->driver->driver_name); \ } \ } \ } while(0) #define device_read_static_data(ups) \ do { \ if (ups->driver) ups->driver->read_ups_static_data(ups); \ } while(0) #define device_read_volatile_data(ups) \ do { \ if (ups->driver) ups->driver->read_ups_volatile_data(ups); \ } while(0) #define device_get_capabilities(ups) \ do { \ if (ups->driver) ups->driver->get_ups_capabilities(ups); \ } while(0) #define device_check_state(ups) \ do { \ if (ups->driver) ups->driver->check_ups_state(ups); \ } while(0) #define device_program_eeprom(ups, command, data) \ do { \ if (ups->driver) ups->driver->ups_program_eeprom(ups, command, data); \ } while(0) #define device_entry_point(ups, command, data) \ do { \ if (ups->driver) ups->driver->ups_entry_point(ups, command, data); \ } while(0) /* Now some defines for device_entry_point commands. */ /* Dumb entry points. */ #define DEVICE_CMD_DTR_ENABLE 0x00 #define DEVICE_CMD_DTR_ST_DISABLE 0x01 /* Smart entry points. */ #define DEVICE_CMD_GET_SELFTEST_MSG 0x02 #define DEVICE_CMD_CHECK_SELFTEST 0x03 #define DEVICE_CMD_SET_DUMB_MODE 0x04 /* Support routines. */ const UPSDRIVER *attach_driver(UPSINFO *ups); #endif /*_DRIVERS_H */ apcupsd-3.14.10/include/extern.h0000664000076400007640000002015611617051241015326 0ustar adk0212adk0212/* * extern.h * * Public exports. */ /* * Copyright (C) 2000-2005 Kern Sibbald * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef _EXTERN_H #define _EXTERN_H /* Function Prototypes */ extern UPSINFO myUPS; extern UPSINFO *core_ups; extern char argvalue[MAXSTRING]; extern void (*error_out) (const char *file, int line, const char *fmt, ...); extern void (*error_exit) (const char *fmt, ...); extern void (*error_cleanup) (void); extern UPSCOMMANDS ups_event[]; extern UPSCMDMSG event_msg[]; /* Serial bits */ extern int le_bit; extern int dtr_bit; extern int rts_bit; extern int st_bit; extern int sr_bit; extern int cts_bit; extern int cd_bit; extern int rng_bit; extern int dsr_bit; /* File opened */ extern int flags; extern struct termios newtio; extern int debug_net; /* getopt flags (see apcoptd.c) */ extern int show_version; extern char *cfgfile; extern int configure_ups; extern int update_battery_date; extern int debug_level; extern int rename_ups; extern int terminate_on_powerfail; extern int hibernate_ups; extern int shutdown_ups; extern int dumb_mode_test; extern int go_background; /* In apceeprom.c */ extern int do_eeprom_programming(UPSINFO *ups); /* In apcopt.c */ extern int parse_options(int argc, char *argv[]); /* In apcupsd.c */ extern void apc_thread_terminate(int sig); extern void clean_threads(void); extern void apcupsd_terminate(int sig); extern void clear_files(void); extern void make_pid(void); /* In apcdevice.c */ void setup_device(UPSINFO *ups); extern void setup_serial(UPSINFO *ups); extern void initiate_hibernate(UPSINFO *ups); extern void initiate_shutdown(UPSINFO *ups); extern void save_dumb_status(UPSINFO *ups); extern int check_serial(UPSINFO *ups); extern void prep_device(UPSINFO *ups); extern void do_device(UPSINFO *ups); /* In apcaction.c */ extern void timer_action(int sig); extern void do_action(UPSINFO *ups); extern void generate_event(UPSINFO *ups, int event); /* In apclock.c */ extern int create_lockfile(UPSINFO *ups); extern void delete_lockfile(UPSINFO *ups); /* In apcnet.c */ extern int write_struct_net(int wsocketfd, struct netdata *write_struct, size_t size); extern int read_struct_net(int rsocketfd, struct netdata *read_struct, size_t size); extern void log_struct(struct netdata *logstruct); extern int reconnect_master(UPSINFO *ups, int who); extern int prepare_master(UPSINFO *ups); extern int reconnect_slave(UPSINFO *ups); extern int prepare_slave(UPSINFO *ups); extern void kill_net(UPSINFO *ups); extern void timer_net(int sig); extern void do_net(UPSINFO *ups); extern void timer_slaves(int sig); extern void do_slaves(UPSINFO *ups); /* In apcfile.c */ extern int make_file(UPSINFO *ups, const char *path); extern void make_pid_file(void); /* In apcconfig.c */ extern char APCCONF[APC_FILENAME_MAX]; extern void init_ups_struct(UPSINFO *ups); extern void check_for_config(UPSINFO *ups, char *cfgfile); /* In apcsetup.c */ extern void setup_ups_name(UPSINFO *ups); extern void setup_ups_replace(UPSINFO *ups); extern char *setup_ups_string(UPSINFO *ups, char cmd, char *setting); extern int setup_ups_single(UPSINFO *ups, char cmd, int single); extern int setup_ups_bubble(UPSINFO *ups, char cmd, int setting); extern void setup_ups_sensitivity(UPSINFO *ups); extern void setup_ups_wakeup(UPSINFO *ups); extern void setup_ups_sleep(UPSINFO *ups); extern void setup_ups_lo_xfer(UPSINFO *ups); extern void setup_ups_hi_xfer(UPSINFO *ups); extern void setup_ups_chargepoint(UPSINFO *ups); extern void setup_ups_alarm(UPSINFO *ups); extern void setup_ups_lowbatt_delay(UPSINFO *ups); extern void setup_ups_selftest(UPSINFO *ups); extern const char *get_model_from_oldfwrev(const char *s); extern void get_apc_capabilities(UPSINFO *ups); extern void read_extended(UPSINFO *ups); extern void setup_extended(UPSINFO *ups); /* In apcnis.c */ extern void do_server(UPSINFO *ups); extern int check_wrappers(char *av, int newsock); /* In apcstatus.c */ extern int output_status(UPSINFO *ups, int fd, void s_open(UPSINFO * ups), void s_write(UPSINFO *ups, const char *fmt, ...), int s_close(UPSINFO * ups, int fd)); extern void stat_open(UPSINFO *ups); extern int stat_close(UPSINFO *ups, int fd); extern void stat_print(UPSINFO *ups, const char *fmt, ...); /* In apcevents.c */ extern int trim_eventfile(UPSINFO *ups); extern int output_events(int sockfd, FILE *events_file); /* In apcreports.c */ extern void clear_files(void); extern int log_status(UPSINFO *ups); extern void timer_reports(int sig); extern void do_reports(UPSINFO *ups); /* In apcsmart.c */ extern int apc_enable(UPSINFO *ups); extern int writechar(char a, UPSINFO *ups); extern int getline(char *s, int len, UPSINFO *ups); extern void UPSlinkCheck(UPSINFO *ups); extern char *smart_poll(char cmd, UPSINFO *ups); extern int fillUPS(UPSINFO *ups); /* In apcsignal.c */ extern void init_signals(void (*handler) (int)); extern void init_thread_signals(void); extern void restore_signals(void); /* In newups.c */ extern UPSINFO *new_ups(void); extern UPSINFO *attach_ups(UPSINFO *ups); extern void detach_ups(UPSINFO *ups); extern void destroy_ups(UPSINFO *ups); #define read_lock(ups) _read_lock(__FILE__, __LINE__, (ups)) #define read_unlock(ups) _read_unlock(__FILE__, __LINE__, (ups)) #define write_lock(ups) _write_lock(__FILE__, __LINE__, (ups)) #define write_unlock(ups) _write_unlock(__FILE__, __LINE__, (ups)) #define read_lock(ups) _read_lock(__FILE__, __LINE__, (ups)) extern void _read_lock(const char *file, int line, UPSINFO *ups); extern void _read_unlock(const char *file, int line, UPSINFO *ups); extern void _write_lock(const char *file, int line, UPSINFO *ups); extern void _write_unlock(const char *file, int line, UPSINFO *ups); /* In apcexec.c */ extern int start_thread(UPSINFO *ups, void (*action) (UPSINFO * ups), const char *proctitle, char *argv0); extern int execute_command(UPSINFO *ups, UPSCOMMANDS cmd); extern void wait_for_termination(int serial_pid); /* In apclog.c */ extern void log_event(const UPSINFO *ups, int level, const char *fmt, ...); extern void logf(const char *fmt, ...); extern void hex_dump(int level, void *data, unsigned int len); extern int format_date(time_t timestamp, char *dest, size_t destlen); /* In apcnetlib.c */ extern int net_open(const char *host, char *service, int port); extern void net_close(int sockfd); extern int net_send(int sockfd, const char *buff, int len); extern int net_recv(int sockfd, char *buff, int maxlen); /* In apclist.c */ extern int insertUps(UPSINFO *ups); extern UPSINFO *getNextUps(UPSINFO *ups); extern UPSINFO *getUpsByname(char *name); /* In apcerror.c */ extern void generic_error_out(const char *file, int line, const char *fmt, ...); extern void generic_error_exit(const char *fmt, ...); /* In asys.c */ int avsnprintf(char *str, size_t size, const char *format, va_list ap); int asnprintf(char *str, size_t size, const char *fmt, ...); char *astrncpy(char *dest, const char *src, int maxlen); char *astrncat(char *dest, const char *src, int maxlen); //struct tm *localtime_r(const time_t *timep, struct tm *tm); char *afgets(char *s, int size, FILE *fd); void *amalloc(size_t size); void *arealloc(void *buf, size_t size); void *acalloc(size_t size1, size_t size2); /* In apcwinipc.c */ int winioctl(int fd, int func, int *addr); /* In sleep.c */ #ifndef HAVE_NANOSLEEP int nanosleep(const struct timespec *req, struct timespec *rem); #endif /* * Common interface to the various versions of gethostbyname_r(). * Implemented in gethostname.c. */ struct hostent * gethostname_re (const char *host,struct hostent *hostbuf,char **tmphstbuf,size_t *hstbuflen); #endif /* _EXTERN_H */ apcupsd-3.14.10/include/getopt.h0000664000076400007640000001027007636630454015336 0ustar adk0212adk0212/* Declarations for getopt. Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _GETOPT_H #define _GETOPT_H 1 #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { #if defined (__STDC__) && __STDC__ const char *name; #else char *name; #endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ #define no_argument 0 #define required_argument 1 #define optional_argument 2 #if defined (__STDC__) && __STDC__ extern int getopt(int argc, char *const *argv, const char *shortopts); extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); extern int getopt_long_only (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind, int long_only); #else /* not __STDC__ */ extern int getopt (); extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); #endif /* __STDC__ */ #ifdef __cplusplus } #endif #endif /* _GETOPT_H */ apcupsd-3.14.10/include/md5.h0000775000076400007640000000650410460440307014512 0ustar adk0212adk0212/* Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. L. Peter Deutsch ghost@aladdin.com */ /* $Id: md5.h,v 1.1 2006/07/22 15:14:15 adk0212 Exp $ */ /* Independent implementation of MD5 (RFC 1321). This code implements the MD5 Algorithm defined in RFC 1321, whose text is available at http://www.ietf.org/rfc/rfc1321.txt The code is derived from the text of the RFC, including the test suite (section A.5) but excluding the rest of Appendix A. It does not include any code or documentation that is identified in the RFC as being copyrighted. The original and principal author of md5.h is L. Peter Deutsch . Other authors are noted in the change history that follows (in reverse chronological order): 2002-04-13 lpd Removed support for non-ANSI compilers; removed references to Ghostscript; clarified derivation from RFC 1321; now handles byte order either statically or dynamically. 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); added conditionalization for C++ compilation from Martin Purschke . 1999-05-03 lpd Original version. */ #ifndef md5_INCLUDED # define md5_INCLUDED /* * This package supports both compile-time and run-time determination of CPU * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is * defined as non-zero, the code will be compiled to run only on big-endian * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to * run on either big- or little-endian CPUs, but will run slightly less * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. */ typedef unsigned char md5_byte_t; /* 8-bit byte */ typedef unsigned int md5_word_t; /* 32-bit word */ /* Define the state of the MD5 Algorithm. */ typedef struct md5_state_s { md5_word_t count[2]; /* message length in bits, lsw first */ md5_word_t abcd[4]; /* digest buffer */ md5_byte_t buf[64]; /* accumulate block */ } md5_state_t; #ifdef __cplusplus extern "C" { #endif /* Initialize the algorithm. */ void md5_init(md5_state_t *pms); /* Append a string to the message. */ void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); /* Finish the message and return the digest. */ void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); #ifdef __cplusplus } /* end extern "C" */ #endif #endif /* md5_INCLUDED */ apcupsd-3.14.10/include/nis.h0000664000076400007640000000322410747127742014624 0ustar adk0212adk0212/* * nis.h * * Include file for nis.c definitions */ /* * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ /* * Receive a message from the other end. Each message consists of * two packets. The first is a header that contains the size * of the data that follows in the second packet. * * Returns number of bytes read * Returns 0 on end of file * Returns -1 on error */ int net_recv(int sockfd, char *buff, int maxlen); /* * Send a message over the network. The send consists of * two network packets. The first is sends a short containing * the length of the data packet which follows. * * Returns number of bytes sent * Returns -1 on error */ int net_send(int sockfd, const char *buff, int len); /* * Open a TCP connection to the UPS network server * * Returns -1 on error * Returns socket file descriptor otherwise */ int net_open(const char *host, char *service, int port); /* Close the network connection */ void net_close(int sockfd); /* Wait for and accept a new TCP connection */ int net_accept(int fd, struct sockaddr_in *cli_addr); apcupsd-3.14.10/include/statmgr.h0000664000076400007640000000312011264725352015503 0ustar adk0212adk0212/* * Copyright (C) 2007 Adam Kropelin * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef STATMGR_H #define STATMGR_H #include "apc.h" #include "amutex.h" #include "alist.h" #include "astring.h" #define MAX_STATS 256 #define MAX_DATA 100 class StatMgr { public: StatMgr(const char *host, unsigned short port); ~StatMgr(); bool Update(); astring Get(const char* key); bool GetAll(alist &keys, alist &values); bool GetEvents(alist &events); bool GetSummary(int &battstat, astring &statstr, astring &upsname); private: bool open(); void close(); char *ltrim(char *str); void rtrim(char *str); char *trim(char *str); void lock(); void unlock(); struct keyval { const char *key; const char *value; char data[MAX_DATA]; }; keyval m_stats[MAX_STATS]; astring m_host; unsigned short m_port; int m_socket; amutex m_mutex; }; #endif // STATMGR_H apcupsd-3.14.10/include/struct.h0000664000076400007640000004244711617051355015362 0ustar adk0212adk0212/* * struct.h * * Common apcupsd structures. */ /* * Copyright (C) 2000-2005 Kern Sibbald * Copyright (C) 1996-1999 Andre M. Hedrick * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #ifndef _STRUCT_H #define _STRUCT_H typedef enum { NO_CABLE = 0, /* Default Disable */ // All simple cable types CUSTOM_SIMPLE, /* SIMPLE cable simple */ APC_940_0119A, /* APC cable number 940-0119A */ APC_940_0127A, /* APC cable number 940-0127A */ APC_940_0128A, /* APC cable number 940-0128A */ APC_940_0020B, /* APC cable number 940-0020B */ APC_940_0020C, /* APC cable number 940-0020C identical to 20B */ APC_940_0023A, /* APC cable number 940-0023A */ MAM_CABLE, /* MAM cable for Alfatronic SPS500X */ // These can (apparently) act as smart or simple cables; for our // purposes we treat them as simple cables. APC_940_0095A, /* APC cable number 940-0095A */ APC_940_0095B, /* APC cable number 940-0095B */ APC_940_0095C, /* APC cable number 940-0095C */ // All smart cable types CABLE_SMART, /* SMART cable smart */ // Other cables APC_NET, /* Ethernet Link */ USB_CABLE /* USB cable */ } UpsCable; typedef enum { NO_UPS = 0, /* Default Disable */ DUMB_UPS, /* Dumb UPS driver */ APCSMART_UPS, /* APC Smart UPS (any) */ USB_UPS, /* USB UPS driver */ SNMP_UPS, /* SNMP UPS driver */ NETWORK_UPS, /* NETWORK UPS driver */ TEST_UPS, /* TEST UPS Driver */ PCNET_UPS, /* PCNET UPS Driver */ SNMPLITE_UPS, /* SNMP Lite UPS Driver */ } UpsMode; typedef enum { NO_CLASS = 0, STANDALONE, SHARESLAVE, SHAREMASTER, } ClassMode; typedef enum { NO_SHARE_NET = 0, DISABLE, /* Disable Share or Net UPS */ SHARE, /* ShareUPS Internal */ } ShareNetMode; typedef enum { NO_LOGON = 0, NEVER, /* Disable Setting NoLogon */ TIMEOUT, /* Based on TIMEOUT + 10 percent */ PERCENT, /* Based on PERCENT + 10 percent */ MINUTES, /* Based on MINUTES + 10 percent */ ALWAYS /* Stop All New Login Attempts. but ROOT */ } NoLoginMode; /* List all the internal self tests allowed. */ typedef enum { SMART_TEST_LEDS = 0, SMART_TEST_SELFTEST, SMART_TEST_POWERFAIL, SMART_TEST_CALIBRATION, SMART_CHANGE_NAME, SMART_CHANGE_BATTDATE, SMART_CHANGE_EPROM, SMART_TEST_MAX } SelfTests; typedef enum { XFER_NA = 0, /* Not supported by this UPS */ XFER_NONE, /* No xfer since power on */ XFER_OVERVOLT, /* Utility voltage too high */ XFER_UNDERVOLT, /* Utility voltage too low */ XFER_NOTCHSPIKE, /* Line voltage notch or spike */ XFER_RIPPLE, /* Excessive utility voltage rate of change */ XFER_SELFTEST, /* Auto or manual self test */ XFER_FORCED, /* Forced onto battery by sw command */ XFER_FREQ, /* Input frequency out of range */ XFER_UNKNOWN } LastXferCause; typedef enum { TEST_NA = 0, /* Not supported by this UPS */ TEST_NONE, /* No self test result available */ TEST_FAILED, /* Test failed (reason unknown) */ TEST_WARNING, /* Test passed with warning */ TEST_INPROGRESS, /* Test currently in progress */ TEST_PASSED, /* Test passed */ TEST_FAILCAP, /* Test failed due to insufficient capacity */ TEST_FAILLOAD, /* Test failed due to overload */ TEST_UNKNOWN } SelfTestResult; typedef struct geninfo { const char *name; /* JHNC: name mustn't contain whitespace */ const char *long_name; int type; } GENINFO; /* for static declaration of data */ typedef struct internalgeninfo { char name[MAXSTRING]; /* JHNC: name mustn't contain whitespace */ char long_name[MAXSTRING]; int type; } INTERNALGENINFO; /* for assigning into upsinfo */ class UPSINFO { public: /* Methods */ void clear_battlow() { Status &= ~UPS_battlow; }; void clear_boost() { Status &= ~UPS_boost; }; void clear_calibration() { Status &= ~UPS_calibration; }; void clear_commlost() { Status &= ~UPS_commlost; }; void clear_dev_setup() { Status &= ~UPS_dev_setup; }; void clear_fastpoll() { Status &= ~UPS_fastpoll; }; void clear_onbatt_msg() { Status &= ~UPS_onbatt_msg; }; void clear_onbatt() { Status &= ~UPS_onbatt; }; void clear_online() { Status |= UPS_onbatt; Status &= ~UPS_online; }; void clear_overload() { Status &= ~UPS_overload; }; void clear_plugged() { Status &= ~UPS_plugged; }; void clear_replacebatt() { Status &= ~UPS_replacebatt; }; void clear_shut_btime() { Status &= ~UPS_shut_btime; }; void clear_shutdown() { Status &= ~UPS_shutdown; }; void clear_shut_emerg() { Status &= ~UPS_shut_emerg; }; void clear_shut_load() { Status &= ~UPS_shut_load; }; void clear_shut_ltime() { Status &= ~UPS_shut_ltime; }; void clear_shut_remote() { Status &= ~UPS_shut_remote; }; void clear_slavedown() { Status &= ~UPS_slavedown; }; void clear_slave() { Status &= ~UPS_slave; }; void clear_trim() { Status &= ~UPS_trim; }; void clear_battpresent() {Status &= ~UPS_battpresent; }; void set_battlow() { Status |= UPS_battlow; }; void set_battlow(int val) { if (val) set_battlow(); else clear_battlow(); }; void set_boost() { Status |= UPS_boost; }; void set_boost(int val) { if (val) set_boost(); else clear_boost(); }; void set_calibration() { Status |= UPS_calibration; }; void set_commlost() { Status |= UPS_commlost; }; void set_dev_setup() { Status |= UPS_dev_setup; }; void set_fastpoll() { Status |= UPS_fastpoll; }; void set_onbatt_msg() { Status |= UPS_onbatt_msg; }; void set_onbatt() { Status |= UPS_onbatt; }; void set_online() { Status |= UPS_online; Status &= ~UPS_onbatt; }; void set_online(int val) { if (val) set_online(); else clear_online(); }; void set_overload() { Status |= UPS_overload; }; void set_overload(int val) { if (val) set_overload(); else clear_overload(); }; void set_plugged() { Status |= UPS_plugged; }; void set_replacebatt() { Status |= UPS_replacebatt; }; void set_replacebatt(int val) { if (val) set_replacebatt(); else clear_replacebatt(); }; void set_shut_btime() { Status |= UPS_shut_btime; }; void set_shut_btime(int val) { if (val) set_shut_btime(); else clear_shut_btime(); }; void set_shutdown() { Status |= UPS_shutdown; }; void set_shut_emerg() { Status |= UPS_shut_emerg; }; void set_shut_emerg(int val) { if (val) set_shut_emerg(); else clear_shut_emerg(); }; void set_shut_load() { Status |= UPS_shut_load; }; void set_shut_load(int val) { if (val) set_shut_load(); else clear_shut_load(); }; void set_shut_ltime() { Status |= UPS_shut_ltime; }; void set_shut_ltime(int val) { if (val) set_shut_ltime(); else clear_shut_ltime(); }; void set_shut_remote() { Status |= UPS_shut_remote; }; void set_slavedown() { Status |= UPS_slavedown; }; void set_slavedown(int val) { if (val) set_slavedown(); else clear_slavedown(); }; void set_slave() { Status |= UPS_slave; }; void set_trim() { Status |= UPS_trim; }; void set_trim(int val) { if (val) set_trim(); else clear_trim(); }; void set_battpresent() { Status |= UPS_battpresent; }; void set_battpresent(int val) { if (val) set_battpresent(); else clear_battpresent(); }; bool is_battlow() const { return (Status & UPS_battlow) == UPS_battlow; }; bool is_boost() const { return (Status & UPS_boost) == UPS_boost; }; bool is_calibration() const { return (Status & UPS_calibration) == UPS_calibration; }; bool is_commlost() const { return (Status & UPS_commlost) == UPS_commlost; }; bool is_dev_setup() const { return (Status & UPS_dev_setup) == UPS_dev_setup; }; bool is_fastpoll() const { return (Status & UPS_fastpoll) == UPS_fastpoll; }; bool is_onbatt() const { return (Status & UPS_onbatt) == UPS_onbatt; }; bool is_onbatt_msg() const { return (Status & UPS_onbatt_msg) == UPS_onbatt_msg; }; bool is_online() const { return (Status & UPS_online) == UPS_online; }; bool is_overload() const { return (Status & UPS_overload) == UPS_overload; }; bool is_plugged() const { return (Status & UPS_plugged) == UPS_plugged; }; bool is_replacebatt() const { return (Status & UPS_replacebatt) == UPS_replacebatt; }; bool is_shut_btime() const { return (Status & UPS_shut_btime) == UPS_shut_btime; }; bool is_shutdown() const { return (Status & UPS_shutdown) == UPS_shutdown; }; bool is_shut_emerg() const { return (Status & UPS_shut_emerg) == UPS_shut_emerg; }; bool is_shut_load() const { return (Status & UPS_shut_load) == UPS_shut_load; }; bool is_shut_ltime() const { return (Status & UPS_shut_ltime) == UPS_shut_ltime; }; bool is_shut_remote() const { return (Status & UPS_shut_remote) == UPS_shut_remote; }; bool is_slave() const { return (Status & UPS_slave) == UPS_slave; }; bool is_slavedown() const { return (Status & UPS_slavedown) == UPS_slavedown; }; bool is_trim() const { return (Status & UPS_trim) == UPS_trim; }; bool is_battpresent() const { return (Status & UPS_battpresent) == UPS_battpresent; }; bool chg_battlow() const { return ((Status ^ PrevStatus) & UPS_battlow) == UPS_battlow; }; bool chg_onbatt() const { return ((Status ^ PrevStatus) & UPS_onbatt) == UPS_onbatt; }; bool chg_battpresent() const { return ((Status ^ PrevStatus) & UPS_battpresent) == UPS_battpresent; }; bool chg_shut_remote() const { return ((Status ^ PrevStatus) & UPS_shut_remote) == UPS_shut_remote; }; /* DATA */ int fd; /* UPS device node file descriptor */ /* UPS capability array and codes */ char UPS_Cap[CI_MAXCI + 1]; /* TRUE if UPS has capability */ unsigned int UPS_Cmd[CI_MAXCI + 1]; /* Command or function code */ INTERNALGENINFO cable; /* UPSCABLE directive */ INTERNALGENINFO nologin; /* NOLOGON directive */ INTERNALGENINFO mode; /* UPSTYPE directive */ INTERNALGENINFO upsclass; /* UPSCLASS directive */ INTERNALGENINFO sharenet; /* UPSMODE directive */ int num_execed_children; /* children created in execute_command() */ /* Internal state flags set in response to UPS condition */ time_t ShutDown; /* set when doing shutdown */ time_t SelfTest; /* start time of self test */ time_t LastSelfTest; /* time of last self test */ time_t poll_time; /* last time UPS polled -- fillUPS() */ time_t start_time; /* time apcupsd started */ time_t last_onbatt_time; /* last time on batteries */ time_t last_offbatt_time; /* last time off batteries */ time_t last_time_on_line; time_t last_time_annoy; time_t last_time_nologon; time_t last_time_changeme; time_t last_master_connect_time; /* last time master connected */ time_t start_shut_ltime; time_t start_shut_load; time_t start_shut_lbatt; int num_xfers; /* number of times on batteries */ int cum_time_on_batt; /* total time on batteries since startup */ int wait_time; /* suggested wait time for drivers in * device_check_state() */ /* Items reported by smart UPS */ /* Volatile items -- i.e. they change with the state of the UPS */ char linequal[8]; /* Line quality */ unsigned int reg1; /* register 1 */ unsigned int reg2; /* register 2 */ unsigned int reg3; /* register 3 */ unsigned int dipsw; /* dip switch info */ unsigned int InputPhase; /* The current AC input phase. */ unsigned int OutputPhase; /* The current AC output phase. */ LastXferCause lastxfer; /* Reason for last xfer to battery */ SelfTestResult testresult; /* results of last seft test */ double BattChg; /* remaining UPS charge % */ double LineMin; /* min line voltage seen */ double LineMax; /* max line voltage seen */ double UPSLoad; /* battery load percentage */ double LineFreq; /* line freq. */ double LineVoltage; /* Line Voltage */ double OutputVoltage; /* Output Voltage */ double OutputFreq; /* Output Frequency */ double OutputCurrent; /* Output Current */ double UPSTemp; /* UPS internal temperature */ double BattVoltage; /* Actual Battery voltage -- about 24V */ double LastSTTime; /* hours since last self test -- not yet implemented */ int32_t Status; /* UPS status (Bitmapped) */ int32_t PrevStatus; /* Previous UPS status */ double TimeLeft; /* Est. time UPS can run on batt. */ double humidity; /* Humidity */ double ambtemp; /* Ambient temperature */ char eprom[500]; /* Eprom values */ /* Items reported by smart UPS */ /* Static items that normally do not change during UPS operation */ int NomOutputVoltage; /* Nominal voltage when on batteries */ int NomInputVoltage; /* Nominal input voltage */ int NomPower; /* Nominal power (watts) */ double nombattv; /* Nominal batt. voltage -- not actual */ int extbatts; /* number of external batteries attached */ int badbatts; /* number of bad batteries */ int lotrans; /* min line voltage before using batt. */ int hitrans; /* max line voltage before using batt. */ int rtnpct; /* % batt charge necessary for return */ int dlowbatt; /* low batt warning in mins. */ int dwake; /* wakeup delay seconds */ int dshutd; /* shutdown delay seconds */ char birth[20]; /* manufacture date */ char serial[32]; /* serial number */ char battdat[20]; /* battery installation date */ char selftest[9]; /* selftest interval as ASCII */ char firmrev[20]; /* firmware revision */ char upsname[UPSNAMELEN]; /* UPS internal name */ char upsmodel[MAXSTRING]; /* ups model number */ char sensitivity[8]; /* sensitivity to line fluxuations */ char beepstate[8]; /* when to beep on power failure. */ /* Items specified from config file */ int annoy; int maxtime; int annoydelay; /* delay before annoying users with logoff request */ int onbattdelay; /* delay before reacting to a power failure */ int killdelay; /* delay after pwrfail before issuing UPS shutdown */ int nologin_time; int nologin_file; int stattime; int datatime; int sysfac; int polltime; /* Time interval to poll the UPS */ int percent; /* shutdown when batt % less than this */ int runtime; /* shutdown when runtime less than this */ char nisip[64]; /* IP for NIS */ int statusport; /* NIS port */ int netstats; /* turn on/off network status */ int logstats; /* turn on/off logging of status info */ char device[MAXSTRING]; /* device name in use */ char configfile[APC_FILENAME_MAX]; /* config filename */ char statfile[APC_FILENAME_MAX]; /* status filename */ char eventfile[APC_FILENAME_MAX]; /* temp events file */ int eventfilemax; /* max size of eventfile in kilobytes */ int event_fd; /* fd for eventfile */ char master_name[APC_FILENAME_MAX]; char lockpath[APC_FILENAME_MAX]; int lockfile; char scriptdir[APC_FILENAME_MAX]; /* Path to apccontrol dir */ char pwrfailpath[APC_FILENAME_MAX]; /* Path to powerfail flag file dir */ char nologinpath[APC_FILENAME_MAX]; /* Path to nologin dir */ int ChangeBattCounter; /* For UPS_REPLACEBATT, see apcaction.c */ pthread_mutex_t mutex; int refcnt; /* thread attach count */ const struct upsdriver *driver; /* UPS driver for this UPSINFO */ void *driver_internal_data; /* Driver private data */ }; /*These are needed for commands executed in action.c */ typedef struct { const char *command; int pid; } UPSCOMMANDS; typedef struct s_cmd_msg { int level; const char *msg; } UPSCMDMSG; #endif /* _STRUCT_H */ apcupsd-3.14.10/include/tcpd.h0000664000076400007640000002203310016704610014744 0ustar adk0212adk0212 /* * @(#) tcpd.h 1.5 96/03/19 16:22:24 * * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. */ /* * This version of the file has been hacked over by * Kern Sibbald to make it compatible with C++ for * the few functions that Bacula uses. 19 April 2002 * It now compiles with C++ but remains untested. * A correct fix would require significantly more work. */ #ifdef __cplusplus extern "C" { #endif /* Structure to describe one communications endpoint. */ #define STRING_LENGTH 128 /* hosts, users, processes */ struct host_info { char name[STRING_LENGTH]; /* access via eval_hostname(host) */ char addr[STRING_LENGTH]; /* access via eval_hostaddr(host) */ struct sockaddr_in *sin; /* socket address or 0 */ struct t_unitdata *unit; /* TLI transport address or 0 */ struct request_info *request; /* for shared information */ }; /* Structure to describe what we know about a service request. */ struct request_info { int fd; /* socket handle */ char user[STRING_LENGTH]; /* access via eval_user(request) */ char daemon[STRING_LENGTH]; /* access via eval_daemon(request) */ char pid[10]; /* access via eval_pid(request) */ struct host_info client[1]; /* client endpoint info */ struct host_info server[1]; /* server endpoint info */ void (*sink) (void); /* datagram sink function or 0 */ void (*hostname) (void); /* address to printable hostname */ void (*hostaddr) (void); /* address to printable address */ void (*cleanup) (void); /* cleanup function or 0 */ struct netconfig *config; /* netdir handle */ }; /* Common string operations. Less clutter should be more readable. */ #define STRN_CPY(d,s,l) { strncpy((d),(s),(l)); (d)[(l)-1] = 0; } #define STRN_EQ(x,y,l) (strncasecmp((x),(y),(l)) == 0) #define STRN_NE(x,y,l) (strncasecmp((x),(y),(l)) != 0) #define STR_EQ(x,y) (strcasecmp((x),(y)) == 0) #define STR_NE(x,y) (strcasecmp((x),(y)) != 0) /* * Initially, all above strings have the empty value. Information that * cannot be determined at runtime is set to "unknown", so that we can * distinguish between `unavailable' and `not yet looked up'. A hostname * that we do not believe in is set to "paranoid". */ #define STRING_UNKNOWN "unknown" /* lookup failed */ #define STRING_PARANOID "paranoid" /* hostname conflict */ extern char unknown[]; extern char paranoid[]; #define HOSTNAME_KNOWN(s) (STR_NE((s),unknown) && STR_NE((s),paranoid)) #define NOT_INADDR(s) (s[strspn(s,"01234567890./")] != 0) /* Global functions. */ #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT) extern void fromhost(); /* get/validate client host info */ #else #define fromhost sock_host /* no TLI support needed */ #endif extern int hosts_access(struct request_info *); /* access control */ extern void shell_cmd(void); /* execute shell command */ extern char *percent_x(void); /* do % expansion */ extern void rfc931(void); /* client name from RFC 931 daemon */ extern void clean_exit(void); /* clean up and exit */ extern void refuse(void); /* clean up and exit */ extern char *xgets(void); /* fgets() on steroids */ extern char *split_at(void); /* strchr() and split */ extern unsigned long dot_quad_addr(void); /* restricted inet_addr() */ /* Global variables. */ extern int allow_severity; /* for connection logging */ extern int deny_severity; /* for connection logging */ extern char *hosts_allow_table; /* for verification mode redirection */ extern char *hosts_deny_table; /* for verification mode redirection */ extern int hosts_access_verbose; /* for verbose matching mode */ extern int rfc931_timeout; /* user lookup timeout */ extern int resident; /* > 0 if resident process */ /* * Routines for controlled initialization and update of request structure * attributes. Each attribute has its own key. */ #ifdef __STDC__ extern struct request_info *request_init(struct request_info *,...); extern struct request_info *request_set(struct request_info *,...); #else extern struct request_info *request_init(); /* initialize request */ extern struct request_info *request_set(); /* update request structure */ #endif #define RQ_FILE 1 /* file descriptor */ #define RQ_DAEMON 2 /* server process (argv[0]) */ #define RQ_USER 3 /* client user name */ #define RQ_CLIENT_NAME 4 /* client host name */ #define RQ_CLIENT_ADDR 5 /* client host address */ #define RQ_CLIENT_SIN 6 /* client endpoint (internal) */ #define RQ_SERVER_NAME 7 /* server host name */ #define RQ_SERVER_ADDR 8 /* server host address */ #define RQ_SERVER_SIN 9 /* server endpoint (internal) */ /* * Routines for delayed evaluation of request attributes. Each attribute * type has its own access method. The trivial ones are implemented by * macros. The other ones are wrappers around the transport-specific host * name, address, and client user lookup methods. The request_info and * host_info structures serve as caches for the lookup results. */ extern char *eval_user(void); /* client user */ extern char *eval_hostname(void); /* printable hostname */ extern char *eval_hostaddr(void); /* printable host address */ extern char *eval_hostinfo(void); /* host name or address */ extern char *eval_client(struct request_info *); /* whatever is available */ extern char *eval_server(void); /* whatever is available */ #define eval_daemon(r) ((r)->daemon) /* daemon process name */ #define eval_pid(r) ((r)->pid) /* process id */ /* Socket-specific methods, including DNS hostname lookups. */ extern void sock_host(struct request_info *); extern void sock_hostname(void); /* translate address to hostname */ extern void sock_hostaddr(void); /* address to printable address */ #define sock_methods(r) \ { (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; } /* The System V Transport-Level Interface (TLI) interface. */ #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT) extern void tli_host(); /* look up endpoint addresses etc. */ #endif /* * Problem reporting interface. Additional file/line context is reported * when available. The jump buffer (tcpd_buf) is not declared here, or * everyone would have to include . */ #ifdef __STDC__ extern void tcpd_warn(char *, ...); /* report problem and proceed */ extern void tcpd_jump(char *, ...); /* report problem and jump */ #else extern void tcpd_warn(); extern void tcpd_jump(); #endif struct tcpd_context { char *file; /* current file */ int line; /* current line */ }; extern struct tcpd_context tcpd_context; /* * While processing access control rules, error conditions are handled by * jumping back into the hosts_access() routine. This is cleaner than * checking the return value of each and every silly little function. The * (-1) returns are here because zero is already taken by longjmp(). */ #define AC_PERMIT 1 /* permit access */ #define AC_DENY (-1) /* deny_access */ #define AC_ERROR AC_DENY /* XXX */ /* * In verification mode an option function should just say what it would do, * instead of really doing it. An option function that would not return * should clear the dry_run flag to inform the caller of this unusual * behavior. */ extern void process_options(void); /* execute options */ extern int dry_run; /* verification flag */ /* Bug workarounds. */ #ifdef INET_ADDR_BUG /* inet_addr() returns struct */ #define inet_addr fix_inet_addr extern long fix_inet_addr(void); #endif #ifdef BROKEN_FGETS /* partial reads from sockets */ #define fgets fix_fgets extern char *fix_fgets(void); #endif #ifdef RECVFROM_BUG /* no address family info */ #define recvfrom fix_recvfrom extern int fix_recvfrom(void); #endif #ifdef GETPEERNAME_BUG /* claims success with UDP */ #define getpeername fix_getpeername extern int fix_getpeername(void); #endif #ifdef SOLARIS_24_GETHOSTBYNAME_BUG /* lists addresses as aliases */ #define gethostbyname fix_gethostbyname extern struct hostent *fix_gethostbyname(void); #endif #ifdef USE_STRSEP /* libc calls strtok(void) */ #define strtok fix_strtok extern char *fix_strtok(void); #endif #ifdef LIBC_CALLS_STRTOK /* libc calls strtok() */ #define strtok my_strtok extern char *my_strtok(void); #endif #ifdef __cplusplus } #endif apcupsd-3.14.10/include/version.h0000664000076400007640000000024711634011267015510 0ustar adk0212adk0212#define DEBUG 1 #define VERSION "3.14.10" #define ADATE "13 September 2011" #define APCUPSD_RELEASE VERSION #ifndef APCUPSD_HOST # define APCUPSD_HOST HOST #endif apcupsd-3.14.10/platforms/0000775000076400007640000000000011634011374014232 5ustar adk0212adk0212apcupsd-3.14.10/platforms/alpha/0000775000076400007640000000000011634011372015315 5ustar adk0212adk0212apcupsd-3.14.10/platforms/alpha/Makefile0000664000076400007640000000343311020615542016756 0ustar adk0212adk0212topdir:=../.. SUBDIRS = include $(topdir)/autoconf/targets.mak all-install: install-alpha all-uninstall: uninstall-alpha install-alpha: $(call DISTINST,alpha) $(call MKDIR,/sbin/init.d) $(call INSTDATA,744,apcupsd,/sbin/init.d/apcupsd) $(call MKDIR,/sbin/rc2.d) $(call SYMLINK,../init.d/apcupsd,/sbin/rc2.d/K56apcupsd) $(call SYMLINK,../init.d/apcupsd,/sbin/rc2.d/S56apcupsd) $(call MKDIR,/sbin/rc3.d) $(call SYMLINK,../init.d/apcupsd,/sbin/rc3.d/K56apcupsd) $(call SYMLINK,../init.d/apcupsd,/sbin/rc3.d/S56apcupsd) # save old halt script $(call COPY,/sbin/rc0,/sbin/rc0.old) # insert apcupsd callout into halt script @echo " AWK " $(DESTDIR)/sbin/rc0 $(V)awk -f awkhaltprog $(DESTDIR)/sbin/rc0.old >$(DESTDIR)/sbin/rc0 $(V)chmod 744 $(DESTDIR)/sbin/rc0 @echo "=================================================" @echo " " @echo "apcupsd script installation for the Alpha $(DISTVER) complete." @echo " " @echo "You should now edit /etc/apcupsd/apcupsd.conf to correspond" @echo "to your setup then start the apcupsd daemon with:" @echo " " @echo "/sbin/init.d/apcupsd start" @echo " " @echo "thereafter when you reboot, it will be stopped and started" @echo "automatically." @echo " " @echo "Please check that your halt script in:" @echo " /sbin/rc0" @echo "was properly updated (see installation section of manual)" @echo " " @echo "=================================================" uninstall-alpha: $(call DISTUNINST,alpha) -$(call UNINST,/sbin/rc2.d/K56apcupsd) -$(call UNINST,/sbin/rc2.d/S56apcupsd) -$(call UNINST,/sbin/rc3.d/K56apcupsd) -$(call UNINST,/sbin/rc3.d/S56apcupsd) -$(call UNINST,/sbin/init.d/apcupsd) $(call COPY,/sbin/rc0,/sbin/rc0.old) $(V)grep -v "###apcupsd###" $(DESTDIR)/sbin/rc0.old >$(DESTDIR)/sbin/rc0 $(V)chmod 744 $(DESTDIR)/sbin/rc0 apcupsd-3.14.10/platforms/alpha/apcupsd.in0000664000076400007640000000174707474703416017333 0ustar adk0212adk0212#! /bin/sh # # apcupsd This shell script takes care of starting and stopping # the apcupsd UPS monitoring daemon. # # description: apcupsd monitors power and takes action if necessary # APCPID=@PIDDIR@/apcupsd.pid return=" Suceeded" failed=" Failed" case "$1" in start) rm -f @PWRFAILDIR@/powerfail rm -f @nologdir@/nologin echo -n "Starting UPS monitoring:" @sbindir@/apcupsd -f @sysconfdir@/apcupsd.conf || return=$failed echo "$return" ;; stop) echo -n "Shutting down UPS monitoring:" if [ -f $APCPID ]; then kill `cat $APCPID` || return=$failed rm -f $APCPID else return=$failed fi echo "$return" rm -f $APCPID ;; restart) $0 stop sleep 15 $0 start ;; status) @sbindir@/apcaccess status ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 ;; esac exit 0 apcupsd-3.14.10/platforms/alpha/awkhaltprog.in0000664000076400007640000000205007474703417020204 0ustar adk0212adk0212# # Awk program to insert the necessary apcupsd script in # to a halt script. # # Suff left over from a previous apcupsd, remove it /^# See if this is a powerfail situation\./ { do { getline } while (length($0) != 0) } # We insert our code just before this line /^# Init single-user state if shutdown/ { print "# See if this is a powerfail situation. # ###apcupsd###" print "if [ -f @PWRFAILDIR@/powerfail ]; then # ###apcupsd###" print " echo # ###apcupsd###" print " echo \"APCUPSD will now power off the UPS\" # ###apcupsd###" print " echo # ###apcupsd###" print " @sysconfdir@/apccontrol killpower # ###apcupsd###" print " echo # ###apcupsd###" print " echo \"Please ensure that the UPS has powered off before rebooting\" # ###apcupsd###" print " echo \"Otherwise, the UPS may cut the power during the reboot!!!\" # ###apcupsd###" print " echo # ###apcupsd###" print "fi # ###apcupsd###" print "" } # everything else is duplicated { print } apcupsd-3.14.10/platforms/80-apcupsd-ups-policy.fdi0000664000076400007640000000107010752435160020705 0ustar adk0212adk0212 hald-addon-hid-ups apcupsd-3.14.10/platforms/Makefile0000775000076400007640000000121411011577113015670 0ustar adk0212adk0212.NOTPARALLEL: topdir:=.. SUBDIRS = etc $(DISTDIR) include $(topdir)/autoconf/targets.mak all-install: install-platform all-uninstall: uninstall-platform install-platform: $(call MKDIR,$(sysconfdir)) $(if $(wildcard ./$(DISTNAME)/apccontrol), \ $(call INSTORIG,744,$(DISTNAME)/apccontrol,$(sysconfdir)), \ $(call INSTORIG,744,apccontrol,$(sysconfdir))) $(if $(HALPOLICYDIR),$(call MKDIR,$(HALPOLICYDIR))) $(if $(HALPOLICYDIR),$(call INSTDATA,644,80-apcupsd-ups-policy.fdi,$(HALPOLICYDIR))) uninstall-platform: $(call UNINST,$(sysconfdir)/apccontrol) $(if $(HALPOLICYDIR),$(call UNINST,$(HALPOLICYDIR)/80-apcupsd-ups-policy.fdi)) apcupsd-3.14.10/platforms/apccontrol.in0000664000076400007640000000745511265717231016746 0ustar adk0212adk0212#!@SCRIPTSHELL@ # # Copyright (C) 1999-2002 Riccardo Facchetti # # for apcupsd release @VERSION@ (@DATE@) - @DISTNAME@ # # @configure_input@ # # Note, this is a generic file that can be used by most # systems. If a particular system needs to have something # special, start with this file, and put a copy in the # platform subdirectory. # # # These variables are needed for set up the autoconf other variables. # prefix=@prefix@ exec_prefix=@exec_prefix@ APCPID=@PIDDIR@/apcupsd.pid APCUPSD=@sbindir@/apcupsd SHUTDOWN=@SHUTDOWN@ SCRIPTSHELL=@SCRIPTSHELL@ SCRIPTDIR=@sysconfdir@ WALL=wall # # Concatenate all output from this script to the events file # Note, the following kills the script in a power fail situation # where the disks are mounted read-only. # exec >>@LOGDIR@/apcupsd.events 2>&1 # # This piece is to substitute the default behaviour with your own script, # perl, or C program. # You can customize every single command creating an executable file (may be a # script or a compiled program) and calling it the same as the $1 parameter # passed by apcupsd to this script. # # After executing your script, apccontrol continues with the default action. # If you do not want apccontrol to continue, exit your script with exit # code 99. E.g. "exit 99". # # WARNING: the apccontrol file will be overwritten every time you update your # apcupsd, doing `make install'. Your own customized scripts will _not_ be # overwritten. If you wish to make changes to this file (discouraged), you # should change apccontrol.sh.in and then rerun the configure process. # if [ -f ${SCRIPTDIR}/${1} -a -x ${SCRIPTDIR}/${1} ] then ${SCRIPTDIR}/${1} ${2} ${3} ${4} # exit code 99 means he does not want us to do default action if [ $? = 99 ] ; then exit 0 fi fi case "$1" in killpower) echo "Apccontrol doing: ${APCUPSD} --killpower on UPS ${2}" | ${WALL} sleep 10 ${APCUPSD} --killpower echo "Apccontrol has done: ${APCUPSD} --killpower on UPS ${2}" | ${WALL} ;; commfailure) echo "Warning communications lost with UPS ${2}" | ${WALL} ;; commok) echo "Communications restored with UPS ${2}" | ${WALL} ;; # # powerout, onbattery, offbattery, mainsback events occur # in that order. # powerout) ;; onbattery) echo "Power failure on UPS ${2}. Running on batteries." | ${WALL} ;; offbattery) echo "Power has returned on UPS ${2}..." | ${WALL} ;; mainsback) if [ -f @PWRFAILDIR@/powerfail ] ; then printf "Continuing with shutdown." | ${WALL} fi ;; failing) echo "Battery power exhaused on UPS ${2}. Doing shutdown." | ${WALL} ;; timeout) echo "Battery time limit exceeded on UPS ${2}. Doing shutdown." | ${WALL} ;; loadlimit) echo "Remaining battery charge below limit on UPS ${2}. Doing shutdown." | ${WALL} ;; runlimit) echo "Remaining battery runtime below limit on UPS ${2}. Doing shutdown." | ${WALL} ;; doreboot) echo "UPS ${2} initiating Reboot Sequence" | ${WALL} ${SHUTDOWN} -r now "apcupsd UPS ${2} initiated reboot" ;; doshutdown) echo "UPS ${2} initiated Shutdown Sequence" | ${WALL} ${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown" ;; annoyme) echo "Power problems with UPS ${2}. Please logoff." | ${WALL} ;; emergency) echo "Emergency Shutdown. Possible battery failure on UPS ${2}." | ${WALL} ;; changeme) echo "Emergency! Batteries have failed on UPS ${2}. Change them NOW" | ${WALL} ;; remotedown) echo "Remote Shutdown. Beginning Shutdown Sequence." | ${WALL} ;; startselftest) ;; endselftest) ;; battdetach) ;; battattach) ;; *) echo "Usage: ${0##*/} command" echo " warning: this script is intended to be launched by" echo " apcupsd and should never be launched by users." exit 1 ;; esac apcupsd-3.14.10/platforms/contrib-rpm/0000775000076400007640000000000011634011372016464 5ustar adk0212adk0212apcupsd-3.14.10/platforms/contrib-rpm/build_rpm.sh0000775000076400007640000000601710626336742021017 0ustar adk0212adk0212#!/bin/bash # shell script to build apcupsd rpm release # copy this script into a working directory with the src rpm to build and execute # 19 Aug 2006 D. Scott Barninger # licensed under GPL-v2 # signing rpms # Make sure you have a .rpmmacros file in your home directory containing the following: # # %_signature gpg # %_gpg_name Your Name # # the %_gpg_name information must match your key # usage: ./build_rpm.sh ########################################################################################### # script configuration section VERSION=3.13.12 RELEASE=1 # build platform for spec # set to one of rh7,rh8,rh9,fedora_core,rhel3,rhel4,rhel5,suse,mdk PLATFORM=suse # platform designator for file names # for RedHat/Fedora set to one of rh7,rh8,rh9,fc1,fc3,fc4,fc5 OR # for RHEL3/clones set to el3 OR # for RHEL4/clones set to el4 OR # for RHEL5/clones set to el5 OR # for SuSE set to su90, su91, su92, su100 or su101 OR # for Mandrake set to 101mdk or 20060mdk FILENAME=su100 # enter your name and email address here PACKAGER="Your Name " # enter the full path to your RPMS output directory RPMDIR=/usr/src/packages/RPMS/i586 # enter your arch string here (i386, i586, i686, x86_64) ARCH=i586 # if the src rpm is not in the current working directory enter the directory location # with trailing slash where it is found. SRPMDIR= # set to 1 to sign packages, 0 not to sign if you want to sign on another machine. SIGN=1 # set to 1 to build gapcmon package (requires Gtk2 >= 2.4) or 0 to not build GAPCMON=1 # to override your language shell variable uncomment and edit this # export LANG=en_US.UTF-8 # Make no changes below this point without consensus ############################################################################################ SRPM=${SRPMDIR}apcupsd-$VERSION-$RELEASE.src.rpm echo Building packages for "$PLATFORM"... sleep 2 if [ "$GAPCMON" = "1" ]; then rpmbuild --rebuild --define "build_${PLATFORM} 1" \ --define "contrib_packager ${PACKAGER}" \ --define "build_snmp 1" \ --define "build_gapcmon 1" ${SRPM} fi if [ "$GAPCMON" = "0" ]; then rpmbuild --rebuild --define "build_${PLATFORM} 1" \ --define "build_snmp 1" \ --define "contrib_packager ${PACKAGER}" ${SRPM} fi # delete any debuginfo packages built rm -f ${RPMDIR}/apcupsd*debug* # copy files to cwd and rename files to final upload names mv -f ${RPMDIR}/apcupsd-${VERSION}-${RELEASE}.${ARCH}.rpm \ ./apcupsd-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm mv -f ${RPMDIR}/apcupsd-multimon-${VERSION}-${RELEASE}.${ARCH}.rpm \ ./apcupsd-multimon-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm mv -f ${RPMDIR}/apcupsd-gapcmon-${VERSION}-${RELEASE}.${ARCH}.rpm \ ./apcupsd-gapcmon-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm # now sign the packages if [ "$SIGN" = "1" ]; then echo Ready to sign packages...; sleep 2; rpm --addsign ./*.rpm; fi echo echo Finished. echo ls # changelog # 19 Aug 2006 initial release # 21 Jan 2007 add new gapcmon build switch # 27 Jan 2007 add new snmp build switch # 27 May 2007 add rhel5 apcupsd-3.14.10/platforms/contrib-rpm/README0000664000076400007640000000554110471720061017351 0ustar adk0212adk0212README file for apcupsd third party rpm contributors Sat Aug 19 2006 D. Scott Barninger This document outlines the procedures to create rpm packages for apcupsd for platforms supported in the rpm spec file but not published on sourceforge. Contributors wishing to build and supply such rpm packages for release on the sourceforge project page should read this documentation. Contributors should contact either Adam Kropelin or Scott Barninger . The general requirements to have contrib rpm packages published on the project page are: 1. Packages must be created using the current released source rpm and the shell script build_rpm.sh in this directory. 2. The packager must sign all rpm packages with his/her personal gpg key and supply a copy of the public key as both a text file and as an rpm using the spec file rpmkey.spec in this directory. 3. No modifications to either the apcupsd source code or spec file are permitted without consulting the project admins. 4. There will be only one sanctioned packager for a given distribution. 5. Contributors who submit two or more successful releases may be given release permissions to release their files directly to sourceforge. Prior to that you will need to coordinate the upload of your files to sourceforge with Adam or Scott to get them posted to the project page. How to create an rpmkey package: 1. Create a plaintext copy of your gpg public key in a file named yourname.asc where yourname is in the form first initial and last name, ie. sbarninger.asc 2. Edit the rpmkey.spec file and edit the line %define pubkeyname yourname replacing yourname with your name as in step 1 above. 3. Edit the rpmkey.spec file and edit the line Packager: Your Name inserting your name and email information. 4. Copy your key file to your SOURCES directory and the spec file to your SPECS directory and create an rpm package. 5. Both the key text file and the rpm will be published on sourceforge in your release package rpms-contrib-yourname. How to build a release: 1. Copy the file build_rpm.sh to a temporary working directory and open it in a text editor. Examine and edit the configuration section of the script to match your platform and build options. Set permissions on the script to 755. 3. Download the srpm you wish to build to the same directory. 4. Execute the script by ./build_rpm.sh The script will build all the necessary packages, move them into the current working directory, rename them for your platform, and sign them with your key. Note: you must have a file named .rpmmacros in your home directory containing at least the following 2 lines: %_signature gpg %_gpg_name Your Name The name and email information in the above line must correspond to the information in the key used to sign the packages when you generated the key. apcupsd-3.14.10/platforms/contrib-rpm/rpmkey.spec0000664000076400007640000000206610471720062020654 0ustar adk0212adk0212# rpm public key package # # # replace the string yourname with your name # first initial and lastname, ie. sbarninger %define pubkeyname yourname # replace below with your name and email address Packager: Your Name Summary: The %{pubkeyname} rpm public key Name: rpmkey-%{pubkeyname} Version: 0.1 Release: 1 License: GPL v2 Group: System/Packages Source0: %{pubkeyname}.asc BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-root %define gpgkeypath /etc/apcupsd/pubkeys %description The %{pubkeyname} rpm public key. If you trust %{pubkeyname} component and you want to import this key to the RPM database, then install this RPM. After installing this package you may import the key into your rpm database, as root: rpm --import %{gpgkeypath}/%{pubkeyname}.asc %prep %setup -c -T a1 %build %install mkdir -p %{buildroot}%{gpgkeypath} cp -a %{SOURCE0} %{buildroot}%{gpgkeypath}/ %files %defattr(-, root, root) %{gpgkeypath}/%{pubkeyname}.asc %changelog * Sat Aug 19 2006 D. Scott Barninger IFPkgFlagRestartAction RecommendedRestart apcupsd-3.14.10/platforms/darwin/ApcupsdDaemon.postflight0000775000076400007640000000121411253257246022356 0ustar adk0212adk0212#!/bin/sh # Ensure kext cache is rebuilt touch /System/Library/Extensions if [ -f /etc/apcupsd/apcupsd.conf.SAVE ] ; then # Appears to be an upgrade, so move user's original apcupsd.conf # back into place and save new one as apcupsd.conf.new. mv /etc/apcupsd/apcupsd.conf /etc/apcupsd/apcupsd.conf.new mv /etc/apcupsd/apcupsd.conf.SAVE /etc/apcupsd/apcupsd.conf else # Looks like a new install, so open apcupsd.conf in an editor # along with a message describing what to do. open -t /etc/apcupsd/apcupsd.conf echo "Please edit apcupsd.conf as appropriate for your UPS and save it before rebooting." > /tmp/inst.txt open -t /tmp/inst.txt fi apcupsd-3.14.10/platforms/darwin/ApcupsdDaemon.preflight0000775000076400007640000000026111253257246022160 0ustar adk0212adk0212#!/bin/sh # Preserve apcupsd.conf, if it already exists (upgrade) if [ -f /etc/apcupsd/apcupsd.conf ] ; then cp -p /etc/apcupsd/apcupsd.conf /etc/apcupsd/apcupsd.conf.SAVE fi apcupsd-3.14.10/platforms/darwin/Info.plist0000664000076400007640000000740411630225671017476 0ustar adk0212adk0212 CFBundleDevelopmentRegion English CFBundleIconFile CFBundleIdentifier com.apcupsd.driver.dummy CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType KEXT CFBundleSignature ???? CFBundleVersion 1.0.0d1 IOKitPersonalities APC Uninterruptible Power Supply CFBundleIdentifier com.apple.kpi.iokit IOClass IOService IOProviderClass IOUSBInterface bConfigurationValue 1 bInterfaceNumber 0 idProduct 2 idVendor 1309 APC9620 Legacy Communications Card CFBundleIdentifier com.apple.kpi.iokit IOClass IOService IOProviderClass IOUSBInterface bConfigurationValue 1 bInterfaceNumber 0 idProduct 3 idVendor 1309 APC9620 Legacy Communications Card (proto1) CFBundleIdentifier com.apple.kpi.iokit IOClass IOService IOProviderClass IOUSBInterface bConfigurationValue 1 bInterfaceNumber 0 idProduct 1 idVendor 1309 APC9620 Legacy Communications Card (proto2) CFBundleIdentifier com.apple.kpi.iokit IOClass IOService IOProviderClass IOUSBInterface bConfigurationValue 1 bInterfaceNumber 0 idProduct 65535 idVendor 1309 SMX750 Microlink CFBundleIdentifier com.apple.kpi.iokit IOClass IOService IOProviderClass IOUSBInterface bConfigurationValue 1 bInterfaceNumber 0 idProduct 5 idVendor 1309 OSBundleLibraries com.apple.iokit.IOUSBFamily 1.8 apcupsd-3.14.10/platforms/darwin/Makefile0000664000076400007640000001145211616624222017163 0ustar adk0212adk0212topdir:=../.. SUBDIRS = include $(topdir)/autoconf/targets.mak # PackageMaker variables PACKAGEMAKER=/Developer/usr/bin/packagemaker PKGROOT=/tmp/apcupsd-pkg all-install: install-darwin install-$(USBDRV) all-uninstall: uninstall-darwin install-darwin: $(call DISTINST,Darwin Mac OS X) $(call MKDIR,/Library/StartupItems/apcupsd) $(call INSTDATA,744,apcupsd,/Library/StartupItems/apcupsd) $(call INSTDATA,444,StartupParameters.plist,/Library/StartupItems/apcupsd) -$(V)chown root:wheel $(DESTDIR)/Library/StartupItems/apcupsd -$(V)chown root:wheel $(DESTDIR)/Library/StartupItems/apcupsd/apcupsd -$(V)chown root:wheel $(DESTDIR)/Library/StartupItems/apcupsd/StartupParameters.plist $(call INSTDATA,755,apcupsd-uninstall,/sbin) @echo "=================================================" @echo " " @echo "apcupsd script installation for MacOS X (Darwin) complete." @echo " " @echo "You should now edit $(DESTDIR)/$(sysconfdir)/apcupsd.conf to correspond" @echo "to your setup then start the apcupsd daemon with:" @echo " " @echo " SystemStarter start \"APC UPS monitor\"" @echo " " @echo "Thereafter when you reboot, it will be stopped and started" @echo "automatically." @echo " " @if [ -f $(DESTDIR)/$(sysconfdir)/apcupsd ] ; then \ echo "WARNING: Old startup script $(DESTDIR)/$(sysconfdir)/apcupsd was renamed to"; \ echo " $(DESTDIR)/$(sysconfdir)/apcupsd.obsolete. Be sure to remove any"; \ echo " references to that script that you may have manually"; \ echo " added to the system init scripts. Apcupsd startup is"; \ echo " now managed via SystemStarter, making the old script"; \ echo " obsolete."; \ echo " "; \ mv $(DESTDIR)/$(sysconfdir)/apcupsd $(DESTDIR)/$(sysconfdir)/apcupsd.obsolete; \ fi @echo "=================================================" install-usb: $(call MKDIR,/System/Library/Extensions/ApcupsdDummy.kext/Contents) -$(V)chown root:wheel $(DESTDIR)/System/Library/Extensions/ApcupsdDummy.kext -$(V)chown root:wheel $(DESTDIR)/System/Library/Extensions/ApcupsdDummy.kext/Contents $(V)chmod 755 $(DESTDIR)/System/Library/Extensions/ApcupsdDummy.kext $(V)chmod 755 $(DESTDIR)/System/Library/Extensions/ApcupsdDummy.kext/Contents $(call INSTDATA,644,Info.plist,/System/Library/Extensions/ApcupsdDummy.kext/Contents) -$(V)chown root:wheel $(DESTDIR)/System/Library/Extensions/ApcupsdDummy.kext/Contents/Info.plist $(call UNINST,/System/Library/Extensions.mkext) $(call UNINST,/System/Library/Extensions.kextcache) @echo "=================================================" @echo " " @echo "Driver installation complete." @echo "You must REBOOT before running apcupsd." @echo " " @echo "=================================================" uninstall-darwin: $(call DISTUNINST,Darwin Mac OS X) -$(call UNINST,/Library/StartupItems/apcupsd) -$(call UNINST,/System/Library/Extensions/ApcupsdDummy.kext) -$(call UNINST,/System/Library/Extensions.mkext) -$(call UNINST,/System/Library/Extensions.kextcache) -$(call UNINST,/sbin/apcupsd-uninstall) @echo "=================================================" @echo " " @echo "Please REBOOT to complete uninstall." @echo " " @echo "=================================================" # Note removal of 'TokenDefinitions.plist' from package below is to prevent # automatic relocation of apcagent.app at install time. This is a workaround # for a PackageMaker bug. apcupsd.pkg: rm -rf $(PKGROOT) mkdir $(PKGROOT) mkdir $(PKGROOT)/Apcupsd.Resources mkdir $(PKGROOT)/Apcupsd.Scripts mkdir $(PKGROOT)/Apcupsd.Root mkdir $(PKGROOT)/Apcupsd ( cd $(topdir) && DESTDIR=$(PKGROOT)/Apcupsd.Root make install ) cp $(topdir)/ReleaseNotes $(PKGROOT)/Apcupsd.Resources/ReadMe.txt cp $(topdir)/COPYING $(PKGROOT)/Apcupsd.Resources/License.txt cp Welcome.txt $(PKGROOT)/Apcupsd.Resources cp ApcupsdDaemon.preflight $(PKGROOT)/Apcupsd.Scripts/preflight cp ApcupsdDaemon.postflight $(PKGROOT)/Apcupsd.Scripts/postflight chown root:admin $(PKGROOT)/Apcupsd.Root/Library chmod 1775 $(PKGROOT)/Apcupsd.Root/Library chown root $(PKGROOT)/Apcupsd.Root/Applications chgrp admin $(PKGROOT)/Apcupsd.Root/Applications chmod 775 $(PKGROOT)/Apcupsd.Root/Applications $(PACKAGEMAKER) -v --no-recommend --no-relocate --root $(PKGROOT)/Apcupsd.Root \ --info ApcupsdDaemon.Info.plist --resources $(PKGROOT)/Apcupsd.Resources \ --scripts $(PKGROOT)/Apcupsd.Scripts --id com.apcupsd.apcupsd --root-volume-only \ --target 10.4 --version $(VERSION) --out $(PKGROOT)/Apcupsd/Apcupsd-$(VERSION).pkg rm -f $(PKGROOT)/Apcupsd/Apcupsd-$(VERSION).pkg/Contents/Resources/TokenDefinitions.plist hdiutil create -ov -fs HFS+ -srcfolder $(PKGROOT)/Apcupsd -volname Apcupsd-$(VERSION) Apcupsd-$(VERSION).dmg apcupsd-3.14.10/platforms/darwin/StartupParameters.plist0000775000076400007640000000026410205652536022272 0ustar adk0212adk0212{ Description = "APC UPS monitoring"; Provides = ("APC UPS monitor"); Requires = ("Disks", "SecurityServer", "Network"); OrderPreference = "Late"; } apcupsd-3.14.10/platforms/darwin/Welcome.txt0000775000076400007640000000164010572363536017670 0ustar adk0212adk0212Welcome to the Apcupsd installer. You will be guided through the steps necessary to install this software. If you are installing for the first time, at the end of the install procedure an editor will be opened with the apcupsd configuration file, apcupsd.conf. Please edit the file as described in the apcupsd manual (http://www.apcupsd.org/manual) and save your changes before rebooting. If you are upgrading from an existing installation, your apcupsd.conf file will be preserved and a new default file will be provided as apcupsd.conf.new. In most cases you can continue to use your existing configuration file unmodified, but please check the release notes and/or compare against apcupsd.conf.new to catch any required changes. If you encounter any problems with the installation or operation of Apcupsd, please join the apcupsd-users mailing list (http://www.apcupsd.org/lists.html) and post any questions there. apcupsd-3.14.10/platforms/darwin/apccontrol.in0000664000076400007640000001001610654643674020227 0ustar adk0212adk0212#!@SCRIPTSHELL@ # # Copyright (C) 1999-2002 Riccardo Facchetti # # for apcupsd release @VERSION@ (@DATE@) - @DISTNAME@ # # @configure_input@ # # Note, this is a generic file that can be used by most # systems. If a particular system needs to have something # special, start with this file, and put a copy in the # platform subdirectory. # # # These variables are needed for set up the autoconf other variables. # prefix=@prefix@ exec_prefix=@exec_prefix@ APCPID=@PIDDIR@/apcupsd.pid APCUPSD=@sbindir@/apcupsd SHUTDOWN=@SHUTDOWN@ SCRIPTSHELL=@SCRIPTSHELL@ SCRIPTDIR=@sysconfdir@ WALL=wall # Log notifications using Growl, if available GROWLSEARCH="/usr/bin/growlnotify /usr/local/bin/growlnotify /opt/local/bin/growlnotify" for GROWL in $GROWLSEARCH ; do if [ -x $GROWL ] ; then WALL="$GROWL -t Apcupsd Notice" break fi done # # Concatenate all output from this script to the events file # Note, the following kills the script in a power fail situation # where the disks are mounted read-only. # exec >>@LOGDIR@/apcupsd.events 2>&1 # # This piece is to substitute the default behaviour with your own script, # perl, or C program. # You can customize every single command creating an executable file (may be a # script or a compiled program) and calling it the same as the $1 parameter # passed by apcupsd to this script. # # After executing your script, apccontrol continues with the default action. # If you do not want apccontrol to continue, exit your script with exit # code 99. E.g. "exit 99". # # WARNING: the apccontrol file will be overwritten every time you update your # apcupsd, doing `make install'. Your own customized scripts will _not_ be # overwritten. If you wish to make changes to this file (discouraged), you # should change apccontrol.sh.in and then rerun the configure process. # if [ -f ${SCRIPTDIR}/${1} -a -x ${SCRIPTDIR}/${1} ] then ${SCRIPTDIR}/${1} ${2} ${3} ${4} # exit code 99 means he does not want us to do default action if [ $? = 99 ] ; then exit 0 fi fi case "$1" in killpower) echo "Apccontrol doing: ${APCUPSD} --killpower on UPS ${2}" sleep 10 ${APCUPSD} --killpower echo "Apccontrol has done: ${APCUPSD} --killpower on UPS ${2}" | ${WALL} ;; commfailure) echo "Communications lost with UPS ${2}" | ${WALL} ;; commok) echo "Communications restored with UPS ${2}" | ${WALL} ;; # # powerout, onbattery, offbattery, mainsback events occur # in that order. # powerout) ;; onbattery) echo "Power failure on UPS ${2}. Running on batteries." | ${WALL} ;; offbattery) echo "Power has returned on UPS ${2}..." | ${WALL} ;; mainsback) if [ -f @PWRFAILDIR@/powerfail ] ; then printf "Continuing with shutdown." | ${WALL} fi ;; failing) echo "Battery power exhaused on UPS ${2}. Doing shutdown." | ${WALL} ;; timeout) echo "Battery time limit exceeded on UPS ${2}. Doing shutdown." | ${WALL} ;; loadlimit) echo "Remaining battery charge below limit on UPS ${2}. Doing shutdown." | ${WALL} ;; runlimit) echo "Remaining battery runtime below limit on UPS ${2}. Doing shutdown." | ${WALL} ;; doreboot) echo "UPS ${2} initiating Reboot Sequence" | ${WALL} ${SHUTDOWN} -r now "apcupsd UPS ${2} initiated reboot" ;; doshutdown) echo "UPS ${2} initiated Shutdown Sequence" | ${WALL} ${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown" ;; annoyme) echo "Power problems with UPS ${2}. Please logoff." | ${WALL} ;; emergency) echo "Emergency Shutdown. Possible battery failure on UPS ${2}." | ${WALL} ;; changeme) echo "Emergency! Batteries have failed on UPS ${2}. Change them NOW" | ${WALL} ;; remotedown) echo "Remote Shutdown. Beginning Shutdown Sequence." | ${WALL} ;; startselftest) ;; endselftest) ;; battdetach) ;; battattach) ;; *) echo "Usage: ${0##*/} command" echo " warning: this script is intended to be launched by" echo " apcupsd and should never be launched by users." exit 1 ;; esac apcupsd-3.14.10/platforms/darwin/apcupsd-uninstall0000775000076400007640000000215411322445700021112 0ustar adk0212adk0212#!/bin/sh if [ "$USER" != "root" ] ; then echo This script must be run as root. echo Try \'sudo $0\' exit 1 fi confirm= read -p "Are you sure you want to uninstall apcupsd? [Y/N] " confirm case $confirm in y|Y) break ;; *) exit 1 ;; esac if [ -e /var/run/apcupsd.lock ] ; then SystemStarter stop "APC UPS monitor" fi files="/System/Library/Extensions/ApcupsdDummy.kext \ /Library/StartupItems/apcupsd \ /Applications/apcagent.app \ /etc/apcupsd \ /sbin/apcaccess \ /sbin/apcupsd \ /sbin/apctest \ /sbin/smtp \ /usr/share/man/man5/apcupsd.conf.5 \ /usr/share/man/man8/apcaccess.8 \ /usr/share/man/man8/apccontrol.8 \ /usr/share/man/man8/apcupsd.8 \ /usr/share/man/man8/apctest.8 \ /Library/Receipts/Apcupsd-*.pkg \ /sbin/apcupsd-uninstall" echo Removing files... for file in $files ; do if [ -e "$file" ] ; then echo Removing $file rm -rf "$file" fi done # Ensure kext cache gets rebuilt touch /System/Library/Extensions echo Apcupsd files removed. Please reboot to complete the uninstall. apcupsd-3.14.10/platforms/darwin/apcupsd.in0000664000076400007640000000201710205652536017511 0ustar adk0212adk0212#!/bin/sh # # apcupsd This shell script takes care of starting and stopping # the apcupsd UPS monitoring daemon. # # Written by Adam Kropelin # Based on work by Ingo Nowak . /etc/rc.common APCPID=@PIDDIR@/apcupsd.pid APCLOCK=@PIDDIR@/apcupsd.lock StartService() { ConsoleMessage "Starting UPS monitoring" rm -f @PWRFAILDIR@/powerfail rm -f @nologdir@/nologin @sbindir@/apcupsd -f @sysconfdir@/apcupsd.conf || exit 0 touch $APCLOCK } StopService() { ConsoleMessage "Shutting down UPS monitoring" if [ -f ${APCPID} ]; then kill `cat ${APCPID}` || exit 0 rm -f ${APCPID} fi rm -f $APCLOCK } RestartService() { StopService sleep 15 StartService } # Typically we'd just use RunService from /etc/rc.common here, but rumor # has it Mac OS 10.1.x and earlier do not have that function so we'll # implement it ourselves. case $1 in start) StartService ;; stop) StopService ;; restart) RestartService ;; *) echo "$0: unknown argument: $1" ;; esac apcupsd-3.14.10/platforms/darwin/build-notes.txt0000775000076400007640000000724111255506141020513 0ustar adk0212adk021210.4+ Universal Binary Builds from XCode 3.x The information in this file is for those who wish to build an apcupsd binary package to run on machines other than the machine on which it was built. If you are building apcupsd for use on the same machine as the one you are building it on, you do not have to do any of this. In that case, just install dependent libs such as libgd and libusb binaries from Fink or MacPorts (or build from source) with no special treatment needed. To build the most compatible apcupsd binary package possible, we must... * Build universal binaries to support PPC and Intel platforms (so-called "fat" binaries) * Build all dependent libraries static to ensure no extra dylibs are needed on the taget machine * Target the MacOS 10.4 "Universal" SDK to ensure the binaries will run on all platforms >= 10.4 Instructions: - Install XCode-3.1 (requires Mac OS 10.5) * Be sure to select the 10.4 SDK when installing * After installing, check if /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib is a symlink to /usr/local/lib. If so, remove it. * This procedure CANNOT be done with XCode-3.2 since Apple dropped support for PPC platforms in XCode-3.2. - Build dependent libs (libusb, libpng, libgd) * Tested with libusb-0.1.12, libpng-1.2.40, and gd-2.0.35 * "Fat" libs will be installed into /Developer/SDKs/MacOSX10.4u.sdk/usr/local so they will not conflict with other libraries you may have installed on your build system. libpng & libusb: CPPFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \ LDFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386 -arch ppc" \ CFLAGS="-arch i386 -arch ppc" CXXFLAGS="-arch i386 -arch ppc" \ CC=gcc-4.0 CXX=g++-4.0 ./configure \ --prefix=/Developer/SDKs/MacOSX10.4u.sdk/usr/local --disable-shared \ --disable-dependency-tracking make sudo make install libgd (depends on libpng, so build/install that first): * gd-2.0.35 has a configure bug where you have to do this twice! After the first configure, when you invoke make, the build system complains about a missing aclocal-1.9 and repeats the configure for you...and gets it wrong. So you have to wait for the bogus reconfigure and make to finish, then configure again the right way, make clean, and make. If you fail to do this it will probably still build, but you'll end up with dependencies on a bunch of X11 libs that you don't want. CPPFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \ LDFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386 -arch ppc" \ CFLAGS="-arch i386 -arch ppc" CXXFLAGS="-arch i386 -arch ppc" \ PATH="/Developer/SDKs/MacOSX10.4u.sdk/usr/local/bin:$PATH" \ CC=gcc-4.0 CXX=g++-4.0 ./configure \ --prefix=/Developer/SDKs/MacOSX10.4u.sdk/usr/local --disable-shared \ --disable-dependency-tracking --without-fontconfig --without-freetype \ --without-x make .dmg apcupsd-3.14.10/platforms/debian/0000775000076400007640000000000011634011372015452 5ustar adk0212adk0212apcupsd-3.14.10/platforms/debian/examples/0000775000076400007640000000000011634011372017270 5ustar adk0212adk0212apcupsd-3.14.10/platforms/debian/examples/cron.d.ex0000664000076400007640000000013307474703422021021 0ustar adk0212adk0212# # Regular cron jobs for the apcupsd package # 0 4 * * * root apcupsd_maintenance apcupsd-3.14.10/platforms/debian/examples/cron.daily0000775000076400007640000000042007474703422021267 0ustar adk0212adk0212#! /bin/sh # apcupsd Cron script to rotate apcupsd log files daily. # # Written by Kevin Foss . # 5/31/99 cd /var/log LOG=apcupsd.log if [ -f $LOG ]; then savelog -g adm -m 644 -u root -c 7 $LOG >/dev/null fi /etc/init.d/apcupsd restart &>/dev/null apcupsd-3.14.10/platforms/debian/examples/emacsen-install.ex0000664000076400007640000000232307474703422022720 0ustar adk0212adk0212#! /bin/sh -e # /usr/lib/emacsen-common/packages/install/apcupsd # Written by Jim Van Zandt , borrowing heavily # from the install scripts for gettext by Santiago Vila # and octave by Dirk Eddelbuettel . FLAVOR=$1 PACKAGE=apcupsd if [ ${FLAVOR} = emacs ]; then exit 0; fi echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} #FLAVORTEST=`echo $FLAVOR | cut -c-6` #if [ ${FLAVORTEST} = xemacs ] ; then # SITEFLAG="-no-site-file" #else # SITEFLAG="--no-site-file" #fi FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile" ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} # Install-info-altdir does not actually exist. # Maybe somebody will write it. if test -x /usr/sbin/install-info-altdir; then echo install/${PACKAGE}: install Info links for ${FLAVOR} install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/info/${PACKAGE}.info.gz fi install -m 755 -d ${ELCDIR} cd ${ELDIR} FILES=`echo *.el` cp ${FILES} ${ELCDIR} cd ${ELCDIR} cat << EOF > path.el (setq load-path (cons "." load-path) byte-compile-warnings nil) EOF ${FLAVOR} ${FLAGS} ${FILES} rm -f *.el path.el exit 0 apcupsd-3.14.10/platforms/debian/examples/emacsen-remove.ex0000664000076400007640000000072107474703422022547 0ustar adk0212adk0212#!/bin/sh -e # /usr/lib/emacsen-common/packages/remove/apcupsd FLAVOR=$1 PACKAGE=apcupsd if [ ${FLAVOR} != emacs ]; then if test -x /usr/sbin/install-info-altdir; then echo remove/${PACKAGE}: removing Info links for ${FLAVOR} install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/info/apcupsd.info.gz fi echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR} rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE} fi apcupsd-3.14.10/platforms/debian/examples/emacsen-startup.ex0000664000076400007640000000135007474703422022753 0ustar adk0212adk0212;; -*-emacs-lisp-*- ;; ;; Emacs startup file for the Debian GNU/Linux apcupsd package ;; ;; Originally contributed by Nils Naumann ;; Modified by Dirk Eddelbuettel ;; Adapted for dh-make by Jim Van Zandt ;; The apcupsd package follows the Debian/GNU Linux 'emacsen' policy and ;; byte-compiles its elisp files for each 'emacs flavor' (emacs19, ;; xemacs19, emacs20, xemacs20...). The compiled code is then ;; installed in a subdirectory of the respective site-lisp directory. ;; We have to add this to the load-path: (setq load-path (cons (concat "/usr/share/" (symbol-name flavor) "/site-lisp/apcupsd") load-path)) apcupsd-3.14.10/platforms/debian/examples/halt.ex0000775000076400007640000000043107474703422020572 0ustar adk0212adk0212#! /bin/sh # # halt Execute the halt command. # # Version: @(#)halt 2.75 19-May-1998 miquels@cistron.nl # PATH=/sbin:/bin:/usr/sbin:/usr/bin # See if we need to cut the power. if [ -x /etc/init.d/ups-monitor ] then /etc/init.d/ups-monitor poweroff fi halt -d -f -i -p apcupsd-3.14.10/platforms/debian/examples/manpage.1.ex0000664000076400007640000000353707474703426021424 0ustar adk0212adk0212.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH APCUPSD SECTION "March 11, 2001" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME apcupsd \- program to do something .SH SYNOPSIS .B apcupsd .RI [ options ] " files" ... .br .B bar .RI [ options ] " files" ... .SH DESCRIPTION This manual page documents briefly the .B apcupsd and .B bar commands. This manual page was written for the Debian GNU/Linux distribution because the original program does not have a manual page. Instead, it has documentation in the GNU Info format; see below. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. \fBapcupsd\fP is a program that... .SH OPTIONS These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see the Info files. .TP .B \-h, \-\-help Show summary of options. .TP .B \-v, \-\-version Show version of program. .SH SEE ALSO .BR bar (1), .BR baz (1). .br The programs are documented fully by .IR "The Rise and Fall of a Fooish Bar" , available via the Info system. .SH AUTHOR This manual page was written by root , for the Debian GNU/Linux system (but may be used by others). apcupsd-3.14.10/platforms/debian/examples/manpage.sgml.ex0000664000076400007640000000775607474703426022235 0ustar adk0212adk0212 FIRSTNAME"> SURNAME"> March 11, 2001"> SECTION"> fgp@phlo.org"> APCUPSD"> Debian GNU/Linux"> GNU"> ]>
&dhemail;
&dhfirstname; &dhsurname; 2000 &dhusername; &dhdate;
&dhucpackage; &dhsection; &dhpackage; program to do something &dhpackage; DESCRIPTION This manual page documents briefly the &dhpackage; and bar commands. This manual page was written for the &debian; distribution because the original program does not have a manual page. Instead, it has documentation in the &gnu; Info format; see below. &dhpackage; is a program that... OPTIONS These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see the Info files. Show summary of options. Show version of program. SEE ALSO bar (1), baz (1). The programs are documented fully by The Rise and Fall of a Fooish Bar available via the Info system. AUTHOR This manual page was written by &dhusername; &dhemail; for the &debian; system (but may be used by others).
apcupsd-3.14.10/platforms/debian/examples/menu.ex0000664000076400007640000000016207474703422020604 0ustar adk0212adk0212?package(apcupsd):needs=X11|text|vc|wm section=Apps/see-menu-manual\ title="apcupsd" command="/usr/bin/apcupsd" apcupsd-3.14.10/platforms/debian/examples/postinst.ex0000664000076400007640000000233607474703422021530 0ustar adk0212adk0212#! /bin/sh # postinst script for apcupsd # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-deconfigure' `in-favour' # `removing' # # for details, see /usr/share/doc/packaging-manual/ # # quoting from the policy: # Any necessary prompting should almost always be confined to the # post-installation script, and should be protected with a conditional # so that unnecessary prompting doesn't happen if a package's # installation fails and the `postinst' is called with `abort-upgrade', # `abort-remove' or `abort-deconfigure'. case "$1" in configure) ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 0 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 apcupsd-3.14.10/platforms/debian/examples/postrm.ex0000664000076400007640000000155007474703422021166 0ustar adk0212adk0212#! /bin/sh # postrm script for apcupsd # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `remove' # * `purge' # * `upgrade' # * `failed-upgrade' # * `abort-install' # * `abort-install' # * `abort-upgrade' # * `disappear' overwrit>r> # for details, see /usr/share/doc/packaging-manual/ case "$1" in purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 0 esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# apcupsd-3.14.10/platforms/debian/examples/preinst.ex0000664000076400007640000000156407474703426021337 0ustar adk0212adk0212#! /bin/sh # preinst script for apcupsd # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `install' # * `install' # * `upgrade' # * `abort-upgrade' # # For details see /usr/share/doc/packaging-manual/ case "$1" in install|upgrade) # if [ "$1" = "upgrade" ] # then # start-stop-daemon --stop --quiet --oknodo \ # --pidfile /var/run/apcupsd.pid \ # --exec /usr/sbin/apcupsd 2>/dev/null || true # fi ;; abort-upgrade) ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 0 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 apcupsd-3.14.10/platforms/debian/examples/prerm.ex0000664000076400007640000000161607474703422020772 0ustar adk0212adk0212#! /bin/sh # prerm script for apcupsd # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `remove' # * `upgrade' # * `failed-upgrade' # * `remove' `in-favour' # * `deconfigure' `in-favour' # `removing' # # for details, see /usr/share/doc/packaging-manual/ case "$1" in remove|upgrade|deconfigure) # install-info --quiet --remove /usr/info/apcupsd.info.gz ;; failed-upgrade) ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 0 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 apcupsd-3.14.10/platforms/debian/examples/watch.ex0000664000076400007640000000047507474703422020755 0ustar adk0212adk0212# Example watch control file for uscan # Rename this file to "watch" and then you can run the "uscan" command # to check for upstream updates and more. # Site Directory Pattern Version Script sunsite.unc.edu /pub/Linux/Incoming apcupsd-(.*)\.tar\.gz debian uupdate apcupsd-3.14.10/platforms/debian/Makefile0000664000076400007640000000221011020615542017103 0ustar adk0212adk0212topdir:=../.. SUBDIRS = include $(topdir)/autoconf/targets.mak all-install: install-debian all-uninstall: uninstall-debian install-debian: $(call DISTINST,debian) $(if $(DESTDIR),,$(V)/usr/sbin/update-rc.d apcupsd remove) $(call MKDIR,/etc/init.d) $(call INSTDATA,744,apcupsd,/etc/init.d/apcupsd) $(if $(DESTDIR),,$(V)/usr/sbin/update-rc.d apcupsd start 20 1 2 3 4 5 . stop 20 0 1 6 .) $(call INSTORIG,744,ups-monitor,/etc/init.d/ups-monitor) @echo "---------------------------------------------------------------------" @echo " NOTE: APCUPSD will almost certainly not work \"out of the box.\"" @echo " You MUST properly edit $(sysconfdir)/apcupsd.conf or apcupsd" @echo " will fail on startup. Also, please see that your script" @echo " at /etc/init.d/halt properly calls /etc/init.d/ups-monitor" @echo " as shown in platforms/debian/examples/halt.ex." @echo "---------------------------------------------------------------------" uninstall-debian: $(call DISTUNINST,debian) -$(call UNINST,/etc/init.d/apcupsd) -$(if $(DESTDIR),,$(V)/usr/sbin/update-rc.d apcupsd remove) -$(call UNINST,/etc/init.d/ups-monitor) apcupsd-3.14.10/platforms/debian/apcupsd.80000664000076400007640000004350407714146531017222 0ustar adk0212adk0212.\" manual page [] for apcupsd .\" SH section heading .\" SS subsection heading .\" LP paragraph .\" IP indented paragraph .\" TP hanging label .TH apcupsd 8 "APCC UPS management under Linux and UNIX" .SH NAME apcupsd \- daemon for Most APCC's UPS support under Linux and UNIX .SH SYNOPSIS .B /sbin/apcupsd .br .B /sbin/powersc .br .B /etc/apcupsd.conf .br .B /sbin/apcaccess .SH DESCRIPTION .LP This daemon can be used for controlling the APC SmartUPS. During a power failure, "apcupsd" will inform the users about power status. If the power is restored before valid test return TRUE, "apcupsd" will inform users about this fact. If power is not restored, a system shutdown will follow when the battery is exausted, a timeout (seconds) expires, or runtime minutes based on internal values based on power consumption rates. The whole shutdown is now made by script calls to the "/sbin/powersc" file called by "apcupsd", so no changes in the inittab are necessary. There is now no communication between "apcupsd" and init(1) process. .LP The "apcupsd" daemon now supports the networking mode. In this mode, one machine is configured as a master, with UPS attached to the serial port. Other machines (max. 20) are configured as a slaves. Master has a network connection with slaves and send them informations about UPS status. Both Master and Slaves open and close there sockets on a regular basis. If someone gets lost nobody gets to upset. .LP .B Hewlett Packard : HP PowerTrust 2997A UPS has been tested as a "smartups" with cable Hewlett Packard part number 5061-2575 as "CUSTOM-SMART". .LP Slackware, RedHat, S.u.S.E., Debian, and UNIFIX "FLAVORS" of Linux have direct install support. All other "FLAVORS" of Linux will need some fussing with to get the install correct. Please send me all new install methods that are not listed above or corrections to these for future versions before the final release. .SH CONFIGURATION It is necessary to write configuration info to the file "/etc/apcupsd.conf". This file is a plain ASCII file and you can use your favorite editor for configuration. For simple configuration, see enclosed sample file. .LP Configuration commands in .B /etc/apcupsd.conf are: .LP .B CONTROL -- .B /sbin/powersc .br Name of control script called by "apcupsd". .LP .B UPSCABLE -- .br [ simple | 940-0020B | 940-0023A (broken) ] .br [ smart | 940-0024B | 940-0024C | 940-0024G ] .br [ 940-0095A | 940-0095C ] .br [ ether ] .LP .B UPSTYPE -- .br [ backups | sharebasic ] : Simple .br [ netups ] : Network Simple Signals .br [ backupspro | smartvsups ] : Sub(barely)Smart .br [ newbackupspro | backupspropnp ] : Sub(very)Smart .br [ smartups | matrixups | sharesmart ] : Smart .LP [ backups | netups | backupspro | smartvsups ] and .br [ newbackupspro | smartups | matrixups ] are tested. .br [ sharebasic | sharesmart ] models are being tested. .LP .B UPSCLASS -- .br [ standalone | shareslave | sharemaster ] and .br [ netslave | netmaster ] are valid types. .br [ standalone | netslave | netmaster ] are tested classes. .br [ shareslave | sharemaster ] classes are being tested. .LP Default for all machines is "standalone". Change to "shareslave" if and only if you are using a ShareUPS and connected to a BASIC Port with Simple Signal. Change to "sharemaster", if and only if you are using a ShareUPS and connected to the ADVANCED Port Smart Signal control. Change to "netslave" if and only if you are not connected to an UPS other than for power. Change to "netmaster", if and only if you are on a TCP/UDP network and connected to an UPS of any kind with other Linux Boxes. .LP .B UPSMODE -- [ disable | share | net | sharenet ] are valid types. .br .LP [ disable | net ] are the only known and tested classes. .br [ share | sharenet ] classes is being tested. .LP BETA [ share ] For two or seven (2/7) additional simple signal ports on a SmartAccessories(tm) (internal/external box) for SmartUPSes. .LP .B DEVICE -- .br Please specify which device is used for UPS communication. The default is /dev/ttyS[0|1|2|3]. .LP .B LOCKFILE -- .br By supplying this argument, "apcupsd" tries to create a lockfile in the specified directory. .LP .B ACCESS -- [ true | false ] .br This enables the use of "apcaccess" interface, on all machines, but for accessing or changing configurations of a running "apcupsd". .LP .B ANNOY --