Skip to content

Commit

Permalink
added isSupported method
Browse files Browse the repository at this point in the history
  • Loading branch information
felHR85 committed Jul 23, 2016
1 parent 19f7773 commit 59add31
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions usbserial/src/main/java/com/felhr/usbserial/UsbSerialDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 59add31

Please sign in to comment.