diff options
author | Keith Packard <keithp@keithp.com> | 2010-04-06 00:58:00 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-04-06 00:58:00 -0700 |
commit | 10330d23518c94a8b791193a97a6cc07b1c9a97c (patch) | |
tree | 3d59f455337e2ae99b73f5d6bc3686228c7e69be /ao-tools/altosui/AltosDeviceLinux.java | |
parent | 9e10e43eff9de3f034da49c4f88728fb933f5035 (diff) |
Enable telemetry monitoring
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/altosui/AltosDeviceLinux.java')
-rw-r--r-- | ao-tools/altosui/AltosDeviceLinux.java | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/ao-tools/altosui/AltosDeviceLinux.java b/ao-tools/altosui/AltosDeviceLinux.java index b7774627..ffc70aff 100644 --- a/ao-tools/altosui/AltosDeviceLinux.java +++ b/ao-tools/altosui/AltosDeviceLinux.java @@ -19,8 +19,6 @@ package altosui; import java.lang.*; import java.io.*; import java.util.*; -import altosui.AltosDeviceName; -import altosui.AltosDeviceNameLinux; import altosui.AltosDevice; public class AltosDeviceLinux extends AltosDevice { @@ -120,7 +118,7 @@ public class AltosDeviceLinux extends AltosDevice { } public String toString() { - return manufacturer + " " + product + " " + serial + " " + idProduct + " " + idVendor + " " + tty; + return String.format("%-20s %6d %-15s", product, serial, tty == null ? "" : tty); } static public AltosDeviceLinux[] list() { LinkedList<AltosDeviceLinux> devices = new LinkedList<AltosDeviceLinux>(); @@ -152,20 +150,23 @@ public class AltosDeviceLinux extends AltosDevice { } } AltosDeviceLinux[] foo = new AltosDeviceLinux[devices.size()]; - for (int e = 0; e < devices.size(); e++) { + for (int e = 0; e < devices.size(); e++) foo[e] = devices.get(e); - System.out.println("Device " + foo[e]); - } return foo; } static public AltosDeviceLinux[] list(String model) { AltosDeviceLinux[] devices = list(); - LinkedList<AltosDeviceLinux> subset = new LinkedList<AltosDeviceLinux>(); - for (int i = 0; i < devices.length; i++) { - if (devices[i].product.startsWith(model)) - subset.add(devices[i]); + if (model != null) { + LinkedList<AltosDeviceLinux> subset = new LinkedList<AltosDeviceLinux>(); + for (int i = 0; i < devices.length; i++) { + if (devices[i].product.startsWith(model)) + subset.add(devices[i]); + } + devices = new AltosDeviceLinux[subset.size()]; + for (int e = 0; e < subset.size(); e++) + devices[e] = subset.get(e); } - return (AltosDeviceLinux[]) subset.toArray(); + return devices; } } |