aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--M50530.c401
-rw-r--r--Makefile.am4
-rw-r--r--Makefile.in12
-rw-r--r--USBLCD.c446
-rwxr-xr-xconfigure4
-rw-r--r--configure.in4
-rw-r--r--drv.c17
-rw-r--r--drv_M50530.c346
-rw-r--r--drv_USBLCD.c369
-rw-r--r--lcd4linux.conf.sample13
-rwxr-xr-xlibtool10
-rw-r--r--ltmain.sh92
12 files changed, 822 insertions, 896 deletions
diff --git a/M50530.c b/M50530.c
deleted file mode 100644
index eec199d..0000000
--- a/M50530.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/* $Id: M50530.c,v 1.18 2004/01/30 20:57:55 reinelt Exp $
- *
- * driver for display modules based on the M50530 chip
- *
- * Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
- *
- * 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: M50530.c,v $
- * Revision 1.18 2004/01/30 20:57:55 reinelt
- * HD44780 patch from Martin Hejl
- * dmalloc integrated
- *
- * Revision 1.17 2004/01/09 04:16:06 reinelt
- * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
- *
- * Revision 1.16 2003/10/05 17:58:50 reinelt
- * libtool junk; copyright messages cleaned up
- *
- * Revision 1.15 2003/09/11 04:09:53 reinelt
- * minor cleanups
- *
- * Revision 1.14 2003/09/10 03:48:22 reinelt
- * Icons for M50530, new processing scheme (Ticks.Text...)
- *
- * Revision 1.13 2003/09/09 06:54:43 reinelt
- * new function 'cfg_number()'
- *
- * Revision 1.12 2003/08/24 05:17:58 reinelt
- * liblcd4linux patch from Patrick Schemitz
- *
- * Revision 1.11 2003/08/16 07:31:35 reinelt
- * double buffering in all drivers
- *
- * Revision 1.10 2003/08/15 07:54:07 reinelt
- * HD44780 4 bit mode implemented
- *
- * Revision 1.9 2003/07/24 04:48:09 reinelt
- * 'soft clear' needed for virtual rows
- *
- * Revision 1.8 2003/04/07 06:02:59 reinelt
- * further parallel port abstraction
- *
- * Revision 1.7 2003/04/04 06:01:59 reinelt
- * new parallel port abstraction scheme
- *
- * Revision 1.6 2003/02/22 07:53:10 reinelt
- * cfg_get(key,defval)
- *
- * Revision 1.5 2002/08/19 10:51:06 reinelt
- * M50530 driver using new generic bar functions
- *
- * Revision 1.4 2002/08/19 07:36:29 reinelt
- *
- * finished bar.c, USBLCD is the first driver that uses the generic bar functions
- *
- * Revision 1.3 2002/08/19 04:41:20 reinelt
- * introduced bar.c, moved bar stuff from display.h to bar.h
- *
- * Revision 1.2 2002/04/30 07:20:15 reinelt
- *
- * implemented the new ndelay(nanoseconds) in all parallel port drivers
- *
- * Revision 1.1 2001/09/11 05:31:37 reinelt
- * M50530 driver
- *
- *
- */
-
-/*
- *
- * exported fuctions:
- *
- * struct LCD M50530[]
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "debug.h"
-#include "cfg.h"
-#include "display.h"
-#include "bar.h"
-#include "icon.h"
-#include "parport.h"
-#include "udelay.h"
-
-#ifdef WITH_DMALLOC
-#include <dmalloc.h>
-#endif
-
-#define XRES 5
-#define YRES 8
-#define CHARS 8
-
-static LCD Lcd;
-static int GPO=0;
-static int Icons;
-
-static char *FrameBuffer1=NULL;
-static char *FrameBuffer2=NULL;
-
-
-static unsigned char SIGNAL_EX;
-static unsigned char SIGNAL_IOC1;
-static unsigned char SIGNAL_IOC2;
-static unsigned char SIGNAL_GPO;
-
-static void M5_command (unsigned int cmd, int delay)
-{
-
- // put data on DB1..DB8
- parport_data (cmd&0xff);
-
- // set I/OC1 (Select inverted)
- // set I/OC2 (AutoFeed inverted)
- parport_control (SIGNAL_IOC1|SIGNAL_IOC2,
- (cmd&0x200?SIGNAL_IOC1:0) |
- (cmd&0x100?SIGNAL_IOC2:0));
-
- // Control data setup time
- ndelay(200);
-
- // send command
- // EX signal pulse width = 500ns
- // Fixme: why 500 ns? Datasheet says 200ns
- parport_toggle (SIGNAL_EX, 1, 500);
-
- // wait
- udelay(delay);
-
-}
-
-
-static void M5_write (unsigned char *string, int len)
-{
- unsigned int cmd;
-
- while (len--) {
- cmd=*string++;
- M5_command (0x100|cmd, 20);
- }
-}
-
-
-static void M5_setGPO (int bits)
-{
- if (Lcd.gpos>0) {
-
- // put data on DB1..DB8
- parport_data (bits);
-
- // 74HCT573 set-up time
- ndelay(20);
-
- // send data
- // 74HCT573 enable pulse width = 24ns
- parport_toggle (SIGNAL_GPO, 1, 24);
- }
-}
-
-
-static void M5_define_char (int ascii, char *buffer)
-{
- M5_command (0x300+192+8*ascii, 20);
- M5_write (buffer, 8);
-}
-
-
-int M5_clear (int full)
-{
-
- memset (FrameBuffer1, ' ', Lcd.rows*Lcd.cols*sizeof(char));
-
- icon_clear();
- bar_clear();
-
- GPO=0;
-
- if (full) {
- memset (FrameBuffer2, ' ', Lcd.rows*Lcd.cols*sizeof(char));
- M5_command (0x0001, 1250); // clear display
- M5_setGPO (GPO); // All GPO's off
- }
-
- return 0;
-}
-
-
-int M5_init (LCD *Self)
-{
- int rows=-1, cols=-1, gpos=-1;
- char *s;
-
- s=cfg_get(NULL, "Size", NULL);
- if (s==NULL || *s=='\0') {
- error ("M50530: no 'Size' entry in %s", cfg_source());
- return -1;
- }
- if (sscanf(s,"%dx%d",&cols,&rows)!=2 || rows<1 || cols<1) {
- error ("M50530: bad size '%s'",s);
- return -1;
- }
-
- if (cfg_number(NULL, "GPOs", 0, 0, 8, &gpos)<0) return -1;
-
- Self->rows=rows;
- Self->cols=cols;
- Self->gpos=gpos;
- Lcd=*Self;
-
- // Init the framebuffers
- FrameBuffer1 = (char*)malloc(Lcd.cols*Lcd.rows*sizeof(char));
- FrameBuffer2 = (char*)malloc(Lcd.cols*Lcd.rows*sizeof(char));
- if (FrameBuffer1==NULL || FrameBuffer2==NULL) {
- error ("HD44780: framebuffer could not be allocated: malloc() failed");
- return -1;
- }
-
- if ((SIGNAL_EX = parport_wire_ctrl ("EX", "STROBE"))==0xff) return -1;
- if ((SIGNAL_IOC1 = parport_wire_ctrl ("IOC1", "SELECT"))==0xff) return -1;
- if ((SIGNAL_IOC2 = parport_wire_ctrl ("IOC2", "AUTOFD"))==0xff) return -1;
- if ((SIGNAL_GPO = parport_wire_ctrl ("GPO", "INIT") )==0xff) return -1;
-
- if (parport_open() != 0) {
- error ("M50530: could not initialize parallel port!");
- return -1;
- }
-
- // set direction: write
- parport_direction (0);
-
- // initialize display
- M5_command (0x00FA, 20); // set function mode
- M5_command (0x0020, 20); // set display mode
- M5_command (0x0050, 20); // set entry mode
- M5_command (0x0030, 20); // set display mode
-
- if (cfg_number(NULL, "Icons", 0, 0, CHARS, &Icons)<0) return -1;
- if (Icons>0) {
- debug ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
- icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, M5_define_char);
- Self->icons=Icons;
- Lcd.icons=Icons;
- }
-
- bar_init(rows, cols, XRES, YRES, CHARS-Icons);
- bar_add_segment(0,0,255,32); // ASCII 32 = blank
-
- M5_clear(1);
-
- return 0;
-}
-
-
-void M5_goto (int row, int col)
-{
- int pos;
-
- pos=row*48+col;
- if (row>3) pos-=168;
- M5_command (0x300|pos, 20);
-}
-
-
-int M5_put (int row, int col, char *text)
-{
- char *p=FrameBuffer1+row*Lcd.cols+col;
- char *t=text;
-
- while (*t && col++<=Lcd.cols) {
- *p++=*t++;
- }
- return 0;
-}
-
-
-int M5_bar (int type, int row, int col, int max, int len1, int len2)
-{
- return bar_draw (type, row, col, max, len1, len2);
-}
-
-
-int M5_icon (int num, int seq, int row, int col)
-{
- return icon_draw (num, seq, row, col);
-}
-
-
-int M5_gpo (int num, int val)
-{
- if (num>=Lcd.gpos)
- return -1;
-
- if (val) {
- GPO |= 1<<num; // set bit
- } else {
- GPO &= ~(1<<num); // clear bit
- }
- return 0;
-}
-
-
-int M5_flush (void)
-{
- int row, col, pos1, pos2;
- int c, equal;
-
- bar_process(M5_define_char);
-
- for (row=0; row<Lcd.rows; row++) {
- for (col=0; col<Lcd.cols; col++) {
- c=bar_peek(row, col);
- if (c==-1) c=icon_peek(row, col);
- if (c!=-1) {
- if (c!=32) c+=248; //blank
- FrameBuffer1[row*Lcd.cols+col]=(char)c;
- }
- }
- for (col=0; col<Lcd.cols; col++) {
- if (FrameBuffer1[row*Lcd.cols+col]==FrameBuffer2[row*Lcd.cols+col]) continue;
- M5_goto (row, col);
- for (pos1=col++, pos2=pos1, equal=0; col<Lcd.cols; col++) {
- if (FrameBuffer1[row*Lcd.cols+col]==FrameBuffer2[row*Lcd.cols+col]) {
- // If we find just one equal byte, we don't break, because this
- // would require a goto, which takes one byte, too.
- if (++equal>2) break;
- } else {
- pos2=col;
- equal=0;
- }
- }
- M5_write (FrameBuffer1+row*Lcd.cols+pos1, pos2-pos1+1);
- }
- }
-
- memcpy (FrameBuffer2, FrameBuffer1, Lcd.rows*Lcd.cols*sizeof(char));
-
- M5_setGPO(GPO);
-
- return 0;
-}
-
-
-int M5_quit (void)
-{
- info("M50530: shutting down.");
-
- if (FrameBuffer1) {
- free(FrameBuffer1);
- FrameBuffer1=NULL;
- }
-
- if (FrameBuffer2) {
- free(FrameBuffer2);
- FrameBuffer2=NULL;
- }
-
- return parport_close();
-}
-
-
-LCD M50530[] = {
- { name: "M50530",
- rows: 0,
- cols: 0,
- xres: XRES,
- yres: YRES,
- bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2,
- icons: 0,
- gpos: 0,
- init: M5_init,
- clear: M5_clear,
- put: M5_put,
- bar: M5_bar,
- icon: M5_icon,
- gpo: M5_gpo,
- flush: M5_flush,
- quit: M5_quit
- },
- { NULL }
-};
diff --git a/Makefile.am b/Makefile.am
index 06fec0e..e06282f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -71,10 +71,10 @@ drv_generic_parport.c drv_generic_parport.h \
BeckmannEgle.c \
drv_Crystalfontz.c \
drv_Cwlinux.c \
-HD44780.c \
+drv_HD44780.c \
drv_M50530.c \
T6963.c \
-USBLCD.c \
+drv_USBLCD.c \
drv_MatrixOrbital.c \
MilfordInstruments.c \
PalmPilot.c \
diff --git a/Makefile.in b/Makefile.in
index 233acf4..3ebd0c3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -125,7 +125,7 @@ lcd4linux_SOURCES = lcd4linux.c cfg.c cfg.h deb
#fontmap.c fontmap.h \
#udelay.c udelay.h
-EXTRA_lcd4linux_SOURCES = drv_generic_text.c drv_generic_text.h drv_generic_serial.c drv_generic_serial.h drv_generic_parport.c drv_generic_parport.h BeckmannEgle.c drv_Crystalfontz.c drv_Cwlinux.c HD44780.c drv_M50530.c T6963.c USBLCD.c drv_MatrixOrbital.c MilfordInstruments.c PalmPilot.c Raster.c SIN.c XWindow.c Text.c
+EXTRA_lcd4linux_SOURCES = drv_generic_text.c drv_generic_text.h drv_generic_serial.c drv_generic_serial.h drv_generic_parport.c drv_generic_parport.h BeckmannEgle.c drv_Crystalfontz.c drv_Cwlinux.c drv_HD44780.c drv_M50530.c T6963.c drv_USBLCD.c drv_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 plugin_sample.c
@@ -171,11 +171,11 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
-DEP_FILES = .deps/BeckmannEgle.P .deps/HD44780.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/cfg.P \
-.deps/debug.P .deps/drv.P .deps/drv_Crystalfontz.P .deps/drv_Cwlinux.P \
-.deps/drv_M50530.P .deps/drv_MatrixOrbital.P \
+DEP_FILES = .deps/BeckmannEgle.P .deps/MilfordInstruments.P \
+.deps/PalmPilot.P .deps/Raster.P .deps/SIN.P .deps/T6963.P .deps/Text.P \
+.deps/XWindow.P .deps/cfg.P .deps/debug.P .deps/drv.P \
+.deps/drv_Crystalfontz.P .deps/drv_Cwlinux.P .deps/drv_HD44780.P \
+.deps/drv_M50530.P .deps/drv_MatrixOrbital.P .deps/drv_USBLCD.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/lock.P .deps/pid.P .deps/plugin.P \
diff --git a/USBLCD.c b/USBLCD.c
deleted file mode 100644
index 63eb7b4..0000000
--- a/USBLCD.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/* $Id: USBLCD.c,v 1.21 2004/01/30 20:57:55 reinelt Exp $
- *
- * Driver for USBLCD (see http://www.usblcd.de)
- *
- * Copyright 2002 Robin Adams, Adams IT Services <info@usblcd.de>
- *
- * This driver is based on HD44780.c, which is
- * Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
- *
- * 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: USBLCD.c,v $
- * Revision 1.21 2004/01/30 20:57:55 reinelt
- * HD44780 patch from Martin Hejl
- * dmalloc integrated
- *
- * Revision 1.20 2004/01/09 04:16:06 reinelt
- * added 'section' argument to cfg_get(), but NULLed it on all calls by now.
- *
- * Revision 1.19 2004/01/06 22:33:14 reinelt
- * Copyright statements cleaned up
- *
- * Revision 1.18 2003/10/05 17:58:50 reinelt
- * libtool junk; copyright messages cleaned up
- *
- * Revision 1.17 2003/09/11 04:09:53 reinelt
- * minor cleanups
- *
- * Revision 1.16 2003/09/10 03:48:23 reinelt
- * Icons for M50530, new processing scheme (Ticks.Text...)
- *
- * Revision 1.15 2003/09/09 11:47:47 reinelt
- * basic icon support for HD44780
- *
- * Revision 1.14 2003/09/09 06:54:43 reinelt
- * new function 'cfg_number()'
- *
- * Revision 1.13 2003/09/09 05:30:34 reinelt
- * even more icons stuff
- *
- * Revision 1.12 2003/08/24 05:17:58 reinelt
- * liblcd4linux patch from Patrick Schemitz
- *
- * Revision 1.11 2003/08/16 07:31:35 reinelt
- * double buffering in all drivers
- *
- * Revision 1.10 2003/07/24 04:48:09 reinelt
- * 'soft clear' needed for virtual rows
- *
- * Revision 1.9 2003/04/04 06:01:59 reinelt
- * new parallel port abstraction scheme
- *
- * Revision 1.8 2003/02/22 07:53:10 reinelt
- * cfg_get(key,defval)
- *
- * Revision 1.7 2002/08/19 09:11:34 reinelt
- * changed HD44780 to use generic bar functions
- *
- * Revision 1.6 2002/08/19 07:52:19 reinelt
- * corrected type declaration of (*defchar)()
- *
- * Revision 1.5 2002/08/19 07:36:29 reinelt
- *
- * finished bar.c, USBLCD is the first driver that uses the generic bar functions
- *
- * Revision 1.4 2002/08/19 04:41:20 reinelt
- * introduced bar.c, moved bar stuff from display.h to bar.h
- *
- * Revision 1.3 2002/08/18 08:11:11 reinelt
- * USBLCD buffered I/O
- *
- * Revision 1.2 2002/08/17 14:14:21 reinelt
- *
- * USBLCD fixes
- *
- * Revision 1.0 2002/07/08 12:16:10 radams
- *
- * first version of the USBLCD driver
- *
- */
-
-/*
- *
- * exported fuctions:
- *
- * struct LCD UDBLCD[]
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <time.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-
-#include <sys/time.h>
-
-#include "debug.h"
-#include "cfg.h"
-#include "display.h"
-#include "icon.h"
-#include "bar.h"
-
-#ifdef WITH_DMALLOC
-#include <dmalloc.h>
-#endif
-
-#define GET_HARD_VERSION 1
-#define GET_DRV_VERSION 2
-
-#define XRES 5
-#define YRES 8
-#define CHARS 8
-
-static LCD Lcd;
-static char *Port=NULL;
-static int usblcd_file;
-static int Icons;
-
-static char *FrameBuffer1=NULL;
-static char *FrameBuffer2=NULL;
-
-static unsigned char *Buffer;
-static unsigned char *BufPtr;
-
-static void USBLCD_send ()
-{
- // struct timeval now, end;
- // gettimeofday (&now, NULL);
-
- write(usblcd_file,Buffer,BufPtr-Buffer);
-
- // gettimeofday (&end, NULL);
- // debug ("send %d: %d usec (%d usec/byte)", BufPtr-Buffer, 1000000*(end.tv_sec-now.tv_sec)+end.tv_usec-now.tv_usec, (1000000*(end.tv_sec-now.tv_sec)+end.tv_usec-now.tv_usec)/(BufPtr-Buffer));
-
- BufPtr=Buffer;
-
-}
-
-
-static void USBLCD_command (unsigned char cmd)
-{
- *BufPtr++='\0';
- *BufPtr++=cmd;
-}
-
-static void USBLCD_write (char *string, int len)
-{
- while (len--) {
- if(*string==0) *BufPtr++=*string;
- *BufPtr++=*string++;
- }
-}
-
-
-static int USBLCD_open (void)
-{
- char buf[128];
- int major,minor;
-
- usblcd_file=open(Port,O_WRONLY);
- if (usblcd_file==-1) {
- error ("USBLCD: open(%s) failed: %s", Port, strerror(errno));
- return -1;
- }
-
- memset(buf,0,sizeof(buf));
- if (ioctl(usblcd_file,GET_DRV_VERSION, buf)!=0) {
- error ("USBLCD: ioctl() failed, could not get Driver Version!");
- return -2;
- }
- debug("Driver Version: %s",buf);
-
- if (sscanf(buf,"USBLCD Driver Version %d.%d",&major,&minor)!=2) {
- error("USBLCD: could not read Driver Version!");
- return -4;
- }
- if (major!=1) {
- error("USBLCD: Driver Version not supported!");
- return -4;
- }
-
- memset(buf,0,sizeof(buf));
- if (ioctl(usblcd_file,GET_HARD_VERSION, buf)!=0) {
- error ("USBLCD: ioctl() failed, could not get Hardware Version!");
- return -3;
- }
- debug("Hardware Version: %s",buf);
-
- if (sscanf(buf,"%d.%d",&major,&minor)!=2) {
- error("USBLCD: could not read Hardware Version!");
- return -4;
- };
- if (major!=1) {
- error("USBLCD: Hardware Version not supported!");
- return -4;
- }
-
- BufPtr=Buffer;
-
- USBLCD_command (0x29); // 8 Bit mode, 1/16 duty cycle, 5x8 font
- USBLCD_command (0x08); // Display off, cursor off, blink off
- USBLCD_command (0x0c); // Display on, cursor off, blink off
- USBLCD_command (0x06); // curser moves to right, no shift
-
- return 0;
-}
-
-static void USBLCD_define_char (int ascii, char *buffer)
-{
- USBLCD_command (0x40|8*ascii);
- USBLCD_write (buffer, 8);
-}
-
-
-int USBLCD_clear (int full)
-{
-
- memset (FrameBuffer1, ' ', Lcd.rows*Lcd.cols*sizeof(char));
-
- icon_clear();
- bar_clear();
-
- if (full) {
- memset (FrameBuffer2, ' ', Lcd.rows*Lcd.cols*sizeof(char));
- USBLCD_command (0x01); // clear display
- }
-
- return 0;
-}
-
-
-int USBLCD_init (LCD *Self)
-{
- int rows=-1, cols=-1 ;
- char *port, *s;
-
- if (Port) {
- free(Port);
- Port=NULL;
- }
- if ((port=cfg_get(NULL, "Port", NULL))==NULL || *port=='\0') {
- error ("USBLCD: no 'Port' entry in %s", cfg_source());
- return -1;
- }
- if (port[0]=='/') {
- Port=strdup(port);
- } else {
- Port=(char *)malloc(5/*/dev/ */+strlen(port)+1);
- sprintf(Port,"/dev/%s",port);
- }
-
- debug ("using device %s ", Port);
-
- s=cfg_get(NULL, "Size", NULL);
- if (s==NULL || *s=='\0') {
- error ("USBLCD: no 'Size' entry in %s", cfg_source());
- return -1;
- }
- if (sscanf(s,"%dx%d",&cols,&rows)!=2 || rows<1 || cols<1) {
- error ("USBLCD: bad size '%s'",s);
- return -1;
- }
-
- Self->rows=rows;
- Self->cols=cols;
- Lcd=*Self;
-
- // Init the command buffer
- Buffer = (char*)malloc(1024);
- if (Buffer==NULL) {
- error ("USBLCD: coommand buffer could not be allocated: malloc() failed");
- return -1;
- }
-
- // Init the framebuffers
- FrameBuffer1 = (char*)malloc(Lcd.cols*Lcd.rows*sizeof(char));
- FrameBuffer2 = (char*)malloc(Lcd.cols*Lcd.rows*sizeof(char));
- if (FrameBuffer1==NULL || FrameBuffer2==NULL) {
- error ("USBLCD: framebuffer could not be allocated: malloc() failed");
- return -1;
- }
-
- if (USBLCD_open()!=0)
- return -1;
-
- if (cfg_number(NULL, "Icons", 0, 0, CHARS, &Icons)<0) return -1;
- if (Icons>0) {
- debug ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
- icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, USBLCD_define_char);
- Self->icons=Icons;
- Lcd.icons=Icons;
- }
-
- bar_init(rows, cols, XRES, YRES, CHARS-Icons);
- bar_add_segment( 0, 0,255, 32); // ASCII 32 = blank
- bar_add_segment(255,255,255,255); // ASCII 255 = block
-
- USBLCD_clear(1);
- USBLCD_send();
-
- return 0;
-}
-
-
-void USBLCD_goto (int row, int col)
-{
- int pos=(row%2)*64+(row/2)*20+col;
- USBLCD_command (0x80|pos);
-}
-
-
-int USBLCD_put (int row, int col, char *text)
-{
- char *p=FrameBuffer1+row*Lcd.cols+col;
- char *t=text;
-
- while (*t && col++<=Lcd.cols) {
- *p++=*t++;
- }
- return 0;
-}
-
-
-int USBLCD_bar (int type, int row, int col, int max, int len1, int len2)
-{
- return bar_draw (type, row, col, max, len1, len2);
-}
-
-
-int USBLCD_icon (int num, int seq, int row, int col)
-{
- return icon_draw (num, seq, row, col);
-}
-
-
-int USBLCD_flush (void)
-{
- int row, col, pos1, pos2;
- int c, equal;
-
- bar_process(USBLCD_define_char);
-
- for (row=0; row<Lcd.rows; row++) {
- for (col=0; col<Lcd.cols; col++) {
- c=bar_peek(row, col);
- if (c==-1) c=icon_peek(row, col);
- if (c!=-1) {
- FrameBuffer1[row*Lcd.cols+col]=(char)c;
- }
- }
- for (col=0; col<Lcd.cols; col++) {
- if (FrameBuffer1[row*Lcd.cols+col]==FrameBuffer2[row*Lcd.cols+col]) continue;
- USBLCD_goto (row, col);
- for (pos1=col++, pos2=pos1, equal=0; col<Lcd.cols; col++) {
- if (FrameBuffer1[row*Lcd.cols+col]==FrameBuffer2[row*Lcd.cols+col]) {
- // If we find just one equal byte, we don't break, because this
- // would require a goto, which takes one byte, too.
- if (++equal>2) break;
- } else {
- pos2=col;
- equal=0;
- }
- }
- USBLCD_write (FrameBuffer1+row*Lcd.cols+pos1, pos2-pos1+1);
- }
- }
-
- USBLCD_send();
-
- memcpy (FrameBuffer2, FrameBuffer1, Lcd.rows*Lcd.cols*sizeof(char));
-
- return 0;
-}
-
-
-int USBLCD_quit (void)
-{
- info("USBLCD: shutting down.");
- USBLCD_send();
-
- debug ("closing port %s", Port);
- close(usblcd_file);
-
- if (Buffer) {
- free(Buffer);
- Buffer=NULL;
- }
-
- if (FrameBuffer1) {
- free(FrameBuffer1);
- FrameBuffer1=NULL;
- }
-
- if (FrameBuffer2) {
- free(FrameBuffer2);
- FrameBuffer2=NULL;
- }
-
- return 0;
-}
-
-
-LCD USBLCD[] = {
- { name: "USBLCD",
- rows: 0,
- cols: 0,
- xres: XRES,
- yres: YRES,
- bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2,
- icons: 0,
- gpos: 0,
- init: USBLCD_init,
- clear: USBLCD_clear,
- put: USBLCD_put,
- bar: USBLCD_bar,
- icon: USBLCD_icon,
- gpo: NULL,
- flush: USBLCD_flush,
- quit: USBLCD_quit
- },
- { NULL }
-};
diff --git a/configure b/configure
index f210394..03f32b9 100755
--- a/configure
+++ b/configure
@@ -21006,8 +21006,8 @@ _ACEOF
fi
if test "$USBLCD" = "yes"; then
-# DRIVERS="$DRIVERS USBLCD.lo"
-# DRIVERS="$DRIVERS USBLCD.o"
+# DRIVERS="$DRIVERS drv_USBLCD.lo"
+ DRIVERS="$DRIVERS drv_USBLCD.o"
cat >>confdefs.h <<\_ACEOF
#define WITH_USBLCD 1
diff --git a/configure.in b/configure.in
index e069dca..731a3d5 100644
--- a/configure.in
+++ b/configure.in
@@ -189,8 +189,8 @@ if test "$T6963" = "yes"; then
fi
if test "$USBLCD" = "yes"; then
-# DRIVERS="$DRIVERS USBLCD.lo"
-# DRIVERS="$DRIVERS USBLCD.o"
+# DRIVERS="$DRIVERS drv_USBLCD.lo"
+ DRIVERS="$DRIVERS drv_USBLCD.o"
AC_DEFINE(WITH_USBLCD,1,[USBLCD driver])
fi
diff --git a/drv.c b/drv.c
index 32aa57e..0b0fd34 100644
--- a/drv.c
+++ b/drv.c
@@ -1,4 +1,4 @@
-/* $Id: drv.c,v 1.6 2004/02/14 11:56:17 reinelt Exp $
+/* $Id: drv.c,v 1.7 2004/02/15 08:22:47 reinelt Exp $
*
* new framework for display drivers
*
@@ -23,6 +23,11 @@
*
*
* $Log: drv.c,v $
+ * Revision 1.7 2004/02/15 08:22:47 reinelt
+ * ported USBLCD driver to NextGeneration
+ * added drv_M50530.c (I forgot yesterday, sorry)
+ * removed old drivers M50530.c and USBLCD.c
+ *
* Revision 1.6 2004/02/14 11:56:17 reinelt
* M50530 driver ported
* changed lots of 'char' to 'unsigned char'
@@ -99,7 +104,7 @@ extern DRIVER drv_Cwlinux;
extern DRIVER drv_HD44780;
extern DRIVER drv_M50530;
extern DRIVER drv_T6963;
-extern DRIVER drv_USBDRIVER;
+extern DRIVER drv_USBLCD;
extern DRIVER drv_MatrixOrbital;
extern DRIVER drv_MilfordInstruments;
extern DRIVER drv_PalmPilot;
@@ -137,9 +142,11 @@ DRIVER *Driver[] = {
#ifdef WITH_T6963
&T6963,
#endif
- #ifdef WITH_USBLCD
- &USBLCD,
- #endif
+ */
+#ifdef WITH_USBLCD
+ &drv_USBLCD,
+#endif
+ /* Fixme
#ifdef WITH_MATRIXORBITAL
&MatrixOrbital,
#endif
diff --git a/drv_M50530.c b/drv_M50530.c
new file mode 100644
index 0000000..b33630e
--- /dev/null
+++ b/drv_M50530.c
@@ -0,0 +1,346 @@
+/* $Id: drv_M50530.c,v 1.1 2004/02/15 08:22:47 reinelt Exp $
+ *
+ * new style driver for M50530-based displays
+ *
+ * Copyright 1999-2004 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_M50530.c,v $
+ * Revision 1.1 2004/02/15 08:22:47 reinelt
+ * ported USBLCD driver to NextGeneration
+ * added drv_M50530.c (I forgot yesterday, sorry)
+ * removed old drivers M50530.c and USBLCD.c
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_M50530
+ *
+ */
+
+#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 "debug.h"
+#include "cfg.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_text.h"
+#include "drv_generic_parport.h"
+
+static char Name[]="M50530";
+
+static int Model;
+static int Capabilities;
+
+static unsigned char SIGNAL_EX;
+static unsigned char SIGNAL_IOC1;
+static unsigned char SIGNAL_IOC2;
+static unsigned char SIGNAL_GPO;
+
+// Fixme
+static int GPOS;
+// static int GPO=0;
+
+
+typedef struct {
+ int type;
+ char *name;
+ int capabilities;
+} MODEL;
+
+static MODEL Models[] = {
+ { 0x01, "generic", 0 },
+ { 0xff, "Unknown", 0 }
+};
+
+
+// ****************************************
+// *** hardware dependant functions ***
+// ****************************************
+
+static void drv_M5_command (unsigned int cmd, int delay)
+{
+
+ // put data on DB1..DB8
+ drv_generic_parport_data (cmd&0xff);
+
+ // set I/OC1
+ // set I/OC2
+ drv_generic_parport_control (SIGNAL_IOC1|SIGNAL_IOC2,
+ (cmd&0x200?SIGNAL_IOC1:0) |
+ (cmd&0x100?SIGNAL_IOC2:0));
+
+ // Control data setup time
+ ndelay(200);
+
+ // send command
+ // EX signal pulse width = 500ns
+ // Fixme: why 500 ns? Datasheet says 200ns
+ drv_generic_parport_toggle (SIGNAL_EX, 1, 500);
+
+ // wait
+ udelay(delay);
+
+}
+
+
+static void drv_M5_write (unsigned char *string, int len)
+{
+ unsigned int cmd;
+
+ while (len--) {
+ cmd=*string++;
+ drv_M5_command (0x100|cmd, 20);
+ }
+}
+
+
+static void drv_M5_goto (int row, int col)
+{
+ int pos=row*48+col;
+ if (row>3) pos-=168;
+ drv_M5_command (0x300|pos, 20);
+}
+
+
+static void drv_M5_defchar (int ascii, unsigned char *buffer)
+{
+ drv_M5_command (0x300+192+8*(ascii-CHAR0), 20);
+ // Fixme: looks like the M50530 cannot control the bottom line
+ // therefore we have only 7 bytes here
+ drv_M5_write (buffer, 7);
+}
+
+
+// Fixme
+#if 0
+static void drv_M5_setGPO (int bits)
+{
+ if (Lcd.gpos>0) {
+
+ // put data on DB1..DB8
+ drv_generic_parport_data (bits);
+
+ // 74HCT573 set-up time
+ ndelay(20);
+
+ // send data
+ // 74HCT573 enable pulse width = 24ns
+ drv_generic_parport_toggle (SIGNAL_GPO, 1, 24);
+ }
+}
+#endif
+
+
+static int drv_M5_start (char *section)
+{
+ char *model, *s;
+ int rows=-1, cols=-1, gpos=-1;
+
+ model=cfg_get(section, "Model", "generic");
+ if (model!=NULL && *model!='\0') {
+ int i;
+ for (i=0; Models[i].type!=0xff; i++) {
+ if (strcasecmp(Models[i].name, model)==0) break;
+ }
+ if (Models[i].type==0xff) {
+ error ("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source());
+ return -1;
+ }
+ Model=i;
+ Capabilities=Models[Model].capabilities;
+ info ("%s: using model '%s'", Name, Models[Model].name);
+ } else {
+ error ("%s: empty '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ s=cfg_get(section, "Size", NULL);
+ if (s==NULL || *s=='\0') {
+ error ("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s,"%dx%d",&cols,&rows)!=2 || rows<1 || cols<1) {
+ error ("%s: bad size '%s'", Name, s);
+ return -1;
+ }
+
+ if (cfg_number(section, "GPOs", 0, 0, 8, &gpos)<0) return -1;
+ info ("%s: controlling %d GPO's", Name, gpos);
+
+ DROWS = rows;
+ DCOLS = cols;
+ GPOS = gpos;
+
+ if (drv_generic_parport_open(section, Name) != 0) {
+ error ("%s: could not initialize parallel port!", Name);
+ return -1;
+ }
+
+ if ((SIGNAL_EX = drv_generic_parport_wire_ctrl ("EX", "STROBE"))==0xff) return -1;
+ if ((SIGNAL_IOC1 = drv_generic_parport_wire_ctrl ("IOC1", "SELECT"))==0xff) return -1;
+ if ((SIGNAL_IOC2 = drv_generic_parport_wire_ctrl ("IOC2", "AUTOFD"))==0xff) return -1;
+ if ((SIGNAL_GPO = drv_generic_parport_wire_ctrl ("GPO", "INIT" ))==0xff) return -1;
+
+ // clear all signals
+ drv_generic_parport_control (SIGNAL_EX|SIGNAL_IOC1|SIGNAL_IOC2|SIGNAL_GPO, 0);
+
+ // set direction: write
+ drv_generic_parport_direction (0);
+
+ drv_M5_command (0x00FA, 20); // set function mode
+ drv_M5_command (0x0020, 20); // set display mode
+ drv_M5_command (0x0050, 20); // set entry mode
+ drv_M5_command (0x0030, 20); // set display mode
+ drv_M5_command (0x0001, 1250); // clear display
+
+ return 0;
+}
+
+
+// ****************************************
+// *** plugins ***
+// ****************************************
+
+// none at the moment
+
+
+// ****************************************
+// *** widget callbacks ***
+// ****************************************
+
+// using drv_generic_text_draw(W)
+// using drv_generic_text_icon_draw(W)
+// using drv_generic_text_bar_draw(W)
+
+
+// ****************************************
+// *** exported functions ***
+// ****************************************
+
+
+// list models
+int drv_M5_list (void)
+{
+ int i;
+
+ for (i=0; Models[i].type!=0xff; i++) {
+ printf ("%s ", Models[i].name);
+ }
+ return 0;
+}
+
+
+// initialize driver & display
+int drv_M5_init (char *section)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ // display preferences
+ XRES = 5; // pixel width of one char
+ YRES = 8; // pixel height of one char
+ CHARS = 8; // number of user-defineable characters
+ CHAR0 = 248; // ASCII of first user-defineable char
+ GOTO_COST = 1; // number of bytes a goto command requires
+
+ // real worker functions
+ drv_generic_text_real_write = drv_M5_write;
+ drv_generic_text_real_goto = drv_M5_goto;
+ drv_generic_text_real_defchar = drv_M5_defchar;
+
+
+ // start display
+ if ((ret=drv_M5_start (section))!=0)
+ return ret;
+
+ // initialize generic text driver
+ if ((ret=drv_generic_text_init(section, Name))!=0)
+ return ret;
+
+ // initialize generic icon driver
+ if ((ret=drv_generic_text_icon_init())!=0)
+ return ret;
+
+ // initialize generic bar driver
+ if ((ret=drv_generic_text_bar_init())!=0)
+ return ret;
+
+ // add fixed chars to the bar driver
+ drv_generic_text_bar_add_segment (0,0,255,32); // ASCII 32 = blank
+
+ // register text widget
+ wc=Widget_Text;
+ wc.draw=drv_generic_text_draw;
+ widget_register(&wc);
+
+ // register icon widget
+ wc=Widget_Icon;
+ wc.draw=drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ // register bar widget
+ wc=Widget_Bar;
+ wc.draw=drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ // register plugins
+ // none at the moment
+
+ return 0;
+}
+
+
+// close driver & display
+int drv_M5_quit (void) {
+
+ info("%s: shutting down.", Name);
+ drv_generic_parport_close();
+ drv_generic_text_quit();
+
+ return (0);
+}
+
+
+DRIVER drv_M50530 = {
+ name: Name,
+ list: drv_M5_list,
+ init: drv_M5_init,
+ quit: drv_M5_quit,
+};
+
+
diff --git a/drv_USBLCD.c b/drv_USBLCD.c
new file mode 100644
index 0000000..2522388
--- /dev/null
+++ b/drv_USBLCD.c
@@ -0,0 +1,369 @@
+/* $Id: drv_USBLCD.c,v 1.1 2004/02/15 08:22:47 reinelt Exp $
+ *
+ * new style driver for USBLCD displays
+ *
+ * Copyright 1999-2004 Michael Reinelt <reinelt@eunet.at>
+ * Copyright 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * based on the old-style USBLCD driver which is
+ * Copyright 2002 Robin Adams, Adams IT Services <info@usblcd.de>
+ *
+ * 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_USBLCD.c,v $
+ * Revision 1.1 2004/02/15 08:22:47 reinelt
+ * ported USBLCD driver to NextGeneration
+ * added drv_M50530.c (I forgot yesterday, sorry)
+ * removed old drivers M50530.c and USBLCD.c
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_USBLCD
+ *
+ */
+
+#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/ioctl.h>
+#include <sys/time.h>
+
+#include "debug.h"
+#include "cfg.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_text.h"
+
+
+#define IOC_GET_HARD_VERSION 1
+#define IOC_GET_DRV_VERSION 2
+
+
+static char Name[]="USBLCD";
+
+static char *Port=NULL;
+static int usblcd_file;
+static unsigned char *Buffer;
+static unsigned char *BufPtr;
+
+
+// ****************************************
+// *** hardware dependant functions ***
+// ****************************************
+
+static void drv_UL_send ()
+{
+
+#if 0
+ struct timeval now, end;
+ gettimeofday (&now, NULL);
+#endif
+
+ write(usblcd_file,Buffer,BufPtr-Buffer);
+
+#if 0
+ gettimeofday (&end, NULL);
+ debug ("send %d bytes in %d msec (%d usec/byte)", BufPtr-Buffer,
+ (1000000*(end.tv_sec-now.tv_sec)+end.tv_usec-now.tv_usec)/1000,
+ (1000000*(end.tv_sec-now.tv_sec)+end.tv_usec-now.tv_usec)/(BufPtr-Buffer));
+#endif
+
+ BufPtr=Buffer;
+}
+
+
+static void drv_UL_command (unsigned char cmd)
+{
+ *BufPtr++='\0';
+ *BufPtr++=cmd;
+}
+
+
+static void drv_UL_write (unsigned char *string, int len)
+{
+ while (len--) {
+ if(*string==0) *BufPtr++=*string;
+ *BufPtr++=*string++;
+ }
+ drv_UL_send();
+}
+
+
+static void drv_UL_goto (int row, int col)
+{
+ int pos=(row%2)*64+(row/2)*20+col;
+ drv_UL_command (0x80|pos);
+}
+
+
+static void drv_UL_defchar (int ascii, unsigned char *buffer)
+{
+ drv_UL_command (0x40|8*ascii);
+ drv_UL_write (buffer, 8);
+ // drv_UL_write() will call drv_UL_send(), so don't call it here!
+}
+
+
+static int drv_UL_start (char *section)
+{
+ int rows=-1, cols=-1;
+ int major, minor;
+ char *port, *s;
+ char buf[128];
+
+ if (Port) {
+ free(Port);
+ Port=NULL;
+ }
+ if ((port=cfg_get(section, "Port", NULL))==NULL || *port=='\0') {
+ error ("%s: no '%s.Port' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (port[0]=='/') {
+ Port=strdup(port);
+ } else {
+ Port=malloc(5+strlen(port)+1);
+ sprintf(Port,"/dev/%s",port);
+ }
+
+ debug ("using device %s ", Port);
+
+ s=cfg_get(section, "Size", NULL);
+ if (s==NULL || *s=='\0') {
+ error ("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ if (sscanf(s,"%dx%d",&cols,&rows)!=2 || rows<1 || cols<1) {
+ error ("%s: bad size '%s'", Name, s);
+ return -1;
+ }
+
+ DROWS = rows;
+ DCOLS = cols;
+
+ // Init the command buffer
+ Buffer = (char*)malloc(1024);
+ if (Buffer==NULL) {
+ error ("%s: coommand buffer could not be allocated: malloc() failed", Name);
+ return -1;
+ }
+
+ // open port
+ usblcd_file=open(Port,O_WRONLY);
+ if (usblcd_file==-1) {
+ error ("%s: open(%s) failed: %s", Name, Port, strerror(errno));
+ return -1;
+ }
+
+ // get driver version
+ memset(buf,0,sizeof(buf));
+ if (ioctl(usblcd_file, IOC_GET_DRV_VERSION, buf)!=0) {
+ error ("USBLCD: ioctl() failed, could not get Driver Version!");
+ return -1;
+ }
+ info("%s: Driver Version: %s", Name, buf);
+
+ if (sscanf(buf,"USBLCD Driver Version %d.%d",&major,&minor)!=2) {
+ error("%s: could not read Driver Version!", Name);
+ return -1;
+ }
+ if (major!=1) {
+ error("%d: Driver Version %d not supported!", Name, major);
+ return -1;
+ }
+
+ memset(buf,0,sizeof(buf));
+ if (ioctl(usblcd_file, IOC_GET_HARD_VERSION, buf)!=0) {
+ error ("%s: ioctl() failed, could not get Hardware Version!", Name);
+ return -1;
+ }
+ info("%s: Hardware Version: %s", Name, buf);
+
+ if (sscanf(buf,"%d.%d",&major,&minor)!=2) {
+ error("%s: could not read Hardware Version!", Name);
+ return -1;
+ }
+
+ if (major!=1) {
+ error("%s: Hardware Version %d not supported!", Name, major);
+ return -1;
+ }
+
+ // reset coimmand buffer
+ BufPtr=Buffer;
+
+ // initialize display
+ drv_UL_command (0x29); // 8 Bit mode, 1/16 duty cycle, 5x8 font
+ drv_UL_command (0x08); // Display off, cursor off, blink off
+ drv_UL_command (0x0c); // Display on, cursor off, blink off
+ drv_UL_command (0x06); // curser moves to right, no shift
+ drv_UL_command (0x01); // clear display
+ drv_UL_command (0x03); // return home
+
+ // flush buffer
+ drv_UL_send();
+
+ return 0;
+}
+
+
+// ****************************************
+// *** plugins ***
+// ****************************************
+
+// none at the moment...
+
+
+// ****************************************
+// *** widget callbacks ***
+// ****************************************
+
+
+// using drv_generic_text_draw(W)
+// using drv_generic_text_icon_draw(W)
+// using drv_generic_text_bar_draw(W)
+
+
+// ****************************************
+// *** exported functions ***
+// ****************************************
+
+
+// list models
+int drv_UL_list (void)
+{
+ printf ("generic");
+ return 0;
+}
+
+
+// initialize driver & display
+int drv_UL_init (char *section)
+{
+ WIDGET_CLASS wc;
+ int asc255bug;
+ int ret;
+
+ // display preferences
+ XRES = 5; // pixel width of one char
+ YRES = 8; // pixel height of one char
+ CHARS = 8; // number of user-defineable characters
+ CHAR0 = 0; // ASCII of first user-defineable char
+ GOTO_COST = 2; // number of bytes a goto command requires
+
+ // real worker functions
+ drv_generic_text_real_write = drv_UL_write;
+ drv_generic_text_real_goto = drv_UL_goto;
+ drv_generic_text_real_defchar = drv_UL_defchar;
+
+
+ // start display
+ if ((ret=drv_UL_start (section))!=0)
+ return ret;
+
+ // initialize generic text driver
+ if ((ret=drv_generic_text_init(section, Name))!=0)
+ return ret;
+
+ // initialize generic icon driver
+ if ((ret=drv_generic_text_icon_init())!=0)
+ return ret;
+
+ // initialize generic bar driver
+ if ((ret=drv_generic_text_bar_init())!=0)
+ return ret;
+
+ // add fixed chars to the bar driver
+ // most displays have a full block on ascii 255, but some have kind of
+ // an 'inverted P'. If you specify 'asc255bug 1 in the config, this
+ // char will not be used, but rendered by the bar driver
+ cfg_number(section, "asc255bug", 0, 0, 1, &asc255bug);
+ drv_generic_text_bar_add_segment ( 0, 0,255, 32); // ASCII 32 = blank
+ if (!asc255bug)
+ drv_generic_text_bar_add_segment (255,255,255,255); // ASCII 255 = block
+
+ // register text widget
+ wc=Widget_Text;
+ wc.draw=drv_generic_text_draw;
+ widget_register(&wc);
+
+ // register icon widget
+ wc=Widget_Icon;
+ wc.draw=drv_generic_text_icon_draw;
+ widget_register(&wc);
+
+ // register bar widget
+ wc=Widget_Bar;
+ wc.draw=drv_generic_text_bar_draw;
+ widget_register(&wc);
+
+ // register plugins
+ // none at the moment...
+
+
+ return 0;
+}
+
+
+// close driver & display
+int drv_UL_quit (void)
+{
+
+ info("%s: shutting down.", Name);
+
+ // flush buffer
+ drv_UL_send();
+
+ debug ("closing port %s", Port);
+ close(usblcd_file);
+
+ if (Buffer) {
+ free(Buffer);
+ Buffer=NULL;
+ BufPtr=Buffer;
+ }
+
+ drv_generic_text_quit();
+
+ return (0);
+}
+
+
+DRIVER drv_USBLCD = {
+ name: Name,
+ list: drv_UL_list,
+ init: drv_UL_init,
+ quit: drv_UL_quit,
+};
+
+
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index ffd01db..164fff9 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -54,7 +54,7 @@ Display HD44780-20x4 {
Display M50530-24x8 {
Driver 'M50530'
Port '/dev/parports/0'
- Port '0x378'
+# Port '0x378'
Size '24x8'
Wire.EX 'STROBE'
Wire.IOC1 'SELECT'
@@ -63,6 +63,14 @@ Display M50530-24x8 {
}
+Display USBLCD {
+ Driver 'USBLCD'
+ Port '/dev/usb/lcd'
+ Size '20x4'
+ asc255bug 1
+}
+
+
Widget OS {
class 'Text'
expression '*** '.uname('sysname').' '.uname('release').' ***'
@@ -279,10 +287,11 @@ Layout L16x2 {
#Display 'LK204'
#Display 'HD44780-20x4'
-Display 'M50530-24x8'
+#Display 'M50530-24x8'
#Display 'CF631'
#Display 'CF632'
#Display 'CF633'
+Display 'USBLCD'
Layout 'Default'
#Layout 'L16x2'
diff --git a/libtool b/libtool
index 9bd9ab0..1818a25 100755
--- a/libtool
+++ b/libtool
@@ -316,7 +316,7 @@ variables_saved_for_relink="PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBR
link_all_deplibs=unknown
# Compile-time system search path for libraries
-sys_lib_search_path_spec=" /usr/lib/gcc-lib/i486-linux/3.3.2/ /usr/lib/gcc/i486-linux/3.3.2/ /usr/lib/gcc-lib/i486-linux/3.3.2/../../../../i486-linux/lib/i486-linux/3.3.2/ /usr/lib/gcc-lib/i486-linux/3.3.2/../../../../i486-linux/lib/ /usr/lib/gcc-lib/i486-linux/3.3.2/../../../i486-linux/3.3.2/ /usr/lib/gcc-lib/i486-linux/3.3.2/../../../ /lib/i486-linux/3.3.2/ /lib/ /usr/lib/i486-linux/3.3.2/ /usr/lib/"
+sys_lib_search_path_spec=" /usr/lib/gcc-lib/i486-linux/3.3.3/ /usr/lib/gcc/i486-linux/3.3.3/ /usr/lib/gcc-lib/i486-linux/3.3.3/../../../../i486-linux/lib/i486-linux/3.3.3/ /usr/lib/gcc-lib/i486-linux/3.3.3/../../../../i486-linux/lib/ /usr/lib/gcc-lib/i486-linux/3.3.3/../../../i486-linux/3.3.3/ /usr/lib/gcc-lib/i486-linux/3.3.3/../../../ /lib/i486-linux/3.3.3/ /lib/ /usr/lib/i486-linux/3.3.3/ /usr/lib/"
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib
@@ -6874,11 +6874,11 @@ striplib="strip --strip-unneeded"
# Dependencies to place before the objects being linked to create a
# shared library.
-predep_objects="/usr/lib/gcc-lib/i486-linux/3.3.2/../../../crti.o /usr/lib/gcc-lib/i486-linux/3.3.2/crtbeginS.o"
+predep_objects="/usr/lib/gcc-lib/i486-linux/3.3.3/../../../crti.o /usr/lib/gcc-lib/i486-linux/3.3.3/crtbeginS.o"
# Dependencies to place after the objects being linked to create a
# shared library.
-postdep_objects="/usr/lib/gcc-lib/i486-linux/3.3.2/crtendS.o /usr/lib/gcc-lib/i486-linux/3.3.2/../../../crtn.o"
+postdep_objects="/usr/lib/gcc-lib/i486-linux/3.3.3/crtendS.o /usr/lib/gcc-lib/i486-linux/3.3.3/../../../crtn.o"
# Dependencies to place before the objects being linked to create a
# shared library.
@@ -6890,7 +6890,7 @@ postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
# The library search path used internally by the compiler when linking
# a shared library.
-compiler_lib_search_path="-L/usr/lib/gcc-lib/i486-linux/3.3.2 -L/usr/lib/gcc-lib/i486-linux/3.3.2/../../.."
+compiler_lib_search_path="-L/usr/lib/gcc-lib/i486-linux/3.3.3 -L/usr/lib/gcc-lib/i486-linux/3.3.3/../../.."
# Method to check whether dependent libraries are shared objects.
deplibs_check_method="pass_all"
@@ -6970,7 +6970,7 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM
link_all_deplibs=unknown
# Compile-time system search path for libraries
-sys_lib_search_path_spec=" /usr/lib/gcc-lib/i486-linux/3.3.2/ /usr/lib/gcc/i486-linux/3.3.2/ /usr/lib/gcc-lib/i486-linux/3.3.2/../../../../i486-linux/lib/i486-linux/3.3.2/ /usr/lib/gcc-lib/i486-linux/3.3.2/../../../../i486-linux/lib/ /usr/lib/gcc-lib/i486-linux/3.3.2/../../../i486-linux/3.3.2/ /usr/lib/gcc-lib/i486-linux/3.3.2/../../../ /lib/i486-linux/3.3.2/ /lib/ /usr/lib/i486-linux/3.3.2/ /usr/lib/"
+sys_lib_search_path_spec=" /usr/lib/gcc-lib/i486-linux/3.3.3/ /usr/lib/gcc/i486-linux/3.3.3/ /usr/lib/gcc-lib/i486-linux/3.3.3/../../../../i486-linux/lib/i486-linux/3.3.3/ /usr/lib/gcc-lib/i486-linux/3.3.3/../../../../i486-linux/lib/ /usr/lib/gcc-lib/i486-linux/3.3.3/../../../i486-linux/3.3.3/ /usr/lib/gcc-lib/i486-linux/3.3.3/../../../ /lib/i486-linux/3.3.3/ /lib/ /usr/lib/i486-linux/3.3.3/ /usr/lib/"
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib
diff --git a/ltmain.sh b/ltmain.sh
index 99938a5..4b9f940 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -55,8 +55,8 @@ modename="$progname"
# Constants.
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION=1.5.0a
-TIMESTAMP=" (1.1220.2.35 2003/11/12 18:51:58) Debian$Rev: 179 $"
+VERSION=1.5.2
+TIMESTAMP=" (1.1220.2.60 2004/01/25 12:25:08) Debian$Rev: 192 $"
default_mode=
help="Try \`$progname --help' for more information."
@@ -890,6 +890,7 @@ EOF
no_install=no
objs=
non_pic_objects=
+ precious_files_regex=
prefer_static_libs=no
preload=no
prev=
@@ -1053,6 +1054,11 @@ EOF
prev=
continue
;;
+ precious_regex)
+ precious_files_regex="$arg"
+ prev=
+ continue
+ ;;
release)
release="-$arg"
prev=
@@ -1419,6 +1425,11 @@ EOF
-o) prev=output ;;
+ -precious-files-regex)
+ prev=precious_regex
+ continue
+ ;;
+
-release)
prev=release
continue
@@ -2321,9 +2332,10 @@ EOF
else
$show "extracting exported symbol list from \`$soname'"
save_ifs="$IFS"; IFS='~'
- eval cmds=\"$extract_expsyms_cmds\"
+ cmds=$extract_expsyms_cmds
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
@@ -2334,9 +2346,10 @@ EOF
if test -f "$output_objdir/$newlib"; then :; else
$show "generating import library for \`$soname'"
save_ifs="$IFS"; IFS='~'
- eval cmds=\"$old_archive_from_expsyms_cmds\"
+ cmds=$old_archive_from_expsyms_cmds
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
@@ -2615,8 +2628,8 @@ EOF
*" $path "*) ;;
*) newlib_search_path="$newlib_search_path $path";;
esac
- path=""
fi
+ path=""
;;
*)
path="-L$path"
@@ -3084,6 +3097,10 @@ EOF
*.$objext)
;;
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+ if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
+ continue
+ fi
removelist="$removelist $p"
;;
*) ;;
@@ -3593,10 +3610,11 @@ EOF
$show "generating symbol list for \`$libname.la'"
export_symbols="$output_objdir/$libname.exp"
$run $rm $export_symbols
- eval cmds=\"$export_symbols_cmds\"
+ cmds=$export_symbols_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
if len=`expr "X$cmd" : ".*"` &&
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
$show "$cmd"
@@ -3713,19 +3731,23 @@ EOF
# Do each of the archive commands.
if test "$module" = yes && test -n "$module_cmds" ; then
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
- eval cmds=\"$module_expsym_cmds\"
+ eval test_cmds=\"$module_expsym_cmds\"
+ cmds=$module_expsym_cmds
else
- eval cmds=\"$module_cmds\"
+ eval test_cmds=\"$module_cmds\"
+ cmds=$module_cmds
fi
else
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- eval cmds=\"$archive_expsym_cmds\"
+ eval test_cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
else
- eval cmds=\"$archive_cmds\"
+ eval test_cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
fi
fi
- if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
+ if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
:
else
@@ -3810,6 +3832,7 @@ EOF
save_ifs="$IFS"; IFS='~'
for cmd in $concat_cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
@@ -3826,19 +3849,28 @@ EOF
# value of $libobjs for piecewise linking.
# Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ cmds=$module_expsym_cmds
+ else
+ cmds=$module_cmds
+ fi
+ else
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- eval cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
else
- eval cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
+ fi
fi
# Append the command to remove the reloadable object files
# to the just-reset $cmds.
- eval cmds=\"\$cmds~$rm $delfiles\"
+ eval cmds=\"\$cmds~\$rm $delfiles\"
fi
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
@@ -3989,10 +4021,11 @@ EOF
reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
output="$obj"
- eval cmds=\"$reload_cmds\"
+ cmds=$reload_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
@@ -4025,10 +4058,11 @@ EOF
# Only do commands if we really have different PIC objects.
reload_objs="$libobjs $reload_conv_objs"
output="$libobj"
- eval cmds=\"$reload_cmds\"
+ cmds=$reload_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
@@ -5000,13 +5034,13 @@ fi\
# Do each command in the archive commands.
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
- eval cmds=\"$old_archive_from_new_cmds\"
+ cmds=$old_archive_from_new_cmds
else
eval cmds=\"$old_archive_cmds\"
if len=`expr "X$cmds" : ".*"` &&
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- :
+ cmds=$old_archive_cmds
else
# the command line is too long to link in one step, link in parts
$echo "using piecewise archive linking..."
@@ -5058,12 +5092,13 @@ fi\
if test "X$oldobjs" = "X" ; then
eval cmds=\"\$concat_cmds\"
else
- eval cmds=\"\$concat_cmds~$old_archive_cmds\"
+ eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
fi
fi
fi
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
+ eval cmd=\"$cmd\"
IFS="$save_ifs"
$show "$cmd"
$run eval "$cmd" || exit $?
@@ -5481,10 +5516,11 @@ relink_command=\"$relink_command\""
# Do each command in the postinstall commands.
lib="$destdir/$realname"
- eval cmds=\"$postinstall_cmds\"
+ cmds=$postinstall_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
@@ -5697,16 +5733,17 @@ relink_command=\"$relink_command\""
$show "$install_prog $file $oldlib"
$run eval "$install_prog \$file \$oldlib" || exit $?
- if test -n "$stripme" && test -n "$striplib"; then
+ if test -n "$stripme" && test -n "$old_striplib"; then
$show "$old_striplib $oldlib"
$run eval "$old_striplib $oldlib" || exit $?
fi
# Do each command in the postinstall commands.
- eval cmds=\"$old_postinstall_cmds\"
+ cmds=$old_postinstall_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || exit $?
done
@@ -5741,10 +5778,11 @@ relink_command=\"$relink_command\""
for libdir in $libdirs; do
if test -n "$finish_cmds"; then
# Do each command in the finish commands.
- eval cmds=\"$finish_cmds\"
+ cmds=$finish_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd" || admincmds="$admincmds
$cmd"
@@ -6018,10 +6056,11 @@ relink_command=\"$relink_command\""
if test "$mode" = uninstall; then
if test -n "$library_names"; then
# Do each command in the postuninstall commands.
- eval cmds=\"$postuninstall_cmds\"
+ cmds=$postuninstall_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd"
if test "$?" -ne 0 && test "$rmforce" != yes; then
@@ -6033,10 +6072,11 @@ relink_command=\"$relink_command\""
if test -n "$old_library"; then
# Do each command in the old_postuninstall commands.
- eval cmds=\"$old_postuninstall_cmds\"
+ cmds=$old_postuninstall_cmds
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
+ eval cmd=\"$cmd\"
$show "$cmd"
$run eval "$cmd"
if test "$?" -ne 0 && test "$rmforce" != yes; then
@@ -6281,6 +6321,8 @@ The following components of LINK-COMMAND are treated specially:
-no-undefined declare that a library does not refer to external symbols
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
-objectlist FILE Use a list of object files found in FILE to specify objects
+ -precious-files-regex REGEX
+ don't remove output files matching REGEX
-release RELEASE specify package release information
-rpath LIBDIR the created library will eventually be installed in LIBDIR
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries