X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Faltosui%2FAltosDeviceLinux.java;h=ffc70aff7a2f70535b38319dc5032b266997b7c3;hp=b777462780f0cf089d2b35eeda3375cae26ad3a5;hb=10330d23518c94a8b791193a97a6cc07b1c9a97c;hpb=9e10e43eff9de3f034da49c4f88728fb933f5035 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 devices = new LinkedList(); @@ -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 subset = new LinkedList(); - for (int i = 0; i < devices.length; i++) { - if (devices[i].product.startsWith(model)) - subset.add(devices[i]); + if (model != null) { + LinkedList subset = new LinkedList(); + 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; } }