[Lcdproc] [Lcdproc][patch] Cwlnx driver bug fix

Gideon gideon.tsang@cwlinux.com
Thu Jan 18 09:27:01 2007


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

Hi Peter,

One more mistake I spot, but the program still write garbages.

I replaced the whole Set_Insert function to the old one and then it 
works perfectly fine, but I don't see any difference between them.  You 
have any idea?

regards,

Gideon


Peter Marschall wrote:
> Hi,
> 
> On Wednesday, 17. January 2007 10:40, Gideon wrote:
>> The bars only write the whole block correctly, but not partially.  It
>> looks something like this
>>
>>
>> ******
>> ******
>>   ***** *****
>>   ***** *****
>>   ***** *****
>>   ***** *****
>>   ***** *****
>>   ***** *****
>>   ***** *****
>>   ***** *****
> 
> O.K. thanks for the info.
> I guess you are right. we need to zero the 6'th column.
> 
>> I also tried the nightly tarball(20070117).  It is somewhat different
>> from the stable-0-5-x version which I was using.  The LCDd of this
>> version didn't run successfully. It gave me this following error:
>>
>> "Could not open driver module server/drivers/CwLnx.so:
>> server/drivers/CwLnx.so: undefined symbol: lib_adv_bignum"
> 
> This man an omission of mine in server/drivers/Makefile.am
> I committed a fix to CVS that will be in tonight's (=tomorrow's) tar ball.
> 
> If you use CVS directly, you may download the latest Makefile.am
> with the fixed line:
> 	CwLnx_LDADD =        libLCD.a libbignum.a
> and regenerate all the Makefile.in's by calling
> 	sh ./autogen.sh
> in the base source directory.
> 
>> and even I commented it out the screen doesn't draw correct, I'm still
>> looking at it now.
> 
> Hmmm, the only changes between the two versions are
> - a few comment changes
> - a change to CwLnx_num() to use the bignum library.
>   (only used in the bigClock screen)
> - the patch you sent to me
>   (I changed it a bit: removed the debugging fprintf(), ...)
> - a few optimzations for the static functions I wrote yesterday
>   (and which I wanted you to test ;)
>   These changes are supposed to do one write operation to the
>   device for each command instead of one write per byte.
>   
> Of these the only "critical" might be my changes.
> But the look pretty straightforward:
> 
> @@ -183,94 +177,58 @@
>  /* Hardware function */
>  static void Enable_Backlight(int fd)
>  {
> -    char c;
> -    int rc;
> +    char cmd[] = { LCD_CMD, LCD_LIGHT_ON, LCD_CMD_END };
> 
> -    c = LCD_CMD;
> -    rc = Write_LCD(fd, &c, 1);
> -    c = LCD_LIGHT_ON;
> -    rc = Write_LCD(fd, &c, 1);
> -    c = LCD_CMD_END;
> -    rc = Write_LCD(fd, &c, 1);
> +    Write_LCD(fd, cmd, 3);
>  }
> 
> I.e. they change: 
> static void Enable_Backlight(int fd)
> {
>     char c;
>     int rc;
> 
>     c = LCD_CMD;
>     rc = Write_LCD(fd, &c, 1);
>     c = LCD_LIGHT_ON;
>     rc = Write_LCD(fd, &c, 1);
>     c = LCD_CMD_END;
>     rc = Write_LCD(fd, &c, 1);
> }
> 
> to 
> 
> static void Enable_Backlight(int fd)
> {
>     char cmd[] = { LCD_CMD, LCD_LIGHT_ON, LCD_CMD_END };
> 
>     Write_LCD(fd, cmd, 3);
> }
> 
> Re-checking the changes, I found one error in them, which I immediately fixed.
> 
> 
>> BTW, I just noticed that the instruction of getting the latest version
>> of LCDproc from CVS is incorrect in this page:
>> http://lcdproc.sourceforge.net/docs/current-user.html
> 
> Thanks for splitting it: Fixed in CVS
> 
> Peter


--------------040305070701020203030709
Content-Type: text/x-patch;
 name="cwlnx.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="cwlnx.patch"

--- lcdproc.orig/server/drivers/CwLnx.c	2007-01-17 21:03:26.000000000 +0800
+++ lcdproc/server/drivers/CwLnx.c	2007-01-18 17:13:45.000000000 +0800
@@ -355,7 +355,7 @@
 	cmd[2] = (char) col;
 	cmd[3] = (char) row;
 
-	Write_LCD(fd, cmd, 4);
+	Write_LCD(fd, cmd, 5);
     }
 }
 

--------------040305070701020203030709--