From: Keith Packard Date: Thu, 23 Aug 2018 00:43:17 +0000 (-0700) Subject: altosuilib: Include device path in equals test of AltosUSBDevice X-Git-Tag: 1.8.7~3^2~53 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=ba285ecf51e317917858740504a7d691b9839588;ds=sidebyside altosuilib: Include device path in equals test of AltosUSBDevice Ensure that multiple AltosFlash devices don't appear the same; they all use serial number 1. Signed-off-by: Keith Packard --- diff --git a/altosuilib/AltosUSBDevice.java b/altosuilib/AltosUSBDevice.java index 16a0e770..f43d6bef 100644 --- a/altosuilib/AltosUSBDevice.java +++ b/altosuilib/AltosUSBDevice.java @@ -95,7 +95,7 @@ public class AltosUSBDevice extends altos_device implements AltosDevice { } public int hashCode() { - return getVendor() ^ getProduct() ^ getSerial(); + return getVendor() ^ getProduct() ^ getSerial() ^ getPath().hashCode(); } public boolean equals(Object o) { @@ -108,7 +108,8 @@ public class AltosUSBDevice extends altos_device implements AltosDevice { return getVendor() == other.getVendor() && getProduct() == other.getProduct() && - getSerial() == other.getSerial(); + getSerial() == other.getSerial() && + getPath().equals(other.getPath()); } static public java.util.List list(int product) {