From: Marcus Comstedt Date: Fri, 12 May 2017 09:02:32 +0000 (+0200) Subject: Revert "Parse vendor-id and product-id as hexadecimal values" X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=59030d50c52c499c02883acb44eb402e7248c0dc;p=sigrok-androidutils.git Revert "Parse vendor-id and product-id as hexadecimal values" 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. --- diff --git a/src/org/sigrok/androidutils/UsbSupplicant.java b/src/org/sigrok/androidutils/UsbSupplicant.java index eaec3d6..0f219a8 100644 --- a/src/org/sigrok/androidutils/UsbSupplicant.java +++ b/src/org/sigrok/androidutils/UsbSupplicant.java @@ -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) &&