[Nut-upsdev] more on 2.0.3-pre

Alfred Ganz alfred-ganz+nut at agci.com
Mon Oct 3 18:49:02 UTC 2005


Peter,

I have tested the three variables:
	input.transfer.low
	input.transfer.high
	battery.charge.warning
for writeability. I found the following two:
	input.transfer.low
	input.transfer.high
writeable, but not the last one:
	battery.charge.warning
On your private comment about writeability under the development tree,
I tried to modify the above three without the ST_FLAG_RW flag present,
and I was NOT able to change them. However, it looks to me like upsrw
is broken, in that it shows ALL the available variables, whereas in
the past it only showed writeable variables. Also, I thought in the
past upsrw without a -s showed the current values. Who should be notified
about this?

On your comment about the ST_FLAG_STRING flag, I have removed this flag
from the entries for battery.charge.low and battery.charge.high, and have 
found no ill effects, so I think that for integer type things it is 
indeed not needed.

I append the latest version of my patch. Now on to the REAL tests, soon
I hope!

Hope this helps, 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-03 14:37:57.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, 0, "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, 0, "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,12 +164,18 @@
     "%.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 },
   { "input.voltage.nominal", 0, 0, "UPS.Input.ConfigVoltage", NULL, "%.0f", HU_FLAG_OK, NULL },
-  { "input.transfer.low", 0, 0, "UPS.Input.LowVoltageTransfer", NULL, "%.0f", HU_FLAG_OK, NULL },
-  { "input.transfer.high", 0, 0, "UPS.Input.HighVoltageTransfer", NULL, "%.0f", HU_FLAG_OK, NULL },
+  /* the following two are writeable for the Back-UPS ES 650 */
+  { "input.transfer.low", ST_FLAG_RW, 0, "UPS.Input.LowVoltageTransfer", NULL, "%.0f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL },
+  { "input.transfer.high", ST_FLAG_RW, 0, "UPS.Input.HighVoltageTransfer", NULL, "%.0f", HU_FLAG_OK | HU_FLAG_SEMI_STATIC, NULL },
 
   /* Output page */
   { "output.voltage", 0, 0, "UPS.Output.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