@@ -0,0 +1,1362 @@
+[PATCH] Add serdisplib driver
+
+This patch adds a serdisplib driver for the serdisplib library
+(http://serdisplib.sf.net) that is used for low-level accessing of dot-matrix
+devices (i.e. such displays that are drived by pixel and not by characters
+unlike HD44780, for example).
+
+I know there's already glcdlib. But that approach has several disadvantages:
+
+ o Unnecessary library dependencies.
+ o Complicated installation, i.e. you have to edit two configuration files.
+ o Too much redraws. In fact, that was the reason for me to write this
+ driver because my ctinclud display (http://www.ct-maeusekino.de) was quite
+ unusable with the glcdlib driver. The problem is simply that lcdproc
+ redraws the whole screen each second and it's the task of the driver
+ to not to redraw it in reality. The problem is now that the glcdproc
+ driver only has the view of characters, and cannot decide which pixels it
+ actually has to redraw. And graphlcd which has the per-pixel view doesn't
+ do that "caching" and simply redraws all. Of course, that _can_
+ be changed in graphlcd, but I'm sure that leads to endless discussions and
+ because I didn't like the glcdlib -> graphlcd -> serdisplib approach
+ anyway, I decided to write that driver.
+
+Some important design decisions:
+
+ o The driver is split into lcdgraphic.c and serdisplib.c. All function that
+ do the character -> pixel "rendering" are split out into lcdgraphic.c,
+ so it would be possible to write another low-level driver that uses that
+ function. However, in normal cases it makes more sense to add that part to
+ serdisplib.
+ o It only requires FreeType (http://freetype.sf.net) for font rendering.
+ That's no new real dependency because in almost all cases, graphlcd was
+ compiled with FreeType support.
+ o Only mono space fonts are supported.
+ o The driver implements symbols (arrow, etc.) using Unicode characters of the
+ font. (The recommended font is Andale Mono which is available for free
+ from http://corefonts.sf.net)
+ o Works on i686 and x86_64.
+
+Please review. The patch is against 0.5.2. If you consider to add this into
+CVS, I'll provide documentation. And this time, I'll provide the documentation
+in time unlike with the ula200 driver. ;-)
+
+
+Signed-off-by: Bernhard Walle <bernhard.walle@gmx.de>
+
+---
+ LCDd.conf | 28 ++
+ acinclude.m4 | 27 +-
+ server/drivers/Makefile.am | 5
+ server/drivers/lcdgraphic.c | 590 ++++++++++++++++++++++++++++++++++++++++++++
+ server/drivers/lcdgraphic.h | 195 ++++++++++++++
+ server/drivers/serdisplib.c | 379 ++++++++++++++++++++++++++++
+ 6 files changed, 1220 insertions(+), 4 deletions(-)
+
+Index: lcdproc-0.5.3/acinclude.m4
+===================================================================
+--- lcdproc-0.5.3.orig/acinclude.m4
++++ lcdproc-0.5.3/acinclude.m4
+@@ -13,13 +13,13 @@ AC_ARG_ENABLE(drivers,
+ [ IOWarrior,irman,irtrans,joy,lb216,lcdm001,lcterm,lirc,lis,]
+ [ MD8800,ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD,picolcd,]
+ [ pyramid,sed1330,sed1520,serialPOS,serialVFD,shuttleVFD,sli,]
+- [ stv5730,svga,t6963,text,tyan,ula200,xosd]
++ [ stv5730,svga,t6963,text,tyan,ula200,serdisplib,xosd]
+ [ 'all' compiles all drivers;]
+ [ 'all,!xxx,!yyy' de-selects previously selected drivers],
+ drivers="$enableval",
+ drivers=[bayrad,CFontz,CFontz633,curses,CwLnx,glk,lb216,lcdm001,MtxOrb,pyramid,text])
+
+-allDrivers=[bayrad,CFontz,CFontz633,CFontzPacket,curses,CwLnx,ea65,EyeboxOne,g15,glcdlib,glk,hd44780,i2500vfd,icp_a106,imon,imonlcd,IOWarrior,irman,irtrans,joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD,picolcd,pyramid,sed1330,sed1520,serialPOS,serialVFD,shuttleVFD,sli,stv5730,svga,t6963,text,tyan,ula200,xosd]
++allDrivers=[bayrad,CFontz,CFontz633,CFontzPacket,curses,CwLnx,ea65,EyeboxOne,g15,glcdlib,glk,hd44780,i2500vfd,icp_a106,imon,imonlcd,IOWarrior,irman,irtrans,joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD,picolcd,pyramid,sed1330,sed1520,serialPOS,serialVFD,shuttleVFD,sli,stv5730,svga,t6963,text,tyan,ula200,xosd,serdisplib]
+
+ drivers=`echo $drivers | sed -e 's/,/ /g'`
+
+@@ -445,6 +445,29 @@ dnl else
+ AC_MSG_WARN([The ula200 driver needs the ftdi library])
+ fi
+ ;;
++ serdisplib)
++ LIBFREETYPE_CFLAGS=`pkg-config --cflags freetype2`
++ LIBFREETYPE_LIBS=`pkg-config --libs freetype2`
++ if test x"$LIBFREETYPE_CFLAGS" = "x" ; then
++ AC_MSG_WARN([The serdisplib driver needs freetype2])
++ fi
++
++ AC_CHECK_HEADERS([serdisplib/serdisp.h],[
++ AC_CHECK_LIB(serdisp, serdisp_nextdisplaydescription,[
++ LIBSERDISP="-lserdisp"
++ DRIVERS="$DRIVERS serdisplib${SO}"
++ actdrivers=["$actdrivers serdisplib"]
++ ],[
++ AC_MSG_WARN([The serdisplib driver needs serdisplib])
++ ])
++ ],[
++ AC_MSG_WARN([The serdisplib driver needs serdislib/serdisp.h])
++ ])
++
++ AC_SUBST(LIBFREETYPE_CFLAGS)
++ AC_SUBST(LIBFREETYPE_LIBS)
++ AC_SUBST(LIBSERDISP)
++ ;;
+ xosd)
+ AC_CHECK_HEADERS([xosd.h],[
+ AC_CHECK_LIB(xosd, main,[
+Index: lcdproc-0.5.3/server/drivers/Makefile.am
+===================================================================
+--- lcdproc-0.5.3.orig/server/drivers/Makefile.am
++++ lcdproc-0.5.3/server/drivers/Makefile.am
+@@ -19,12 +19,13 @@ AM_LDFLAGS = @LDSHARED@
+ #LIBS =
+
+ pkglib_PROGRAMS = @DRIVERS@
+-EXTRA_PROGRAMS = bayrad CFontz CFontz633 CFontzPacket curses CwLnx ea65 EyeboxOne g15 glcdlib glk hd44780 icp_a106 imon imonlcd IOWarrior irman joy lb216 lcdm001 lcterm lirc lis MD8800 ms6931 mtc_s16209x MtxOrb mx5000 NoritakeVFD picolcd pyramid sed1330 sed1520 serialPOS serialVFD shuttleVFD stv5730 svga t6963 text tyan sli ula200 xosd i2500vfd irtrans
++EXTRA_PROGRAMS = bayrad CFontz CFontz633 CFontzPacket curses CwLnx ea65 EyeboxOne g15 glcdlib glk hd44780 icp_a106 imon imonlcd IOWarrior irman joy lb216 lcdm001 lcterm lirc lis MD8800 ms6931 mtc_s16209x MtxOrb mx5000 NoritakeVFD picolcd pyramid sed1330 sed1520 serialPOS serialVFD shuttleVFD stv5730 svga t6963 text tyan sli ula200 serdisplib xosd i2500vfd irtrans
+ noinst_LIBRARIES = libLCD.a libbignum.a
+
+ IOWarrior_CFLAGS = @LIBUSB_CFLAGS@ $(AM_CFLAGS)
+ hd44780_CFLAGS = @LIBUSB_CFLAGS@ @LIBFTDI_CFLAGS@ $(AM_CFLAGS)
+ g15_CFLAGS = @LIBUSB_CFLAGS@ $(AM_CFLAGS)
++ serdisplib_CFLAGS = @LIBFREETYPE_CFLAGS@ $(AM_CFLAGS)
+ lis_CFLAGS = @LIBUSB_CFLAGS@ @LIBFTDI_CFLAGS@ $(AM_CFLAGS)
+ picolcd_CFLAGS = @LIBUSB_CFLAGS@ $(AM_CFLAGS)
+ shuttleVFD_CFLAGS = @LIBUSB_CFLAGS@ $(AM_CFLAGS)
+@@ -37,6 +38,7 @@ CFontzPacket_LDADD = libLCD.a libbignum.
+ curses_LDADD = @LIBCURSES@
+ CwLnx_LDADD = libLCD.a libbignum.a
+ g15_LDADD = libLCD.a @LIBG15@
++serdisplib_LDADD = libLCD.a @LIBSERDISP@ @LIBFREETYPE_LIBS@
+ glcdlib_LDADD = libLCD.a @LIBGLCD@
+ hd44780_LDADD = libLCD.a @HD44780_DRIVERS@ @LIBUSB_LIBS@ @LIBFTDI_LIBS@ libbignum.a
+ hd44780_DEPENDENCIES = @HD44780_DRIVERS@
+@@ -113,6 +115,7 @@ t6963_SOURCES = lcd.h lcd_lib.h t69
+ text_SOURCES = lcd.h text.h text.c report.h
+ tyan_SOURCES = lcd.h lcd_lib.h tyan_lcdm.h tyan_lcdm.c report.h adv_bignum.h
+ ula200_SOURCES = lcd.h lcd_lib.h ula200.h ula200.c report.h
++serdisplib_SOURCES = lcd.h serdisplib.h serdisplib.c lcdgraphic.c lcdgraphic.h
+ sli_SOURCES = lcd.h lcd_lib.h wirz-sli.h wirz-sli.c report.h
+ xosd_SOURCES = lcd.h xosdlib_drv.c xosdlib_drv.h report.h adv_bignum.h
+ i2500vfd_SOURCES = lcd.h i2500vfd.c i2500vfd.h i2500vfdfm.c i2500vfdfm.h report.h
+Index: lcdproc-0.5.3/server/drivers/lcdgraphic.c
+===================================================================
+--- /dev/null
++++ lcdproc-0.5.3/server/drivers/lcdgraphic.c
+@@ -0,0 +1,590 @@
++// Description:
++
++/* Copyright (C) 2007 Bernhard Walle <bernhard.walle@gmx.de>
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 */
++
++#include <stdlib.h>
++#include <stdio.h>
++#include <unistd.h>
++#include <termios.h>
++#include <fcntl.h>
++#include <string.h>
++#include <errno.h>
++#include <limits.h>
++#include <syslog.h>
++#include <stdint.h>
++
++#include "lcdgraphic.h"
++
++
++///////////////////////////////////////////////////////////////////////////////
++// Defines
++
++#undef report
++#define lcdgr_report lcdgr->drv->report
++
++///////////////////////////////////////////////////////////////////////////////
++// Returns the value of a pixel in the new_buffer buffer.
++//
++// @param lcdgr a pointer to a valid lcdgraphic structure
++// @param x the x location of the pixel
++// @param y the y location of the pixel
++//
++// @return the value of the pixel
++//
++static inline int get_pixel_new(struct lcdgraphic *lcdgr, int x, int y)
++{
++ if (x >= lcdgr->width || y >= lcdgr->height)
++ return -1;
++ else
++ return lcdgr->new_buffer[lcdgr->width * y + x];
++}
|