added CH341A support

pull/297/head
kai-morich 2020-06-19 18:20:05 +02:00
rodzic 3e7fd9a748
commit 06d1041738
4 zmienionych plików z 13 dodań i 11 usunięć

Wyświetl plik

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 0x0403 FTDI -->
<!-- 0x0403 / 0x60??: FTDI -->
<usb-device vendor-id="1027" product-id="24577" /> <!-- 0x6001: FT232R -->
<usb-device vendor-id="1027" product-id="24592" /> <!-- 0x6010: FT2232H -->
<usb-device vendor-id="1027" product-id="24593" /> <!-- 0x6011: FT4232H -->
<usb-device vendor-id="1027" product-id="24596" /> <!-- 0x6014: FT232H -->
<usb-device vendor-id="1027" product-id="24597" /> <!-- 0x6015: FT231X -->
<!-- 0x10C4 / 0xEAxx: Silabs CP210x -->
<!-- 0x10C4 / 0xEA??: Silabs CP210x -->
<usb-device vendor-id="4292" product-id="60000" /> <!-- 0xea60: CP2102 -->
<usb-device vendor-id="4292" product-id="60016" /> <!-- 0xea70: CP2105 -->
<usb-device vendor-id="4292" product-id="60017" /> <!-- 0xea71: CP2108 -->
@ -16,8 +16,9 @@
<!-- 0x067B / 0x2303: Prolific PL2303 -->
<usb-device vendor-id="1659" product-id="8963" />
<!-- 0x1a86 / 0x7523: Qinheng CH340 -->
<usb-device vendor-id="6790" product-id="29987" />
<!-- 0x1a86 / 0x?523: Qinheng CH34x -->
<usb-device vendor-id="6790" product-id="21795" /> <!-- 0x5523: CH341A -->
<usb-device vendor-id="6790" product-id="29987" /> <!-- 0x7523: CH340 -->
<!-- CDC driver -->
<usb-device vendor-id="9025" /> <!-- 0x2341 / ......: Arduino -->

Wyświetl plik

@ -18,7 +18,7 @@ android {
}
dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'commons-net:commons-net:3.6'

Wyświetl plik

@ -181,8 +181,7 @@ public class Ch34xSerialDriver implements UsbSerialDriver {
throw new IOException("Init failed: #5");
}
checkState("init #6", 0x95, 0x0706, new int[]{-1/*0xf?*/, 0xee});
checkState("init #6", 0x95, 0x0706, new int[]{-1/*0xf?*/, -1/*0xec,0xee*/});
if (controlOut(0xa1, 0x501f, 0xd90a) < 0) {
throw new IOException("Init failed: #7");
@ -192,7 +191,7 @@ public class Ch34xSerialDriver implements UsbSerialDriver {
writeHandshakeByte();
checkState("init #10", 0x95, 0x0706, new int[]{-1/* 0x9f, 0xff*/, 0xee});
checkState("init #10", 0x95, 0x0706, new int[]{-1/* 0x9f, 0xff*/, -1/*0xec,0xee*/});
}
@ -213,7 +212,7 @@ public class Ch34xSerialDriver implements UsbSerialDriver {
}
factor = 0x10000 - factor;
divisor |= 0x0080; // else ch341a waits until buffer full
int ret = controlOut(0x9a, 0x1312, (int) ((factor & 0xff00) | divisor));
if (ret < 0) {
throw new IOException("Error setting baud rate: #1)");
@ -335,7 +334,8 @@ public class Ch34xSerialDriver implements UsbSerialDriver {
public static Map<Integer, int[]> getSupportedDevices() {
final Map<Integer, int[]> supportedDevices = new LinkedHashMap<Integer, int[]>();
supportedDevices.put(UsbId.VENDOR_QINHENG, new int[]{
UsbId.QINHENG_HL340
UsbId.QINHENG_CH340,
UsbId.QINHENG_CH341A,
});
return supportedDevices;
}

Wyświetl plik

@ -69,7 +69,8 @@ public final class UsbId {
public static final int PROLIFIC_PL2303 = 0x2303;
public static final int VENDOR_QINHENG = 0x1a86;
public static final int QINHENG_HL340 = 0x7523;
public static final int QINHENG_CH340 = 0x7523;
public static final int QINHENG_CH341A = 0x5523;
// at www.linux-usb.org/usb.ids listed for NXP/LPC1768, but all processors supported by ARM mbed DAPLink firmware report these ids
public static final int VENDOR_ARM = 0x0d28;