X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=micropeak%2FMicroUSB.java;h=6ffdb6281ea82e0e9a14a68a588675c9101e7667;hp=d48610fe720a07d5e057931eb3e29389254455ad;hb=5b7ec0c69343db3793c0317939b5eff1f2d04752;hpb=65b512c890a3ccf487655b79305ab1cfcf49259c diff --git a/micropeak/MicroUSB.java b/micropeak/MicroUSB.java index d48610fe..6ffdb628 100644 --- a/micropeak/MicroUSB.java +++ b/micropeak/MicroUSB.java @@ -16,10 +16,13 @@ */ package org.altusmetrum.micropeak; + import java.util.*; import libaltosJNI.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; -public class MicroUSB extends altos_device { +public class MicroUSB extends altos_device implements AltosDevice { static boolean initialized = false; static boolean loaded_library = false; @@ -48,16 +51,16 @@ public class MicroUSB extends altos_device { String name = getName(); if (name == null) name = "Altus Metrum"; - return String.format("%-20.20s %4d %s", - name, getSerial(), getPath()); + return String.format("%-24.24s %s", + name, getPath()); } public String toShortString() { String name = getName(); if (name == null) name = "Altus Metrum"; - return String.format("%s %d %s", - name, getSerial(), getPath()); + return String.format("%s %s", + name, getPath()); } @@ -73,18 +76,25 @@ public class MicroUSB extends altos_device { } private boolean isMicro() { - if (getVendor() != 0x0403) - return false; - if (getProduct() != 0x6001) - return false; - return true; + int vid = getVendor(); + int pid = getProduct(); + if (vid == 0x0403 && pid == 0x6015) + return true; + if (vid == AltosLib.vendor_altusmetrum && + pid == AltosLib.product_mpusb) + return true; + return false; + } + + public boolean matchProduct(int product) { + return isMicro(); } static java.util.List list() { if (!load_library()) return null; - SWIGTYPE_p_altos_list list = libaltos.altos_list_start(); + SWIGTYPE_p_altos_list list = libaltos.altos_ftdi_list_start(); ArrayList device_list = new ArrayList(); if (list != null) { @@ -100,4 +110,4 @@ public class MicroUSB extends altos_device { return device_list; } -} \ No newline at end of file +}