AltosDevice device = new AltosDevice();
if (libaltos.altos_list_next(list, device) == 0)
break;
- device_list.add(device);
+ if (product == null || device.getProduct().startsWith(product))
+ device_list.add(device);
}
libaltos.altos_list_finish(list);
}
devices[0]);
return (altos_device) o;
} else {
+ JOptionPane.showMessageDialog(frame,
+ "No AltOS devices available",
+ "No AltOS devices",
+ JOptionPane.ERROR_MESSAGE);
return null;
}
}
public void open(altos_device device) throws FileNotFoundException {
close();
altos = libaltos.altos_open(device);
+ if (altos == null)
+ throw new FileNotFoundException(device.getPath());
input_thread = new Thread(this);
input_thread.start();
}
run_display(thread);
} catch (FileNotFoundException ee) {
JOptionPane.showMessageDialog(AltosUI.this,
- device.getPath(),
- "Cannot open serial port",
+ String.format("Cannot open device \"%s\"",
+ device.getPath()),
+ "Cannot open target device",
JOptionPane.ERROR_MESSAGE);
} catch (IOException ee) {
JOptionPane.showMessageDialog(AltosUI.this,