@@ -0,0 +1,1357 @@
+[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/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];
++}
++
++///////////////////////////////////////////////////////////////////////////////
++// Returns the value of a pixel in the disp_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_disp(struct lcdgraphic *lcdgr, int x, int y)
++{
++ if (x >= lcdgr->width || y >= lcdgr->height)
++ return -1;
++ else
++ return lcdgr->disp_buffer[lcdgr->width * y + x];
++}
++
++///////////////////////////////////////////////////////////////////////////////
++// Sets 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
++// @param value the value to which the buffer should be set
++//
++static void set_pixel_new(struct lcdgraphic *lcdgr, int x, int y, int value)
++{
++ if (x < lcdgr->width && y < lcdgr->height)
++ lcdgr->new_buffer[lcdgr->width * y + x] = value;
++}
++
++///////////////////////////////////////////////////////////////////////////////
++// Sets the value of a pixel in the disp_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
++// @param value the value to which the buffer should be set
++//
++static void set_pixel_disp(struct lcdgraphic *lcdgr, int x, int y, int value)
++{
++ if (x < lcdgr->width && y < lcdgr->height)
++ lcdgr->disp_buffer[lcdgr->width * y + x] = value;
++}
++
++///////////////////////////////////////////////////////////////////////////////
++// Maps a lcdproc icon to a unicode code for an icon.
++//
++// @param icon the lcdproc icon constant
++//
++// @return Unicode value
++//
++static int icon2unicode(int icon)
++{
++ switch (icon) {
++ case ICON_BLOCK_FILLED:
++ return UNICODE_BLOCK_FILLED;
++ case ICON_HEART_FILLED:
++ return UNICODE_HEART_FILLED;
++ case ICON_HEART_OPEN:
++ return UNICODE_HEART_OPEN;
++ case ICON_ARROW_UP:
++ return UNICODE_ARROW_UP;
++ case ICON_ARROW_DOWN:
++ return UNICODE_ARROW_DOWN;
++ case ICON_ARROW_LEFT:
++ return UNICODE_ARROW_LEFT;
++ case ICON_ARROW_RIGHT:
++ return UNICODE_ARROW_RIGHT;
++ case ICON_SELECTOR_AT_LEFT:
++ return UNICODE_SELECTOR_AT_LEFT;
++ case ICON_SELECTOR_AT_RIGHT:
++ return UNICODE_SELECTOR_AT_RIGHT;
++ case ICON_ELLIPSIS:
++ return UNICODE_ELLIPSIS;
++ default:
++ return -1;
++ }
++}
++
++///////////////////////////////////////////////////////////////////////////////
++// Initialises the instance
++//
++// @param lcdgr a pointer to a valid lcdgraphic structure (not initialised,
|