In packet master, move USB flush from packet thread to echo thread
authorKeith Packard <keithp@keithp.com>
Thu, 5 Nov 2009 05:29:37 +0000 (21:29 -0800)
committerKeith Packard <keithp@keithp.com>
Thu, 5 Nov 2009 05:29:37 +0000 (21:29 -0800)
This keeps the packet thread from blocking on USB and also makes the
flush happen after every packet (slightly more USB traffic, but
packets are slow anyway).

Signed-off-by: Keith Packard <keithp@keithp.com>
src/ao_packet_master.c

index 2751f414a374e7bfc04ed35169b92dacdccb0caa..d03899d1336e40c0d8b7a4309c6b7206decb1674 100644 (file)
@@ -27,6 +27,7 @@ ao_packet_getchar(void)
                        break;
                if (ao_packet_master_sleeping)
                        ao_wake_task(&ao_packet_task);
                        break;
                if (ao_packet_master_sleeping)
                        ao_wake_task(&ao_packet_task);
+               flush();
                ao_sleep(&ao_stdin_ready);
        }
        return c;
                ao_sleep(&ao_stdin_ready);
        }
        return c;
@@ -94,8 +95,6 @@ ao_packet_master(void)
                                continue;
                        if (ao_rx_packet.packet.len)
                                ao_packet_master_busy();
                                continue;
                        if (ao_rx_packet.packet.len)
                                ao_packet_master_busy();
-                       else
-                               flush();
                        ao_packet_master_sleeping = 1;
                        ao_delay(ao_packet_master_delay);
                        ao_packet_master_sleeping = 0;
                        ao_packet_master_sleeping = 1;
                        ao_delay(ao_packet_master_delay);
                        ao_packet_master_sleeping = 0;