[Lcdproc] patch for CwLnx display corruption

Gideon gideon.tsang@cwlinux.com
Wed May 9 09:46:01 2007


This is a multi-part message in MIME format.
--------------020709060903020502080100
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi all,

The CwLnx driver displays corrupted data since v0.5.x.  The display has 
problem handing the data if a string of characters is sent at once. 
Attached is the patch against v0.5.2.

BR,

Gideon Tsang

--------------020709060903020502080100
Content-Type: text/x-patch;
 name="lcdproc-0.5.x-cwlinux.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="lcdproc-0.5.x-cwlinux.patch"

diff -ru -xCVS -x'.#*' -x'*.so' -x'*~' -x'*conf*' -x'*.P*' -x'Makefile*' lcdproc-0.5.2.orig/server/drivers/CwLnx.c lcdproc-0.5.2/server/drivers/CwLnx.c
--- lcdproc-0.5.2.orig/server/drivers/CwLnx.c	2007-04-14 22:38:14.000000000 +0800
+++ lcdproc-0.5.2/server/drivers/CwLnx.c	2007-05-09 17:09:44.000000000 +0800
@@ -153,17 +153,17 @@
 
 static int Write_LCD(int fd, char *c, int size)
 {
-    int rc;
+    int rc, i;
     int retries = 30;
 
-    do {
-	rc = write(fd, c, size);
-        if (rc == size)
-	    break;
-	usleep(DELAY);
-        
-    } while (--retries > 0);
-
+    for (i = 0; i < size; i++) {
+        do {
+            rc = write(fd, &c[i], 1);
+            if (rc == 1)
+            break;
+        usleep(DELAY);
+        } while (--retries > 0);
+    }
     return rc;
 }

--------------020709060903020502080100--