From 3380ce4e13a3f67e6efe7e0677804c0b878e447e Mon Sep 17 00:00:00 2001 From: Michael Lasevich Date: Fri, 27 Jul 2018 11:23:43 -0700 Subject: [PATCH] Change a single hardcoded FTDI USB Product ID to a list. --- .../android/AndroidXBeeInterface.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/library/src/main/java/com/digi/xbee/api/connection/android/AndroidXBeeInterface.java b/library/src/main/java/com/digi/xbee/api/connection/android/AndroidXBeeInterface.java index ccee6199..01e4c78f 100644 --- a/library/src/main/java/com/digi/xbee/api/connection/android/AndroidXBeeInterface.java +++ b/library/src/main/java/com/digi/xbee/api/connection/android/AndroidXBeeInterface.java @@ -48,7 +48,15 @@ public class AndroidXBeeInterface implements IConnectionInterface { // Constants. private static final int VID = 0x0403; - private static final int PID = 0x6001; + private static final int[] FTDI_PIDS = { + 0x6001, // FT232 and FT245 + //0x6010, // FT2232 + //0x6011, // FT4232 + //0x6014, // FT232H + 0x6015, // FT-X series + //0x601C, //FT4222H + }; + private static final int BASE_CLOCK = 48000000; private static final String ACTION_USB_PERMISSION = "com.android.example.USB_PERMISSION"; @@ -387,9 +395,16 @@ private UsbDevice findDevice() { UsbDevice usbDevice = null; HashMap deviceList = usbManager.getDeviceList(); for (UsbDevice device:deviceList.values()) { - if ((device.getProductId() == PID) && (device.getVendorId() == VID)) { - usbDevice = device; - logger.info("USB XBee Android device found: " + usbDevice.getDeviceName()); + if (device.getVendorId() == VID) { + for (int pid:FTDI_PIDS) { + if (device.getProductId() == pid) { + usbDevice = device; + logger.info("USB XBee Android device found: " + usbDevice.getDeviceName()); + break; + } + } + } + if (usbDevice != null) { break; } }