Hi,
I own a Yunto-Q 700 (made 2000 by online usv systems) and a Yunto-Q 1200
(made 2010).
They both work with blazer_ser, but didn't shutdown.
I straced the proprietary driver and found the ups expected the return
time given with _5_ digits instead of 4, else the command was ignored by
the ups.
And the Yunto don't send rating/manufacturer informations.
I don't want to commit this to git, because debian/wheezy doesn't has
the latest branch and I still want to use the debian package system (get
source, patch, rebuild), so the patch is against an older version
(2.6.4) and needs to be build in by hand.
I introduced a new protocol "yunto" and added alternatives in the
shutdown-restore and load.off section. (I saw in git that there has been
changes already not to send the "Rxxx" part when shutdown without return
has been requested - that's what I found, too, does the proprietary
driver.)
There is a change in main.c, too, because sending the forceshutdown()
before upsdrv_initinfo did not read the additional protocol parameter so
the ups was not shut down when upsdrvctl shutdown was called from the
halt script in init.d. So I moved the forceshutdown below the initinfo.
CU,
Gernot
--- nut.ori/nut-2.6.4/drivers/blazer.c 2012-05-29 13:22:15.000000000 +0200
+++ nut/nut-2.6.4/drivers/blazer.c 2014-07-25 18:16:19.000000000 +0200
@@ -78,6 +78,7 @@
{ "mustek", "QS\r", "F\r", "I\r" },
{ "megatec/old", "D\r", "F\r", "I\r" },
{ "zinto", "Q1\r", "F\r", "FW?\r" },
+ { "yunto", "Q1\r" },
{ NULL }
};
@@ -395,7 +396,6 @@
const char *ups;
} instcmd[] = {
{ "beeper.toggle", "Q\r" },
- { "load.off", "S00R0000\r" },
{ "load.on", "C\r" },
{ "shutdown.stop", "C\r" },
{ "test.battery.start.deep", "TL\r" },
@@ -406,7 +406,6 @@
char buf[SMALLBUF] = "";
int i;
-
for (i = 0; instcmd[i].cmd; i++) {
if (strcasecmp(cmdname, instcmd[i].cmd)) {
@@ -435,16 +434,39 @@
* up by 2, i.e. S01R0003, and it will return online properly.
* (thus the default of ondelay=3 mins)
*/
- if (offdelay < 60) {
- snprintf(buf, sizeof(buf), "S.%dR%04d\r", offdelay / 6, ondelay);
+ if (!strcasecmp(command[proto].name, "yunto")) {
+ if (offdelay < 60) {
+ snprintf(buf, sizeof(buf), "S.%dR%05d\r", offdelay / 6, ondelay);
+ } else {
+ snprintf(buf, sizeof(buf), "S%02dR%05d\r", offdelay / 60, ondelay);
+ }
+ } else {
+ if (offdelay < 60) {
+ snprintf(buf, sizeof(buf), "S.%dR%04d\r", offdelay / 6, ondelay);
+ } else {
+ snprintf(buf, sizeof(buf), "S%02dR%04d\r", offdelay / 60, ondelay);
+ }
+
+ }
+ } else if (!strcasecmp(cmdname, "load.off")) {
+ if (!strcasecmp(command[proto].name, "yunto")) {
+ snprintf(buf, sizeof(buf), "S00\r", offdelay / 6);
} else {
- snprintf(buf, sizeof(buf), "S%02dR%04d\r", offdelay / 60, ondelay);
+ snprintf(buf, sizeof(buf), "S00R0000\r", offdelay / 6);
}
} else if (!strcasecmp(cmdname, "shutdown.stayoff")) {
- if (offdelay < 60) {
- snprintf(buf, sizeof(buf), "S.%dR0000\r", offdelay / 6);
+ if (!strcasecmp(command[proto].name, "yunto")) {
+ if (offdelay < 60) {
+ snprintf(buf, sizeof(buf), "S.%d\r", offdelay / 6);
+ } else {
+ snprintf(buf, sizeof(buf), "S%02d\r", offdelay / 60);
+ }
} else {
- snprintf(buf, sizeof(buf), "S%02dR0000\r", offdelay / 60);
+ if (offdelay < 60) {
+ snprintf(buf, sizeof(buf), "S.%dR0000\r", offdelay / 6);
+ } else {
+ snprintf(buf, sizeof(buf), "S%02dR0000\r", offdelay / 60);
+ }
}
} else if (!strcasecmp(cmdname, "test.battery.start")) {
int delay = extra ? strtol(extra, NULL, 10) : 10;
--- nut.ori/nut-2.6.4/drivers/main.c 2012-05-02 23:35:39.000000000 +0200
+++ nut/nut-2.6.4/drivers/main.c 2014-07-25 20:45:12.000000000 +0200
@@ -616,9 +616,6 @@
fatalx(EXIT_FAILURE, "Fatal error: broken driver. It probably needs to be converted.\n");
}
- if (do_forceshutdown)
- forceshutdown();
-
/* note: device.type is set early to be overriden by the driver
* when its a pdu! */
dstate_setinfo("device.type", "ups");
@@ -632,6 +629,9 @@
upsdrv_initinfo();
upsdrv_updateinfo();
+ if (do_forceshutdown)
+ forceshutdown();
+
if (dstate_getinfo("driver.flag.ignorelb")) {
int have_lb_method = 0;
_______________________________________________
Nut-upsdev mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsdev