summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
dcd1503)
The eeprom download code wants to interrupt serial communication so
that it can stop downloading stuff in the middle of a run. Make
flush_input pass the exception along instead of discarding it.
Signed-off-by: Keith Packard <keithp@keithp.com>
void ensure_debug_mode() {
if (!debug_mode) {
printf("D\n");
void ensure_debug_mode() {
if (!debug_mode) {
printf("D\n");
+ try {
+ flush_input();
+ } catch (InterruptedException ie) {
+ }
serial_line.device.toShortString()),
"Connection Failed");
} finally {
serial_line.device.toShortString()),
"Connection Failed");
} finally {
- if (remote)
- serial_line.stop_remote();
- serial_line.flush_output();
- serial_line.close();
+ try {
+ if (remote)
+ serial_line.stop_remote();
+ } catch (InterruptedException ie) {
+ } finally {
+ serial_line.flush_output();
+ serial_line.close();
+ }
}
if (listener != null) {
Runnable r = new Runnable() {
}
if (listener != null) {
Runnable r = new Runnable() {
"Connection Failed",
JOptionPane.ERROR_MESSAGE);
} finally {
"Connection Failed",
JOptionPane.ERROR_MESSAGE);
} finally {
- if (remote)
- serial_line.stop_remote();
+ if (remote) {
+ try {
+ serial_line.stop_remote();
+ } catch (InterruptedException ie) {
+ }
+ }
serial_line.flush_output();
}
monitor.done();
serial_line.flush_output();
}
monitor.done();
public void finish() {
if (serial_line != null) {
public void finish() {
if (serial_line != null) {
- serial_line.flush_input();
+ try {
+ serial_line.flush_input();
+ } catch (InterruptedException ie) {
+ }
serial_line.close();
serial_line = null;
}
serial_line.close();
serial_line = null;
}
- public void flush_input() {
+ public void flush_input() throws InterruptedException {
flush_output();
boolean got_some;
flush_output();
boolean got_some;
if (remote)
timeout = 500;
do {
if (remote)
timeout = 500;
do {
- try {
- Thread.sleep(timeout);
- } catch (InterruptedException ie) {
- }
got_some = !reply_queue.isEmpty();
synchronized(this) {
if (!"VERSION".startsWith(line) &&
got_some = !reply_queue.isEmpty();
synchronized(this) {
if (!"VERSION".startsWith(line) &&
- if (remote)
- stop_remote();
+ if (remote) {
+ try {
+ stop_remote();
+ } catch (InterruptedException ie) {
+ }
+ }
if (in_reply != 0)
System.out.printf("Uh-oh. Closing active serial device\n");
if (in_reply != 0)
System.out.printf("Uh-oh. Closing active serial device\n");
- public void stop_remote() {
+ public void stop_remote() throws InterruptedException {
if (debug)
System.out.printf("stop remote\n");
try {
if (debug)
System.out.printf("stop remote\n");
try {