usb-serial-for-android: add PID/VIDs

Signed-off-by: Christof Arnosti <charno@charno.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Christof Arnosti 2020-03-06 15:03:13 +01:00 committed by Dirk Hohndel
parent 6e38f85ba7
commit debc7ae1f2
2 changed files with 44 additions and 8 deletions

View file

@ -1,11 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- FTDI Chips -->
<!-- (Smart Interface), Heinrichs Weikamp -->
<!-- FTDI_FT232R -->
<usb-device vendor-id="0x0403" product-id="0x6001"/>
<!-- FTDI_FT2232H -->
<usb-device vendor-id="0x0403" product-id="0x6010"/>
<!-- FTDI_FT4232H -->
<usb-device vendor-id="0x0403" product-id="0x6011"/>
<!-- May be Aqualung custom PID? -->
<!--FTDI_FT232H -->
<usb-device vendor-id="0x0403" product-id="0x6014"/>
<!--FTDI_FT231X -->
<usb-device vendor-id="0x0403" product-id="0x6015"/>
<!-- Oceanic Custom PID -->
<usb-device vendor-id="0x0403" product-id="0xf460"/>
@ -13,6 +17,8 @@
<usb-device vendor-id="0x0403" product-id="0xf680"/>
<!-- Cressi (Leonardo) Custom PID -->
<usb-device vendor-id="0x0403" product-id="0x87d0"/>
<!-- Mares Icon HD Custom PID -->
<usb-device vendor-id="0xFFFF" product-id="0x0005"/>
<!-- USB devices -->
<!-- EON Steel -->
@ -27,4 +33,28 @@
<usb-device vendor-id="0xc251" product-id="0x2006"/>
<!-- Atomics Aquatics Cobalt -->
<usb-device vendor-id="0x0471" product-id="0x0888"/>
</resources>
<!-- devices supported by usb-serial-for-android which aren't included in FTDI chips -->
<!-- Don't support Arduino / Teensyduino / Leaflabs Maple -->
<!-- SiLabs CP2102 -->
<usb-device vendor-id="0x10c4" product-id="0xea60"/>
<!-- SiLabs CP2105 -->
<usb-device vendor-id="0x10c4" product-id="0xea70"/>
<!-- SiLabs CP2108 -->
<usb-device vendor-id="0x10c4" product-id="0xea71"/>
<!-- SiLabs CP2110 -->
<usb-device vendor-id="0x10c4" product-id="0xea80"/>
<!-- PROLIFIC_PL2303 -->
<usb-device vendor-id="0x067b" product-id="0x2303"/>
<usb-device vendor-id="0x04B8" product-id="0x0521"/>
<usb-device vendor-id="0x04B8" product-id="0x0522"/>
<!-- QINHENG_HL340 -->
<usb-device vendor-id="0x1a86" product-id="0x7523"/>
<!-- ARM mBed (possibly not used) -->
<usb-device vendor-id="0x0d28" product-id="0x0204"/>
</resources>

View file

@ -1,8 +1,6 @@
package org.subsurfacedivelog.mobile;
import com.hoho.android.usbserial.driver.UsbSerialDriver;
import com.hoho.android.usbserial.driver.UsbSerialPort;
import com.hoho.android.usbserial.driver.UsbSerialProber;
import com.hoho.android.usbserial.driver.*;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbManager;
@ -91,9 +89,17 @@ public class AndroidSerial {
// Find all available drivers from attached devices.
Context context = SubsurfaceMobileActivity.getAppContext();
UsbManager manager = (UsbManager) context.getSystemService(Context.USB_SERVICE);
UsbSerialProber usbSerialProber = UsbSerialProber.getDefaultProber();
ProbeTable usbSerialProbetable = UsbSerialProber.getDefaultProbeTable();
// TODO attach custom VID / PID / Drivers
usbSerialProbetable.addProduct(0x0403, 0xf460, FtdiSerialDriver.class); // Oceanic Custom PID
usbSerialProbetable.addProduct(0x0403, 0xf680, FtdiSerialDriver.class); // Suunto Custom PID
usbSerialProbetable.addProduct(0x0403, 0x87d0, FtdiSerialDriver.class); // Cressi (Leonardo) Custom PID
usbSerialProbetable.addProduct(0x04B8, 0x0521, ProlificSerialDriver.class); // Mares (Nemo Sport) / Cressi Custom PID
usbSerialProbetable.addProduct(0x04B8, 0x0521, ProlificSerialDriver.class); // Zeagle Custom PID
usbSerialProbetable.addProduct(0xFFFF, 0x0005, CdcAcmSerialDriver.class); // Mares Icon HD Custom PID
UsbSerialProber usbSerialProber = new UsbSerialProber(usbSerialProbetable);
List<UsbSerialDriver> availableDrivers = usbSerialProber.findAllDrivers(manager);
if (availableDrivers.isEmpty()) {