aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-01-09 17:03:07 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-01-09 17:03:07 +0000
commit22f3f6af66d2feea50512544df4cf32a039e559b (patch)
treecac3b4854c1e8437e81b711fd892b9b921a71abf
parent9dc6ff97fe8e9c911dfee409114fc5428adf858a (diff)
downloadlcd4linux-22f3f6af66d2feea50512544df4cf32a039e559b.tar.gz
[lcd4linux @ 2004-01-09 17:03:06 by reinelt]
initiated transfer to new driver architecture new file 'drv.c' will someday replace 'display.c' new file 'drv_MatrixOrbital.c' will replace 'MatrixOrbital.c' due to this 'soft' transfer lcd4linux should stay usable during the switch (at least I hope so) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@299 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--Makefile.am3
-rw-r--r--Makefile.in16
-rwxr-xr-xconfigure2
-rw-r--r--configure.in2
-rw-r--r--display.c57
-rw-r--r--display.h13
-rw-r--r--drv.c184
-rw-r--r--drv.h65
-rw-r--r--drv_MatrixOrbital.c82
-rw-r--r--lcd4linux.c47
10 files changed, 420 insertions, 51 deletions
diff --git a/Makefile.am b/Makefile.am
index d6885c9..b93c710 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -43,6 +43,7 @@ liblcd4linux_la_LIBADD = @DRIVERS@
liblcd4linux_la_SOURCES = \
display.c display.h \
+drv.c drv.h \
debug.c debug.h \
cfg.c cfg.h \
lock.c lock.h \
@@ -61,7 +62,7 @@ HD44780.c \
M50530.c \
T6963.c \
USBLCD.c \
-MatrixOrbital.c \
+drv_MatrixOrbital.c MatrixOrbital.c \
MilfordInstruments.c \
PalmPilot.c \
Raster.c \
diff --git a/Makefile.in b/Makefile.in
index d63b636..d899b1c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -108,10 +108,10 @@ liblcd4linux_la_DEPENDENCIES = @DRIVERS@
liblcd4linux_la_LDFLAGS = -version-info 9:12:9
liblcd4linux_la_LIBADD = @DRIVERS@
-liblcd4linux_la_SOURCES = display.c display.h debug.c debug.h cfg.c cfg.h lock.c lock.h pixmap.c pixmap.h bar.c bar.h icon.c icon.h fontmap.c fontmap.h udelay.c udelay.h
+liblcd4linux_la_SOURCES = display.c display.h drv.c drv.h debug.c debug.h cfg.c cfg.h lock.c lock.h pixmap.c pixmap.h bar.c bar.h icon.c icon.h fontmap.c fontmap.h udelay.c udelay.h
-EXTRA_lcd4linux_SOURCES = parport.c parport.h BeckmannEgle.c Crystalfontz.c Cwlinux.c HD44780.c M50530.c T6963.c USBLCD.c MatrixOrbital.c MilfordInstruments.c PalmPilot.c Raster.c SIN.c XWindow.c Text.c
+EXTRA_lcd4linux_SOURCES = parport.c parport.h BeckmannEgle.c Crystalfontz.c Cwlinux.c HD44780.c M50530.c T6963.c USBLCD.c drv_MatrixOrbital.c MatrixOrbital.c MilfordInstruments.c PalmPilot.c Raster.c SIN.c XWindow.c Text.c
EXTRA_DIST = lcd4linux.conf.sample lcd4kde.conf lcd4linux.kdelnk lcd4linux.xpm lcd4linux.lsm curses.m4 AUTHORS CREDITS FAQ NEWS TODO README README.Rows README.Tokens README.Drivers README.Plugins README.KDE Skeleton.c plugin_sample.c
@@ -131,8 +131,8 @@ X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
-liblcd4linux_la_OBJECTS = display.lo debug.lo cfg.lo lock.lo pixmap.lo \
-bar.lo icon.lo fontmap.lo udelay.lo
+liblcd4linux_la_OBJECTS = display.lo drv.lo debug.lo cfg.lo lock.lo \
+pixmap.lo bar.lo icon.lo fontmap.lo udelay.lo
bin_PROGRAMS = lcd4linux$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
@@ -163,10 +163,10 @@ DEP_FILES = .deps/BeckmannEgle.P .deps/Crystalfontz.P .deps/Cwlinux.P \
.deps/HD44780.P .deps/M50530.P .deps/MatrixOrbital.P \
.deps/MilfordInstruments.P .deps/PalmPilot.P .deps/Raster.P .deps/SIN.P \
.deps/T6963.P .deps/Text.P .deps/USBLCD.P .deps/XWindow.P .deps/bar.P \
-.deps/battery.P .deps/cfg.P .deps/debug.P .deps/display.P .deps/dvb.P \
-.deps/evaluator.P .deps/exec.P .deps/expr.P .deps/filter.P \
-.deps/fontmap.P .deps/icon.P .deps/imon.P .deps/isdn.P \
-.deps/lcd4linux.P .deps/lock.P .deps/mail.P .deps/mail2.P \
+.deps/battery.P .deps/cfg.P .deps/debug.P .deps/display.P .deps/drv.P \
+.deps/drv_MatrixOrbital.P .deps/dvb.P .deps/evaluator.P .deps/exec.P \
+.deps/expr.P .deps/filter.P .deps/fontmap.P .deps/icon.P .deps/imon.P \
+.deps/isdn.P .deps/lcd4linux.P .deps/lock.P .deps/mail.P .deps/mail2.P \
.deps/parport.P .deps/parser.P .deps/pid.P .deps/pixmap.P \
.deps/plugin.P .deps/plugin_math.P .deps/plugin_string.P \
.deps/plugin_xmms.P .deps/processor.P .deps/seti.P .deps/socket.P \
diff --git a/configure b/configure
index ecd5772..4265cf5 100755
--- a/configure
+++ b/configure
@@ -21013,7 +21013,7 @@ _ACEOF
fi
if test "$MATRIXORBITAL" = "yes"; then
- DRIVERS="$DRIVERS MatrixOrbital.lo"
+ DRIVERS="$DRIVERS MatrixOrbital.lo drv_MatrixOrbital.lo"
cat >>confdefs.h <<\_ACEOF
#define WITH_MATRIXORBITAL 1
diff --git a/configure.in b/configure.in
index 9930a4a..bb7302b 100644
--- a/configure.in
+++ b/configure.in
@@ -178,7 +178,7 @@ if test "$USBLCD" = "yes"; then
fi
if test "$MATRIXORBITAL" = "yes"; then
- DRIVERS="$DRIVERS MatrixOrbital.lo"
+ DRIVERS="$DRIVERS MatrixOrbital.lo drv_MatrixOrbital.lo"
AC_DEFINE(WITH_MATRIXORBITAL,1,[junk])
fi
diff --git a/display.c b/display.c
index 9d45f29..1ba0941 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.44 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: display.c,v 1.45 2004/01/09 17:03:07 reinelt Exp $
*
* framework for device drivers
*
@@ -22,6 +22,13 @@
*
*
* $Log: display.c,v $
+ * Revision 1.45 2004/01/09 17:03:07 reinelt
+ * initiated transfer to new driver architecture
+ * new file 'drv.c' will someday replace 'display.c'
+ * new file 'drv_MatrixOrbital.c' will replace 'MatrixOrbital.c'
+ * due to this 'soft' transfer lcd4linux should stay usable during the switch
+ * (at least I hope so)
+ *
* Revision 1.44 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
@@ -250,18 +257,18 @@ extern LCD MilfordInstruments[];
extern LCD PalmPilot[];
extern LCD Raster[];
extern LCD SIN[];
-extern LCD Skeleton[];
extern LCD XWindow[];
extern LCD Text[];
// output file for Raster driver
// has to be defined here because it's referenced
// even if the raster driver is not included!
-char *output=NULL;
+// Fixme: has gone to new drv.c
+// char *output=NULL;
-FAMILY Driver[] = {
+FAMILY oldDriver[] = {
#ifdef WITH_BECKMANNEGLE
- { "Beckmann+Egle", BeckmannEgle },
+ { "BeckmannEgle", BeckmannEgle },
#endif
#ifdef WITH_CRYSTALFONTZ
{ "Crystalfontz", Crystalfontz },
@@ -270,40 +277,34 @@ FAMILY Driver[] = {
{ "Cwlinux", Cwlinux },
#endif
#ifdef WITH_HD44780
- { "HD 44780 based", HD44780 },
+ { "HD44780", HD44780 },
#endif
#ifdef WITH_M50530
- { "M50530 based", M50530 },
+ { "M50530", M50530 },
#endif
#ifdef WITH_T6963
- { "T6963 based", T6963 },
+ { "T6963", T6963 },
#endif
#ifdef WITH_USBLCD
{ "USBLCD", USBLCD },
#endif
#ifdef WITH_MATRIXORBITAL
- { "Matrix Orbital", MatrixOrbital },
+ { "MatrixOrbital", MatrixOrbital },
#endif
#ifdef WITH_MILINST
- { "Milford Instruments", MilfordInstruments },
+ { "MilfordInstruments", MilfordInstruments },
#endif
#ifdef WITH_PALMPILOT
- { "3Com Palm Pilot", PalmPilot },
+ { "PalmPilot", PalmPilot },
#endif
#if defined (WITH_PNG) || defined(WITH_PPM)
{ "Raster", Raster },
#endif
-#ifdef WITH_SIN
- { "SIN Router", SIN },
-#endif
-#ifdef WITH_SKELETON
- { "Skeleton", Skeleton },
-#endif
#ifdef WITH_X11
- { "X Window System", XWindow },
+ { "X11", XWindow },
#endif
#ifdef WITH_TEXT
- { "ncurses Text", Text },
+ { "Text", Text },
#endif
{ NULL }
};
@@ -316,12 +317,12 @@ int lcd_list (void)
{
int i, j;
- printf ("available display drivers:");
+ printf ("available *old* display drivers and models:");
- for (i=0; Driver[i].name; i++) {
- printf ("\n %-20s:", Driver[i].name);
- for (j=0; Driver[i].Model[j].name; j++) {
- printf (" %s", Driver[i].Model[j].name);
+ for (i=0; oldDriver[i].driver; i++) {
+ printf ("\n %-20s:", oldDriver[i].driver);
+ for (j=0; oldDriver[i].Model[j].name; j++) {
+ printf (" %s", oldDriver[i].Model[j].name);
}
}
printf ("\n");
@@ -332,10 +333,10 @@ int lcd_list (void)
int lcd_init (char *driver)
{
int i, j;
- for (i=0; Driver[i].name; i++) {
- for (j=0; Driver[i].Model[j].name; j++) {
- if (strcmp (Driver[i].Model[j].name, driver)==0) {
- Lcd=&Driver[i].Model[j];
+ for (i=0; oldDriver[i].driver; i++) {
+ for (j=0; oldDriver[i].Model[j].name; j++) {
+ if (strcmp (oldDriver[i].Model[j].name, driver)==0) {
+ Lcd=&oldDriver[i].Model[j];
if (Lcd->init==NULL) return 0;
return Lcd->init(Lcd);
}
diff --git a/display.h b/display.h
index 98c078e..9a0b8ab 100644
--- a/display.h
+++ b/display.h
@@ -1,4 +1,4 @@
-/* $Id: display.h,v 1.22 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: display.h,v 1.23 2004/01/09 17:03:07 reinelt Exp $
*
* framework for device drivers
*
@@ -22,6 +22,13 @@
*
*
* $Log: display.h,v $
+ * Revision 1.23 2004/01/09 17:03:07 reinelt
+ * initiated transfer to new driver architecture
+ * new file 'drv.c' will someday replace 'display.c'
+ * new file 'drv_MatrixOrbital.c' will replace 'MatrixOrbital.c'
+ * due to this 'soft' transfer lcd4linux should stay usable during the switch
+ * (at least I hope so)
+ *
* Revision 1.22 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
@@ -130,8 +137,8 @@ typedef struct LCD {
} LCD;
typedef struct {
- char *name;
- LCD *Model;
+ char *driver;
+ LCD *Model;
} FAMILY;
diff --git a/drv.c b/drv.c
new file mode 100644
index 0000000..1356421
--- /dev/null
+++ b/drv.c
@@ -0,0 +1,184 @@
+/* $Id: drv.c,v 1.1 2004/01/09 17:03:07 reinelt Exp $
+ *
+ * new framework for display drivers
+ *
+ * Copyright 1999-2003 Michael Reinelt <reinelt@eunet.at>
+ * Copyright 2004 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.c,v $
+ * Revision 1.1 2004/01/09 17:03:07 reinelt
+ * initiated transfer to new driver architecture
+ * new file 'drv.c' will someday replace 'display.c'
+ * new file 'drv_MatrixOrbital.c' will replace 'MatrixOrbital.c'
+ * due to this 'soft' transfer lcd4linux should stay usable during the switch
+ * (at least I hope so)
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * drv_list (void)
+ * lists all available drivers to stdout
+ *
+ * drv_init (char *driver)
+ * initializes the named driver
+ *
+ * drv_query (int *rows, int *cols, int *xres, int *yres, int *bars, int *gpos)
+ * queries the attributes of the selected driver
+ *
+ * drv_clear ()
+ * clears the display
+ *
+ * int drv_put (int row, int col, char *text)
+ * writes text at row, col
+ *
+ * int drv_bar (int type, int row, int col, int max, int len1, int len2)
+ * draws a specified bar at row, col with len
+ *
+ * int drv_icon (int num, int seq, int row, int col)
+ * draws icon #num sequence #seq at row, col
+ *
+ * int drv_gpo (int num, int val)
+ * sets GPO #num to val
+ *
+ * int drv_flush (void)
+ * flushes the framebuffer to the display
+ *
+ * int drv_quit (void)
+ * de-initializes the driver
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "drv.h"
+
+extern DRIVER drv_BeckmannEgle;
+extern DRIVER drv_Crystalfontz;
+extern DRIVER drv_Cwlinux;
+extern DRIVER drv_HD44780;
+extern DRIVER drv_M50530;
+extern DRIVER drv_T6963;
+extern DRIVER drv_USBDRIVER;
+extern DRIVER drv_MatrixOrbital;
+extern DRIVER drv_MilfordInstruments;
+extern DRIVER drv_PalmPilot;
+extern DRIVER drv_Raster;
+extern DRIVER drv_XWindow;
+extern DRIVER drv_Text;
+
+// output file for Raster driver
+// has to be defined here because it's referenced
+// even if the raster driver is not included!
+char *output=NULL;
+
+DRIVER *Driver[] = {
+#ifdef WITH_MATRIXORBITAL
+ &drv_MatrixOrbital,
+#endif
+ /* Fixme
+ #ifdef WITH_BECKMANNEGLE
+ &BeckmannEgle,
+ #endif
+ #ifdef WITH_CRYSTALFONTZ
+ &Crystalfontz,
+ #endif
+ #ifdef WITH_CWLINUX
+ &Cwlinux,
+ #endif
+ #ifdef WITH_HD44780
+ &HD44780,
+ #endif
+ #ifdef WITH_M50530
+ &M50530,
+ #endif
+ #ifdef WITH_T6963
+ &T6963,
+ #endif
+ #ifdef WITH_USBLCD
+ &USBLCD,
+ #endif
+ #ifdef WITH_MATRIXORBITAL
+ &MatrixOrbital,
+ #endif
+ #ifdef WITH_MILINST
+ &MilfordInstruments,
+ #endif
+ #ifdef WITH_PALMPILOT
+ &PalmPilot,
+ #endif
+ #if defined (WITH_PNG) || defined(WITH_PPM)
+ &Raster,
+ #endif
+ #ifdef WITH_X11
+ &XWindow,
+ #endif
+ #ifdef WITH_TEXT
+ &Text,
+ #endif
+ */
+ NULL,
+};
+
+
+static DRIVER *Lcd = NULL;
+
+
+int drv_list (void)
+{
+ int i;
+
+ printf ("available display drivers:");
+
+ for (i=0; Driver[i]; i++) {
+ printf ("\n %-20s: ", Driver[i]->name);
+ if (Driver[i]->list) Driver[i]->list();
+ }
+ printf ("\n");
+ return 0;
+}
+
+
+int drv_init (char *section, char *driver)
+{
+ int i;
+ for (i=0; Driver[i]; i++) {
+ if (strcmp (Driver[i]->name, driver)==0) {
+ Lcd=Driver[i];
+ if (Lcd->init==NULL) return 0;
+ return Lcd->init(Lcd);
+ }
+ }
+ error ("drv_init(%s) failed: no such driver", driver);
+ return -1;
+}
+
+
+int drv_quit (void)
+{
+ if (Lcd->quit==NULL) return 0;
+ return Lcd->quit();
+}
diff --git a/drv.h b/drv.h
new file mode 100644
index 0000000..59cf376
--- /dev/null
+++ b/drv.h
@@ -0,0 +1,65 @@
+/* $Id: drv.h,v 1.1 2004/01/09 17:03:07 reinelt Exp $
+ *
+ * new framework for display drivers
+ *
+ * Copyright 1999-2003 Michael Reinelt <reinelt@eunet.at>
+ * Copyright 2004 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.h,v $
+ * Revision 1.1 2004/01/09 17:03:07 reinelt
+ * initiated transfer to new driver architecture
+ * new file 'drv.c' will someday replace 'display.c'
+ * new file 'drv_MatrixOrbital.c' will replace 'MatrixOrbital.c'
+ * due to this 'soft' transfer lcd4linux should stay usable during the switch
+ * (at least I hope so)
+ *
+ */
+
+#ifndef _DRV_H_
+#define _DRV_H_
+
+typedef struct DRIVER {
+ char *name;
+ int (*list) (void);
+ int (*init) (struct DRIVER *Self);
+ int (*quit) (void);
+} DRIVER;
+
+
+// output file for Raster driver
+// has to be defined here because it's referenced
+// even if the raster driver is not included!
+extern char *output;
+
+int drv_list (void);
+int drv_init (char *section, char *driver);
+int drv_quit (void);
+
+/*
+ int drv_query (int *rows, int *cols, int *xres, int *yres, int *bars, int *icons, int *gpos);
+ int drv_clear (int full);
+ int drv_put (int row, int col, char *text);
+ int drv_bar (int type, int row, int col, int max, int len1, int le2);
+ int drv_icon (int num, int seq, int row, int col);
+ int drv_gpo (int num, int val);
+ int drv_flush (void);
+*/
+
+#endif
diff --git a/drv_MatrixOrbital.c b/drv_MatrixOrbital.c
new file mode 100644
index 0000000..1bb55e7
--- /dev/null
+++ b/drv_MatrixOrbital.c
@@ -0,0 +1,82 @@
+/* $Id: drv_MatrixOrbital.c,v 1.1 2004/01/09 17:03:07 reinelt Exp $
+ *
+ * new style driver for Matrix Orbital serial display modules
+ *
+ * Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
+ * Copyright 2004 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_MatrixOrbital.c,v $
+ * Revision 1.1 2004/01/09 17:03:07 reinelt
+ * initiated transfer to new driver architecture
+ * new file 'drv.c' will someday replace 'display.c'
+ * new file 'drv_MatrixOrbital.c' will replace 'MatrixOrbital.c'
+ * due to this 'soft' transfer lcd4linux should stay usable during the switch
+ * (at least I hope so)
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_MatrixOrbital
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "plugin.h"
+#include "lock.h"
+#include "drv.h"
+#include "bar.h"
+#include "icon.h"
+
+int drv_MO_list (void)
+{
+ printf ("this and that");
+ return 0;
+}
+
+int drv_MO_init (struct DRIVER *Self)
+{
+ debug ("consider me initialized");
+ return 0;
+}
+
+int drv_MO_quit (void) {
+ debug ("consider me gone");
+ return 0;
+}
+
+
+DRIVER drv_MatrixOrbital = {
+ name: "MatrixOrbital",
+ list: drv_MO_list,
+ init: drv_MO_init,
+ quit: drv_MO_quit
+};
diff --git a/lcd4linux.c b/lcd4linux.c
index 4e51b50..28e39ff 100644
--- a/lcd4linux.c
+++ b/lcd4linux.c
@@ -1,4 +1,4 @@
-/* $Id: lcd4linux.c,v 1.55 2004/01/09 04:16:06 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.56 2004/01/09 17:03:07 reinelt Exp $
*
* LCD4Linux
*
@@ -22,6 +22,13 @@
*
*
* $Log: lcd4linux.c,v $
+ * Revision 1.56 2004/01/09 17:03:07 reinelt
+ * initiated transfer to new driver architecture
+ * new file 'drv.c' will someday replace 'display.c'
+ * new file 'drv_MatrixOrbital.c' will replace 'MatrixOrbital.c'
+ * due to this 'soft' transfer lcd4linux should stay usable during the switch
+ * (at least I hope so)
+ *
* Revision 1.55 2004/01/09 04:16:06 reinelt
* added 'section' argument to cfg_get(), but NULLed it on all calls by now.
*
@@ -275,7 +282,8 @@
#include "debug.h"
#include "pid.h"
#include "udelay.h"
-#include "display.h"
+#include "display.h" // Fixme: remove me...
+#include "drv.h"
#include "processor.h"
#include "plugin.h"
@@ -368,7 +376,8 @@ void handler (int signal)
int main (int argc, char *argv[])
{
char *cfg="/etc/lcd4linux.conf";
- char *driver;
+ char *display, *driver;
+ char section[32];
int c;
int quiet=0;
int interactive=0;
@@ -414,6 +423,8 @@ int main (int argc, char *argv[])
break;
case 'l':
printf ("%s\n", release);
+ drv_list();
+ printf ("\n");
lcd_list();
exit(0);
case 'o':
@@ -451,10 +462,19 @@ int main (int argc, char *argv[])
if (cfg_init(cfg)==-1)
exit (1);
- driver=cfg_get(NULL, "display", NULL);
+ display=cfg_get(NULL, "Display", NULL);
+ if (display==NULL || *display=='\0') {
+ error ("missing 'Display' entry in %s!", cfg_source());
+ exit (1);
+ }
+
+ snprintf (section, sizeof(section), "Display:%s", display);
+ driver=cfg_get(section, "Driver", NULL);
if (driver==NULL || *driver=='\0') {
- error ("missing 'display' entry in %s!", cfg_source());
+#if 0
+ error ("missing '%s.Driver' entry in %s!", section, cfg_source());
exit (1);
+#endif
}
if (!running_foreground) {
@@ -509,10 +529,19 @@ int main (int argc, char *argv[])
running_background=1;
}
- debug ("initializing driver %s", driver);
- if (lcd_init(driver)==-1) {
- pid_exit(PIDFILE);
- exit (1);
+ // Fixme: Compatibility only...
+ if (driver!=NULL) {
+ debug ("initializing driver %s", driver);
+ if (drv_init(section, driver)==-1) {
+ pid_exit(PIDFILE);
+ exit (1);
+ }
+ } else {
+ debug ("initializing old-style driver %s", display);
+ if (lcd_init(display)==-1) {
+ pid_exit(PIDFILE);
+ exit (1);
+ }
}
// process_init sets global vars tick, tack