\
display.c display.h \
drv.c drv.h \
-drv_generic.c drv_generic.h \
-drv_generic_text.c drv_generic_text.h \
+drv_generic_serial.c drv_generic_serial.h \
+drv_generic_text.c drv_generic_text.h \
debug.c debug.h \
cfg.c cfg.h \
lock.c lock.h \
#remove next line for liblcd4linux
lcd4linux_DEPENDENCIES = @DRIVERS@
-lcd4linux_SOURCES = lcd4linux.c pid.c pid.h hash.c hash.h parser.c parser.h processor.c processor.h layout.c layout.h timer.c timer.h evaluator.c evaluator.h widget.c widget.h widget_text.c widget_text.h widget_bar.c widget_bar.h plugin.c plugin.h plugin_math.c plugin_string.c plugin_cfg.c plugin_uname.c plugin_loadavg.c plugin_proc_stat.c plugin_cpuinfo.c plugin_meminfo.c plugin_i2c_sensors.c plugin_xmms.c system.c system.h isdn.c isdn.h wifi.c wifi.h mail.c mail.h seti.c seti.h battery.c battery.h dvb.c dvb.h filter.c filter.h exec.c exec.h expr.c expr.h mail2.c socket.c socket.h imon.c imon.h display.c display.h drv.c drv.h drv_generic.c drv_generic.h drv_generic_text.c drv_generic_text.h debug.c debug.h cfg.c cfg.h lock.c lock.h pixmap.c pixmap.h bar.c bar.h icon.c icon.h fontmap.c fontmap.h udelay.c udelay.h
+lcd4linux_SOURCES = lcd4linux.c pid.c pid.h hash.c hash.h parser.c parser.h processor.c processor.h layout.c layout.h timer.c timer.h evaluator.c evaluator.h widget.c widget.h widget_text.c widget_text.h widget_bar.c widget_bar.h plugin.c plugin.h plugin_math.c plugin_string.c plugin_cfg.c plugin_uname.c plugin_loadavg.c plugin_proc_stat.c plugin_cpuinfo.c plugin_meminfo.c plugin_i2c_sensors.c plugin_xmms.c system.c system.h isdn.c isdn.h wifi.c wifi.h mail.c mail.h seti.c seti.h battery.c battery.h dvb.c dvb.h filter.c filter.h exec.c exec.h expr.c expr.h mail2.c socket.c socket.h imon.c imon.h display.c display.h drv.c drv.h drv_generic_serial.c drv_generic_serial.h drv_generic_text.c drv_generic_text.h debug.c debug.h cfg.c cfg.h lock.c lock.h pixmap.c pixmap.h bar.c bar.h icon.c icon.h fontmap.c fontmap.h udelay.c udelay.h
#liblcd4linux_la_DEPENDENCIES = @DRIVERS@
isdn.$(OBJEXT) wifi.$(OBJEXT) mail.$(OBJEXT) seti.$(OBJEXT) \
battery.$(OBJEXT) dvb.$(OBJEXT) filter.$(OBJEXT) exec.$(OBJEXT) \
expr.$(OBJEXT) mail2.$(OBJEXT) socket.$(OBJEXT) imon.$(OBJEXT) \
-display.$(OBJEXT) drv.$(OBJEXT) drv_generic.$(OBJEXT) \
+display.$(OBJEXT) drv.$(OBJEXT) drv_generic_serial.$(OBJEXT) \
drv_generic_text.$(OBJEXT) debug.$(OBJEXT) cfg.$(OBJEXT) lock.$(OBJEXT) \
pixmap.$(OBJEXT) bar.$(OBJEXT) icon.$(OBJEXT) fontmap.$(OBJEXT) \
udelay.$(OBJEXT)
.deps/MilfordInstruments.P .deps/PalmPilot.P .deps/Raster.P .deps/SIN.P \
.deps/T6963.P .deps/Text.P .deps/USBLCD.P .deps/XWindow.P .deps/bar.P \
.deps/battery.P .deps/cfg.P .deps/debug.P .deps/display.P .deps/drv.P \
-.deps/drv_MatrixOrbital.P .deps/drv_generic.P .deps/drv_generic_text.P \
-.deps/dvb.P .deps/evaluator.P .deps/exec.P .deps/expr.P .deps/filter.P \
-.deps/fontmap.P .deps/hash.P .deps/icon.P .deps/imon.P .deps/isdn.P \
-.deps/layout.P .deps/lcd4linux.P .deps/lock.P .deps/mail.P \
-.deps/mail2.P .deps/parport.P .deps/parser.P .deps/pid.P .deps/pixmap.P \
-.deps/plugin.P .deps/plugin_cfg.P .deps/plugin_cpuinfo.P \
+.deps/drv_MatrixOrbital.P .deps/drv_generic_serial.P \
+.deps/drv_generic_text.P .deps/dvb.P .deps/evaluator.P .deps/exec.P \
+.deps/expr.P .deps/filter.P .deps/fontmap.P .deps/hash.P .deps/icon.P \
+.deps/imon.P .deps/isdn.P .deps/layout.P .deps/lcd4linux.P .deps/lock.P \
+.deps/mail.P .deps/mail2.P .deps/parport.P .deps/parser.P .deps/pid.P \
+.deps/pixmap.P .deps/plugin.P .deps/plugin_cfg.P .deps/plugin_cpuinfo.P \
.deps/plugin_i2c_sensors.P .deps/plugin_loadavg.P .deps/plugin_math.P \
.deps/plugin_meminfo.P .deps/plugin_proc_stat.P .deps/plugin_string.P \
.deps/plugin_uname.P .deps/plugin_xmms.P .deps/processor.P .deps/seti.P \
-/* $Id: drv_MatrixOrbital.c,v 1.12 2004/01/20 12:45:47 reinelt Exp $
+/* $Id: drv_MatrixOrbital.c,v 1.13 2004/01/20 14:25:12 reinelt Exp $
*
* new style driver for Matrix Orbital serial display modules
*
*
*
* $Log: drv_MatrixOrbital.c,v $
+ * Revision 1.13 2004/01/20 14:25:12 reinelt
+ * some reorganization
+ * moved drv_generic to drv_generic_serial
+ * moved port locking stuff to drv_generic_serial
+ *
* Revision 1.12 2004/01/20 12:45:47 reinelt
* "Default screen" working with MatrixOrbital
*
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <errno.h>
#include <unistd.h>
-#include <termios.h>
-#include <fcntl.h>
#include "debug.h"
#include "cfg.h"
#include "plugin.h"
-#include "lock.h"
#include "widget.h"
#include "widget_text.h"
#include "widget_bar.h"
#include "drv.h"
-#include "drv_generic.h"
+#include "drv_generic_serial.h"
#include "drv_generic_text.h"
{
int i;
char *model;
- char *port, buffer[256];
- speed_t speed;
+ char buffer[256];
model=cfg_get(section, "Model", NULL);
if (model!=NULL && *model!='\0') {
}
- port=cfg_get(section, "Port", NULL);
- if (port==NULL || *port=='\0') {
- error ("%s: no '%s.Port' entry from %s", Name, section, cfg_source());
- return -1;
- }
-
- if (cfg_number(section, "Speed", 19200, 1200, 19200, &i)<0) return -1;
- switch (i) {
- case 1200:
- speed=B1200;
- break;
- case 2400:
- speed=B2400;
- break;
- case 9600:
- speed=B9600;
- break;
- case 19200:
- speed=B19200;
- break;
- default:
- error ("%s: unsupported speed '%d' from %s", Name, i, cfg_source());
- return -1;
- }
-
- info ("%s: using port '%s' at %d baud", Name, port, i);
-
- if (drv_generic_serial_open(Name, port, speed)<0) return -1;
+ if (drv_generic_serial_open(section, Name)<0) return -1;
// read module type
drv_generic_serial_write ("\3767", 2);
+++ /dev/null
-/* $Id: drv_generic.c,v 1.2 2004/01/20 05:36:59 reinelt Exp $
- *
- * generic driver helper for text- and graphic-based displays
- *
- * Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
- * Copyright 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
- *
- * This file is part of LCD4Linux.
- *
- * LCD4Linux is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * LCD4Linux is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
- * $Log: drv_generic.c,v $
- * Revision 1.2 2004/01/20 05:36:59 reinelt
- * moved text-display-specific stuff to drv_generic_text
- * moved all the bar stuff from drv_generic_bar to generic_text
- *
- * Revision 1.1 2004/01/20 04:51:39 reinelt
- * moved generic stuff from drv_MatrixOrbital to drv_generic
- * implemented new-stylish bars which are nearly finished
- *
- */
-
-/*
- *
- * exported fuctions:
- *
- * Fixme: document me!
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <termios.h>
-#include <fcntl.h>
-
-#include "debug.h"
-#include "cfg.h"
-#include "plugin.h"
-#include "lock.h"
-#include "widget.h"
-#include "widget_text.h"
-#include "widget_bar.h"
-#include "drv.h"
-#include "drv_generic.h"
-
-
-static char *Driver;
-static char *Port;
-static speed_t Speed;
-static int Device=-1;
-
-
-// ****************************************
-// *** generic serial/USB communication ***
-// ****************************************
-
-int drv_generic_serial_open (char *driver, char *port, speed_t speed)
-{
- int fd;
- pid_t pid;
- struct termios portset;
-
- Driver = driver;
- Port = port;
- Speed = speed;
-
- if ((pid=lock_port(port))!=0) {
- if (pid==-1)
- error ("%s: port %s could not be locked", Driver, Port);
- else
- error ("%s: port %s is locked by process %d", Driver, Port, pid);
- return -1;
- }
-
- fd = open(Port, O_RDWR | O_NOCTTY | O_NDELAY);
- if (fd==-1) {
- error ("%s: open(%s) failed: %s", Driver, Port, strerror(errno));
- unlock_port(Port);
- return -1;
- }
-
- if (tcgetattr(fd, &portset)==-1) {
- error ("%s: tcgetattr(%s) failed: %s", Driver, Port, strerror(errno));
- unlock_port(Port);
- return -1;
- }
-
- cfmakeraw(&portset);
- cfsetospeed(&portset, Speed);
- if (tcsetattr(fd, TCSANOW, &portset)==-1) {
- error ("%s: tcsetattr(%s) failed: %s", Driver, Port, strerror(errno));
- unlock_port(Port);
- return -1;
- }
-
- Device=fd;
- return Device;
-}
-
-
-int drv_generic_serial_read (char *string, int len)
-{
- int run, ret;
-
- if (Device==-1) return -1;
- for (run=0; run<10; run++) {
- ret=read (Device, string, len);
- if (ret>=0 || errno!=EAGAIN) break;
- debug ("read(): EAGAIN");
- usleep(1000);
- }
-
- if (ret<0) {
- error("%s: read(%s, %d) failed: %s", Driver, Port, len, strerror(errno));
- } else if (ret!=len) {
- error ("%s: partial read: len=%d ret=%d", Driver, len, ret);
- }
-
- return ret;
-}
-
-
-void drv_generic_serial_write (char *string, int len)
-{
- int run, ret;
-
- if (Device==-1) return;
- for (run=0; run<10; run++) {
- ret=write (Device, string, len);
- if (ret>=0 || errno!=EAGAIN) break;
- debug ("write(): EAGAIN");
- usleep(1000);
- }
-
- if (ret<0) {
- error ("MatrixOrbital: write(%s) failed: %s", Port, strerror(errno));
- } else if (ret!=len) {
- error ("MatrixOrbital: partial write: len=%d ret=%d", len, ret);
- }
-
- return;
-}
-
-
-int drv_generic_serial_close (void)
-{
- debug ("%s: closing port %s", Driver, Port);
- close (Device);
- unlock_port(Port);
- return 0;
-}
-
+++ /dev/null
-/* $Id: drv_generic.h,v 1.2 2004/01/20 05:36:59 reinelt Exp $
- *
- * generic driver helper for text- and graphic-based displays
- *
- * Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
- * Copyright 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
- *
- * This file is part of LCD4Linux.
- *
- * LCD4Linux is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * LCD4Linux is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
- * $Log: drv_generic.h,v $
- * Revision 1.2 2004/01/20 05:36:59 reinelt
- * moved text-display-specific stuff to drv_generic_text
- * moved all the bar stuff from drv_generic_bar to generic_text
- *
- * Revision 1.1 2004/01/20 04:51:39 reinelt
- * moved generic stuff from drv_MatrixOrbital to drv_generic
- * implemented new-stylish bars which are nearly finished
- *
- */
-
-/*
- *
- * exported fuctions:
- *
- * Fixme: document me!
- *
- */
-
-#ifndef _DRV_GENERIC_H_
-#define _DRV_GENERIC_H_
-
-int drv_generic_serial_open (char *driver, char *port, speed_t speed);
-int drv_generic_serial_read (char *string, int len);
-void drv_generic_serial_write (char *string, int len);
-int drv_generic_serial_close (void);
-
-#endif
-/* $Id: drv_generic_text.c,v 1.2 2004/01/20 12:45:47 reinelt Exp $
+/* $Id: drv_generic_text.c,v 1.3 2004/01/20 14:25:12 reinelt Exp $
*
* generic driver helper for text-based displays
*
*
*
* $Log: drv_generic_text.c,v $
+ * Revision 1.3 2004/01/20 14:25:12 reinelt
+ * some reorganization
+ * moved drv_generic to drv_generic_serial
+ * moved port locking stuff to drv_generic_serial
+ *
* Revision 1.2 2004/01/20 12:45:47 reinelt
* "Default screen" working with MatrixOrbital
*
#include "debug.h"
#include "cfg.h"
#include "plugin.h"
-#include "lock.h"
#include "widget.h"
#include "widget_text.h"
#include "widget_bar.h"
#include "drv.h"
-#include "drv_generic.h"
#include "drv_generic_text.h"
-/* $Id: widget_bar.c,v 1.3 2004/01/20 12:45:47 reinelt Exp $
+/* $Id: widget_bar.c,v 1.4 2004/01/20 14:25:12 reinelt Exp $
*
* bar widget handling
*
*
*
* $Log: widget_bar.c,v $
+ * Revision 1.4 2004/01/20 14:25:12 reinelt
+ * some reorganization
+ * moved drv_generic to drv_generic_serial
+ * moved port locking stuff to drv_generic_serial
+ *
* Revision 1.3 2004/01/20 12:45:47 reinelt
* "Default screen" working with MatrixOrbital
*
// sanity check
if (B->expression1==NULL || *B->expression1=='\0') {
- error ("widget %s has no expression, using '0.0'", Self->name, c);
+ error ("widget %s has no expression, using '0.0'", Self->name);
B->expression1="0";
}