diff options
author | Keith Packard <keithp@keithp.com> | 2018-08-22 17:43:17 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2018-08-22 17:43:17 -0700 |
commit | ba285ecf51e317917858740504a7d691b9839588 (patch) | |
tree | c1b7fbb03eaebf7bdef8fd81ee11c06dfeafe8f2 | |
parent | 378ebab2e70917b4182cbd840a3fa66e4e42fd92 (diff) |
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 <keithp@keithp.com>
-rw-r--r-- | altosuilib/AltosUSBDevice.java | 5 |
1 files 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<AltosDevice> list(int product) { |