From 48e221cca00c9f925ff57588dd782842705f7a23 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 20 Oct 2018 17:29:36 -0700 Subject: altoslib: When flashing hardware, pull USB data from device if needed If we fail to extract USB vid/pid and product values from the device ROM, use the data discovered over USB when the device was originally discovered. Also, use the USB product to select appropriate .ihx files instead of only using the USB vid/pid. This will help people avoid using the wrong file when reflashing devices. Signed-off-by: Keith Packard --- altosuilib/AltosUSBDevice.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'altosuilib/AltosUSBDevice.java') diff --git a/altosuilib/AltosUSBDevice.java b/altosuilib/AltosUSBDevice.java index f43d6bef..e4b94eea 100644 --- a/altosuilib/AltosUSBDevice.java +++ b/altosuilib/AltosUSBDevice.java @@ -20,6 +20,7 @@ package org.altusmetrum.altosuilib_13; import java.util.*; import libaltosJNI.*; +import org.altusmetrum.altoslib_13.*; public class AltosUSBDevice extends altos_device implements AltosDevice { @@ -98,6 +99,14 @@ public class AltosUSBDevice extends altos_device implements AltosDevice { return getVendor() ^ getProduct() ^ getSerial() ^ getPath().hashCode(); } + public AltosUsbId usb_id() { + return new AltosUsbId(getVendor(), getProduct()); + } + + public String usb_product() { + return getName(); + } + public boolean equals(Object o) { if (o == null) return false; -- cgit v1.2.3