Flush pending input when switching to remote packet mode
authorKeith Packard <keithp@keithp.com>
Thu, 5 Nov 2009 05:59:12 +0000 (21:59 -0800)
committerKeith Packard <keithp@keithp.com>
Thu, 5 Nov 2009 05:59:12 +0000 (21:59 -0800)
Any pending input would just confuse the application, so pull it off
the link and dump it.

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/lib/cc-usb.c

index 9b3b831f3898e44c5f61f9bb14f70e6f770f78e6..53a507412bbb9189077671bb8b2e05969ef40d82 100644 (file)
@@ -378,7 +378,7 @@ void
 cc_usb_open_remote(struct cc_usb *cc)
 {
        if (!cc->remote) {
-               cc_usb_printf(cc, "p\nE 0\n");
+               cc_usb_printf(cc, "\np\nE 0\n");
                do {
                        cc->in_count = cc->in_pos = 0;
                        _cc_usb_sync(cc, 100);
@@ -419,7 +419,7 @@ cc_usb_open(char *tty)
        save_termios = termios;
        cfmakeraw(&termios);
        tcsetattr(cc->fd, TCSAFLUSH, &termios);
-       cc_usb_printf(cc, "E 0\nm 0\n");
+       cc_usb_printf(cc, "\nE 0\nm 0\n");
        do {
                cc->in_count = cc->in_pos = 0;
                _cc_usb_sync(cc, 100);