[Lcdproc] hd44780-serial support for Pertelian X2040

Matteo Pillon matteo.pillon@gmail.com
Sun Mar 18 13:37:02 2007


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

Hi everybody,

Recently I received a mail mentioning the Pertelian X2040 display
interface, which uses the usb bus, with an usb-serial converter.
Attached, the patch to add support for this particular inteface.

Bye!

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

--Nq2Wo0NMKNjxTN9z
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: attachment; filename="lcdproc_pertelian.patch"

Index: docs/lcdproc-user/drivers/hd44780.docbook
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/docs/lcdproc-user/drivers/hd44780.docbook,v
retrieving revision 1.23
diff -u -r1.23 hd44780.docbook
--- docs/lcdproc-user/drivers/hd44780.docbook	4 Feb 2007 16:16:33 -0000	1.23
+++ docs/lcdproc-user/drivers/hd44780.docbook	18 Mar 2007 12:22:02 -0000
@@ -1283,6 +1283,24 @@
 
 </sect3>
 
+<sect3 id="hd44780-pertelian">
+<title>Pertelian X2040 "pertelian"</title>
+
+<para>
+The Pertelian X2040 includes an hd44780 display with enclosure and usb
+connection. In order to work with lcdproc you need usbserial and
+ftdi_sio modules loaded. Display will be available on /dev/ttyUSB0.
+</para>
+
+<para>
+  See <ulink
+         url="http://pertelian.com/index.php?option=com_content&task=view&id=43&Itemid=48">product
+    page</ulink> for more information.
+</para>
+
+</sect3>
+
+
 <sect3 id="hd44780-picanlcd">
 <title>PIC-an-LCD serial device "picanlcd"</title>
 
Index: server/drivers/hd44780-drivers.h
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/drivers/hd44780-drivers.h,v
retrieving revision 1.12
diff -u -r1.12 hd44780-drivers.h
--- server/drivers/hd44780-drivers.h	29 Jan 2007 20:37:50 -0000	1.12
+++ server/drivers/hd44780-drivers.h	18 Mar 2007 12:22:02 -0000
@@ -44,6 +44,7 @@
 	{"los-panel", hd_init_serial, "\tnone\n"},
 	{"vdr-lcd", hd_init_serial, "\tnone\n"},
 	{"vdr-wakeup", hd_init_serial, "\tnone\n"},
+	{"pertelian", hd_init_serial, "\tnone\n"},
 	/* End serial connectiontypes */
 	{"lis2", hd_init_lis2, "\tnone\n"},
 #ifdef HAVE_LIBUSB
Index: server/drivers/hd44780-serial.c
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/drivers/hd44780-serial.c,v
retrieving revision 1.10
diff -u -r1.10 hd44780-serial.c
--- server/drivers/hd44780-serial.c	2 Feb 2007 16:46:07 -0000	1.10
+++ server/drivers/hd44780-serial.c	18 Mar 2007 12:22:02 -0000
@@ -267,18 +267,19 @@
 void
 serial_HD44780_backlight (PrivateData *p, unsigned char state)
 {
+        unsigned char send[1];
 	if (p->have_backlight) {
 		if (SERIAL_IF.backlight_escape) {
-			unsigned char send[2];
 			send[0] = SERIAL_IF.backlight_escape;
-			send[1] = state ? 0 : 0xFF;
-			write(p->fd, &send, 2);
+			write(p->fd, &send, 1);
+                }
+                if (SERIAL_IF.backlight_on && SERIAL_IF.backlight_off) {
+			send[0] = state ? SERIAL_IF.backlight_on : SERIAL_IF.backlight_off;
 		}
 		else {
-			unsigned char send[1];
-			send[0] = state ? SERIAL_IF.backlight_on : SERIAL_IF.backlight_off;
-			write(p->fd, &send, 1);
+			send[0] = state ? 0 : 0xFF;
 		}
+                write(p->fd, &send, 1);
 	}
 }
 
Index: server/drivers/hd44780-serial.h
===================================================================
RCS file: /cvsroot/lcdproc/lcdproc/server/drivers/hd44780-serial.h,v
retrieving revision 1.6
diff -u -r1.6 hd44780-serial.h
--- server/drivers/hd44780-serial.h	2 Feb 2007 16:46:07 -0000	1.6
+++ server/drivers/hd44780-serial.h	18 Mar 2007 12:22:02 -0000
@@ -18,6 +18,12 @@
 	char         keypad;
 	char         keypad_escape;
 	char         backlight;
+        /*
+          if both escape and on/off codes are set means that display
+          can't set brightness, but can only switch light on or off and
+          needs both escape and on/off bytes (see pertelian,
+          http://pertelian.com/index.php?option=com_content&task=view&id=27&Itemid=33)
+        */
 	char         backlight_escape; /* leave to 0 is the interface uses on/off codes   */
 	char         backlight_off;
 	char         backlight_on;     /* leave these two to 0 is backlight_escape is set */
@@ -33,7 +39,8 @@
 	{ "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 }
+	{ "vdr-wakeup",    0xC0, 0xC4, 0xC0, 0xD0,   9600,   4, 0, 0x00, 1,    0, 0xC9, 0xC8,   1, 0xCF },
+	{ "pertelian",     0xFE,    0, 0x00, 0x00,   9600,   8, 0, 0x00, 1, 0xFE, 0x02, 0x03,   0,    0 }
 };
 
 /* initialize this particular driver */

--Nq2Wo0NMKNjxTN9z--