ao-sky-flash: Clean up debug printfs a bit
authorKeith Packard <keithp@keithp.com>
Tue, 4 Dec 2012 09:30:39 +0000 (01:30 -0800)
committerKeith Packard <keithp@keithp.com>
Tue, 4 Dec 2012 09:30:39 +0000 (01:30 -0800)
This makes debugging output a bit cleaner

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/ao-sky-flash/sky_bin.c
ao-tools/ao-sky-flash/sky_serial.c

index e693c89204d16f02c8c9ed30744dbf525080679f..04cfec35794899a9e7a800480e3aee9df0556b75 100644 (file)
@@ -40,14 +40,12 @@ skytraq_send_bin(int fd, const char *filename)
                return -1;
        }
 
-       printf ("computing checksum...\n"); fflush(stdout);
        /* Compute checksum, figure out how long the file */
        cksum = 0;
        while ((c = getc(file)) != EOF)
                cksum += (unsigned char) c;
        size = ftell(file);
        rewind(file);
-       printf ("checksum: %d\n", cksum); fflush(stdout);
 
        sprintf(message, "BINSIZE = %d Checksum = %d Loopnumber = %d ", size, cksum, 1);
 
@@ -65,7 +63,7 @@ skytraq_send_bin(int fd, const char *filename)
                }
                if (count == 0)
                        break;
-               printf ("write %ld of %ld ", pos + count, size); fflush(stdout);
+               skytraq_dbg_printf (0, "%7d of %7d ", pos + count, size);
                pos += count;
                ret = skytraq_cmd_wait(fd, buf, count, "OK", 20000);
                if (ret < 0)
index 4aeb14581801129c41593461d9e8058d2f71d408..7230bf8c194a9dbc48f367ea737637363978f877 100644 (file)
@@ -103,16 +103,14 @@ skytraq_write(int fd, const char *data, int len)
        int             r;
        int             us;
 
+       skytraq_dbg_printf (0, "%4d: ", len);
+       if (len < 70)
+               skytraq_dbg_buf(0, data, len);
        while (len) {
                int     this_time = len;
                if (this_time > 128)
                        this_time = 128;
-               if (this_time < 70) {
-                       skytraq_dbg_printf (0, "%4d: ", this_time);
-                       skytraq_dbg_buf(0, data, this_time);
-               } else {
-                       skytraq_dbg_printf (0, "%d bytes (%d remain)", this_time, len);
-               }
+               skytraq_dbg_printf(0, ".");
                fflush(stdout);
                r = write(fd, data, this_time);
                if (r <= 0)