aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile.am1
-rw-r--r--Makefile.in30
-rw-r--r--config.h.in6
-rwxr-xr-xconfigure180
-rw-r--r--configure.in3
-rw-r--r--drivers.m420
-rw-r--r--drv.c9
-rw-r--r--drv_serdisplib.c272
-rw-r--r--lcd4linux.conf.sample12
9 files changed, 511 insertions, 22 deletions
diff --git a/Makefile.am b/Makefile.am
index 8d5caff..f9cffe8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -65,6 +65,7 @@ drv_MilfordInstruments.c \
drv_Noritake.c \
drv_NULL.c \
drv_RouterBoard.c \
+drv_serdisplib.c \
drv_SimpleLCD.c \
drv_T6963.c \
drv_Trefon.c \
diff --git a/Makefile.in b/Makefile.in
index af5e29c..20d463f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -104,7 +104,7 @@ lcd4linux_DEPENDENCIES = @DRIVERS@ @PLUGINS@
lcd4linux_SOURCES = lcd4linux.c cfg.c cfg.h debug.c debug.h drv.c drv.h evaluator.c evaluator.h hash.c hash.h layout.c layout.h pid.c pid.h timer.c timer.h thread.c thread.h udelay.c udelay.h qprintf.c qprintf.h widget.c widget.h widget_text.c widget_text.h widget_bar.c widget_bar.h widget_icon.c widget_icon.h plugin.c plugin.h plugin_cfg.c plugin_math.c plugin_string.c plugin_test.c plugin_time.c
-EXTRA_lcd4linux_SOURCES = drv_generic_text.c drv_generic_text.h drv_generic_graphic.c drv_generic_graphic.h drv_generic_serial.c drv_generic_serial.h drv_generic_parport.c drv_generic_parport.h drv_generic_i2c.c drv_generic_i2c.h drv_BeckmannEgle.c drv_BWCT.c drv_Crystalfontz.c drv_Curses.c drv_Cwlinux.c drv_HD44780.c drv_Image.c drv_LCDLinux.c drv_LCDTerm.c drv_M50530.c drv_MatrixOrbital.c drv_MilfordInstruments.c drv_Noritake.c drv_NULL.c drv_RouterBoard.c drv_SimpleLCD.c drv_T6963.c drv_Trefon.c drv_USBLCD.c drv_X11.c font_6x8.h plugin_apm.c plugin_cpuinfo.c plugin_diskstats.c plugin_dvb.c plugin_exec.c plugin_i2c_sensors.c plugin_imon.c plugin_isdn.c plugin_loadavg.c plugin_meminfo.c plugin_mysql.c plugin_netdev.c plugin_pop3.c plugin_ppp.c plugin_proc_stat.c plugin_python.c plugin_seti.c plugin_statfs.c plugin_uname.c plugin_uptime.c plugin_wireless.c plugin_xmms.c
+EXTRA_lcd4linux_SOURCES = drv_generic_text.c drv_generic_text.h drv_generic_graphic.c drv_generic_graphic.h drv_generic_serial.c drv_generic_serial.h drv_generic_parport.c drv_generic_parport.h drv_generic_i2c.c drv_generic_i2c.h drv_BeckmannEgle.c drv_BWCT.c drv_Crystalfontz.c drv_Curses.c drv_Cwlinux.c drv_HD44780.c drv_Image.c drv_LCDLinux.c drv_LCDTerm.c drv_M50530.c drv_MatrixOrbital.c drv_MilfordInstruments.c drv_Noritake.c drv_NULL.c drv_RouterBoard.c drv_serdisplib.c drv_SimpleLCD.c drv_T6963.c drv_Trefon.c drv_USBLCD.c drv_X11.c font_6x8.h plugin_apm.c plugin_cpuinfo.c plugin_diskstats.c plugin_dvb.c plugin_exec.c plugin_i2c_sensors.c plugin_imon.c plugin_isdn.c plugin_loadavg.c plugin_meminfo.c plugin_mysql.c plugin_netdev.c plugin_pop3.c plugin_ppp.c plugin_proc_stat.c plugin_python.c plugin_seti.c plugin_statfs.c plugin_uname.c plugin_uptime.c plugin_wireless.c plugin_xmms.c
EXTRA_DIST = lcd4linux.conf.sample lcd4kde.conf lcd4linux.kdelnk lcd4linux.xpm lcd4linux.lsm curses.m4 AUTHORS CREDITS FAQ NEWS TODO README README.Drivers README.Plugins README.KDE plugin_sample.c
@@ -151,20 +151,20 @@ DEP_FILES = .deps/cfg.P .deps/debug.P .deps/drv.P .deps/drv_BWCT.P \
.deps/drv_SimpleLCD.P .deps/drv_T6963.P .deps/drv_Trefon.P \
.deps/drv_USBLCD.P .deps/drv_X11.P .deps/drv_generic_graphic.P \
.deps/drv_generic_i2c.P .deps/drv_generic_parport.P \
-.deps/drv_generic_serial.P .deps/drv_generic_text.P .deps/evaluator.P \
-.deps/hash.P .deps/layout.P .deps/lcd4linux.P .deps/pid.P \
-.deps/plugin.P .deps/plugin_apm.P .deps/plugin_cfg.P \
-.deps/plugin_cpuinfo.P .deps/plugin_diskstats.P .deps/plugin_dvb.P \
-.deps/plugin_exec.P .deps/plugin_i2c_sensors.P .deps/plugin_imon.P \
-.deps/plugin_isdn.P .deps/plugin_loadavg.P .deps/plugin_math.P \
-.deps/plugin_meminfo.P .deps/plugin_mysql.P .deps/plugin_netdev.P \
-.deps/plugin_pop3.P .deps/plugin_ppp.P .deps/plugin_proc_stat.P \
-.deps/plugin_python.P .deps/plugin_seti.P .deps/plugin_statfs.P \
-.deps/plugin_string.P .deps/plugin_test.P .deps/plugin_time.P \
-.deps/plugin_uname.P .deps/plugin_uptime.P .deps/plugin_wireless.P \
-.deps/plugin_xmms.P .deps/qprintf.P .deps/thread.P .deps/timer.P \
-.deps/udelay.P .deps/widget.P .deps/widget_bar.P .deps/widget_icon.P \
-.deps/widget_text.P
+.deps/drv_generic_serial.P .deps/drv_generic_text.P \
+.deps/drv_serdisplib.P .deps/evaluator.P .deps/hash.P .deps/layout.P \
+.deps/lcd4linux.P .deps/pid.P .deps/plugin.P .deps/plugin_apm.P \
+.deps/plugin_cfg.P .deps/plugin_cpuinfo.P .deps/plugin_diskstats.P \
+.deps/plugin_dvb.P .deps/plugin_exec.P .deps/plugin_i2c_sensors.P \
+.deps/plugin_imon.P .deps/plugin_isdn.P .deps/plugin_loadavg.P \
+.deps/plugin_math.P .deps/plugin_meminfo.P .deps/plugin_mysql.P \
+.deps/plugin_netdev.P .deps/plugin_pop3.P .deps/plugin_ppp.P \
+.deps/plugin_proc_stat.P .deps/plugin_python.P .deps/plugin_seti.P \
+.deps/plugin_statfs.P .deps/plugin_string.P .deps/plugin_test.P \
+.deps/plugin_time.P .deps/plugin_uname.P .deps/plugin_uptime.P \
+.deps/plugin_wireless.P .deps/plugin_xmms.P .deps/qprintf.P \
+.deps/thread.P .deps/timer.P .deps/udelay.P .deps/widget.P \
+.deps/widget_bar.P .deps/widget_icon.P .deps/widget_text.P
SOURCES = $(lcd4linux_SOURCES) $(EXTRA_lcd4linux_SOURCES)
OBJECTS = $(lcd4linux_OBJECTS)
diff --git a/config.h.in b/config.h.in
index 0849a1b..4cad1b7 100644
--- a/config.h.in
+++ b/config.h.in
@@ -100,6 +100,9 @@
/* Define to 1 if you have the `regcomp' function. */
#undef HAVE_REGCOMP
+/* Define to 1 if you have the <serdisplib/serdisp.h> header file. */
+#undef HAVE_SERDISPLIB_SERDISP_H
+
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET
@@ -383,6 +386,9 @@
/* RouterBoard driver */
#undef WITH_ROUTERBOARD
+/* serdisplib driver */
+#undef WITH_SERDISPLIB
+
/* SimpleLCD driver */
#undef WITH_SIMPLELCD
diff --git a/configure b/configure
index 04cb541..a2b1f4e 100755
--- a/configure
+++ b/configure
@@ -870,7 +870,8 @@ Optional Packages:
BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux,
HD44780, LCDLinux, LCDTerm, M50530, MatrixOrbital,
MilfordInstruments, Noritake, NULL, PNG, PPM,
- RouterBoard, SimpleLCD, T6963, Trefon, USBLCD, X11
+ RouterBoard, serdisplib, SimpleLCD, T6963, Trefon,
+ USBLCD, X11
--with-plugins=<list> choose which plugins to compile.
type --with-plugins=list for a list
of avaible plugins
@@ -3478,7 +3479,7 @@ echo "${ECHO_T}Please note that some screen refreshs may fail" >&6
echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6
ncurses_version=unknown
cat > conftest.$ac_ext <<EOF
-#line 3481 "configure"
+#line 3482 "configure"
#include "confdefs.h"
#ifdef RENAMED_NCURSES
#include <curses.h>
@@ -5523,6 +5524,159 @@ fi
done
+# check for serdisplib
+
+for ac_header in serdisplib/serdisp.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ---------------------------------------------------- ##
+## Report this to lcd4linux-users@lists.sourceforge.net ##
+## ---------------------------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ has_serdisplib="true"
+else
+ has_serdisplib="false"
+fi
+
+done
+
+
# check for python
## ------------------------
## Python file handling
@@ -5818,11 +5972,12 @@ for driver in $drivers; do
PNG="yes"
PPM="yes"
ROUTERBOARD="yes"
+ SERDISPLIB="yes"
+ SIMPLELCD="yes"
T6963="yes"
Trefon="yes"
USBLCD="yes"
X11="yes"
- SIMPLELCD="yes"
;;
BeckmannEgle)
BECKMANNEGLE=$val
@@ -5872,6 +6027,9 @@ for driver in $drivers; do
RouterBoard)
ROUTERBOARD=$val
;;
+ serdisplib)
+ SERDISPLIB=$val;
+ ;;
SimpleLCD)
SIMPLELCD=$val
;;
@@ -6099,6 +6257,22 @@ _ACEOF
fi
+if test "$SERDISPLIB" = "yes"; then
+ if test "$has_serdisplib" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_serdisplib.o"
+ DRVLIBS="$DRVLIBS -L/usr/local/lib -lserdisp"
+
+cat >>confdefs.h <<\_ACEOF
+#define WITH_SERDISPLIB 1
+_ACEOF
+
+ else
+ { echo "$as_me:$LINENO: WARNING: serdisp.h not found: serdisplib driver disabled" >&5
+echo "$as_me: WARNING: serdisp.h not found: serdisplib driver disabled" >&2;}
+ fi
+fi
+
if test "$SIMPLELCD" = "yes"; then
TEXT="yes"
SERIAL="yes"
diff --git a/configure.in b/configure.in
index 185d97b..342a2ea 100644
--- a/configure.in
+++ b/configure.in
@@ -64,6 +64,9 @@ AC_CHECK_HEADERS(linux/compiler.h linux/i2c.h linux/i2c-dev.h,[has_i2c="true"],[
# endif
])
+# check for serdisplib
+AC_CHECK_HEADERS(serdisplib/serdisp.h, [has_serdisplib="true"], [has_serdisplib="false"])
+
# check for python
sinclude(python.m4)
AC_PYTHON_DEVEL
diff --git a/drivers.m4 b/drivers.m4
index 2e60a04..ee5da93 100644
--- a/drivers.m4
+++ b/drivers.m4
@@ -31,7 +31,8 @@ AC_ARG_WITH(
[ BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux,]
[ HD44780, LCDLinux, LCDTerm, M50530, MatrixOrbital,]
[ MilfordInstruments, Noritake, NULL, PNG, PPM,]
- [ RouterBoard, SimpleLCD, T6963, Trefon, USBLCD, X11],
+ [ RouterBoard, serdisplib, SimpleLCD, T6963, Trefon,]
+ [ USBLCD, X11],
drivers=$withval,
drivers=all
)
@@ -68,11 +69,12 @@ for driver in $drivers; do
PNG="yes"
PPM="yes"
ROUTERBOARD="yes"
+ SERDISPLIB="yes"
+ SIMPLELCD="yes"
T6963="yes"
Trefon="yes"
USBLCD="yes"
X11="yes"
- SIMPLELCD="yes"
;;
BeckmannEgle)
BECKMANNEGLE=$val
@@ -122,6 +124,9 @@ for driver in $drivers; do
RouterBoard)
ROUTERBOARD=$val
;;
+ serdisplib)
+ SERDISPLIB=$val;
+ ;;
SimpleLCD)
SIMPLELCD=$val
;;
@@ -279,6 +284,17 @@ if test "$ROUTERBOARD" = "yes"; then
AC_DEFINE(WITH_ROUTERBOARD,1,[RouterBoard driver])
fi
+if test "$SERDISPLIB" = "yes"; then
+ if test "$has_serdisplib" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_serdisplib.o"
+ DRVLIBS="$DRVLIBS -L/usr/local/lib -lserdisp"
+ AC_DEFINE(WITH_SERDISPLIB,1,[serdisplib driver])
+ else
+ AC_MSG_WARN(serdisp.h not found: serdisplib driver disabled)
+ fi
+fi
+
if test "$SIMPLELCD" = "yes"; then
TEXT="yes"
SERIAL="yes"
diff --git a/drv.c b/drv.c
index 0347cdc..9c1a1ba 100644
--- a/drv.c
+++ b/drv.c
@@ -1,4 +1,4 @@
-/* $Id: drv.c,v 1.31 2005/05/08 04:32:43 reinelt Exp $
+/* $Id: drv.c,v 1.32 2005/05/10 13:20:14 reinelt Exp $
*
* new framework for display drivers
*
@@ -23,6 +23,9 @@
*
*
* $Log: drv.c,v $
+ * Revision 1.32 2005/05/10 13:20:14 reinelt
+ * added serdisplib driver
+ *
* Revision 1.31 2005/05/08 04:32:43 reinelt
* CodingStyle added and applied
*
@@ -209,6 +212,7 @@ extern DRIVER drv_MilfordInstruments;
extern DRIVER drv_Noritake;
extern DRIVER drv_NULL;
extern DRIVER drv_RouterBoard;
+extern DRIVER drv_serdisplib;
extern DRIVER drv_SimpleLCD;
extern DRIVER drv_T6963;
extern DRIVER drv_Trefon;
@@ -267,6 +271,9 @@ DRIVER *Driver[] = {
#ifdef WITH_ROUTERBOARD
&drv_RouterBoard,
#endif
+#ifdef WITH_SERDISPLIB
+ &drv_serdisplib,
+#endif
#ifdef WITH_SIMPLELCD
&drv_SimpleLCD,
#endif
diff --git a/drv_serdisplib.c b/drv_serdisplib.c
new file mode 100644
index 0000000..6b44139
--- /dev/null
+++ b/drv_serdisplib.c
@@ -0,0 +1,272 @@
+/* $Id: drv_serdisplib.c,v 1.1 2005/05/10 13:20:14 reinelt Exp $
+ *
+ * driver for serdisplib displays
+ *
+ * Copyright (C) 2005 Michael Reinelt <reinelt@eunet.at>
+ * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux 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, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *
+ * $Log: drv_serdisplib.c,v $
+ * Revision 1.1 2005/05/10 13:20:14 reinelt
+ * added serdisplib driver
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_serdisplib
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+//#include <stdio.h>
+#include <string.h>
+//#include <errno.h>
+#include <unistd.h>
+//#include <termios.h>
+//#include <fcntl.h>
+//#include <sys/time.h>
+
+#include <serdisplib/serdisp.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_graphic.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+static char Name[] = "serdisplib";
+
+static serdisp_CONN_t *sdcd;
+static serdisp_t *dd;
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static void drv_SD_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c;
+ long color;
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ color = drv_generic_graphic_FB[r * LCOLS + c] ? SD_COL_BLACK : SD_COL_WHITE;
+ serdisp_setcolour(dd, r, c, color);
+ }
+ }
+
+ serdisp_update(dd);
+}
+
+
+static int drv_SD_start(const char *section)
+{
+ long version;
+ char *port, *model, *options, *s;
+ int TROWS, TCOLS;
+
+ version = serdisp_getversioncode();
+ info ("%s: header version %d.%d", Name, SERDISP_VERSION_MAJOR, SERDISP_VERSION_MINOR);
+ info ("%s: library version %d.%d", Name, version>>8, version & 0xff);
+
+ port = cfg_get(section, "Port", NULL);
+ if (port == NULL || *port == '\0') {
+ error("%s: no '%s.Port' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ /* opening the output device */
+ sdcd = SDCONN_open(port);
+ if (sdcd == NULL) {
+ error ("%s: open(%s) failed: %s", Name, port, sd_geterrormsg());
+ return -1;
+ }
+
+
+ model = cfg_get(section, "Model", "");
+ if (model == NULL || *model == '\0') {
+ error("%s: no '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ info("%s: using model '%s'", Name, model);
+
+ options = cfg_get(section, "Options", "");
+ info("%s: using options '%s'", Name, options);
+
+ /* opening and initialising the display */
+ dd = serdisp_init(sdcd, model, options);
+ if (dd == NULL) {
+ error ("%s: init(%s, %s, %s) failed: %s", Name, port, model, options, sd_geterrormsg());
+ SDCONN_close(sdcd);
+ return -1;
+ }
+
+ DROWS = serdisp_getheight(dd);
+ DCOLS = serdisp_getwidth(dd);
+ info ("%s: display size %dx%d", Name, DCOLS, DROWS);
+
+ XRES = -1;
+ YRES = -1;
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad Font '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ /* Fixme: provider other fonts someday... */
+ if (XRES != 6 && YRES != 8) {
+ error("%s: bad Font '%s' from %s (only 6x8 at the moment)", Name, s, cfg_source());
+ return -1;
+ }
+
+ TROWS = DROWS / YRES; /* text rows */
+ TCOLS = DCOLS / XRES; /* text cols */
+
+ /* clear display */
+ serdisp_clear(dd);
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+/* none at the moment... */
+/* Fixme: SD_FEATURE's */
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_graphic_draw(W) */
+/* using drv_generic_graphic_icon_draw(W) */
+/* using drv_generic_graphic_bar_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_SD_list(void)
+{
+ printf("%s", "any");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_SD_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_SD_blit;
+
+ /* start display */
+ if ((ret = drv_SD_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ /* register text widget */
+ wc = Widget_Text;
+ wc.draw = drv_generic_graphic_draw;
+ widget_register(&wc);
+
+ /* register icon widget */
+ wc = Widget_Icon;
+ wc.draw = drv_generic_graphic_icon_draw;
+ widget_register(&wc);
+
+ /* register bar widget */
+ wc = Widget_Bar;
+ wc.draw = drv_generic_graphic_bar_draw;
+ widget_register(&wc);
+
+ /* register plugins */
+ /* none at the moment... */
+ /* Fixme: SD_FEATURE's */
+
+ return 0;
+}
+
+
+/* close driver & display */
+int drv_SD_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ drv_generic_graphic_clear();
+
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_generic_graphic_quit();
+
+ serdisp_quit(dd);
+
+ return (0);
+}
+
+
+DRIVER drv_serdisplib = {
+ name:Name,
+ list:drv_SD_list,
+ init:drv_SD_init,
+ quit:drv_SD_quit,
+};
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index c089d52..d2a152f 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -1,3 +1,12 @@
+Display SerDispLib {
+ Driver 'serdisplib'
+ Port 'PAR:/dev/parports/0'
+ #Port '/dev/tts/0'
+ Model 'OPTREX323'
+ Options ''
+}
+
+
Display Trefon {
Driver 'TREFON'
Size '16x2'
@@ -740,7 +749,8 @@ Layout testMySQL {
}
-Display 'LCD-Linux'
+Display 'SerDispLib'
+#Display 'LCD-Linux'
#Display 'LK204'
#Display 'MI240'
#Display 'CW12232'