]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2000-12-01 20:42:37 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Fri, 1 Dec 2000 20:42:37 +0000 (20:42 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Fri, 1 Dec 2000 20:42:37 +0000 (20:42 +0000)
added debugging of SIN driver output, probably found the positioning bug (format %02x instead of %2x)

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

SIN.c
lcd4linux.conf.sample

diff --git a/SIN.c b/SIN.c
index fc03047a06d695f8276e4d81d50d8e318ca56125..d5c8e46243f4c4a020565e13c982425333cecb76 100644 (file)
--- a/SIN.c
+++ b/SIN.c
@@ -1,4 +1,4 @@
-/* $Id: SIN.c,v 1.3 2000/12/01 07:20:26 reinelt Exp $
+/* $Id: SIN.c,v 1.4 2000/12/01 20:42:37 reinelt Exp $
  *
  * driver for SIN router displays
  *
  *
  *
  * $Log: SIN.c,v $
+ * Revision 1.4  2000/12/01 20:42:37  reinelt
+ *
+ * added debugging of SIN driver output, probably found the positioning bug (format %02x instead of %2x)
+ *
  * Revision 1.3  2000/12/01 07:20:26  reinelt
  *
  * modified text positioning: row starts with 0, column is hexadecimal
@@ -45,6 +49,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <ctype.h>
 #include <string.h>
 #include <errno.h>
 #include <unistd.h>
@@ -99,8 +104,28 @@ static int SIN_open (void)
   return fd;
 }
 
+static void SIN_debug (char *string, int len)
+{
+  char buffer[256];
+  char *p, *c;
+  
+  p=buffer;
+  c=string;
+  while (len-->0) {
+    if (isprint(*c)) {
+      *p++=*c;
+    } else {
+      p+=sprintf(p, "\\%02x", *c);
+    }
+    c++;
+  }
+  *p='\0';
+  debug ("sending '%s'", buffer);
+}
+
 static void SIN_write (char *string, int len)
 {
+  SIN_debug(string, len);
   if (Device==-1) return;
   if (write (Device, string, len)==-1) {
     if (errno==EAGAIN) {
@@ -178,7 +203,7 @@ int SIN_flush (void)
     buffer[3]='0'+row;
     for (col=0; col<Lcd.cols; col++) {
       if (Txt[row][col]=='\t') continue;
-      sprintf (buffer+4, "%2x", col);
+      sprintf (buffer+4, "%02x", col);
       for (p=buffer+6; col<Lcd.cols; col++, p++) {
        if (Txt[row][col]=='\t') break;
        *p=Txt[row][col];
index fc7f2322c0bd643f5b5250dd18ad28a44fe8ea7c..fd4d0acf5b3bf521de42efb821cccea04152ac4d 100644 (file)
@@ -3,13 +3,10 @@
 #Speed 19200
 #Contrast 160
 
-Display HD44780
-Port 0x378
-Size 16x2
-Delay 398
-
-Row1 "Disk%dm $R10dr+dw"
-Row2 "Net %nm $R10nr+nw"
+#Display HD44780
+#Port 0x378
+#Size 16x2
+#Delay 398
 
 #Display BLC100x
 #Port /dev/ttyS2
@@ -44,6 +41,12 @@ Row2 "Net %nm $R10nr+nw"
 #halfground \#90c000
 #background \#a0d000
 
+Display SIN
+Port /dev/ttyS1
+
+Row1 "Disk%dm $R10dr+dw"
+Row2 "Net %nm $R10nr+nw"
+
 #Row1 "*** %o %v ***"
 #Row2 "%p CPU  %r MB RAM"
 #Row3 "Busy %cb%% $r10cs+cb"
@@ -78,5 +81,3 @@ Sensor2_max 50
 Sensor3 /proc/sys/dev/sensors/w83781d-isa-0290/temp3
 Sensor3_min 30
 Sensor3_max 50
-
-Fifo /var/run/lcd4linux