[Nut-upsdev] more on 2.0.3-pre

Alfred Ganz alfred-ganz+nut at agci.com
Sun Oct 2 20:44:04 UTC 2005


Gentlemen,

I have now had a chance to run some initial tests of my changes to
apc-hid.c of the current development tree. Running newhipups and 
inspecting the -DDDD output seems to indicate that with the fix below
everything seems to work as expected. However, I have not yet shut
my system in order to take the UPS out of action so that I can do my
various tests with a lightbulb load. I still hope to do this before the 
end of this week.

In the initial tests I found that a trick that I was using with the 2.0.2 
sources no longer works. I have therefore made a change for the second 
item in my previous message:
>2) the rather lengthy, unsolicited status messages from my "Back-UPS ES 650"
>   return two variables that are not contained in the current table,
>   adding them avoids the indications that newhidups doesn't know what
>   to do with the variables, although the current change doesn't affect
>   status evaluation in any way either.
Rather than using a NULL item mapping I am now using the hex_conversion 
mapping to accept the two items:
	UPS.PowerSummary.PresentStatus.BatteryPresent and
	UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired
that are however still ignored, as it happened with the 2.0.2 changes. 

If the experts think it would be worthwhile to actually make the two 
items available (although they are not particularly useful), please let 
me know how they might be mapped, and I will add and test such a mapping.

Here follows the modified patch, AG

---------------------------------------------------------------------------
diff -ru nut-2.1.dev.orig/drivers/apc-hid.c nut-2.1.dev/drivers/apc-hid.c
--- nut-2.1.dev.orig/drivers/apc-hid.c	2005-09-24 00:37:25.000000000 -0400
+++ nut-2.1.dev/drivers/apc-hid.c	2005-10-02 14:38:00.000000000 -0400
@@ -115,11 +115,14 @@
   
   /* Battery page */
   { "battery.charge", 0, 1, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", HU_FLAG_OK, NULL },
-  { "battery.charge.low", ST_FLAG_STRING, 5, "UPS.PowerSummary.RemainingCapacityLimit", NULL,
-    "%.0f", HU_FLAG_OK, NULL }, /* Read only */
+  /* the following is writeable for the Back-UPS ES 650 */
+  { "battery.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerSummary.RemainingCapacityLimit", NULL,
+    "%.0f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL },
   { "battery.charge.warning", ST_FLAG_STRING, 5, "UPS.PowerSummary.WarningCapacityLimit", NULL, "%.0f", HU_FLAG_OK, NULL }, /* Read only */
   { "battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", HU_FLAG_OK, NULL },
-  { "battery.runtime.low", 0, 0, "UPS.Battery.RemainingTimeLimit", NULL, "%.0f", HU_FLAG_OK, NULL },
+  /* the following is writeable for the Back-UPS ES 650 */
+  { "battery.runtime.low", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerSummary.RemainingTimeLimit", NULL,
+    "%.0f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL },
   { "battery.voltage",  0, 0, "UPS.PowerSummary.Voltage", NULL, "%.1f", HU_FLAG_OK, NULL },
   { "battery.voltage.nominal", 0, 0, "UPS.Battery.ConfigVoltage", NULL,
     "%.1f", HU_FLAG_OK, NULL },
@@ -161,6 +164,11 @@
     "%.0f", HU_FLAG_OK, &overbatt_info[0] },
   { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.NeedReplacement", NULL,
     "%.0f", HU_FLAG_OK, &replacebatt_info[0] },
+  /* The following two are returned with long notification from Back-UPS ES 650 */
+  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired", NULL,
+    "%.0f", HU_FLAG_OK, &hex_conversion[0]},
+  { "ups.status", 0, 1, "UPS.PowerSummary.PresentStatus.BatteryPresent", NULL,
+    "%.0f", HU_FLAG_OK, &hex_conversion[0]},
 
   /* Input page */
   { "input.voltage", 0, 0, "UPS.Input.Voltage", NULL, "%.1f", HU_FLAG_OK, NULL },
---------------------------------------------------------------------------

-- 
 ----------------------------------------------------------------------
   Alfred Ganz					alfred-ganz at agci.com
   AG Consulting, Inc.				(203) 624-9667
   440 Prospect Street # 11
   New Haven, CT 06511
 ----------------------------------------------------------------------



More information about the Nut-upsdev mailing list