From 59add313e9cd584c6766f5b3802b0df82c6ca471 Mon Sep 17 00:00:00 2001 From: Felipe Herranz Date: Sat, 23 Jul 2016 13:41:35 +0200 Subject: [PATCH] added isSupported method --- .../com/felhr/usbserial/UsbSerialDevice.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/usbserial/src/main/java/com/felhr/usbserial/UsbSerialDevice.java b/usbserial/src/main/java/com/felhr/usbserial/UsbSerialDevice.java index bc48f82d..6eafa664 100644 --- a/usbserial/src/main/java/com/felhr/usbserial/UsbSerialDevice.java +++ b/usbserial/src/main/java/com/felhr/usbserial/UsbSerialDevice.java @@ -82,6 +82,25 @@ else if(isCdcDevice(device)) return null; } + public static boolean isSupported(UsbDevice device) + { + int vid = device.getVendorId(); + int pid = device.getProductId(); + + if(FTDISioIds.isDeviceSupported(vid, pid)) + return true; + else if(CP210xIds.isDeviceSupported(vid, pid)) + return true; + else if(PL2303Ids.isDeviceSupported(vid, pid)) + return true; + else if(CH34xIds.isDeviceSupported(vid, pid)) + return true; + else if(isCdcDevice(device)) + return true; + else + return false; + } + // Common Usb Serial Operations (I/O Asynchronous) @Override public abstract boolean open();