[Nut-upsdev] Proposed apcsmart driver patch

rrgea1017 at rrgnet.com rrgea1017 at rrgnet.com
Tue Jul 31 19:01:54 UTC 2007


G'day y'all,

Here's a tiny patch set for drivers/apcsmart.c and drivers/apcsmart.h.
Adds APC SmartUPS 1250 ("8QD" case) + 940-0024C recognition to
apcsmart.  (Unpatched apcsmart.c v1.99.8 misidentifies the SmartUPS
1250 as a "dumb" UPS.)  For NUT 2.0.5+.

NUT 2.0.5: Patches apply successfully.  Builds successfully.  Works as
expected under Ubuntu 7.04.

NUT 2.2: Patches apply successfully (with offset).  Builds
successfully.  Untested.

No changes to man pages.


     -- Rob


[Sample output from upsc(8)]

Dumb upsc(8) output with unpatched apcsmart(8):

root at maya /root (4:1804) #  -? upsc SmartUPS-1250 at localhost
driver.name: apcsmart
driver.parameter.cable: 940-0024C
driver.parameter.port: /dev/ups
driver.parameter.sdtype: 0
driver.version: 2.0.5
driver.version.internal: 1.99.8
input.voltage: 119.6
ups.mfr: APC
ups.model: Smart-UPS
ups.serial: 09000717
ups.status: OL


Not-so-dumb upsc(8) output with patched apcsmart(8):

root at maya /root (4:1805) #  -? upsc SmartUPS-1250 at localhost
battery.alarm.threshold: 0
battery.charge: 100.0
battery.charge.restart: 00
battery.date: 07/12/94
battery.runtime: 3060
battery.runtime.low: 300
battery.voltage: 27.67
battery.voltage.nominal: 024
driver.name: apcsmart
driver.parameter.cable: 940-0024C
driver.parameter.port: /dev/ups
driver.parameter.sdtype: 0
driver.version: 2.0.5
driver.version.internal: 1.99.8
input.frequency: 60.00
input.quality: FF
input.sensitivity: H
input.transfer.high: 132
input.transfer.low: 103
input.transfer.reason: R
input.voltage: 119.6
input.voltage.maximum: 119.6
input.voltage.minimum: 119.6
output.voltage: 119.6
output.voltage.nominal: 115
ups.delay.shutdown: 020
ups.delay.start: 000
ups.id: UPS_IDEN
ups.load: 019.2
ups.mfr: APC
ups.mfr.date: 07/12/94
ups.model: Smart-UPS
ups.serial: 09000717
ups.status: OL
ups.temperature: 051.3
ups.test.interval: 0
ups.test.result: NO


[Patches follow]

--- drivers/apcsmart.c~	2006-11-07 18:08:45.000000000 -0800
+++ drivers/apcsmart.c	2007-07-27 12:52:10.000000000 -0700
@@ -532,15 +532,14 @@
  			SER_WAIT_SEC, SER_WAIT_USEC);

  		/* found one, force the model information */
-		if (!strcmp(buf, "6QD")) {
+		if(!strcmp(buf, "8QD") || /* (SmartUPS 1250, vintage 07/94.) */
+		   !strcmp(buf, "6QD") || /* (APC600.) */
+		   !strcmp(buf, "6TI")) { /* (APC600.) */
  			upsdebugx(1, "Found Smart-UPS");
  			dstate_setinfo("ups.model", "Smart-UPS");
  		}
-		else if (!strcmp(buf, "6TI")) {
-			upsdebugx(1, "Found Smart-UPS");
-			dstate_setinfo("ups.model", "Smart-UPS");
-		}
-		else return 0;
+		else
+			return 0;
  	}

  	upsdebugx(2, "Firmware: [%s]", buf);

--- drivers/apcsmart.h~	2006-11-24 23:57:56.000000000 -0800
+++ drivers/apcsmart.h	2007-07-27 12:51:30.000000000 -0700
@@ -260,6 +260,8 @@ struct {
  	{ "D6",         "789ABCEFGKLMNOPQRSUVWXYZ", 0 },
  	{ "D5",         "789ABCEFGKLMNOPQRSUVWXYZ", 0 },
  	{ "D4",         "789ABCEFGKLMNOPQRSUVWXYZ", 0 },
+	/* SmartUPS 1250. */
+	{ "8QD",	"79ABCDEFGKLMNOPQRSUVWXYZcefgjklmnopqrsuxz", 0 },

  	{ NULL,		NULL,			0 },
  };



More information about the Nut-upsdev mailing list