]> sigrok.org Git - sigrok-androidutils.git/commitdiff
Revert "Parse vendor-id and product-id as hexadecimal values"
authorMarcus Comstedt <redacted>
Fri, 12 May 2017 09:02:32 +0000 (11:02 +0200)
committerMarcus Comstedt <redacted>
Fri, 12 May 2017 09:02:32 +0000 (11:02 +0200)
This reverts commit 2606541de1a91657c0001c0ea573d537069e2332.

The usb-device tag is defined by Android and putting hexadecimal
values into it breaks compatibility which means that the XML can
not be used as a device filter in AndroidManifest.xml as intended.

src/org/sigrok/androidutils/UsbSupplicant.java

index eaec3d69c1b2d3ca673a0b6d337a44ba01e8aff2..0f219a87c932c2dbc7466762b1865c0dea00b3da 100644 (file)
@@ -106,7 +106,7 @@ public class UsbSupplicant
                        for (int i = 0; i < count; i++) {
                                String name = parser.getAttributeName(i);
                                // All attribute values are ints
-                               int value = parseAttribute(name, parser.getAttributeValue(i));
+                               int value = Integer.parseInt(parser.getAttributeValue(i));
 
                                if ("vendor-id".equals(name)) {
                                        vendorId = value;
@@ -124,14 +124,6 @@ public class UsbSupplicant
                                        deviceClass, deviceSubclass, deviceProtocol);
                }
 
-               private static int parseAttribute(String name, String value) {
-                       // vendor-id and product-id are in hexadecimal format.
-                       if ("vendor-id".equals(name) || "product-id".equals(name))
-                               return Integer.parseInt(value, 16);
-                       else
-                               return Integer.parseInt(value);
-               }
-
                private boolean matches(int clasz, int subclass, int protocol) {
                        return ((mClass == -1 || clasz == mClass) &&
                                        (mSubclass == -1 || subclass == mSubclass) &&