diff options
author | Keith Packard <keithp@keithp.com> | 2012-07-29 19:34:00 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-07-29 19:34:00 -0700 |
commit | 0bf21399d3d47d58410df4c6ce89fc20fcd42c89 (patch) | |
tree | f1c39fbbc5470e7d5489f6fcef2d0fe5ac2a461e /altosui/AltosSerial.java | |
parent | 59588ba34159b27c02e1a886b46497ecfa0cf4d3 (diff) |
altosui: Handle Monitor Idle errors better
Deal with missing data by checking for MISSING in more places.
Handle serial communication failures during send by reporting back
from libaltos.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosSerial.java')
-rw-r--r-- | altosui/AltosSerial.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/altosui/AltosSerial.java b/altosui/AltosSerial.java index c4e9c697..8b692fa9 100644 --- a/altosui/AltosSerial.java +++ b/altosui/AltosSerial.java @@ -54,13 +54,19 @@ public class AltosSerial extends AltosLink implements Runnable { Frame frame; public int getchar() { + if (altos == null) + return ERROR; return libaltos.altos_getchar(altos, 0); } public void flush_output() { super.flush_output(); if (altos != null) { - libaltos.altos_flush(altos); + if (libaltos.altos_flush(altos) != 0) { + libaltos.altos_close(altos); + altos = null; + abort_reply(); + } } } @@ -155,7 +161,11 @@ public class AltosSerial extends AltosLink implements Runnable { private void putc(char c) { if (altos != null) - libaltos.altos_putchar(altos, c); + if (libaltos.altos_putchar(altos, c) != 0) { + libaltos.altos_close(altos); + altos = null; + abort_reply(); + } } public void print(String data) { |