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

Arnaud Quette aquette.dev at gmail.com
Mon Oct 17 08:40:22 UTC 2011


2011/10/16 Trantore <quesoyjamon at aol.com>:
> Trantore <quesoyjamon <at> aol.com> writes:
>
>>
>> Hi Arnoud,
>>
>> Works Great!!!! Thank you....
>> working the input.voltage, the load, output.voltage, etc.
>>
>> What more you need from me to add the patch to the main branch for 2.6.3 ?
>>
>> Regards,
>> Trantore.
>
>
> Hi Arnoud,
>
> I checked the SVN tree and I can't find any trace of your patch.
> Please, instruct me on what else I need to do to commit this patch.
>
> Best regards and thank you for your support!

the mentioned patch was attached in one of my previous mail.
I've attached again a version, with the needed modification for you
(ie, langid = 409 instead of 4095).

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 --------------
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, 0x409, 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