aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-01-21 13:26:44 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-01-21 13:26:44 +0000
commit83a890a4c831fac8421cd34e6d7b7023e9b342c4 (patch)
treedbcee93d96594d5044e38483830b426b8c5b180a
parentab1f95d24f2b5132f99812ee68a181cd7fa0dc01 (diff)
downloadlcd4linux-83a890a4c831fac8421cd34e6d7b7023e9b342c4.tar.gz
[lcd4linux @ 2006-01-21 13:26:43 by reinelt]
Logitech G-15 keyboard LCD driver from Dave Ingram git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@618 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to '')
-rw-r--r--Makefile.am1
-rw-r--r--Makefile.in50
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure28
-rw-r--r--drivers.m423
-rw-r--r--drv.c9
-rw-r--r--drv_G15.c413
-rw-r--r--lcd4linux.conf.sample4
8 files changed, 495 insertions, 36 deletions
diff --git a/Makefile.am b/Makefile.am
index 46dd741..a407421 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -58,6 +58,7 @@ drv_BWCT.c \
drv_Crystalfontz.c \
drv_Curses.c \
drv_Cwlinux.c \
+drv_G15.c \
drv_HD44780.c \
drv_Image.c \
drv_LCDLinux.c \
diff --git a/Makefile.in b/Makefile.in
index 2fd087d..1648abb 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 widget_gpo.c widget_gpo.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_gpio.c drv_generic_gpio.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_LPH7508.c drv_LUIse.c drv_M50530.c drv_MatrixOrbital.c drv_MilfordInstruments.c drv_Noritake.c drv_NULL.c drv_RouterBoard.c drv_Sample.c drv_serdisplib.c drv_SimpleLCD.c drv_T6963.c drv_Trefon.c drv_USBLCD.c drv_WincorNixdorf.c drv_X11.c font_6x8.h lcd4linux_i2c.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_sample.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_gpio.c drv_generic_gpio.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_G15.c drv_HD44780.c drv_Image.c drv_LCDLinux.c drv_LCDTerm.c drv_LPH7508.c drv_LUIse.c drv_M50530.c drv_MatrixOrbital.c drv_MilfordInstruments.c drv_Noritake.c drv_NULL.c drv_RouterBoard.c drv_Sample.c drv_serdisplib.c drv_SimpleLCD.c drv_T6963.c drv_Trefon.c drv_USBLCD.c drv_WincorNixdorf.c drv_X11.c font_6x8.h lcd4linux_i2c.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_sample.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
@@ -143,30 +143,30 @@ TAR = tar
GZIP_ENV = --best
DEP_FILES = .deps/cfg.P .deps/debug.P .deps/drv.P .deps/drv_BWCT.P \
.deps/drv_BeckmannEgle.P .deps/drv_Crystalfontz.P .deps/drv_Curses.P \
-.deps/drv_Cwlinux.P .deps/drv_HD44780.P .deps/drv_Image.P \
-.deps/drv_LCDLinux.P .deps/drv_LCDTerm.P .deps/drv_LPH7508.P \
-.deps/drv_LUIse.P .deps/drv_M50530.P .deps/drv_MatrixOrbital.P \
-.deps/drv_MilfordInstruments.P .deps/drv_NULL.P .deps/drv_Noritake.P \
-.deps/drv_RouterBoard.P .deps/drv_Sample.P .deps/drv_SimpleLCD.P \
-.deps/drv_T6963.P .deps/drv_Trefon.P .deps/drv_USBLCD.P \
-.deps/drv_WincorNixdorf.P .deps/drv_X11.P .deps/drv_generic_gpio.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/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_sample.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_gpo.P .deps/widget_icon.P \
-.deps/widget_text.P
+.deps/drv_Cwlinux.P .deps/drv_G15.P .deps/drv_HD44780.P \
+.deps/drv_Image.P .deps/drv_LCDLinux.P .deps/drv_LCDTerm.P \
+.deps/drv_LPH7508.P .deps/drv_LUIse.P .deps/drv_M50530.P \
+.deps/drv_MatrixOrbital.P .deps/drv_MilfordInstruments.P \
+.deps/drv_NULL.P .deps/drv_Noritake.P .deps/drv_RouterBoard.P \
+.deps/drv_Sample.P .deps/drv_SimpleLCD.P .deps/drv_T6963.P \
+.deps/drv_Trefon.P .deps/drv_USBLCD.P .deps/drv_WincorNixdorf.P \
+.deps/drv_X11.P .deps/drv_generic_gpio.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/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_sample.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_gpo.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 759048b..ff630f0 100644
--- a/config.h.in
+++ b/config.h.in
@@ -362,6 +362,9 @@
/* Define if using the dmalloc debugging malloc package */
#undef WITH_DMALLOC
+/* G-15 driver */
+#undef WITH_G15
+
/* HD44780 driver */
#undef WITH_HD44780
diff --git a/configure b/configure
index fa1262a..1087c51 100755
--- a/configure
+++ b/configure
@@ -869,10 +869,10 @@ Optional Packages:
(try 'all,\!<driver>' if your shell complains...)
possible drivers are:
BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux,
- HD44780, LCDLinux, LCDTerm, LPH7508, LUIse, M50530,
- MatrixOrbital, MilfordInstruments, Noritake, NULL,
- PNG, PPM, RouterBoard, Sample, serdisplib, SimpleLCD,
- T6963, Trefon, USBLCD, WincorNixdorf, X11
+ G15, HD44780, LCDLinux, LCDTerm, LPH7508, LUIse,
+ M50530, MatrixOrbital, MilfordInstruments, Noritake,
+ NULL, PNG, PPM, RouterBoard, Sample, serdisplib,
+ SimpleLCD, T6963, Trefon, USBLCD, WincorNixdorf, X11
--with-plugins=<list> choose which plugins to compile.
type --with-plugins=list for a list
of avaible plugins
@@ -6190,6 +6190,7 @@ for driver in $drivers; do
CRYSTALFONTZ="yes"
CURSES="yes"
CWLINUX="yes"
+ G15="yes"
HD44780="yes"
LCDLINUX="yes"
LCDTERM="yes"
@@ -6227,6 +6228,9 @@ for driver in $drivers; do
Cwlinux)
CWLINUX=$val
;;
+ G15)
+ G15=$val
+ ;;
HD44780)
HD44780=$val
;;
@@ -6380,6 +6384,22 @@ _ACEOF
fi
+if test "$G15" = "yes"; then
+ if test "$has_usb" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_G15.o"
+ DRVLIBS="$DRVLIBS -lusb"
+
+cat >>confdefs.h <<\_ACEOF
+#define WITH_G15 1
+_ACEOF
+
+ else
+ { echo "$as_me:$LINENO: WARNING: usb.h not found: G15 driver disabled" >&5
+echo "$as_me: WARNING: usb.h not found: G15 driver disabled" >&2;}
+ fi
+fi
+
if test "$HD44780" = "yes"; then
TEXT="yes"
PARPORT="yes"
diff --git a/drivers.m4 b/drivers.m4
index cf5660b..86ad941 100644
--- a/drivers.m4
+++ b/drivers.m4
@@ -29,10 +29,10 @@ AC_ARG_WITH(
[ (try 'all,\!<driver>' if your shell complains...)]
[ possible drivers are:]
[ BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux,]
- [ HD44780, LCDLinux, LCDTerm, LPH7508, LUIse, M50530,]
- [ MatrixOrbital, MilfordInstruments, Noritake, NULL,]
- [ PNG, PPM, RouterBoard, Sample, serdisplib, SimpleLCD,]
- [ T6963, Trefon, USBLCD, WincorNixdorf, X11],
+ [ G15, HD44780, LCDLinux, LCDTerm, LPH7508, LUIse,]
+ [ M50530, MatrixOrbital, MilfordInstruments, Noritake,]
+ [ NULL, PNG, PPM, RouterBoard, Sample, serdisplib,]
+ [ SimpleLCD, T6963, Trefon, USBLCD, WincorNixdorf, X11],
drivers=$withval,
drivers=all
)
@@ -58,6 +58,7 @@ for driver in $drivers; do
CRYSTALFONTZ="yes"
CURSES="yes"
CWLINUX="yes"
+ G15="yes"
HD44780="yes"
LCDLINUX="yes"
LCDTERM="yes"
@@ -95,6 +96,9 @@ for driver in $drivers; do
Cwlinux)
CWLINUX=$val
;;
+ G15)
+ G15=$val
+ ;;
HD44780)
HD44780=$val
;;
@@ -223,6 +227,17 @@ if test "$CWLINUX" = "yes"; then
AC_DEFINE(WITH_CWLINUX,1,[CwLinux driver])
fi
+if test "$G15" = "yes"; then
+ if test "$has_usb" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_G15.o"
+ DRVLIBS="$DRVLIBS -lusb"
+ AC_DEFINE(WITH_G15,1,[G-15 driver])
+ else
+ AC_MSG_WARN(usb.h not found: G15 driver disabled)
+ fi
+fi
+
if test "$HD44780" = "yes"; then
TEXT="yes"
PARPORT="yes"
diff --git a/drv.c b/drv.c
index 0b31359..207660c 100644
--- a/drv.c
+++ b/drv.c
@@ -1,4 +1,4 @@
-/* $Id: drv.c,v 1.37 2006/01/03 13:20:06 reinelt Exp $
+/* $Id: drv.c,v 1.38 2006/01/21 13:26:44 reinelt Exp $
*
* new framework for display drivers
*
@@ -23,6 +23,9 @@
*
*
* $Log: drv.c,v $
+ * Revision 1.38 2006/01/21 13:26:44 reinelt
+ * Logitech G-15 keyboard LCD driver from Dave Ingram
+ *
* Revision 1.37 2006/01/03 13:20:06 reinelt
* LUIse driver added
*
@@ -218,6 +221,7 @@ extern DRIVER drv_BWCT;
extern DRIVER drv_Crystalfontz;
extern DRIVER drv_Curses;
extern DRIVER drv_Cwlinux;
+extern DRIVER drv_G15;
extern DRIVER drv_HD44780;
extern DRIVER drv_Image;
extern DRIVER drv_LCDLinux;
@@ -261,6 +265,9 @@ DRIVER *Driver[] = {
#ifdef WITH_CURSES
&drv_Curses,
#endif
+#ifdef WITH_G15
+ &drv_G15,
+#endif
#ifdef WITH_HD44780
&drv_HD44780,
#endif
diff --git a/drv_G15.c b/drv_G15.c
new file mode 100644
index 0000000..60e650a
--- /dev/null
+++ b/drv_G15.c
@@ -0,0 +1,413 @@
+/* $Id: drv_G15.c,v 1.1 2006/01/21 13:26:44 reinelt Exp $
+ *
+ * Driver for Logitech G-15 keyboard LCD screen
+ *
+ * Copyright (C) 2006 Dave Ingram <dave@partis-project.net>
+ * 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_G15.c,v $
+ * Revision 1.1 2006/01/21 13:26:44 reinelt
+ * Logitech G-15 keyboard LCD driver from Dave Ingram
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_G15
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include <usb.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.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"
+
+#define G15_VENDOR 0x046d
+#define G15_DEVICE 0xc222
+
+#if 0
+#define DEBUG(x) debug("%s(): %s", __FUNCTION__, x);
+#else
+#define DEBUG(x)
+#endif
+
+static char Name[] = "G-15";
+
+static usb_dev_handle *g15_lcd;
+
+static unsigned char *g15_image;
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+static int drv_G15_open()
+{
+ struct usb_bus *bus;
+ struct usb_device *dev;
+ char dname[32]={0};
+
+ g15_lcd=NULL;
+
+ info("%s: Scanning USB for G-15 keyboard...", Name);
+
+ usb_init();
+ usb_set_debug(0);
+ usb_find_busses();
+ usb_find_devices();
+
+ for (bus=usb_get_busses(); bus; bus=bus->next) {
+ for (dev=bus->devices; dev; dev=dev->next) {
+ if ((g15_lcd=usb_open(dev))) {
+ if ((dev->descriptor.idVendor == G15_VENDOR) &&
+ (dev->descriptor.idProduct == G15_DEVICE)) {
+
+ // detach from the kernel if we need to
+ int retval=usb_get_driver_np(g15_lcd, 0, dname, 31);
+ if (retval==0 && strcmp(dname, "usbhid")==0) {
+ usb_detach_kernel_driver_np(g15_lcd, 0);
+ }
+ usb_set_configuration(g15_lcd,1);
+ usleep(100);
+ usb_claim_interface(g15_lcd,0);
+ return 0;
+ } else {
+ usb_close(g15_lcd);
+ }
+ }
+ }
+ }
+
+ return -1;
+}
+
+
+static int drv_G15_close(void)
+{
+ usb_release_interface(g15_lcd, 0);
+ if (g15_lcd)
+ usb_close(g15_lcd);
+
+ return 0;
+}
+
+
+static void drv_G15_send(const char *data, const unsigned int len)
+{
+ /* send data to the serial port is easy... */
+ //drv_generic_serial_write(data, len);
+}
+
+static void drv_G15_update_img()
+{
+ int i,j,k;
+ unsigned char *output=malloc(160*43*sizeof(unsigned char));
+
+ DEBUG("entered");
+ if (!output)
+ return;
+
+ DEBUG("memory allocated");
+ memset(output, 0, 160*43);
+ DEBUG("memory set");
+ output[0]=0x03;
+ DEBUG("first output set");
+
+ for (k=0; k<6; k++) {
+ for (i=0; i<160; i++) {
+ int maxj=(k==5)?3:8;
+ for (j=0; j<maxj; j++) {
+ if (g15_image[(k*1280)+i+(j*160)]) output[32+i+(k*160)]|=(1<<j);
+ }
+ }
+ }
+
+ DEBUG("output array prepared");
+
+ usb_bulk_write(g15_lcd, 0x02, output, 992, 1000);
+ usleep(300);
+
+ DEBUG("data written to LCD");
+
+ free(output);
+
+ DEBUG("memory freed");
+ DEBUG("left");
+}
+
+
+
+/* for graphic displays only */
+static void drv_G15_blit(const int row, const int col, const int height,
+ const int width)
+{
+ int r, c;
+
+ DEBUG("entered");
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ g15_image[r*160+c]=(drv_generic_graphic_FB[r * LCOLS + c]);
+ }
+ }
+
+ DEBUG("updating image");
+
+ drv_G15_update_img();
+
+ DEBUG("left");
+}
+
+
+/* example function used in a plugin */
+static int drv_G15_contrast(int contrast)
+{
+ char cmd[2];
+
+ /* adjust limits according to the display */
+ if (contrast < 0)
+ contrast = 0;
+ if (contrast > 255)
+ contrast = 255;
+
+ /* call a 'contrast' function */
+ /* assume 0x04 to be the 'set contrast' command */
+ cmd[0] = 0x04;
+ cmd[1] = contrast;
+ drv_G15_send(cmd, 2);
+
+ return contrast;
+}
+
+
+/* start graphic display */
+static int drv_G15_start(const char *section)
+{
+ char *s;
+ //int contrast;
+
+ DEBUG("entered");
+
+ /* read display size from config */
+ DROWS = 160;
+ DCOLS = 43;
+
+ DEBUG("display size set");
+
+ 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;
+ }
+
+ XRES = -1;
+ YRES = -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;
+ }
+
+ DEBUG("Finished config stuff");
+
+ DEBUG("allocating image buffer");
+ /* you surely want to allocate a framebuffer or something... */
+ g15_image=malloc(160*43*sizeof(unsigned char));
+ if (!g15_image)
+ return -1;
+ DEBUG("allocated");
+ memset(g15_image,0,160*43);
+ DEBUG("zeroed");
+
+ /* open communication with the display */
+ DEBUG("opening display...");
+ if (drv_G15_open() < 0) {
+ DEBUG("opening failed");
+ return -1;
+ }
+ DEBUG("display open");
+
+ /* reset & initialize display */
+ DEBUG("clearing display");
+ drv_G15_update_img();
+ DEBUG("done");
+
+ /*
+ if (cfg_number(section, "Contrast", 0, 0, 255, &contrast) > 0) {
+ drv_G15_contrast(contrast);
+ }
+ */
+
+ DEBUG("left");
+
+ return 0;
+}
+
+
+/****************************************/
+/*** plugins ***/
+/****************************************/
+
+static void plugin_contrast(RESULT * result, RESULT * arg1)
+{
+ double contrast;
+
+ contrast = drv_G15_contrast(R2N(arg1));
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+
+/****************************************/
+/*** widget callbacks ***/
+/****************************************/
+
+
+/* using drv_generic_text_draw(W) */
+/* using drv_generic_text_icon_draw(W) */
+/* using drv_generic_text_bar_draw(W) */
+/* using drv_generic_gpio_draw(W) */
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_G15_list(void)
+{
+ printf("generic");
+ return 0;
+}
+
+
+/* initialize driver & display */
+int drv_G15_init(const char *section, const int quiet)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ DEBUG("entered");
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_G15_blit;
+
+ /* start display */
+ if ((ret = drv_G15_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 */
+ //AddFunction("LCD::contrast", 1, plugin_contrast);
+
+ DEBUG("left");
+
+ return 0;
+}
+
+
+
+/* close driver & display */
+int drv_G15_quit(const int quiet)
+{
+ info("%s: shutting down.", Name);
+
+ DEBUG("clearing display");
+ /* clear display */
+ drv_generic_graphic_clear();
+
+ DEBUG("saying goodbye");
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ DEBUG("generic_graphic_quit()");
+ drv_generic_graphic_quit();
+
+ DEBUG("closing connection");
+ drv_G15_close();
+
+ DEBUG("freeing image alloc");
+ free(g15_image);
+
+ return (0);
+}
+
+
+DRIVER drv_G15 = {
+ name:Name,
+ list:drv_G15_list,
+ init:drv_G15_init,
+ quit:drv_G15_quit,
+};
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index 7df0053..c9f7c53 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -929,7 +929,7 @@ Layout testMySQL {
#Display 'LCM-162'
#Display 'CF631'
#Display 'CF632'
-#Display 'CF633'
+Display 'CF633'
#Display 'Curses'
#Display 'M50530-24x8'
#Display 'LCDTerm'
@@ -937,7 +937,7 @@ Layout testMySQL {
#Display 'BA63'
#Display 'CT20x4'
#Display 'T6963-240x64'
-Display 'XWindow'
+#Display 'XWindow'
#Display 'USBLCD'
#Display 'BWCT'
#Display 'Image'