[Nut-upsdev] Request for new UPS support : Tecnoware ECO LCD 650VA

Arnaud Quette aquette.dev at gmail.com
Fri Sep 16 12:02:37 UTC 2011


guys,

I'm willing to put a bit of time to finally solve this point.

2011/9/6 Charles Lepple <clepple at gmail.com>

> On Sep 5, 2011, at 4:25 AM, trantore wrote:
>
>  I repeat several months after: The patch from Brian R. Smith WORKS!
>>
>
@Trantore: please stop yelling, this is not constructive.
We know that these no-name cheap devices are widely sold.
Stop thinking that NUT devs don't want to add support for your specific
device.
Our (NUT devs) issue is to add these while not breaking the (10 times more)
numerous others!
We exposed this and proposed our help... several times.

Finally, if you really want to support NUT and Opensource in general, buying
such devices is the opposite way. Prefer to consider NUT friendly
manufacturer(s):
http://www.networkupstools.org/acknowledgements.html


> Haven't I seen this discussion somewhere before?
>
> http://lists.alioth.debian.**org/pipermail/nut-upsdev/2010-**
> November/005030.html<http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-November/005030.html>
>
> http://lists.alioth.debian.**org/pipermail/nut-upsdev/2010-**
> November/005038.html<http://lists.alioth.debian.org/pipermail/nut-upsdev/2010-November/005038.html>
>
> I think I speak for some of the other developers when I say that I don't
> like to apply random patches that have a high likelihood of breaking other
> users' configurations. Please code and test a patch that can be selectively
> enabled. If you need help coding it up, ask on this list.
>

still valid!
acts being better than words, there is a patch attached (against 2.6.2).
this limits the required krauler changes using a flag ("langid_fix") in
ups.conf, and does not impact existing ones.

that being said, Arjen was the author and expert for this driver / protocol.
He is now retired, and I'm personally not able to test it on other units.

So, if you want to see this patch making its way into the trunk, test it
(you all, Brian, Trantore, Aurélien and Волька!) and send us back driver
debug output (-DDDDD) with *and* without using the ups.conf flag.

The 2nd condition to accept this patch is to have report from existing
blazer_usb->krauler users that confirms everything is still working.

The 3rd and last condition is that you send HCL report, as mentioned there:
http://www.networkupstools.org/stable-hcl.html#footnotes

As usual, feedback and comments welcome...

cheers,
Arnaud
-- 
Linux / Unix Expert R&D - Eaton - http://powerquality.eaton.com
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.free.fr/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20110916/da021ec9/attachment.html>
-------------- next part --------------
Index: docs/man/blazer.txt
===================================================================
--- docs/man/blazer.txt	(révision 3235)
+++ docs/man/blazer.txt	(copie de travail)
@@ -156,6 +156,11 @@
 *ippon*, *cypress*, and *krauler*. When using this option, it is mandatory to also
 specify the *vendorid* and *productid*.
 
+*langid_fix*::
+
+Apply the languageID workaround to the krauler subdriver. This is mandatory
+for some devices, from LDLC, Dynamix and others, to work.
+
 UPS COMMANDS
 ------------
 
Index: drivers/blazer_usb.c
===================================================================
--- drivers/blazer_usb.c	(révision 3235)
+++ drivers/blazer_usb.c	(copie de travail)
@@ -27,7 +27,7 @@
 #include "blazer.h"
 
 #define DRIVER_NAME	"Megatec/Q1 protocol USB driver"
-#define DRIVER_VERSION	"0.03"
+#define DRIVER_VERSION	"0.04"
 
 /* driver description structure */
 upsdrv_info_t upsdrv_info = {
@@ -246,13 +246,47 @@
 		for (retry = 0; retry < 10; retry++) {
 			int	ret;
 
-			ret = usb_get_string_simple(udev, command[i].index, buf, buflen);
+			
+			if (testvar("langid_fix")) {
+				/* Hardcode lang to 0x4095 */
+				ret = usb_get_string(udev, command[i].index, 0x4095, buf, buflen);
+			}
+			else {
+				ret = usb_get_string_simple(udev, command[i].index, buf, buflen);
+			}
 
 			if (ret <= 0) {
 				upsdebugx(3, "read: %s", ret ? usb_strerror() : "timeout");
 				return ret;
 			}
 
+			/* this may serve in the future */
+			upsdebugx(1, "received %d (%d)", ret, buf[0]);
+
+			if (testvar("langid_fix")) {
+				/* Limit this check, at least for now */
+				/* Invalid receive size - message corrupted */
+				if (ret != buf[0]) 
+				{
+					upsdebugx(1, "size mismatch: %d / %d", ret, buf[0]);
+					continue;
+				}
+
+				/* Simple unicode -> ASCII inplace conversion */
+				unsigned int di, si, size = buf[0];
+				for (di = 0, si = 2; si < size; si += 2) {
+					if (di >= (buflen - 1))
+						break;
+
+					if (buf[si + 1]) /* high byte */
+						buf[di++] = '?';
+					else
+						buf[di++] = buf[si];
+				}
+				buf[di] = 0;
+				ret = di;
+			}
+
 			/* "UPS No Ack" has a special meaning */
 			if (!strcasecmp(buf, "UPS No Ack")) {
 				upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf);
@@ -449,6 +483,8 @@
 
 	addvar(VAR_VALUE, "bus", "Regular expression to match USB bus name");
 
+	addvar(VAR_FLAG, "langid_fix", "Apply the languageID workaround to the krauler subdriver");
+
 	blazer_makevartable();
 }
 


More information about the Nut-upsdev mailing list