]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2004-01-20 14:25:12 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Tue, 20 Jan 2004 14:25:12 +0000 (14:25 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Tue, 20 Jan 2004 14:25:12 +0000 (14:25 +0000)
some reorganization
moved drv_generic to drv_generic_serial
moved port locking stuff to drv_generic_serial

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@324 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

Makefile.am
Makefile.in
drv_MatrixOrbital.c
drv_generic.c [deleted file]
drv_generic.h [deleted file]
drv_generic_text.c
widget_bar.c

index 180a9e57ad7e69eea6e6e26e3b199699e84f91ec..7c1759ee2877c26d78f279b5b39c7d662887c20c 100644 (file)
@@ -54,8 +54,8 @@ 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 \
+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 \
index 609db6c9e5cd18acc7a0262aa1488ab5b2295827..fcec6778b433346ca6ebfe02407c00bd981bfe91 100644 (file)
@@ -106,7 +106,7 @@ lcd4linux_LDADD = @DRIVERS@ @DRVLIBS@
 #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@
@@ -157,7 +157,7 @@ plugin_i2c_sensors.$(OBJEXT) plugin_xmms.$(OBJEXT) system.$(OBJEXT) \
 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)
@@ -181,12 +181,12 @@ DEP_FILES =  .deps/BeckmannEgle.P .deps/Crystalfontz.P .deps/Cwlinux.P \
 .deps/MilfordInstruments.P .deps/PalmPilot.P .deps/Raster.P .deps/SIN.P \
 .deps/T6963.P .deps/Text.P .deps/USBLCD.P .deps/XWindow.P .deps/bar.P \
 .deps/battery.P .deps/cfg.P .deps/debug.P .deps/display.P .deps/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 \
index 706dda969f3e0b44560466e12e16c61b681a0905..2a8be1f2c1e17c6fb51ce83e99206d39c5b2100e 100644 (file)
@@ -1,4 +1,4 @@
-/* $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"
 
 
@@ -182,8 +183,7 @@ static int drv_MO_start (char *section)
 {
   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') {
@@ -202,34 +202,7 @@ static int drv_MO_start (char *section)
   }
   
   
-  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);
diff --git a/drv_generic.c b/drv_generic.c
deleted file mode 100644 (file)
index fbec1e9..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/* $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;
-}
-
diff --git a/drv_generic.h b/drv_generic.h
deleted file mode 100644 (file)
index 52d53d4..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $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
index 2de0c299e6e2123828096f196bd00bda944d5a26..0ba2f108ab6979bb1b74bc926154caf0b08f0a64 100644 (file)
@@ -1,4 +1,4 @@
-/* $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"
 
 
index 65cb7480684965c4a79756dae1126add5a366fc4..ab93ea575a2f12f79f4f4cbae8151c60b1aacbe6 100644 (file)
@@ -1,4 +1,4 @@
-/* $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
  *
@@ -140,7 +145,7 @@ int widget_bar_init (WIDGET *Self)
   
   // 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";
   }