-debug master
authorJan Kratochvil <jan.kratochvil@redhat.com>
Wed, 12 Mar 2014 08:20:03 +0000 (09:20 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Wed, 12 Mar 2014 08:20:03 +0000 (09:20 +0100)
lptgpib.c
terminal.c

index 591d32d..e5e2eea 100644 (file)
--- a/lptgpib.c
+++ b/lptgpib.c
@@ -11,7 +11,7 @@
 #include <sys/mman.h>
 #include <time.h>
 
-#define DEBUG 4 /* 4 - all, 3 - data, */
+#define DEBUG 2 /* 4 - all, 3 - data, */
 
 #if DEBUG > 3
        #define DBG_low(...) { fprintf(stderr,__VA_ARGS__); fflush(stderr); }
index b3c460e..188b695 100644 (file)
@@ -20,28 +20,24 @@ static const int zdroj_adresa=20;
 extern int lpt_base;
 
 int main(int argc,char **argv) {
+  setbuf(stdout,NULL);
   lptgpib_init(0x378);
   int init=1;
   for (;;) {
 
     // GPIB -> obrazovka
     if (init) {
-      fprintf(stderr,"Inicializuji port... ");
       lptgpib_command(UNL);
       lptgpib_command(MLA+0);
       lptgpib_command(MTA+zdroj_adresa);
-      fprintf(stderr,"hotovo.\n");
       init=0;
     }
     put_control(TRI | NDAC);   /* clear NRFD */
     usleep(1000000/10);
     if (get_control()&DAV) {   /* wait for DAV */
-      fprintf(stderr,"ctu znak...\n");
       char flags,val=lptgpib_read_byte(&flags);
-      if (flags&ATN)
-       lptgpib_print_command(val);
-      else
-       fprintf(stderr,"precten znak: %02x (%c)\n",val,val);
+      if (!(flags&ATN))
+       putchar(val);
     }
     put_control(TRI | NDAC | NRFD );  /* back to default state */
     usleep(1000000/10); /* chvili pockat, asi zbytecne, jen aby to bylo videt na portu */
@@ -60,9 +56,7 @@ int main(int argc,char **argv) {
       assert(s);
       assert(s[1]==0);
       *s=0;
-      fprintf(stderr,"zapisuji radek: %s\n",str);
       lptgpib_write(zdroj_adresa,str);
-      fprintf(stderr,"zapsan radek.\n");
       init=1;
     }