Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Mar 2003 05:46:21 +0200 (EET)
From:      Heikki Suonsivu <hsu@bbnetworks.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/48859: Patch to add upscode2 support to nut port
Message-ID:  <200303030346.h233kKcB083279@news.bbnetworks.net>

next in thread | raw e-mail | index | archive | help

>Number:         48859
>Category:       ports
>Synopsis:       Patch to add upscode2 support to nut port
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 02 19:50:10 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Heikki Suonsivu
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
bbnetworks.net
>Environment:

System: FreeBSD news.bbnetworks.net 4.7-STABLE FreeBSD 4.7-STABLE #13: Sun Jan 26 06:19:07 EET 2003 hsu@news.bbnetworks.net:/m/news/news5/obj/usr/src/sys/CAT i386

>Description:

Nut does not have upscode2 support built-in, as the guy who built it
has not yet submitted it to nut.  This patch should add it.

>How-To-Repeat:

Attach a powerware 9110 UPS and nut.

>Fix:

Extract to nut/files.  Please proofread, I am not very experienced with ports.

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	patch-upscode2
#	patch-upscode2-Makefile.drvbuild
#
echo x - patch-upscode2
sed 's/^X//' >patch-upscode2 << 'END-of-patch-upscode2'
Xdiff -Nru drivers/Makefile.in ../nut-1.2.1/drivers/Makefile.in
X--- drivers/Makefile.in	Sun Dec  8 02:44:15 2002
X+++ ../nut-1.2.1/drivers/Makefile.in	Mon Mar  3 04:01:42 2003
X@@ -13,7 +13,7 @@
X 	  masterguard powercom cyberpower mge-ellipse tripplite \
X 	  victronups bestferrups801-807 genericups hp bcmxcp mge-utalk \
X 	  bestuferrups microdowell isbmex etapro oneac bestfortress \
X-	  liebert sms
X+	  liebert sms upscode2
X 
X LIBDEP	= @LIBOBJ@
X LIBOBJ	= $(LIBDEP) @NETLIBS@ @SERLIBS@
Xdiff -Nru drivers/upscode2.c ../nut-1.2.1/drivers/upscode2.c
X--- drivers/upscode2.c	Thu Jan  1 02:00:00 1970
X+++ ../nut-1.2.1/drivers/upscode2.c	Fri Nov 29 17:59:34 2002
X@@ -0,0 +1,620 @@
X+/* upscode2.c - model specific routines for UPSes using the UPSCode II
X+                command set.  This includes PowerWare, Fiskars, 
X+		Compaq (PowerWare OEM?), some IBM (PowerWare OEM?)
X+
X+   Copyright (C) 2002 Håvard Lygre <hklygre@online.no>
X+
X+   This program is free software; you can redistribute it and/or modify
X+   it under the terms of the GNU General Public License as published by
X+   the Free Software Foundation; either version 2 of the License, or
X+   (at your option) any later version.
X+
X+   This program is distributed in the hope that it will be useful,
X+   but WITHOUT ANY WARRANTY; without even the implied warranty of
X+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X+   GNU General Public License for more details.
X+
X+   You should have received a copy of the GNU General Public License
X+   along with this program; if not, write to the Free Software
X+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
X+*/
X+
X+#include <stdio.h>
X+
X+#include "main.h"
X+#include "upscode2.h"
X+
X+ #define ENDCHAR	'\r'	
X+ #define IGNCHARS	"\n"
X+
X+extern unsigned int sddelay;
X+extern int do_forceshutdown;
X+
X+void upsdrv_initinfo(void)
X+{
X+   addinfo(INFO_MFR, "", 0, 0);
X+   addinfo(INFO_MODEL, "", 0, 0);   /* UPSC_TYPE */
X+   addinfo(INFO_SERIAL, "", 0, 0);
X+   addinfo(INFO_OUTVOLT, "", 0, 0); 
X+   addinfo(INFO_UTILITY, "", 0, 0);
X+   addinfo(INFO_BATTVOLT, "", 0, 0);
X+   addinfo(INFO_STATUS, "", 0, 0);
X+   addinfo(INFO_OUT_FREQ, "", 0, 0);
X+   addinfo(INFO_OUT_VA, "", 0, 0);
X+   addinfo(INFO_CURRENT, "", 0, 0);
X+   addinfo(INFO_RUNTIME, "", 0, 0);
X+   addinfo(INFO_OUT_LOADPWR1, "", 0, 0);
X+	/* upsh.instcmd = instcmd; */
X+
X+   upsc_getbaseinfo();
X+   writeinfo();
X+}
X+
X+void upsdrv_updateinfo(void)
X+{
X+   char *buf;
X+   //   char *status_str;
X+   int status = 0;
X+   int buffer_empty = 0;
X+
X+
X+   upsflushin(0, 1, IGNCHARS);
X+   upscsend("UPDS");
X+
X+   buf = upsc_malloc();
X+   //   status_str = upsc_malloc();
X+   //   status_str[0] = '\0';
X+
X+
X+   // flush blank line
X+   upscrecv(buf);
X+   
X+   while(!buffer_empty) {
X+
X+      upscrecv(buf);
X+
X+      if(!strlen(buf)) {
X+	 upslogx(LOG_ERR, "Empty string received from UPS!");
X+	 break;
X+      }
X+
X+
X+      // STatus Utility Failure
X+      if((!strcmp(buf, "STUF")) || (!strcmp(buf, "STBO"))) { 
X+	 upscrecv(buf);
X+
X+	 if(!strcmp(buf, "00")) { // On Line
X+	    status |= UPSC_STAT_ONLINE;
X+	 } else {  
X+	    /* Should I check for '11' here?  The only two statuses
X+	       possible are '00' and '11' ... I'll wait.
X+	    */
X+	    status |= UPSC_STAT_ONBATT;
X+	 }
X+	 continue;
X+      }
X+
X+      // line regulation
X+      if(!strcmp(buf,"STLR")) {
X+	 upscrecv(buf);
X+	 if(!strcmp(buf, "NO")) {
X+	    /* Do nothing.  Normal operation */
X+	 } else if(!strcmp(buf, "SD")) {
X+	    status |= UPSC_STAT_TRIM;
X+	 } else if((!strcmp(buf, "SU")) || (!strcmp(buf, "DU"))) {
X+	    status |= UPSC_STAT_BOOST;
X+	 } else {
X+	    upslogx(LOG_ERR, "Unknown STLR Code received: '%s'", buf);
X+	 }
X+	 continue;
X+      }
X+
X+      // bypass
X+      // TODO:  What?
X+      if(!strcmp(buf,"STBP")) {
X+	 upscrecv(buf);
X+	 if(!strcmp(buf, "11")) {
X+	    // We're on bypass.  So what?
X+	 }
X+	 continue;
X+      }
X+
X+
X+      // malfunction
X+      if(!strcmp(buf,"STMF")) {
X+	 upscrecv(buf);
X+	 if(!strcmp(buf, "00")) {
X+	    // Do nothing.  Normal operation
X+	 } else if(!strcmp(buf, "BC")) {
X+	    // TODO:  What?
X+	    // Backfeed contact failure
X+	    upslogx(LOG_WARNING, "Backfeed contact failure");
X+	 } else if(!strcmp(buf, "BL")) {
X+	    /* This _really_ means "battery low limit", i.e.
X+	     * that we have reached the limit
X+	     */
X+	    status |= UPSC_STAT_LOBATT;
X+	 } else if(!strcmp(buf, "OL")) {
X+	    status |= UPSC_STAT_OVERLOAD;
X+	 } else {
X+	    upslogx(LOG_ERR, "Unknown STMF Code received: '%s'", buf);
X+	 }
X+	 continue;
X+      }
X+
X+      // Battery Management
X+      if(!strcmp(buf, "STBM")) {
X+	 /* TODO:  What?  
X+	  * Don't know how to report this.  Possible statuses:
X+	  *
X+	  * RS - Resting
X+	  * FT - Floating
X+	  * CH - Charging
X+	  * DI - Discharging
X+	  *
X+	  */
X+	 upscrecv(buf);
X+	 continue;
X+      }
X+      
X+
X+      // Remaining battery time
X+      if(!strcmp(buf, "BTIME")) {
X+	 setinfo(INFO_RUNTIME, upscrecv(buf));
X+	 continue;
X+      }
X+      
X+      /* TODO: Figure out what to do with STOK.  For now just capture
X+       * it.
X+       * STOK: 00 - Normal Operation, 11 - Abnormal Operation
X+       * What is "abnormal", apart from ONBATT?  ONBATT is reported
X+       * elsewhere also - can we depend on only STOK?  I doubt it.
X+       */
X+      if(!strcmp(buf, "STOK")) {
X+	 upscrecv(buf);
X+	 if(!strcmp(buf, "00")) {
X+	    // Normal operation.  Don't care
X+	 } else if(!strcmp(buf, "11")) {
X+	    // TODO: This message doesn't mean much, so I'm ignoring it.
X+	    //	    upslogx(LOG_WARNING, "Unknown failure/abnormal operation");
X+	 } else {
X+	    upslogx(LOG_ERR, "Unknown STOK Code received: '%s'", buf);
X+	 }
X+	 continue;
X+      }
X+
X+      /* TODO: Implement
X+       * Attention required.
X+       * 
X+       * Values:
X+       *   00  - no failure
X+       *   US  - Unsynchronised
X+       *   BY  - Battery failure
X+       *   GF  - Ground failure
X+       *   IV  - Inverter failure
X+       */
X+      if(!strcmp(buf, "STAT")) {
X+	 upscrecv(buf);  // Ignore messages
X+	 continue;
X+      }
X+
X+
X+
X+
X+      // STatus Battery Low
X+      if(!strcmp(buf, "STBL")) {
X+	 upscrecv(buf);
X+	 if(!strcmp(buf, "11")) {
X+	    status |= UPSC_STAT_LOBATT;
X+	 }
X+	 continue;
X+      }
X+
X+      // Measured Input UtiLity
X+      if(!strcmp(buf, "MIUL1")) {
X+	 upscrecv(buf);
X+	 setinfo(INFO_UTILITY, buf);
X+	 continue;
X+      }
X+
X+      // Output voltage
X+      if(!strcmp(buf, "MOUL1")) {
X+	 upscrecv(buf);
X+	 setinfo(INFO_OUTVOLT, buf);
X+	 continue;
X+      }
X+
X+      // Battery voltage
X+      if(!strcmp(buf, "MBUUU")) {
X+	 upscrecv(buf);
X+	 setinfo(INFO_BATTVOLT, buf);
X+	 continue;
X+      }
X+
X+      // Battery what?
X+      // TODO: Figure out.
X+      // 'I' is normally current...
X+      if(!strcmp(buf, "MBIII")) {
X+	 upscrecv(buf);
X+	 continue;
X+      }
X+
X+      // output current
X+      if(!strcmp(buf, "MOIL1")) {
X+	 upscrecv(buf);
X+	 setinfo(INFO_CURRENT, buf);
X+	 continue;
X+      }
X+
X+      // Output KW - calculated.
X+      // Can we calculate load from this?
X+      if(!strcmp(buf, "MOPL1")) {
X+	 upscrecv(buf);
X+	 setinfo(INFO_OUT_LOADPWR1, buf);
X+	 continue;
X+      }
X+
X+      // output KVA
X+      if(!strcmp(buf, "MOSL1")) {
X+	 upscrecv(buf);
X+	 setinfo(INFO_OUT_VA, buf);
X+	 continue;
X+      } 
X+
X+      // TODO: Unknown
X+      if(!strcmp(buf, "MUTE1")) {
X+	 upscrecv(buf);
X+	 continue;
X+      }
X+
X+      // TODO: Unknown
X+      // TODO: Does this always give two lines of output?
X+      if(!strcmp(buf, "MPUL1")) {
X+	 upscrecv(buf);
X+
X+	 // TODO:  This command appears to _sometimes_ give two
X+	 // values, and sometimes not. 
X+	 // for now, handle this if parameter debug_mpul is set.
X+
X+	 if(testvar("debug_mpul"))
X+	    upscrecv(buf);
X+
X+
X+	 continue;
X+      }
X+
X+      // Measured output frequency
X+      if(!strcmp(buf, "MOFFF")) {
X+	 buffer_empty = 1;   // MOFFF is always the last status
X+	 upscrecv(buf);
X+	 setinfo(INFO_OUT_FREQ, buf);
X+	 continue;
X+      }   
X+
X+      if(!testvar("statign"))
X+	 upslogx(LOG_ERR, "Unknown status received: '%s'", buf);
X+   }
X+   
X+   //   setinfo(INFO_STATUS, upsc_genstatus(status, status_str));
X+
X+   upsc_setstatus(status);
X+
X+   writeinfo();
X+
X+   // cleanup
X+   upsc_free(buf);
X+   //   upsc_free(status_str);
X+}
X+
X+void upsdrv_shutdown(void)
X+{
X+   char *buf;
X+
X+   buf = upsc_malloc();
X+
X+	/* replace with a proper shutdown function */
X+   if(do_forceshutdown) {
X+      upslogx(LOG_EMERG, "Emergency shutdown\n");
X+      upscsend("UPSD");  // Set shutdown delay
X+      upscsend("1");     // 1 second (lowest possible. 0 returns current.
X+   } else {
X+      upslogx(LOG_EMERG, "Shutdown with %d seconds delay", sddelay);
X+      upscsend("UPSD");
X+      snprintf(buf, UPSC_BUFLEN, "%d", sddelay);
X+      upscsend(buf);
X+   }
X+
X+   upslogx(LOG_EMERG, "Shutting down...\n");
X+   upscsend("UPPC");       // Powercycle UPS
X+   upscsend("IJHLDMGCIU"); // security code
X+
X+   upsc_free(buf);
X+}
X+
X+
X+void instcmd (int auxcmd, int dlen, char *data)
X+{
X+
X+   switch (auxcmd) {
X+   default:
X+      upslogx(LOG_INFO, "instcmd: unknown type 0x%04x", auxcmd);
X+   }
X+}
X+
X+
X+void upsdrv_help(void)
X+{
X+}
X+
X+/* list flags and values that you want to receive via -x */
X+void upsdrv_makevartable(void)
X+{
X+   // addvar(VAR_FLAG, "pollonly", "Enable pollonly (debug) mode");
X+   addvar(VAR_FLAG, "statign", "Ignore unknown status values");
X+   addvar(VAR_FLAG, "debug_mpul", "Debug - expect two values from MPUL1");
X+
X+
X+	/* allow '-x xyzzy' */
X+	/* addvar(VAR_FLAG, "xyzzy", "Enable xyzzy mode"); */
X+
X+	/* allow '-x foo=<some value>' */
X+	/* addvar(VAR_VALUE, "foo", "Override foo setting"); */
X+}
X+
X+void upsdrv_banner(void)
X+{
X+   printf("Network UPS Tools - UPSCode II UPS driver %s (%s)\n", 
X+	  UPSC_VERSION, UPS_VERSION);
X+   printf("Copyright (C) 2001-2002 Håvard Lygre, <hklygre@online.no>\n\n");
X+
X+   experimental_driver = 1;
X+}
X+
X+void upsdrv_initups(void)
X+{
X+   open_serial(device_path, B1200);
X+}
X+
X+/* tell main how many items you need */
X+int upsdrv_infomax(void)
X+{
X+
X+	/* every addinfo() consumes an entry.  plan ahead, but don't go
X+	 * overboard, since this is an easy way to waste memory.
X+	 */
X+
X+	return 128;
X+}
X+
X+/*
X+  This function is an internal function used to malloc a range of bytes
X+  (UPSC_BUFLEN) and return a char pointer.
X+ */
X+char *upsc_malloc(void)
X+{
X+   char *buf;
X+
X+   buf = malloc(UPSC_BUFLEN);
X+   if(!buf) {
X+      printf("Aiee!  Malloc failed\n");
X+      exit(1);
X+   }
X+
X+   return(buf);
X+}
X+
X+/*
X+  Frees the bytes previously alloced.  Function provided for
X+  completeness
X+*/
X+void upsc_free(char *buf)
X+{
X+   free(buf);
X+}
X+   
X+void upsc_setinfo(int infotype, char *buf)
X+{
X+   setinfo(infotype, "%s", buf);
X+
X+   upsc_free(buf);
X+}
X+
X+
X+/*
X+  Generate status string from bitfield
X+*/
X+void upsc_setstatus(unsigned int status)
X+{
X+
X+   /*
X+    * I'll look for all available statuses, even though they might not be
X+    *  supported in the UPSCode II protocol.
X+    */
X+
X+   status_init();
X+
X+   if(status & UPSC_STAT_ONLINE)
X+      status_set("OL");
X+   if(status & UPSC_STAT_ONBATT)
X+      status_set("OB");
X+   if(status & UPSC_STAT_LOBATT)
X+      status_set("LB");
X+   if(status & UPSC_STAT_REPLACEBATT)
X+      status_set("RB");
X+   if(status & UPSC_STAT_BOOST)
X+      status_set("BOOST");
X+   if(status & UPSC_STAT_TRIM)
X+      status_set("TRIM");
X+   if(status & UPSC_STAT_OVERLOAD)
X+      status_set("OVER");
X+   if(status & UPSC_STAT_CALIBRATION)
X+      status_set("CAL");
X+
X+   status_commit();
X+}
X+
X+
X+/*
X+  This function returns a string (for which it allocates 
X+  memory itself) to the information retrieved from the UPS
X+  of the type requested.
X+
X+  It allocates UPSC_BUFLEN bytes - this is most of the time
X+  too much, but it is supposed to be deallocated immediately
X+  (in upsc_setinfo)
X+
X+  type: Type of info requested (from upscode2.h)
X+*/
X+char *upsc_getinfo(int type)
X+{
X+   char *buf;
X+
X+   buf = upsc_malloc();
X+
X+   switch(type) {
X+   case UPSC_INFO_TYPE:
X+      upsc_getinfo_type(buf);
X+      return(buf);
X+      break;
X+   case UPSC_INFO_SERIAL:
X+      upsc_getinfo_serial(buf);
X+      return(buf);
X+      break;
X+   default: 
X+      upslogx(LOG_ERR, "upsc_getinfo: Unknown command %i", type);
X+      upsc_free(buf);
X+      return(NULL);
X+      break;
X+   }
X+}
X+
X+
X+/* Get UPS type and software version */
X+void upsc_getinfo_type(char *buf)
X+{
X+   upscsend("UPTP");
X+
X+   /* Expecting: '\rNNAME\r<model><sw ver>\r\n' */
X+   upscrecv_second(buf);
X+   upsc_expect(buf, "NNAME");
X+   upscrecv(buf);
X+}
X+
X+void upsc_getinfo_serial(char *buf)
X+{
X+   upscsend("UPSN");
X+   upscsend("0");
X+
X+   upscrecv_second(buf);
X+   upsc_expect(buf, "ACSN");
X+   upscrecv(buf);
X+}
X+
X+void upsc_expect(char *buf, char *expect)
X+{
X+   if(strcmp(buf, expect)) {
X+      upslogx(LOG_ERR, "Expected '%s', got '%s'", expect, buf);
X+   }
X+}
X+
X+/* Add \r to end of command and send to UPS */
X+void upscsend(char *cmd)
X+{
X+   char *buf;
X+
X+   // TODO: Do we really want to flush here?  Can we at any time
X+   // expect to send data in several groups and expect input to be
X+   // queued?
X+   upsflushin(0, 1, IGNCHARS);
X+
X+   buf = upsc_malloc();
X+   snprintf(buf, UPSC_BUFLEN, "%s%c", cmd, '\r');
X+
X+   upssend(buf);
X+
X+   upsc_free(buf);
X+
X+   return;
X+}
X+
X+/* Receive two strings, dump the first and return the second */
X+char *upscrecv_second(char *buf)
X+{
X+   /* Receive empty string - bomb if not empty */
X+   /* 
X+    * TODO: This fails if UPS is not connected on startup.
X+    * We don't want the driver to exit in that case.
X+    */
X+   upscrecv(buf);
X+   if(strlen(buf)) {
X+      printf("%s: Non-empty string '%s'(len %i) received\n", 
X+	     __FUNCTION__, buf, strlen(buf));
X+      exit(1);
X+   }
X+
X+   /* Receive real response */
X+   return(upscrecv(buf));
X+}
X+
X+/* Return a string read from UPS */
X+char *upscrecv(char *buf)
X+{
X+   upsrecv(buf, UPSC_BUFLEN, ENDCHAR, IGNCHARS);
X+
X+   // printf("Received %i bytes:\t'%s'\n", strlen(buf), buf);
X+
X+   if(buf[strlen(buf) - 1] == '\r') {
X+      printf("stripping \\r\n");
X+      buf[strlen(buf) - 1] = '\0';
X+   }
X+
X+   return(buf);
X+}
X+
X+
X+void upsc_getbaseinfo()
X+{
X+   char *buf;
X+
X+   /* Probe UPS type and model */
X+   buf = upsc_getinfo(UPSC_INFO_TYPE);
X+
X+   /* Use standard setinfo as we don't want a free afterwards */
X+   setinfo(INFO_MFR, upsc_parsemfr(buf));
X+   
X+   upsc_setinfo(INFO_MODEL, buf);
X+
X+   buf = upsc_getinfo(UPSC_INFO_SERIAL);
X+   upsc_setinfo(INFO_SERIAL, buf);
X+}
X+
X+
X+char *upsc_parsemfr(char *buf)
X+{
X+   /* Let's do it simple for now... */
X+   if(buf && strlen(buf)) {
X+      switch(buf[0]) {
X+      case 'P':
X+	 return("PowerWare");
X+	 break;
X+      default:
X+	 // Never mind logging this - we won't be able to use this anyway.
X+	 // upslogx(LOG_ERR, "Unknown UPS - please report this: '%s'", buf);
X+	 return("Unknown UPS - please report");
X+	 break;
X+      }
X+   }
X+
X+   upslogx(LOG_ERR, "Aiee - reached end of function %s", __FUNCTION__);
X+   return("Unknown UPS - Parse Error");
X+}
X+
X+
X+/* Debug function */
X+void upsc_test_io(void)
X+{
X+   char *buf;
X+
X+   printf("Receiving UPS Type\n");
X+   buf = upsc_getinfo(UPSC_INFO_TYPE);
X+}
Xdiff -Nru drivers/upscode2.h ../nut-1.2.1/drivers/upscode2.h
X--- drivers/upscode2.h	Thu Jan  1 02:00:00 1970
X+++ ../nut-1.2.1/drivers/upscode2.h	Fri Nov 29 17:16:55 2002
X@@ -0,0 +1,58 @@
X+/* upscode2.h - model capability table
X+
X+   Copyright (C) 2002 Håvard Lygre <hklygre@online.no>
X+
X+   This program is free software; you can redistribute it and/or modify
X+   it under the terms of the GNU General Public License as published by
X+   the Free Software Foundation; either version 2 of the License, or
X+   (at your option) any later version.
X+
X+   This program is distributed in the hope that it will be useful,
X+   but WITHOUT ANY WARRANTY; without even the implied warranty of
X+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X+   GNU General Public License for more details.
X+
X+   You should have received a copy of the GNU General Public License
X+   along with this program; if not, write to the Free Software
X+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
X+*/
X+
X+#define UPSC_VERSION "0.04"
X+
X+char *upsc_malloc(void);
X+void upsc_free(char *);
X+
X+void upscsend(char *);
X+char *upscrecv(char *);
X+char *upscrecv_second(char *);
X+
X+void upsc_expect(char *, char *);
X+char *upsc_parsemfr(char *);
X+void upsc_getbaseinfo(void);
X+
X+void upsc_setinfo(int, char *);
X+char *upsc_getinfo(int);
X+void upsc_getinfo_type(char *);
X+void upsc_getinfo_serial(char *);
X+void upsc_setstatus(unsigned int);
X+
X+void upsc_test_io(void);
X+
X+#define UPSC_BUFLEN 256  /* Size of response buffers from UPS */
X+
X+
X+/* UPSCode II commands */
X+#define UPSC_INFO_TYPE     100
X+#define UPSC_INFO_SERIAL   101
X+
X+
X+/* Status messages from UPS */
X+#define UPSC_STAT_ONLINE       0x01
X+#define UPSC_STAT_ONBATT       0x02
X+#define UPSC_STAT_LOBATT       0x04
X+#define UPSC_STAT_REPLACEBATT  0x08
X+#define UPSC_STAT_BOOST        0x10
X+#define UPSC_STAT_TRIM         0x20
X+#define UPSC_STAT_OVERLOAD     0x40
X+#define UPSC_STAT_CALIBRATION  0x80
X+
END-of-patch-upscode2
echo x - patch-upscode2-Makefile.drvbuild
sed 's/^X//' >patch-upscode2-Makefile.drvbuild << 'END-of-patch-upscode2-Makefile.drvbuild'
X--- drivers/Makefile.drvbuild.rikki	Sun Dec  8 03:29:16 2002
X+++ drivers/Makefile.drvbuild	Mon Mar  3 04:19:36 2003
X@@ -55,3 +55,5 @@
X 	$(CC) $(CFLAGS) -o liebert liebert.o main.o upscommon.o ../common/upsconf.o ../common/parseconf.o $(LIBOBJ) $(STRLCPY) 
X sms: sms.o main.o upscommon.o ../include/shared.h ../include/shared-tables.h ../common/upsconf.o ../common/parseconf.o $(LIBDEP)
X 	$(CC) $(CFLAGS) -o sms sms.o main.o upscommon.o ../common/upsconf.o ../common/parseconf.o $(LIBOBJ) $(STRLCPY) 
X+upscode2: upscode2.o main.o upscommon.o ../include/shared.h ../include/shared-tables.h ../common/upsconf.o ../common/parseconf.o $(LIBDEP)
X+	$(CC) $(CFLAGS) -o upscode2 upscode2.o main.o upscommon.o ../common/upsconf.o ../common/parseconf.o $(LIBOBJ) $(STRLCPY) 
END-of-patch-upscode2-Makefile.drvbuild
exit




>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303030346.h233kKcB083279>