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@agci.com AG Consulting, Inc. (203) 624-9667 440 Prospect Street # 11 New Haven, CT 06511 ----------------------------------------------------------------------
Hi Alfred, thanks for your testing. I also have a Back-UPS ES 650, but it is currently in my wife's office at work so I am not doing any testing with it. Thanks for catching the writable variables. That is of course useful to make them writable in NUT. I have no idea why the writable variables always also get the ST_FLAG_STRING flag - Arnaud, do you know if this is necessary / sensible? Perhaps it is just a copy-and-paste error. Alfred, do you know if there are any other potentially writable variables? Potential candidates are: battery.charge.warning input.transfer.low input.transfer.high "ups.beeper.status" is also writable in principle, but this is already taken care of by instant commands. Regarding the other change - NUT's status flags don't have slots for "RemainingTimeLimitExpired" and "BatteryPresent". So adding these has no effect other than removing some debug messages. -- Peter Alfred Ganz wrote:> > 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@agci.com > AG Consulting, Inc. (203) 624-9667 > 440 Prospect Street # 11 > New Haven, CT 06511 > ---------------------------------------------------------------------- > > _______________________________________________ > Nut-upsdev mailing list > Nut-upsdev@lists.alioth.debian.org > http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev >
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@agci.com
AG Consulting, Inc. (203) 624-9667
440 Prospect Street # 11
New Haven, CT 06511
----------------------------------------------------------------------
Peter,
As part of my writeability tests, I tried to play with the
beeper.{on|off} commands. I was not able to make them work with the
current apc-hid.c. However, upon further looking around, it seems to
me that the "Back-UPS ES 650" doesn't support the
"muted" value for
UPS.AudibleAlarmControl that is in the current table (i.e. "3"), but
it does support the "disabled" value (i.e. "1").
After changing the instant value for the beeper.off instant command
entry from "3" to "1" I am now able to manipulate the
ups.beeper.status
with beeper.{on|off} and show the results with upsc.
Do you know if there are APC UPS's that actually support the
"muted"
value, or is this just an artifact from the time the apc-hid code was
created (I note that belkin-hid.c indeed also uses a "3")? Since I
don't know the history of this I am reluctant to propose the above
change without further insight from the experts.
Hope this helps, AG
--
----------------------------------------------------------------------
Alfred Ganz alfred-ganz@agci.com
AG Consulting, Inc. (203) 624-9667
440 Prospect Street # 11
New Haven, CT 06511
----------------------------------------------------------------------