diff options
author | Keith Packard <keithp@keithp.com> | 2015-02-14 01:13:21 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2015-02-14 01:13:21 -0800 |
commit | c4f9d96bdea192486f0e3f2d80b846c39a05c0ab (patch) | |
tree | a1e07514b7a8679582120544f67a22684e26b864 | |
parent | 0e929ee2d0a3d1b1bacd36c2c3723ab860eb40b6 (diff) |
altosuilib: Detect pair programming by product name, not USB id
With TeleDongle, TeleBT and TeleMetrum coming in both pair- and self-
programmable versions, we can't use the USB id to tell them
apart. Instead, fetch the device name and use that instead.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | altosuilib/AltosFlashUI.java | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/altosuilib/AltosFlashUI.java b/altosuilib/AltosFlashUI.java index 6e497c42..ace8fbe5 100644 --- a/altosuilib/AltosFlashUI.java +++ b/altosuilib/AltosFlashUI.java @@ -54,7 +54,7 @@ public class AltosFlashUI // Flash controller AltosProgrammer programmer; - private static String[] pair_programmed = { + private static final String[] pair_programmed_files = { "teleballoon", "telebt-v1", "teledongle-v0", @@ -67,20 +67,34 @@ public class AltosFlashUI "teleterra" }; + private static final String[] pair_programmed_devices = { + "TeleBalloon", + "TeleBT-v1", + "TeleDongle-v0", + "TeleFire", + "TeleMetrum-v0", + "TeleMetrum-v1", + "TeleMini", + "TeleNano", + "TeleShield", + "TeleTerra" + }; + private boolean is_pair_programmed() { if (file != null) { String name = file.getName(); - for (int i = 0; i < pair_programmed.length; i++) { - if (name.startsWith(pair_programmed[i])) + for (int i = 0; i < pair_programmed_files.length; i++) { + if (name.startsWith(pair_programmed_files[i])) return true; } } if (device != null) { - if (!device.matchProduct(AltosLib.product_altusmetrum) && - (device.matchProduct(AltosLib.product_teledongle) || - device.matchProduct(AltosLib.product_telebt))) - return true; + String name = device.toString(); + for (int i = 0; i < pair_programmed_devices.length; i++) { + if (name.startsWith(pair_programmed_devices[i])) + return true; + } } return false; } |