[lcd4linux @ 2004-05-28 13:51:41 by reinelt]

ported driver for Beckmann+Egle Mini-Terminals
added 'flags' parameter to serial_init()

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@440 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
This commit is contained in:
reinelt
2004-05-28 13:51:42 +00:00
parent ee99b99e77
commit ea44a92b2a
17 changed files with 127 additions and 748 deletions
-440
View File
@@ -1,440 +0,0 @@
/* $Id: BeckmannEgle.c,v 1.20 2004/01/30 20:57:55 reinelt Exp $
*
* driver for Beckmann+Egle mini terminals
*
* Copyright 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: BeckmannEgle.c,v $
* Revision 1.20 2004/01/30 20:57:55 reinelt
* HD44780 patch from Martin Hejl
* dmalloc integrated
*
* Revision 1.19 2004/01/29 04:40:02 reinelt
* every .c file includes "config.h" now
*
* Revision 1.18 2004/01/09 04:16:06 reinelt
* added 'section' argument to cfg_get(), but NULLed it on all calls by now.
*
* Revision 1.17 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
* Revision 1.16 2003/09/13 06:45:43 reinelt
* icons for all remaining drivers
*
* Revision 1.15 2003/08/24 05:17:58 reinelt
* liblcd4linux patch from Patrick Schemitz
*
* Revision 1.14 2003/08/16 07:31:35 reinelt
* double buffering in all drivers
*
* Revision 1.13 2003/07/24 04:48:09 reinelt
* 'soft clear' needed for virtual rows
*
* Revision 1.12 2003/02/22 07:53:09 reinelt
* cfg_get(key,defval)
*
* Revision 1.11 2002/08/22 05:51:36 reinelt
* cosmetic changes
*
* Revision 1.10 2002/08/19 10:51:06 reinelt
* M50530 driver using new generic bar functions
*
* Revision 1.9 2002/08/19 09:43:43 reinelt
* BeckmannEgle using new generic bar functions
*
* Revision 1.8 2002/08/19 07:36:29 reinelt
*
* finished bar.c, USBLCD is the first driver that uses the generic bar functions
*
* Revision 1.7 2002/08/19 04:41:20 reinelt
* introduced bar.c, moved bar stuff from display.h to bar.h
*
* Revision 1.6 2001/04/27 05:04:57 reinelt
* replaced OPEN_MAX with sysconf()
* replaced mktemp() with mkstemp()
* unlock serial port if open() fails
*
* Revision 1.5 2001/02/13 09:00:13 reinelt
* prepared framework for GPO's (general purpose outputs)
*
* Revision 1.4 2000/08/10 09:44:09 reinelt
* new debugging scheme: error(), info(), debug()
* uses syslog if in daemon mode
*
* Revision 1.3 2000/08/09 09:50:29 reinelt
* opened 0.98 development
* removed driver-specific signal-handlers
* added 'quit'-function to driver structure
* added global signal-handler
*
* Revision 1.2 2000/04/30 06:40:42 reinelt
* bars for Beckmann+Egle driver
*
* Revision 1.1 2000/04/28 05:19:55 reinelt
* first release of the Beckmann+Egle driver
*
*/
/*
*
* exported fuctions:
*
* struct LCD BeckmannEgle[]
*
*/
#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 "debug.h"
#include "cfg.h"
#include "lock.h"
#include "display.h"
#include "bar.h"
#include "icon.h"
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif
#define XRES 5
#define YRES 8
#define CHARS 8
typedef struct {
int cols;
int rows;
int type;
} MODEL;
static LCD Lcd;
static char *Port=NULL;
static int Device=-1;
static int Type=-1;
static int Icons;
static char *FrameBuffer1=NULL;
static char *FrameBuffer2=NULL;
static MODEL Model[]= {{ 16, 1, 0 },
{ 16, 2, 1 },
{ 16, 4, 2 },
{ 20, 1, 3 },
{ 20, 2, 4 },
{ 20, 4, 5 },
{ 24, 1, 6 },
{ 24, 2, 7 },
{ 32, 1, 8 },
{ 32, 2, 9 },
{ 40, 1, 10 },
{ 40, 2, 11 },
{ 40, 4, 12 },
{ 0, 0, 0 }};
static int BE_open (void)
{
int fd;
pid_t pid;
struct termios portset;
if ((pid=lock_port(Port))!=0) {
if (pid==-1)
error ("BeckmannEgle: port %s could not be locked", Port);
else
error ("BeckmannEgle: port %s is locked by process %d", Port, pid);
return -1;
}
fd = open(Port, O_RDWR | O_NOCTTY | O_NDELAY);
if (fd==-1) {
error ("BeckmannEgle: open(%s) failed: %s", Port, strerror(errno));
unlock_port(Port);
return -1;
}
if (tcgetattr(fd, &portset)==-1) {
error ("BeckmannEgle: tcgetattr(%s) failed: %s", Port, strerror(errno));
unlock_port(Port);
return -1;
}
cfmakeraw(&portset); // 8N1
portset.c_cflag |= CSTOPB; // 2 stop bits
cfsetospeed(&portset, B9600); // 9600 baud
if (tcsetattr(fd, TCSANOW, &portset)==-1) {
error ("BeckmannEgle: tcsetattr(%s) failed: %s", Port, strerror(errno));
unlock_port(Port);
return -1;
}
return fd;
}
static void BE_write (char *string, int len)
{
if (Device==-1) return;
if (write (Device, string, len)==-1) {
if (errno==EAGAIN) {
usleep(1000);
if (write (Device, string, len)>=0) return;
}
error ("BeckmannEgle: write(%s) failed: %s", Port, strerror(errno));
}
}
static void BE_define_char (int ascii, char *buffer)
{
int i;
char cmd[32];
char *p;
p=cmd;
*p++='\033';
*p++='&';
*p++='T'; // enter transparent mode
*p++='\0'; // write cmd
*p++=0x40|8*ascii; // write CGRAM
for (i=0; i<YRES; i++) {
*p++='\1'; // write data
*p++=buffer[i]; // character bitmap
}
*p++='\377'; // leave transparent mode
BE_write (cmd, p-cmd);
}
int BE_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));
BE_write ("\033&#", 3);
}
return 0;
}
int BE_init (LCD *Self)
{
int i, rows=-1, cols=-1;
char *port, *s;
char buffer[5];
if (Port) {
free (Port);
Port=NULL;
}
port=cfg_get (NULL, "Port", NULL);
if (port==NULL || *port=='\0') {
error ("BeckmannEgle: no 'Port' entry in %s", cfg_source());
return -1;
}
Port=strdup(port);
s=cfg_get(NULL, "Type", NULL);
if (s==NULL || *s=='\0') {
error ("BeckmannEgle: no 'Type' entry in %s", cfg_source());
return -1;
}
if (sscanf(s,"%dx%d",&cols,&rows)!=2 || rows<1 || cols<1) {
error ("BeckmannEgle: bad type '%s'", s);
return -1;
}
Type=-1;
for (i=0; Model[i].cols; i++) {
if (Model[i].cols==cols && Model[i].rows==rows) {
Type=Model[i].type;
break;
}
}
if (Type==-1) {
error ("BeckmannEgle: unsupported model '%dx%d'", cols, rows);
return -1;
}
debug ("using %dx%d display at port %s", cols, rows, Port);
Self->rows=rows;
Self->cols=cols;
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 ("BeckmannEgle: framebuffer could not be allocated: malloc() failed");
return -1;
}
Device=BE_open();
if (Device==-1) return -1;
snprintf (buffer, sizeof(buffer), "\033&s%c", Type);
BE_write (buffer, 4); // select display type
BE_write ("\033&D", 3); // cursor off
if (cfg_number("", "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, BE_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
BE_clear(1);
return 0;
}
void BE_goto (int row, int col)
{
char cmd[7]="\033[y;xH";
cmd[2]=(char)row;
cmd[4]=(char)col;
BE_write (cmd, 6);
}
int BE_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 BE_bar (int type, int row, int col, int max, int len1, int len2)
{
return bar_draw (type, row, col, max, len1, len2);
}
int BE_icon (int num, int seq, int row, int col)
{
return icon_draw (num, seq, row, col);
}
int BE_flush (void)
{
int row, col, pos1, pos2;
int c, equal;
bar_process(BE_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;
BE_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 some bytes, too.
if (++equal>5) break;
} else {
pos2=col;
equal=0;
}
}
BE_write (FrameBuffer1+row*Lcd.cols+pos1, pos2-pos1+1);
}
}
memcpy (FrameBuffer2, FrameBuffer1, Lcd.rows*Lcd.cols*sizeof(char));
return 0;
}
int BE_quit (void)
{
debug ("closing port %s", Port);
close (Device);
unlock_port(Port);
info("BeckmannEgle: shutting down.");
if (FrameBuffer1) {
free(FrameBuffer1);
FrameBuffer1=NULL;
}
if (FrameBuffer2) {
free(FrameBuffer2);
FrameBuffer2=NULL;
}
return 0;
}
LCD BeckmannEgle[] = {
{ name: "BLC100x",
rows: 0,
cols: 0,
xres: XRES,
yres: YRES,
bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2,
icons: 0,
gpos: 0,
init: BE_init,
clear: BE_clear,
put: BE_put,
bar: BE_bar,
icon: BE_icon,
gpo: NULL,
flush: BE_flush,
quit: BE_quit
},
{ NULL }
};
+1 -2
View File
@@ -24,7 +24,6 @@ drv.c drv.h \
evaluator.c evaluator.h \
hash.c hash.h \
layout.c layout.h \
lock.c lock.h \
pid.c pid.h \
timer.c timer.h \
thread.c thread.h \
@@ -57,7 +56,7 @@ drv_generic_serial.c \
drv_generic_serial.h \
drv_generic_parport.c \
drv_generic_parport.h \
BeckmannEgle.c \
drv_BeckmannEgle.c \
drv_Crystalfontz.c \
drv_Curses.c \
drv_Cwlinux.c \
+10 -10
View File
@@ -92,7 +92,7 @@ lcd4linux_LDADD = @DRIVERS@ @PLUGINS@ @DRVLIBS@ @PLUGINLIBS@
#remove next line for liblcd4linux
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 lock.c lock.h pid.c pid.h timer.c timer.h thread.c thread.h udelay.c udelay.h qprintf.c qprintf.h widget.c widget.h widget_text.c widget_text.h widget_bar.c widget_bar.h widget_icon.c widget_icon.h plugin.c plugin.h plugin_cfg.c plugin_math.c plugin_string.c plugin_time.c
lcd4linux_SOURCES = lcd4linux.c cfg.c cfg.h debug.c debug.h drv.c drv.h evaluator.c evaluator.h hash.c hash.h layout.c layout.h pid.c pid.h timer.c timer.h thread.c thread.h udelay.c udelay.h qprintf.c qprintf.h widget.c widget.h widget_text.c widget_text.h widget_bar.c widget_bar.h widget_icon.c widget_icon.h plugin.c plugin.h plugin_cfg.c plugin_math.c plugin_string.c plugin_time.c
#liblcd4linux_la_DEPENDENCIES = @DRIVERS@
@@ -101,7 +101,7 @@ lcd4linux_SOURCES = lcd4linux.c cfg.c cfg.h deb
#liblcd4linux_la_SOURCES =
EXTRA_lcd4linux_SOURCES = drv_generic_text.c drv_generic_text.h drv_generic_graphic.c drv_generic_graphic.h drv_generic_serial.c drv_generic_serial.h drv_generic_parport.c drv_generic_parport.h BeckmannEgle.c drv_Crystalfontz.c drv_Curses.c drv_Cwlinux.c drv_HD44780.c drv_Image.c drv_M50530.c drv_MatrixOrbital.c drv_MilfordInstruments.c drv_T6963.c drv_USBLCD.c drv_X11.c font_6x8.h plugin_apm.c plugin_cpuinfo.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_seti.c plugin_uname.c plugin_uptime.c plugin_wireless.c plugin_xmms.c
EXTRA_lcd4linux_SOURCES = drv_generic_text.c drv_generic_text.h drv_generic_graphic.c drv_generic_graphic.h drv_generic_serial.c drv_generic_serial.h drv_generic_parport.c drv_generic_parport.h drv_BeckmannEgle.c drv_Crystalfontz.c drv_Curses.c drv_Cwlinux.c drv_HD44780.c drv_Image.c drv_M50530.c drv_MatrixOrbital.c drv_MilfordInstruments.c drv_T6963.c drv_USBLCD.c drv_X11.c font_6x8.h plugin_apm.c plugin_cpuinfo.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_seti.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
@@ -122,7 +122,7 @@ X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
lcd4linux_OBJECTS = lcd4linux.o cfg.o debug.o drv.o evaluator.o hash.o \
layout.o lock.o pid.o timer.o thread.o udelay.o qprintf.o widget.o \
layout.o pid.o timer.o thread.o udelay.o qprintf.o widget.o \
widget_text.o widget_bar.o widget_icon.o plugin.o plugin_cfg.o \
plugin_math.o plugin_string.o plugin_time.o
CFLAGS = @CFLAGS@
@@ -139,14 +139,14 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
DEP_FILES = .deps/BeckmannEgle.P .deps/cfg.P .deps/debug.P .deps/drv.P \
.deps/drv_Crystalfontz.P .deps/drv_Curses.P .deps/drv_Cwlinux.P \
.deps/drv_HD44780.P .deps/drv_Image.P .deps/drv_M50530.P \
.deps/drv_MatrixOrbital.P .deps/drv_MilfordInstruments.P \
.deps/drv_T6963.P .deps/drv_USBLCD.P .deps/drv_X11.P \
.deps/drv_generic_graphic.P .deps/drv_generic_parport.P \
DEP_FILES = .deps/cfg.P .deps/debug.P .deps/drv.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_M50530.P .deps/drv_MatrixOrbital.P \
.deps/drv_MilfordInstruments.P .deps/drv_T6963.P .deps/drv_USBLCD.P \
.deps/drv_X11.P .deps/drv_generic_graphic.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/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_dvb.P .deps/plugin_exec.P \
.deps/plugin_i2c_sensors.P .deps/plugin_imon.P .deps/plugin_isdn.P \
+33 -6
View File
@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
timestamp='2004-01-05'
timestamp='2004-03-12'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -197,12 +197,18 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit 0 ;;
amd64:OpenBSD:*:*)
echo x86_64-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
cats:OpenBSD:*:*)
echo arm-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
@@ -239,10 +245,24 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit 0 ;;
macppc:MirBSD:*:*)
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
exit 0 ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit 0 ;;
alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then
case $UNAME_RELEASE in
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
fi
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
@@ -280,11 +300,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha*:OpenVMS:*:*)
echo alpha-hp-vms
@@ -405,6 +426,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
@@ -829,6 +853,9 @@ EOF
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
@@ -1230,8 +1257,8 @@ EOF
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
exit 0 ;;
*:DRAGONFLY:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly${UNAME_RELEASE}
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
esac
Vendored
+20 -8
View File
@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
timestamp='2004-01-05'
timestamp='2004-03-12'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -237,7 +237,7 @@ case $basic_machine in
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| m32r | m68000 | m68k | m88k | mcore \
| m32r | m32rle | m68000 | m68k | m88k | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -262,7 +262,7 @@ case $basic_machine in
| pyramid \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
@@ -308,7 +308,7 @@ case $basic_machine in
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| m32r-* \
| m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
@@ -336,7 +336,7 @@ case $basic_machine in
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
@@ -363,6 +363,9 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
@@ -442,12 +445,20 @@ case $basic_machine in
basic_machine=j90-cray
os=-unicos
;;
cr16c)
basic_machine=cr16c-unknown
os=-elf
;;
crds | unos)
basic_machine=m68k-crds
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
@@ -1070,7 +1081,7 @@ case $basic_machine in
sh64)
basic_machine=sh64-unknown
;;
sparc | sparcv9 | sparcv9b)
sparc | sparcv8 | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
cydra)
@@ -1143,8 +1154,9 @@ case $os in
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
Vendored
+2 -2
View File
@@ -5482,8 +5482,8 @@ GRAPHIC="no"
IMAGE="no"
if test "$BECKMANNEGLE" = "yes"; then
# DRIVERS="$DRIVERS BeckmannEgle.lo"
# DRIVERS="$DRIVERS BeckmannEgle.o"
# DRIVERS="$DRIVERS drv_BeckmannEgle.lo"
DRIVERS="$DRIVERS drv_BeckmannEgle.o"
cat >>confdefs.h <<\_ACEOF
#define WITH_BECKMANNEGLE 1
+2 -2
View File
@@ -101,8 +101,8 @@ GRAPHIC="no"
IMAGE="no"
if test "$BECKMANNEGLE" = "yes"; then
# DRIVERS="$DRIVERS BeckmannEgle.lo"
# DRIVERS="$DRIVERS BeckmannEgle.o"
# DRIVERS="$DRIVERS drv_BeckmannEgle.lo"
DRIVERS="$DRIVERS drv_BeckmannEgle.o"
AC_DEFINE(WITH_BECKMANNEGLE,1,[Beckmann&Egle driver])
fi
+9 -6
View File
@@ -1,4 +1,4 @@
/* $Id: drv.c,v 1.13 2004/05/26 11:37:36 reinelt Exp $
/* $Id: drv.c,v 1.14 2004/05/28 13:51:42 reinelt Exp $
*
* new framework for display drivers
*
@@ -23,6 +23,11 @@
*
*
* $Log: drv.c,v $
* Revision 1.14 2004/05/28 13:51:42 reinelt
*
* ported driver for Beckmann+Egle Mini-Terminals
* added 'flags' parameter to serial_init()
*
* Revision 1.13 2004/05/26 11:37:36 reinelt
*
* Curses driver ported.
@@ -145,11 +150,9 @@ extern DRIVER drv_X11;
char *output=NULL;
DRIVER *Driver[] = {
/* Fixme
#ifdef WITH_BECKMANNEGLE
&BeckmannEgle,
#endif
*/
#ifdef WITH_BECKMANNEGLE
&drv_BeckmannEgle,
#endif
#ifdef WITH_CRYSTALFONTZ
&drv_Crystalfontz,
#endif
+7 -2
View File
@@ -1,4 +1,4 @@
/* $Id: drv_Crystalfontz.c,v 1.17 2004/05/27 03:39:47 reinelt Exp $
/* $Id: drv_Crystalfontz.c,v 1.18 2004/05/28 13:51:42 reinelt Exp $
*
* new style driver for Crystalfontz display modules
*
@@ -23,6 +23,11 @@
*
*
* $Log: drv_Crystalfontz.c,v $
* Revision 1.18 2004/05/28 13:51:42 reinelt
*
* ported driver for Beckmann+Egle Mini-Terminals
* added 'flags' parameter to serial_init()
*
* Revision 1.17 2004/05/27 03:39:47 reinelt
*
* changed function naming scheme to plugin::function
@@ -683,7 +688,7 @@ static int drv_CF_start (char *section)
}
// open serial port
if (drv_generic_serial_open(section, Name)<0) return -1;
if (drv_generic_serial_open(section, Name, 0)<0) return -1;
// Fixme: why such a large delay?
usleep(350*1000);
+7 -2
View File
@@ -1,4 +1,4 @@
/* $Id: drv_Cwlinux.c,v 1.6 2004/05/27 03:39:47 reinelt Exp $
/* $Id: drv_Cwlinux.c,v 1.7 2004/05/28 13:51:42 reinelt Exp $
*
* new style driver for Cwlinux display modules
*
@@ -23,6 +23,11 @@
*
*
* $Log: drv_Cwlinux.c,v $
* Revision 1.7 2004/05/28 13:51:42 reinelt
*
* ported driver for Beckmann+Egle Mini-Terminals
* added 'flags' parameter to serial_init()
*
* Revision 1.6 2004/05/27 03:39:47 reinelt
*
* changed function naming scheme to plugin::function
@@ -179,7 +184,7 @@ static int drv_CW_start (char *section)
}
// open serial port
if (drv_generic_serial_open(section, Name)<0) return -1;
if (drv_generic_serial_open(section, Name, 0)<0) return -1;
// this does not work as I'd expect it...
#if 0
+7 -2
View File
@@ -1,4 +1,4 @@
/* $Id: drv_MatrixOrbital.c,v 1.23 2004/05/27 03:39:47 reinelt Exp $
/* $Id: drv_MatrixOrbital.c,v 1.24 2004/05/28 13:51:42 reinelt Exp $
*
* new style driver for Matrix Orbital serial display modules
*
@@ -23,6 +23,11 @@
*
*
* $Log: drv_MatrixOrbital.c,v $
* Revision 1.24 2004/05/28 13:51:42 reinelt
*
* ported driver for Beckmann+Egle Mini-Terminals
* added 'flags' parameter to serial_init()
*
* Revision 1.23 2004/05/27 03:39:47 reinelt
*
* changed function naming scheme to plugin::function
@@ -245,7 +250,7 @@ static int drv_MO_start (char *section)
}
if (drv_generic_serial_open(section, Name)<0) return -1;
if (drv_generic_serial_open(section, Name, 0)<0) return -1;
// read module type
drv_generic_serial_write ("\3767", 2);
+8 -3
View File
@@ -1,4 +1,4 @@
/* $Id: drv_MilfordInstruments.c,v 1.2 2004/05/26 11:37:36 reinelt Exp $
/* $Id: drv_MilfordInstruments.c,v 1.3 2004/05/28 13:51:42 reinelt Exp $
*
* driver for Milford Instruments 'BPK' piggy-back serial interface board
* for standard Hitachi 44780 compatible lcd modules.
@@ -27,6 +27,11 @@
*
*
* $Log: drv_MilfordInstruments.c,v $
* Revision 1.3 2004/05/28 13:51:42 reinelt
*
* ported driver for Beckmann+Egle Mini-Terminals
* added 'flags' parameter to serial_init()
*
* Revision 1.2 2004/05/26 11:37:36 reinelt
*
* Curses driver ported.
@@ -137,7 +142,7 @@ static int drv_MI_start (char *section)
Model=i;
info ("%s: using model '%s'", Name, Models[Model].name);
if (drv_generic_serial_open(section, Name)<0) return -1;
if (drv_generic_serial_open(section, Name, 0)<0) return -1;
// initialize global variables
DROWS = Models[Model].rows;
@@ -194,7 +199,7 @@ int drv_MI_init (char *section)
YRES = 8; // pixel height of one char
CHARS = 8; // number of user-defineable characters
CHAR0 = 0; // ASCII of first user-defineable char
GOTO_COST = 4; // number of bytes a goto command requires
GOTO_COST = 2; // number of bytes a goto command requires
// real worker functions
drv_generic_text_real_write = drv_MI_write;
+8 -2
View File
@@ -1,4 +1,4 @@
/* $Id: drv_generic_serial.c,v 1.8 2004/03/03 04:44:16 reinelt Exp $
/* $Id: drv_generic_serial.c,v 1.9 2004/05/28 13:51:42 reinelt Exp $
*
* generic driver helper for serial and usbserial displays
*
@@ -23,6 +23,11 @@
*
*
* $Log: drv_generic_serial.c,v $
* Revision 1.9 2004/05/28 13:51:42 reinelt
*
* ported driver for Beckmann+Egle Mini-Terminals
* added 'flags' parameter to serial_init()
*
* Revision 1.8 2004/03/03 04:44:16 reinelt
* changes (cosmetics?) to the big patch from Martin
* hash patch un-applied
@@ -242,7 +247,7 @@ static pid_t drv_generic_serial_unlock_port (char *Port)
}
int drv_generic_serial_open (char *section, char *driver)
int drv_generic_serial_open (char *section, char *driver, unsigned int flags)
{
int i, fd;
pid_t pid;
@@ -295,6 +300,7 @@ int drv_generic_serial_open (char *section, char *driver)
}
cfmakeraw(&portset);
portset.c_cflag |= flags;
cfsetospeed(&portset, Speed);
if (tcsetattr(fd, TCSANOW, &portset)==-1) {
error ("%s: tcsetattr(%s) failed: %s", Driver, Port, strerror(errno));
+7 -2
View File
@@ -1,4 +1,4 @@
/* $Id: drv_generic_serial.h,v 1.3 2004/02/14 11:56:17 reinelt Exp $
/* $Id: drv_generic_serial.h,v 1.4 2004/05/28 13:51:42 reinelt Exp $
*
* generic driver helper for serial and usbserial displays
*
@@ -23,6 +23,11 @@
*
*
* $Log: drv_generic_serial.h,v $
* Revision 1.4 2004/05/28 13:51:42 reinelt
*
* ported driver for Beckmann+Egle Mini-Terminals
* added 'flags' parameter to serial_init()
*
* Revision 1.3 2004/02/14 11:56:17 reinelt
* M50530 driver ported
* changed lots of 'char' to 'unsigned char'
@@ -56,7 +61,7 @@
#ifndef _DRV_GENERIC_SERIALH_
#define _DRV_GENERIC_SERIAL_H_
int drv_generic_serial_open (char *section, char *driver);
int drv_generic_serial_open (char *section, char *driver, unsigned int flags);
int drv_generic_serial_poll (unsigned char *string, int len);
int drv_generic_serial_read (unsigned char *string, int len);
void drv_generic_serial_write (unsigned char *string, int len);
+6 -6
View File
@@ -177,7 +177,7 @@ Widget RAM {
Widget Busy {
class 'Text'
expression cpu('busy', 500)
expression proc_stat::cpu('busy', 500)
prefix 'Busy'
postfix '%'
width 10
@@ -188,8 +188,8 @@ Widget Busy {
Widget BusyBar {
class 'Bar'
expression cpu('busy', 500)
expression2 cpu('system', 500)
expression proc_stat::cpu('busy', 500)
expression2 proc_stat::cpu('system', 500)
length 10
direction 'E'
update tack
@@ -220,7 +220,7 @@ Widget Disk {
class 'Text'
# disk.[rw]blk return blocks, we assume a blocksize of 512
# to get the number in kB/s we would do blk*512/1024, which is blk/2
expression (disk('.*', 'rblk', 500)+disk('.*', 'wblk', 500))/2
expression (proc_stat::disk('.*', 'rblk', 500)+proc_stat::disk('.*', 'wblk', 500))/2
prefix 'disk'
postfix ' '
width 10
@@ -231,8 +231,8 @@ Widget Disk {
Widget DiskBar {
class 'Bar'
expression disk('.*', 'rblk', 500)
expression2 disk('.*', 'wblk', 500)
expression proc_stat::disk('.*', 'rblk', 500)
expression2 proc_stat::disk('.*', 'wblk', 500)
length 14
direction 'E'
update tack
-211
View File
@@ -1,211 +0,0 @@
/* $Id: lock.c,v 1.7 2004/03/03 03:47:04 reinelt Exp $
*
* UUCP style locking
*
* 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: lock.c,v $
* Revision 1.7 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
* - save CPU cycles on gettimeofday()
* - add quit() functions to free allocated memory
* - fixed lots of memory leaks
*
* Revision 1.6 2004/01/29 04:40:02 reinelt
* every .c file includes "config.h" now
*
* Revision 1.5 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
* Revision 1.4 2003/09/19 08:40:32 reinelt
*
*
* increased version number to 0.9.12
* port locking is done as /var/lock/LCK..usb_tts_0 for /dev/usb/tts/0
*
* Revision 1.3 2001/04/27 05:04:57 reinelt
*
* replaced OPEN_MAX with sysconf()
* replaced mktemp() with mkstemp()
* unlock serial port if open() fails
*
* Revision 1.2 2000/08/10 09:44:09 reinelt
*
* new debugging scheme: error(), info(), debug()
* uses syslog if in daemon mode
*
* Revision 1.1 2000/04/07 05:42:20 reinelt
*
* UUCP style lockfiles for the serial port
*
*/
/*
* exported functions:
*
* pid_t lock_port (char *port)
* returns 0 if port could be successfully locked
* otherwise returns PID of the process holding the lock
*
* pid_t unlock_port (char *port)
* returns 0 if port could be successfully unlocked
* otherwise returns PID of the process holding the lock
*
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "debug.h"
#include "lock.h"
#include "qprintf.h"
pid_t lock_port (char *Port)
{
char lockfile[256];
char tempfile[256];
char buffer[16];
char *port, *p;
int fd, len, pid;
if (strncmp(Port, "/dev/", 5)==0) {
port=strdup(Port+5);
} else {
port=strdup(Port);
}
while ((p=strchr(port, '/'))!=NULL) {
*p='_';
}
qprintf(lockfile, sizeof(lockfile), LOCK, port);
qprintf(tempfile, sizeof(tempfile), LOCK, "TMP.XXXXXX");
free (port);
if ((fd=mkstemp(tempfile))==-1) {
error ("mkstemp(%s) failed: %s", tempfile, strerror(errno));
return -1;
}
if (fchmod(fd,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)==-1) {
error ("fchmod(%s) failed: %s", tempfile, strerror(errno));
close(fd);
unlink(tempfile);
return -1;
}
snprintf (buffer, sizeof(buffer), "%10d\n", (int)getpid());
if (write(fd, buffer, strlen(buffer))!=strlen(buffer)) {
error ("write(%s) failed: %s", tempfile, strerror(errno));
close(fd);
unlink(tempfile);
return -1;
}
close (fd);
while (link(tempfile, lockfile)==-1) {
if (errno!=EEXIST) {
error ("link(%s, %s) failed: %s", tempfile, lockfile, strerror(errno));
unlink(tempfile);
return -1;
}
if ((fd=open(lockfile, O_RDONLY))==-1) {
if (errno==ENOENT) continue; // lockfile disappared
error ("open(%s) failed: %s", lockfile, strerror(errno));
unlink (tempfile);
return -1;
}
len=read(fd, buffer, sizeof(buffer)-1);
if (len<0) {
error ("read(%s) failed: %s", lockfile, strerror(errno));
unlink (tempfile);
return -1;
}
buffer[len]='\0';
if (sscanf(buffer, "%d", &pid)!=1 || pid==0) {
error ("scan(%s) failed.", lockfile);
unlink (tempfile);
return -1;
}
if (pid==getpid()) {
error ("%s already locked by us. uh-oh...", lockfile);
unlink(tempfile);
return 0;
}
if ((kill(pid, 0)==-1) && errno==ESRCH) {
error ("removing stale lockfile %s", lockfile);
if (unlink(lockfile)==-1 && errno!=ENOENT) {
error ("unlink(%s) failed: %s", lockfile, strerror(errno));
unlink(tempfile);
return pid;
}
continue;
}
unlink (tempfile);
return pid;
}
unlink (tempfile);
return 0;
}
pid_t unlock_port (char *Port)
{
char lockfile[256];
char *port, *p;
if (strncmp(Port, "/dev/", 5)==0) {
port=strdup(Port+5);
} else {
port=strdup(Port);
}
while ((p=strchr(port, '/'))!=NULL) {
*p='_';
}
qprintf(lockfile, sizeof(lockfile), LOCK, port);
unlink (lockfile);
free (port);
return 0;
}
-42
View File
@@ -1,42 +0,0 @@
/* $Id: lock.h,v 1.2 2003/10/05 17:58:50 reinelt Exp $
*
* UUCP style port locking
*
* 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: lock.h,v $
* Revision 1.2 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
* Revision 1.1 2000/04/07 05:42:20 reinelt
*
* UUCP style lockfiles for the serial port
*
*/
#ifndef _LOCK_H_
#define _LOCK_H_
#define LOCK "/var/lock/LCK..%s"
pid_t lock_port (char *port);
pid_t unlock_port (char *port);
#endif