]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2000-11-28 16:46:11 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Tue, 28 Nov 2000 16:46:11 +0000 (16:46 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Tue, 28 Nov 2000 16:46:11 +0000 (16:46 +0000)
first try to support display of SIN router

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

Makefile.am
Makefile.in
README
SIN.c [new file with mode: 0644]
display.c

index 8753e75692580144276b4f4f42d1367e2a9bd711..a4eef065fbba6991dda2086a39e40407a18ed1bb 100644 (file)
@@ -30,6 +30,7 @@ MatrixOrbital.c \
 BeckmannEgle.c \
 HD44780.c \
 Crystalfontz.c Crystalfontz.h \
+SIN.c \
 PalmPilot.c \
 Raster.c \
 XWindow.c
index 340aa1df2b3cedaec06c7a5d9ec132434cb12ac7..41063061b3b2a8c0be54761905a6521c9150914f 100644 (file)
@@ -73,7 +73,7 @@ AM_CFLAGS = $(X_CFLAGS) -D_GNU_SOURCE -Wall
 lcd4linux_LDFLAGS = $(X_LIBS)
 @WITH_X_TRUE@lcd4linux_LDADD = -lX11
 
-lcd4linux_SOURCES =  lcd4linux.c debug.c debug.h cfg.c cfg.h lock.c lock.h parser.c parser.h processor.c processor.h system.c system.h isdn.c isdn.h filter.c filter.h udelay.c udelay.h display.c display.h pixmap.c pixmap.h fontmap.c fontmap.h Skeleton.c MatrixOrbital.c BeckmannEgle.c HD44780.c Crystalfontz.c Crystalfontz.h PalmPilot.c Raster.c XWindow.c
+lcd4linux_SOURCES =  lcd4linux.c debug.c debug.h cfg.c cfg.h lock.c lock.h parser.c parser.h processor.c processor.h system.c system.h isdn.c isdn.h filter.c filter.h udelay.c udelay.h display.c display.h pixmap.c pixmap.h fontmap.c fontmap.h Skeleton.c MatrixOrbital.c BeckmannEgle.c HD44780.c Crystalfontz.c Crystalfontz.h SIN.c PalmPilot.c Raster.c XWindow.c
 
 
 EXTRA_DIST =  lcd4linux.conf.sample lcd4kde.conf lcd4linux.kdelnk lcd4linux.xpm lcd4linux.lsm FAQ TODO README.Drivers README.MatrixOrbital README.HD44780 README.Crystalfontz README.X11 README.KDE README.Raster
@@ -95,7 +95,7 @@ X_PRE_LIBS = @X_PRE_LIBS@
 lcd4linux_OBJECTS =  lcd4linux.o debug.o cfg.o lock.o parser.o \
 processor.o system.o isdn.o filter.o udelay.o display.o pixmap.o \
 fontmap.o Skeleton.o MatrixOrbital.o BeckmannEgle.o HD44780.o \
-Crystalfontz.o PalmPilot.o Raster.o XWindow.o
+Crystalfontz.o SIN.o PalmPilot.o Raster.o XWindow.o
 @WITH_X_TRUE@lcd4linux_DEPENDENCIES = 
 CFLAGS = @CFLAGS@
 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -110,11 +110,11 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 TAR = tar
 GZIP_ENV = --best
 DEP_FILES =  .deps/BeckmannEgle.P .deps/Crystalfontz.P .deps/HD44780.P \
-.deps/MatrixOrbital.P .deps/PalmPilot.P .deps/Raster.P .deps/Skeleton.P \
-.deps/XWindow.P .deps/cfg.P .deps/debug.P .deps/display.P \
-.deps/filter.P .deps/fontmap.P .deps/isdn.P .deps/lcd4linux.P \
-.deps/lock.P .deps/parser.P .deps/pixmap.P .deps/processor.P \
-.deps/system.P .deps/udelay.P
+.deps/MatrixOrbital.P .deps/PalmPilot.P .deps/Raster.P .deps/SIN.P \
+.deps/Skeleton.P .deps/XWindow.P .deps/cfg.P .deps/debug.P \
+.deps/display.P .deps/filter.P .deps/fontmap.P .deps/isdn.P \
+.deps/lcd4linux.P .deps/lock.P .deps/parser.P .deps/pixmap.P \
+.deps/processor.P .deps/system.P .deps/udelay.P
 SOURCES = $(lcd4linux_SOURCES)
 OBJECTS = $(lcd4linux_OBJECTS)
 
diff --git a/README b/README
index a0d49a6b4e0b3c93a014e59b0a13f589ba8a8b6d..255b17161b9cf4f749d5c71b43a76e7b0dd75dbf 100644 (file)
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 #
-# $Id: README,v 1.9 2000/08/10 09:44:09 reinelt Exp $
+# $Id: README,v 1.10 2000/11/28 16:46:11 reinelt Exp $
 #
 
 This is the README file for lcd4linux
@@ -163,10 +163,10 @@ Tokens:
   'dw', disk blocks written
   'dt', disk blocks total (read+write)
   'dm', disk blocks max (read, write)
-  'nr', network packets received
-  'nw', network packets transmitted
-  'nt', network packets total (receive+transmit)
-  'nm', network packets max (receive, transmit)
+  'nr', network bytes received
+  'nw', network bytes transmitted
+  'nt', network bytes total (receive+transmit)
+  'nm', network bytes max (receive, transmit)
   'ii', ISDN bytes received
   'io', ISDN bytes sent
   'it', ISDN bytes total (received+send)
diff --git a/SIN.c b/SIN.c
new file mode 100644 (file)
index 0000000..e0f3d6e
--- /dev/null
+++ b/SIN.c
@@ -0,0 +1,193 @@
+/* $Id: SIN.c,v 1.1 2000/11/28 16:46:11 reinelt Exp $
+ *
+ * driver for SIN router displays
+ *
+ * Copyright 2000 by Michael Reinelt (reinelt@eunet.at)
+ *
+ * This program 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.
+ *
+ * This program 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: SIN.c,v $
+ * Revision 1.1  2000/11/28 16:46:11  reinelt
+ *
+ * first try to support display of SIN router
+ *
+ *
+ */
+
+/* 
+ *
+ * exported fuctions:
+ *
+ * struct LCD SIN[]
+ *
+ */
+
+#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"
+
+#define XRES 5
+#define YRES 8
+
+// Fixme: Bar Support disabled
+#define BARS 0
+
+static LCD Lcd;
+static char *Port=NULL;
+static int Device=-1;
+
+static char Txt[8][40];
+
+static int SIN_open (void)
+{
+  int fd;
+  pid_t pid;
+  struct termios portset;
+  
+  if ((pid=lock_port(Port))!=0) {
+    if (pid==-1)
+      error ("SIN: port %s could not be locked", Port);
+    else
+      error ("SIN: port %s is locked by process %d", Port, pid);
+    return -1;
+  }
+  fd = open(Port, O_RDWR | O_NOCTTY | O_NDELAY); 
+  if (fd==-1) {
+    error ("SIN: open(%s) failed: %s", Port, strerror(errno));
+    return -1;
+  }
+  if (tcgetattr(fd, &portset)==-1) {
+    error ("SIN: tcgetattr(%s) failed: %s", Port, strerror(errno));
+    return -1;
+  }
+  cfmakeraw(&portset);
+  cfsetospeed(&portset, B9600);
+  if (tcsetattr(fd, TCSANOW, &portset)==-1) {
+    error ("SIN: tcsetattr(%s) failed: %s", Port, strerror(errno));
+    return -1;
+  }
+  return fd;
+}
+
+static void SIN_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 ("SIN: write(%s) failed: %s", Port, strerror(errno));
+  }
+}
+
+int SIN_clear (void)
+{
+  int row, col;
+
+  for (row=0; row<Lcd.rows; row++) {
+    for (col=0; col<Lcd.cols; col++) {
+      Txt[row][col]='\t';
+    }
+  }
+  
+  SIN_write ("\033S\000", 3); // select screen #0
+  return 0;
+}
+
+int SIN_init (LCD *Self)
+{
+  char *port;
+
+  Lcd=*Self;
+
+  if (Port) {
+    free (Port);
+    Port=NULL;
+  }
+
+  port=cfg_get ("Port");
+  if (port==NULL || *port=='\0') {
+    error ("SIN: no 'Port' entry in %s", cfg_file());
+    return -1;
+  }
+  Port=strdup(port);
+
+  debug ("using port %s at 9600 baud", Port);
+
+  Device=SIN_open();
+  if (Device==-1) return -1;
+
+  SIN_write ("\015", 1);  // send 'Enter'
+  SIN_clear();
+
+  return 0;
+}
+
+int SIN_put (int row, int col, char *text)
+{
+  char *p=&Txt[row][col];
+  char *t=text;
+  
+  while (*t && col++<=Lcd.cols) {
+    *p++=*t++;
+  }
+  return 0;
+}
+
+int SIN_flush (void)
+{
+  char buffer[256]="\033T"; // place text
+  char *p;
+  int  row, col;
+  
+  for (row=0; row<Lcd.rows; row++) {
+    buffer[2]=row+1;
+    for (col=0; col<Lcd.cols; col++) {
+      if (Txt[row][col]=='\t') continue;
+      buffer[3]=col+1;
+      for (p=buffer+4; col<Lcd.cols; col++, p++) {
+       if (Txt[row][col]=='\t') break;
+       *p=Txt[row][col];
+      }
+      *p++='\015'; // append <CR>
+      SIN_write (buffer, p-buffer);
+    }
+  }
+  return 0;
+}
+
+int SIN_quit (void)
+{
+  debug ("closing port %s", Port);
+  close (Device);
+  unlock_port(Port);
+  return (0);
+}
+
+LCD SIN[] = {
+  { "SIN", 8, 40, XRES, YRES, BARS, SIN_init, SIN_clear, SIN_put, NULL, SIN_flush, SIN_quit },
+  { NULL }
+};
index bd166e54b2694c1c2834568f18629a5ad36d8e00..7d6f6737e36d458a727d9600a56c7b8b5b8407eb 100644 (file)
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.20 2000/08/10 09:44:09 reinelt Exp $
+/* $Id: display.c,v 1.21 2000/11/28 16:46:11 reinelt Exp $
  *
  * framework for device drivers
  *
  *
  *
  * $Log: display.c,v $
+ * Revision 1.21  2000/11/28 16:46:11  reinelt
+ *
+ * first try to support display of SIN router
+ *
  * Revision 1.20  2000/08/10 09:44:09  reinelt
  *
  * new debugging scheme: error(), info(), debug()
@@ -153,6 +157,7 @@ extern LCD MatrixOrbital[];
 extern LCD BeckmannEgle[];
 extern LCD HD44780[];
 extern LCD Crystalfontz[];
+extern LCD SIN[];
 extern LCD PalmPilot[];
 extern LCD Raster[];
 extern LCD XWindow[];
@@ -163,6 +168,7 @@ FAMILY Driver[] = {
   { "Beckmann+Egle",   BeckmannEgle },
   { "HD 44780 based",  HD44780 },
   { "Crystalfontz",    Crystalfontz },
+  { "SIN Router",      SIN },
   { "3Com Palm Pilot", PalmPilot },
   { "Raster",          Raster },
 #ifndef X_DISPLAY_MISSING