aboutsummaryrefslogtreecommitdiffstats
path: root/BeckmannEgle.c
diff options
context:
space:
mode:
authorreinelt <>2000-08-10 09:44:09 +0000
committerreinelt <>2000-08-10 09:44:09 +0000
commita71c28313e3e3ef0f2e235f78eaf38fca52deb1f (patch)
tree58f94e3a69cee7187c02a77f19890b99e0910cfc /BeckmannEgle.c
parentc6583cea7fd9fac922a9cf653a66b431a3539f44 (diff)
downloadlcd4linux-a71c28313e3e3ef0f2e235f78eaf38fca52deb1f.tar.gz
[lcd4linux @ 2000-08-10 09:44:09 by reinelt]
new debugging scheme: error(), info(), debug() uses syslog if in daemon mode
Diffstat (limited to 'BeckmannEgle.c')
-rw-r--r--BeckmannEgle.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/BeckmannEgle.c b/BeckmannEgle.c
index c660bf9..d434092 100644
--- a/BeckmannEgle.c
+++ b/BeckmannEgle.c
@@ -1,4 +1,4 @@
-/* $Id: BeckmannEgle.c,v 1.3 2000/08/09 09:50:29 reinelt Exp $
+/* $Id: BeckmannEgle.c,v 1.4 2000/08/10 09:44:09 reinelt Exp $
*
* driver for Beckmann+Egle mini terminals
*
@@ -20,6 +20,11 @@
*
*
* $Log: BeckmannEgle.c,v $
+ * 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
@@ -120,25 +125,25 @@ static int BE_open (void)
if ((pid=lock_port(Port))!=0) {
if (pid==-1)
- fprintf (stderr, "BeckmannEgle: port %s could not be locked\n", Port);
+ error ("BeckmannEgle: port %s could not be locked", Port);
else
- fprintf (stderr, "BeckmannEgle: port %s is locked by process %d\n", Port, pid);
+ 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) {
- fprintf (stderr, "BeckmannEgle: open(%s) failed: %s\n", Port, strerror(errno));
+ error ("BeckmannEgle: open(%s) failed: %s", Port, strerror(errno));
return -1;
}
if (tcgetattr(fd, &portset)==-1) {
- fprintf (stderr, "BeckmannEgle: tcgetattr(%s) failed: %s\n", Port, strerror(errno));
+ error ("BeckmannEgle: tcgetattr(%s) failed: %s", Port, strerror(errno));
return -1;
}
cfmakeraw(&portset); // 8N1
portset.c_cflag |= CSTOPB; // 2 stop bits
cfsetospeed(&portset, B9600); // 9600 baud
if (tcsetattr(fd, TCSANOW, &portset)==-1) {
- fprintf (stderr, "BeckmannEgle: tcsetattr(%s) failed: %s\n", Port, strerror(errno));
+ error ("BeckmannEgle: tcsetattr(%s) failed: %s", Port, strerror(errno));
return -1;
}
return fd;
@@ -152,7 +157,7 @@ static void BE_write (char *string, int len)
usleep(1000);
if (write (Device, string, len)>=0) return;
}
- fprintf (stderr, "BeckmannEgle: write(%s) failed: %s\n", Port, strerror(errno));
+ error ("BeckmannEgle: write(%s) failed: %s", Port, strerror(errno));
}
}
@@ -216,13 +221,13 @@ static void BE_compact_bars (void)
int i, j, r, c, min;
int pack_i, pack_j;
int pass1=1;
- int error[nSegment][nSegment];
+ int deviation[nSegment][nSegment];
if (nSegment>CHARS+2) {
for (i=2; i<nSegment; i++) {
for (j=0; j<nSegment; j++) {
- error[i][j]=BE_segment_diff(i,j);
+ deviation[i][j]=BE_segment_diff(i,j);
}
}
@@ -233,8 +238,8 @@ static void BE_compact_bars (void)
for (i=2; i<nSegment; i++) {
if (pass1 && Segment[i].used) continue;
for (j=0; j<nSegment; j++) {
- if (error[i][j]<min) {
- min=error[i][j];
+ if (deviation[i][j]<min) {
+ min=deviation[i][j];
pack_i=i;
pack_j=j;
}
@@ -245,7 +250,7 @@ static void BE_compact_bars (void)
pass1=0;
continue;
} else {
- fprintf (stderr, "BeckmannEgle: unable to compact bar characters\n");
+ error ("BeckmannEgle: unable to compact bar characters");
nSegment=CHARS;
break;
}
@@ -255,8 +260,8 @@ static void BE_compact_bars (void)
Segment[pack_i]=Segment[nSegment];
for (i=0; i<nSegment; i++) {
- error[pack_i][i]=error[nSegment][i];
- error[i][pack_i]=error[i][nSegment];
+ deviation[pack_i][i]=deviation[nSegment][i];
+ deviation[i][pack_i]=deviation[i][nSegment];
}
for (r=0; r<Lcd.rows; r++) {
@@ -365,18 +370,18 @@ int BE_init (LCD *Self)
port=cfg_get ("Port");
if (port==NULL || *port=='\0') {
- fprintf (stderr, "BeckmannEgle: no 'Port' entry in %s\n", cfg_file());
+ error ("BeckmannEgle: no 'Port' entry in %s", cfg_file());
return -1;
}
Port=strdup(port);
s=cfg_get("Type");
if (s==NULL || *s=='\0') {
- fprintf (stderr, "BeckmannEgle: no 'Type' entry in %s\n", cfg_file());
+ error ("BeckmannEgle: no 'Type' entry in %s", cfg_file());
return -1;
}
if (sscanf(s,"%dx%d",&cols,&rows)!=2 || rows<1 || cols<1) {
- fprintf(stderr,"BeckmannEgle: bad type '%s'\n", s);
+ error ("BeckmannEgle: bad type '%s'", s);
return -1;
}
@@ -388,11 +393,11 @@ int BE_init (LCD *Self)
}
}
if (Type==-1) {
- fprintf(stderr,"BeckmannEgle: unsupported model '%dx%d'\n", cols, rows);
+ error ("BeckmannEgle: unsupported model '%dx%d'", cols, rows);
return -1;
}
- debug ("using %dx%d display at port %s\n", cols, rows, Port);
+ debug ("using %dx%d display at port %s", cols, rows, Port);
Self->rows=rows;
Self->cols=cols;
@@ -530,7 +535,7 @@ int BE_flush (void)
int BE_quit (void)
{
- debug ("closing port %s\n", Port);
+ debug ("closing port %s", Port);
close (Device);
unlock_port(Port);
return 0;