From ba285ecf51e317917858740504a7d691b9839588 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 22 Aug 2018 17:43:17 -0700 Subject: [PATCH] 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 --- altosuilib/AltosUSBDevice.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) { -- 2.30.2