All pastes #2095079 Raw Edit

Unnamed

public text v1 · immutable
#2095079 ·published 2011-11-23 21:27 UTC
rendered paste body
diff -Naur lcdproc-0.5.2_org/acinclude.m4 lcdproc-0.5.2/acinclude.m4
--- lcdproc-0.5.2_org/acinclude.m4	2007-04-14 22:39:28.000000000 +0800
+++ lcdproc-0.5.2/acinclude.m4	2010-11-03 15:55:37.000000000 +0800
@@ -187,7 +187,7 @@
 		hd44780)
 			HD44780_DRIVERS="hd44780-hd44780-serial.o hd44780-hd44780-lis2.o"
 			if test "$ac_cv_port_have_lpt" = yes ; then
-				HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-4bit.o hd44780-hd44780-ext8bit.o hd44780-lcd_sem.o hd44780-hd44780-winamp.o hd44780-hd44780-serialLpt.o"
+				HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-4bit.o hd44780-hd44780-ext8bit.o hd44780-lcd_sem.o hd44780-hd44780-winamp.o hd44780-hd44780-serialLpt.o hd44780-hd44780-lanner.o"
 			fi
 			if test "$enable_libusb" = yes ; then
 				HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-bwct-usb.o hd44780-hd44780-lcd2usb.o"
diff -Naur lcdproc-0.5.2_org/clients/examples/demo.txt lcdproc-0.5.2/clients/examples/demo.txt
--- lcdproc-0.5.2_org/clients/examples/demo.txt	1970-01-01 08:00:00.000000000 +0800
+++ lcdproc-0.5.2/clients/examples/demo.txt	2010-11-03 16:04:21.000000000 +0800
@@ -0,0 +1,13 @@
+Line1 0123456789 Line1 abcdefghij Line1 klmnopqrs Line1 tuvwxyz>
+Line2 0123456789 Line2 abcdefghij Line2 klmnopqrs Line2 tuvwxyz>
+Line3 0123456789 Line3 abcdefghij Line3 klmnopqrs Line3 tuvwxyz>
+Line4 0123456789 Line4 abcdefghij Line4 klmnopqrs Line4 tuvwxyz>
+Line5 0123456789 Line5 abcdefghij Line5 klmnopqrs Line5 tuvwxyz>
+Line6 0123456789 Line6 abcdefghij Line6 klmnopqrs Line6 tuvwxyz>
+Line7 0123456789 Line7 abcdefghij Line7 klmnopqrs Line7 tuvwxyz>
+Line8 0123456789 Line8 abcdefghij Line8 klmnopqrs Line8 tuvwxyz>
+Line9 0123456789 Line9 abcdefghij Line9 klmnopqrs Line9 tuvwxyz>
+Line10 0123456789 Line10 abcdefghij Line10 klmnopqrs Line10 tuvwxyz>
+Line11 0123456789 Line11 abcdefghij Line11 klmnopqrs Line11 tuvwxyz>
+Line12 0123456789 Line12 abcdefghij Line12 klmnopqrs Line12 tuvwxyz>
+Line13 0123456789 Line13 abcdefghij Line13 klmnopqrs Line13 tuvwxyz>
diff -Naur lcdproc-0.5.2_org/LCDd.conf lcdproc-0.5.2/LCDd.conf
--- lcdproc-0.5.2_org/LCDd.conf	2007-04-26 03:56:43.000000000 +0800
+++ lcdproc-0.5.2/LCDd.conf	2010-11-03 15:56:07.000000000 +0800
@@ -41,7 +41,7 @@
 #   irman, joy, lb216, lcdm001, lcterm, lirc, MD8800, ms6931, mtc_s16209x,
 #   MtxOrb, NoritakeVFD, picolcd, pyramid, sed1330, sed1520, serialPOS,
 #   serialVFD, sli, stv5730, svga, t6963, text, tyan, ula200, xosd
-Driver=curses
+Driver=hd44780
 
 # Tells the driver to bind to the given interface
 Bind=127.0.0.1
@@ -407,7 +407,7 @@
 [hd44780]
 
 # Select what type of connection. See documentation for types.
-ConnectionType=4bit
+ConnectionType=lanner
 
 # Port where the LPT is. Usual values are 0x278, 0x378 and 0x3BC
 Port=0x378
@@ -420,13 +420,13 @@
 
 # If you have a keypad connected.
 # You may also need to configure the keypad layout further on in this file.
-Keypad=no
+Keypad=yes
 
 # set the initial contrast (for bwctusb only) [default: 0; legal: 0 - 1000]
 Contrast=0
 
 # If you have a switchable backlight.
-Backlight=no
+Backlight=yes
 
 # If you have the additional output port ("bargraph") and you want to
 # be able to control it with the lcdproc OUTPUT command
@@ -438,7 +438,7 @@
 
 # Specifies the size of the LCD.
 # In case of multiple combined displays, this should be the total size.
-Size=20x4
+Size=20x2
 
 # For multiple combined displays: how many lines does each display have.
 # Vspan=2,2 means both displays have 2 lines.
@@ -479,11 +479,14 @@
 #   KeyDirect_4=Enter
 # For matrix keys use the X and Y coordinates of the key:
 #   KeyMatrix_1_3=Enter
-KeyMatrix_4_1=Enter
-KeyMatrix_4_2=Up
-KeyMatrix_4_3=Down
-KeyMatrix_4_4=Escape
-
+#KeyMatrix_4_1=Enter
+#KeyMatrix_4_2=Up
+#KeyMatrix_4_3=Down
+#KeyMatrix_4_4=Escape
+keydirect_1=Left
+keydirect_2=Up
+keydirect_3=Down
+keydirect_4=Right
 
 
 ## ICP A106 driver ##
diff -Naur lcdproc-0.5.2_org/server/drivers/hd44780-drivers.h lcdproc-0.5.2/server/drivers/hd44780-drivers.h
--- lcdproc-0.5.2_org/server/drivers/hd44780-drivers.h	2007-04-14 22:38:14.000000000 +0800
+++ lcdproc-0.5.2/server/drivers/hd44780-drivers.h	2010-11-03 15:57:06.000000000 +0800
@@ -16,6 +16,7 @@
 # include "hd44780-ext8bit.h"
 # include "hd44780-serialLpt.h"
 # include "hd44780-winamp.h"
+# include "hd44780-lanner.h"
 #endif
 #include "hd44780-serial.h"
 #include "hd44780-lis2.h"
@@ -39,6 +40,7 @@
 	{ "8bit",          hd_init_ext8bit,   "\tnone\n" },
 	{ "serialLpt",     hd_init_serialLpt, "\tnone\n" },
 	{ "winamp",        hd_init_winamp,    "\tnone\n" },
+	{ "lanner",        hd_init_lanner,    "\tnone\n" },
 #endif
 	/* Serial connectiontypes */
 	{ "picanlcd",      hd_init_serial,    "\tnone\n" },
diff -Naur lcdproc-0.5.2_org/server/drivers/hd44780-lanner.c lcdproc-0.5.2/server/drivers/hd44780-lanner.c
--- lcdproc-0.5.2_org/server/drivers/hd44780-lanner.c	1970-01-01 08:00:00.000000000 +0800
+++ lcdproc-0.5.2/server/drivers/hd44780-lanner.c	2010-11-03 16:01:07.000000000 +0800
@@ -0,0 +1,146 @@
+/*
+* 8-bit driver module for Hitachi HD44780 based LCD displays.
+* The LCD is operated in it's 8 bit-mode to be connected to a single
+* PC parallel port.
+*
+* Copyright (c) 1999, 1995 Benjamin Tse <blt@Comports.com>
+* 2001 Joris Robijn <joris@robijn.net>
+* 2009 Holger Rasch <rasch@bytemine.net>
+* 2010 Hugo Lin <hugo_lin@lannerinc.com>
+*
+* Created modular driver Dec 1999, Benjamin Tse <blt@Comports.com>
+*
+* Based on the code in the lcdtime package which uses the LCD
+* controller in its 8-bit mode.
+*
+* This file is released under the GNU General Public License. Refer to the
+* COPYING file distributed with this package.
+*/
+
+/*
+* Copied from "hd44780-ext8.c" and modified for lcm-162 module
+* found in nexcom nsaXXXX models.
+*/
+/*
+* Copied from "hd44780-lcm162.c" and modified for Lanner parallet Text LCM.
+* This code should applied to all Lanner platform.
+*/
+
+#include "hd44780-lanner.h"
+#include "hd44780-low.h"
+#include "lpt-port.h"
+
+#include "port.h"
+#include "lcd_sem.h"
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+// Generally, any function that accesses the LCD control lines needs to be
+// implemented separately for each HW design. This is typically (but not
+// restricted to):
+// HD44780_senddata
+// HD44780_readkeypad
+
+void lanner_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch);
+void lanner_HD44780_backlight(PrivateData *p, unsigned char state);
+unsigned char lanner_HD44780_readkeypad(PrivateData *p, unsigned int YData);
+void lanner_HD44780_output(PrivateData *p, int data);
+
+/* lcm-162 specific mapping parport <-> hd44780 signals */
+#define RS SEL
+#define RW INIT
+#define EN1 LF
+
+static int semid;
+
+// initialise the driver
+int
+hd_init_lanner(Driver *drvthis)
+{
+	PrivateData *p = (PrivateData*) drvthis->private_data;
+	HD44780_functions *hd44780_functions = p->hd44780_functions;
+
+	semid = sem_get();
+
+	// Reserve the port registers
+	port_access_multiple(p->port,3);
+
+	hd44780_functions->senddata = lanner_HD44780_senddata;
+	hd44780_functions->backlight = lanner_HD44780_backlight;
+	hd44780_functions->readkeypad = lanner_HD44780_readkeypad;
+
+	// setup the lcd in 8 bit mode
+	hd44780_functions->senddata(p, 0, RS_INSTR, FUNCSET | IF_8BIT);
+	hd44780_functions->uPause(p, 4100);
+	hd44780_functions->senddata(p, 0, RS_INSTR, FUNCSET | IF_8BIT);
+	hd44780_functions->uPause(p, 100);
+	hd44780_functions->senddata(p, 0, RS_INSTR, FUNCSET | IF_8BIT | TWOLINE | SMALLCHAR);
+	hd44780_functions->uPause(p, 40);
+
+	common_init (p, IF_8BIT);
+
+	if (p->have_keypad)
+		p->stuckinputs = 0; /* unused here */
+
+	// Writes new value to the “bargraph” latches
+	hd44780_functions->output = NULL;
+	return 0;
+}
+
+// lanner_HD44780_senddata
+void
+lanner_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch)
+{
+	unsigned char enableLines = 0, portControl;
+
+	// Only one controller is supported
+	enableLines = EN1;
+
+	if (flags == RS_INSTR)
+		portControl = 0;
+	else //if (iflags == RS_DATA)
+		portControl = RS;
+
+	portControl |= p->backlight_bit;
+
+	sem_wait(semid);
+	port_out(p->port + 2, portControl ^ OUTMASK);
+	port_out(p->port, ch);
+	if (p->delayBus) p->hd44780_functions->uPause(p, 1);
+		port_out(p->port + 2, (enableLines|portControl) ^ OUTMASK);
+	if (p->delayBus) p->hd44780_functions->uPause(p, 1);
+		port_out(p->port + 2, portControl ^ OUTMASK);
+	sem_signal(semid);
+}
+
+void lanner_HD44780_backlight(PrivateData *p, unsigned char state)
+{
+/* ignore config, there is no backlight control on the lcm-162 */
+
+        p->backlight_bit = (state?STRB:0);
+
+        port_out(p->port + 2, p->backlight_bit ^ OUTMASK);
+
+return;
+}
+
+unsigned char lanner_HD44780_readkeypad(PrivateData *p, unsigned int YData)
+{
+	unsigned char readval;
+
+	if (YData) return 0; /* no keymatrix */
+
+	readval = port_in(p->port + 1);
+	if (readval & ACK) { /* a key is pressed */
+		/* 4 keys encoded in signals PAPEREND and FAULT */
+		/* map them to low nibble (multiple keys not supported) */
+		return 1 << (
+			((readval & FAULT) / FAULT << 1) |
+			((readval & PAPEREND) / PAPEREND)
+			);
+	} else
+	return 0;
+}
+
+
diff -Naur lcdproc-0.5.2_org/server/drivers/hd44780-lanner.h lcdproc-0.5.2/server/drivers/hd44780-lanner.h
--- lcdproc-0.5.2_org/server/drivers/hd44780-lanner.h	1970-01-01 08:00:00.000000000 +0800
+++ lcdproc-0.5.2/server/drivers/hd44780-lanner.h	2010-11-03 16:01:35.000000000 +0800
@@ -0,0 +1,11 @@
+#ifndef HD_LANNER_H
+#define HD_LANNER_H
+
+#include "lcd.h" /* for Driver */
+
+// initialise this particular driver
+int hd_init_lanner(Driver *drvthis);
+
+#endif
+
+
diff -Naur lcdproc-0.5.2_org/server/drivers/Makefile.am lcdproc-0.5.2/server/drivers/Makefile.am
--- lcdproc-0.5.2_org/server/drivers/Makefile.am	2007-04-14 22:39:53.000000000 +0800
+++ lcdproc-0.5.2/server/drivers/Makefile.am	2010-11-03 16:03:04.000000000 +0800
@@ -71,7 +71,7 @@
 glcdlib_SOURCES =    lcd.h lcd_lib.h glcdlib.h glcdlib.c report.h
 glk_SOURCES =        lcd.h glk.c glk.h glkproto.c glkproto.h report.h
 hd44780_SOURCES =    lcd.h lcd_lib.h hd44780.h hd44780.c hd44780-drivers.h hd44780-low.h hd44780-charmap.h report.h adv_bignum.h
-EXTRA_hd44780_SOURCES = hd44780-4bit.c hd44780-4bit.h hd44780-ext8bit.c hd44780-ext8bit.h lcd_sem.c lcd_sem.h hd44780-serialLpt.c hd44780-serialLpt.h hd44780-serial.c hd44780-serial.h hd44780-winamp.c hd44780-winamp.h hd44780-bwct-usb.c hd44780-bwct-usb.h hd44780-lcd2usb.c hd44780-lcd2usb.h hd44780-lis2.c hd44780-lis2.h hd44780-i2c.c hd44780-i2c.h port.h lpt-port.h timing.h
+EXTRA_hd44780_SOURCES = hd44780-4bit.c hd44780-4bit.h hd44780-ext8bit.c hd44780-ext8bit.h lcd_sem.c lcd_sem.h hd44780-serialLpt.c hd44780-serialLpt.h hd44780-serial.c hd44780-serial.h hd44780-winamp.c hd44780-winamp.h hd44780-bwct-usb.c hd44780-bwct-usb.h hd44780-lcd2usb.c hd44780-lcd2usb.h hd44780-lis2.c hd44780-lis2.h hd44780-i2c.c hd44780-i2c.h port.h lpt-port.h timing.h hd44780-lanner.c hd44780-lanner.h
 
 icp_a106_SOURCES =   lcd.h lcd_lib.h icp_a106.c icp_a106.h report.h
 imon_SOURCES =       lcd.h lcd_lib.h imon.h imon.c report.h