After installing NUT, I've noticed that the belkin driver capabilities
are rather basic. We have a Belkin Regulator Pro 1400VA (F6C1400-EUR),
so I've updated the driver to support control of the buzzer & tests, as
well as adding test result reporting.
I've attached the following patches. Hopefully they can be added to any
upcoming versions.
--
John Bayly
Systems Administrator
------------------
TipsTrade Ltd.
16 Wornal Park,
Menmarsh Road,
Worminghall,
Bucks.
HP18 9JX
T: +44 (0)1844 337 326 (Direct)
M: +44 (0)7787 727 934
F: +44 (0)1844 337 337
E: [email protected]
E-Mail Disclaimer
Whilst TipsTrade Ltd. believes that the information is correct at the
date of this e-mail, no warranty or representation is given to this effect
and no responsibility can be accepted by TipsTrade Ltd. to any end users
for any action taken on the basis of the information.
The information contained in this electronic transmission is strictly
confidential and may be legally privileged. It is intended solely for the
addressee. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken in reliance on this
is prohibited and may be unlawful. Please treat our information in
confidence, as you would expect us to treat yours.
E-mail is an inherently insecure form of communication and we do not accept
liability for any unintentional damage caused to a recipient's system by
this e-mail message and/or its attachments or for any unauthorised access to
or interference with this e-mail that may occur.
If you have received this e-mail in error, please notify the Systems
Manager: [email protected]
--- drivers/belkin.c.orig 2009-02-17 09:20:48.000000000 +0000
+++ drivers/belkin.c 2010-10-08 18:18:37.000000000 +0000
@@ -217,8 +217,13 @@
ser_flush_io(upsfd);
+ dstate_addcmd("beeper.disable");
+ dstate_addcmd("beeper.enable");
dstate_addcmd("load.off");
dstate_addcmd("load.on");
+ dstate_addcmd("test.battery.start.quick");
+ dstate_addcmd("test.battery.start.deep");
+ dstate_addcmd("test.battery.stop");
upsdrv_updateinfo();
return 0;
}
@@ -283,6 +288,44 @@
get_belkin_field(temp, st, sizeof(st), 7);
val = atof(st);
dstate_setinfo("ups.load", "%03.0f", val);
+
+ send_belkin_command(STATUS, TEST_RESULT, "");
+ res = get_belkin_reply(temp);
+ if (res == -1)
+ return;
+
+ get_belkin_field(temp, st, sizeof(st), 1);
+ val = atof(st);
+ switch ((int)val) {
+ case 0:
+ dstate_setinfo("ups.test.result", "%s", "No test
performed");
+ break;
+
+ case 1:
+ dstate_setinfo("ups.test.result", "%s", "Passed");
+ break;
+
+ case 2:
+ dstate_setinfo("ups.test.result", "%s", "In progress");
+ break;
+
+ case 3:
+ case 4:
+ dstate_setinfo("ups.test.result", "%s", "10s test
failed");
+ break;
+
+ case 5:
+ dstate_setinfo("ups.test.result", "%s", "deep test
failed");
+ break;
+
+ case 6:
+ dstate_setinfo("ups.test.result", "%s", "Aborted");
+ break;
+
+ default:
+ break;
+
+ }
}
static int get_belkin_reply(char *buf)
@@ -347,6 +390,28 @@
send_belkin_command(CONTROL, "SDA", "5");
}
+/* handle "beeper.disable" */
+static void do_beeper_off(void) {
+ int res;
+ char temp[SMALLBUF];
+
+ // Compare the model name, as the BUZZER_OFF argument depends on it
+ send_belkin_command(STATUS, MODEL, "");
+ res = get_belkin_reply(temp);
+ if (res == -1)
+ return;
+
+ char arg;
+ if (!strcmp(temp, "F6C1400-EUR")) {
+ arg = BUZZER_OFF2;
+
+ } else {
+ arg = BUZZER_OFF0;
+
+ }
+ send_belkin_command(CONTROL,BUZZER,arg);
+}
+
/* handle the "load.off" with some paranoia */
static void do_off(void)
{
@@ -375,6 +440,16 @@
static int instcmd(const char *cmdname, const char *extra)
{
+ if (!strcasecmp(cmdname, "beeper.disable")) {
+ do_beeper_off();
+ return STAT_INSTCMD_HANDLED;
+ }
+
+ if (!strcasecmp(cmdname, "beeper.enable")) {
+ send_belkin_command(CONTROL,BUZZER,BUZZER_ON);
+ return STAT_INSTCMD_HANDLED;
+ }
+
if (!strcasecmp(cmdname, "load.off")) {
do_off();
return STAT_INSTCMD_HANDLED;
@@ -385,6 +460,21 @@
return STAT_INSTCMD_HANDLED;
}
+ if (!strcasecmp(cmdname, "test.battery.start.quick")) {
+ send_belkin_command(CONTROL,TEST,TEST_10SEC);
+ return STAT_INSTCMD_HANDLED;
+ }
+
+ if (!strcasecmp(cmdname, "test.battery.start.deep")) {
+ send_belkin_command(CONTROL,TEST,TEST_DEEP);
+ return STAT_INSTCMD_HANDLED;
+ }
+
+ if (!strcasecmp(cmdname, "test.battery.stop")) {
+ send_belkin_command(CONTROL,TEST,TEST_CANCEL);
+ return STAT_INSTCMD_HANDLED;
+ }
+
upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname);
return STAT_INSTCMD_UNKNOWN;
}
--- drivers/belkin.h.orig 2009-02-17 09:20:48.000000000 +0000
+++ drivers/belkin.h 2010-10-08 17:18:37.000000000 +0000
@@ -32,10 +32,19 @@
#define STAT_OUTPUT "STO"
#define STAT_BATTERY "STB"
#define STAT_STATUS "STA"
+#define TEST_RESULT "TSR"
#define POWER_ON "RON"
#define POWER_OFF "ROF"
#define POWER_SDTYPE "SDT" /* shutdown type? */
#define POWER_CYCLE "SDA" /* shutdown, then restore */
+#define BUZZER "BUZ"
+#define BUZZER_ON "1"
+#define BUZZER_OFF0 "0" /* Switching the buzzer off can be either 0 or 2 */
+#define BUZZER_OFF2 "2" /* Seems to be used for F6c1400 */
+#define TEST "TST"
+#define TEST_10SEC "3"
+#define TEST_DEEP "4"
+#define TEST_CANCEL "0"
/* The UPS Status "low battery" comes up 10s before the UPS actually stops.
Therefore a shutdown is done at this battery % */
_______________________________________________
Nut-upsdev mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev