altosuilib: Show a more useful message when the flash target device is unknown
[fw/altos] / altosuilib / AltosUSBDevice.java
index 221ac829727715c08d02b10d4f47c48fb9ecddb2..16a0e7709dd5be7c3793bd3eb42c86c481164d6c 100644 (file)
@@ -16,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altosuilib_11;
+package org.altusmetrum.altosuilib_13;
 
 import java.util.*;
 import libaltosJNI.*;
@@ -94,6 +94,23 @@ public class AltosUSBDevice  extends altos_device implements AltosDevice {
                return false;
        }
 
+       public int hashCode() {
+               return getVendor() ^ getProduct() ^ getSerial();
+       }
+
+       public boolean equals(Object o) {
+               if (o == null)
+                       return false;
+
+               if (!(o instanceof AltosUSBDevice))
+                       return false;
+               AltosUSBDevice other = (AltosUSBDevice) o;
+
+               return getVendor() == other.getVendor() &&
+                       getProduct() == other.getProduct() &&
+                       getSerial() == other.getSerial();
+       }
+
        static public java.util.List<AltosDevice> list(int product) {
                if (!AltosUILib.load_library())
                        return null;