[Lcdproc] Re: lcdproc-0.5.1 and serialized HD44780 on k-data wake-up 2.0 module

Matteo Pillon matteo.pillon@gmail.com
Wed Jan 31 15:42:01 2007


--TB36FDmn/VVEgNH/
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline

Hi Frank,

On Wed, Jan 31, 2007 at 11:20:58AM +0100, Frank Jepsen wrote:
> I have no problem to change the timeout of vdr-wakeup firmware to let's 
> say 10 sec to put it high above the Waittime default value of 5. After 
> all it is only a fallback when something went wrong with the PC. In 
> normal case the vdr-wakeup should get the end code 0xCF send. Then this 
> problem with backlight being turned of would be no more.

Uhmmm, I think raising the timeout in your firmware isn't a good solution
(i.e. the user can stand in a menu for more than 10 seconds...).
We should integrate a way to keep the display alive in the driver (as
pointed out by Joris Robijn). If anyone has a good idea for
implementing this... I'm a bit busy at the moment, don't know if I can
work on this on the weekend...
Attached a patch to send 0xCF on shutdown (wasn't already there) and
to fix the missing close()... (hey, this was missing also on
pic-an-lcd driver! ;-).

> Today I got a look at the CVS. I like the new aproach with the unified 
> serial attached display driver. I also found my charmap for SED1278F_0B 
> included.

I'm glad you liked it ;-).

> My VDR-Wakeup page is already linked in the driver 
> documentation hd44780.docbook. Please feel free to link to it. I will 
> update it as soon as possible and will test this new version. It's about 
> time to switch to V5.1. ;)

;-)

Thanks for helping us.
Bye.

-- 
 * Matteo Pillon
   http://hydra.ilc.pd.it/~pmatthew

--TB36FDmn/VVEgNH/
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: attachment; filename=patch2

Index: server/drivers/hd44780-low.h
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/drivers/hd44780-low.h,v
retrieving revision 1.18
diff -u -r1.18 hd44780-low.h
--- server/drivers/hd44780-low.h	13 Aug 2006 11:13:13 -0000	1.18
+++ server/drivers/hd44780-low.h	31 Jan 2007 15:38:30 -0000
@@ -150,6 +150,9 @@
 	// Output "data" to output latch if there is one
 	void (*output) (PrivateData *p, int data);
 
+        // Close the interface on shutdown
+        void (*close) (PrivateData *p);
+
 } HD44780_functions;				  /* for want of a better name :-) */
 
 
Index: server/drivers/hd44780-serial.c
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/drivers/hd44780-serial.c,v
retrieving revision 1.9
diff -u -r1.9 hd44780-serial.c
--- server/drivers/hd44780-serial.c	29 Jan 2007 20:49:42 -0000	1.9
+++ server/drivers/hd44780-serial.c	31 Jan 2007 15:38:32 -0000
@@ -1,6 +1,6 @@
 /*
  * Driver for serial connected hd44780 LCDs
- * Copyright (C) 2006  Matteo Pillon <matteo.pillon@gmail.com>
+ * Copyright (C) 2006-2007  Matteo Pillon <matteo.pillon@gmail.com>
  *
  * Some parts are based on the original pic-an-lcd driver code
  *  Copyright (C) 1997, Matthias Prinke <m.prinke@trashcan.mcnet.de>
@@ -121,6 +121,7 @@
 void serial_HD44780_senddata (PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch);
 void serial_HD44780_backlight (PrivateData *p, unsigned char state);
 unsigned char serial_HD44780_scankeypad (PrivateData *p);
+void serial_HD44780_close (PrivateData *p);
 
 // initialize the driver
 int
@@ -224,6 +225,7 @@
 	p->hd44780_functions->backlight = serial_HD44780_backlight;
 	if (p->have_keypad)
 		p->hd44780_functions->scankeypad = serial_HD44780_scankeypad;
+        p->hd44780_functions->close = serial_HD44780_close;
 
 	/* Do initialization */
 	if (SERIAL_IF.if_bits == 8) {
@@ -298,3 +300,11 @@
 	}
 	return 0;
 }
+
+void
+serial_HD44780_close (PrivateData *p)
+{
+        if (SERIAL_IF.end_code)
+                write(p->fd, &SERIAL_IF.end_code, 1);
+        close(p->fd);
+}
Index: server/drivers/hd44780-serial.h
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/drivers/hd44780-serial.h,v
retrieving revision 1.5
diff -u -r1.5 hd44780-serial.h
--- server/drivers/hd44780-serial.h	29 Jan 2007 20:49:42 -0000	1.5
+++ server/drivers/hd44780-serial.h	31 Jan 2007 15:38:32 -0000
@@ -22,17 +22,18 @@
 	char         backlight_off;
 	char         backlight_on;     /* leave these two to 0 is backlight_escape is set */
  	char         multiple_displays;
+        char         end_code;         /* code to send on shutdown */
 } SerialInterface;
 
 /* List of connectiontypes managed by this driver, if you change
    something here, remember also to change hd44780-drivers.h */
 static const SerialInterface serial_interfaces[] = {
-	/*    name         instr data     v     ^ bitrate bits  K   esc  B  Besc  Boff   Bon Multi */
-	{ "picanlcd",      0x11, 0x12, 0x00, 0x20,   9600,   8, 0, 0x00, 0,    0,    0,    0,   0 },
-	{ "lcdserializer", 0xFE,    0, 0x00, 0x00,   9600,   8, 0, 0x00, 0,    0,    0,    0,   0 },
-	{ "los-panel",     0xFE,    0, 0x00, 0x00,   9600,   4, 1, 0xFE, 1, 0xFF,    0,    0,   0 },
-	{ "vdr-lcd",       0xFE,    0, 0x00, 0x00,   9600,   4, 0, 0x00, 0,    0,    0,    0,   0 },
-	{ "vdr-wakeup",    0xC0, 0xC4, 0xC0, 0xD0,   9600,   4, 0, 0x00, 1,    0, 0xC9, 0xC8,   1 }
+	/*    name         instr data     v     ^ bitrate bits  K   esc  B  Besc  Boff   Bon Multi  End */
+	{ "picanlcd",      0x11, 0x12, 0x00, 0x20,   9600,   8, 0, 0x00, 0,    0,    0,    0,   0,    0 },
+	{ "lcdserializer", 0xFE,    0, 0x00, 0x00,   9600,   8, 0, 0x00, 0,    0,    0,    0,   0,    0 },
+	{ "los-panel",     0xFE,    0, 0x00, 0x00,   9600,   4, 1, 0xFE, 1, 0xFF,    0,    0,   0,    0 },
+	{ "vdr-lcd",       0xFE,    0, 0x00, 0x00,   9600,   4, 0, 0x00, 0,    0,    0,    0,   0,    0 },
+	{ "vdr-wakeup",    0xC0, 0xC4, 0xC0, 0xD0,   9600,   4, 0, 0x00, 1,    0, 0xC9, 0xC8,   1, 0xCF }
 };
 
 /* initialize this particular driver */
Index: server/drivers/hd44780.c
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/drivers/hd44780.c,v
retrieving revision 1.60
diff -u -r1.60 hd44780.c
--- server/drivers/hd44780.c	15 Oct 2006 16:06:09 -0000	1.60
+++ server/drivers/hd44780.c	31 Jan 2007 15:38:37 -0000
@@ -328,6 +328,7 @@
 	p->hd44780_functions->uPause = uPause;
 	p->hd44780_functions->scankeypad = HD44780_scankeypad;
 	p->hd44780_functions->output = NULL;
+	p->hd44780_functions->close = NULL;
 
 	// Do connection type specific display init
 	if (connectionMapping[p->connectiontype_index].init_fn(drvthis) != 0)
@@ -409,6 +410,9 @@
 {
 	PrivateData *p = (PrivateData *) drvthis->private_data;
 
+        if (p->hd44780_functions->close)
+                p->hd44780_functions->close(p);
+
 	if (p != NULL) {
 		if (p->framebuf)
 			free(p->framebuf);

--TB36FDmn/VVEgNH/--