pull/145/head
Felipe Herranz 2018-01-14 16:31:14 +01:00
commit 35cb3ea98e
13 zmienionych plików z 27 dodań i 23 usunięć

Wyświetl plik

@ -1,9 +1,11 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.android.tools.build:gradle:3.0.1'
}
}

Wyświetl plik

@ -3,7 +3,6 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
applicationId "com.felhr.serialportexample"
@ -21,9 +20,9 @@ android {
}
dependencies {
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
implementation 'com.android.support:support-v4:23.1.1'
implementation 'com.android.support:appcompat-v7:23.1.1'
implementation 'com.android.support:design:23.1.1'
compile project(':usbserial')
implementation project(':usbserial')
}

Wyświetl plik

@ -180,7 +180,8 @@ public class UsbService extends Service {
int deviceVID = device.getVendorId();
int devicePID = device.getProductId();
if (deviceVID != 0x1d6b && (devicePID != 0x0001 && devicePID != 0x0002 && devicePID != 0x0003)) {
if (deviceVID != 0x1d6b && (devicePID != 0x0001 && devicePID != 0x0002 && devicePID != 0x0003) && deviceVID != 0x5c6 && devicePID != 0x904c) {
// There is a device connected to our Android device. Try to open it as a Serial Port.
requestUserPermission();
keep = false;

Wyświetl plik

@ -3,7 +3,6 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
applicationId "com.felhr.serialportexamplesync"
@ -21,9 +20,9 @@ android {
}
dependencies {
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
implementation 'com.android.support:support-v4:23.1.1'
implementation 'com.android.support:appcompat-v7:23.1.1'
implementation 'com.android.support:design:23.1.1'
compile project(':usbserial')
implementation project(':usbserial')
}

Wyświetl plik

@ -1,7 +1,5 @@
VERSION_NAME=1.0
VERSION_CODE=1
ANDROID_BUILD_MIN_SDK_VERSION=12
ANDROID_BUILD_TARGET_SDK_VERSION=23
ANDROID_BUILD_SDK_VERSION=23
ANDROID_BUILD_TOOLS_VERSION=23.0.2
ANDROID_BUILD_TARGET_SDK_VERSION=27
ANDROID_BUILD_SDK_VERSION=27

Wyświetl plik

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

0
gradlew vendored 100644 → 100755
Wyświetl plik

Wyświetl plik

@ -6,7 +6,6 @@ android {
version = '1.0.0'
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
compileOptions {
encoding "UTF-8"
@ -20,12 +19,12 @@ android {
}
//noinspection GroovyAssignabilityCheck
task deleteJar(type: org.gradle.api.tasks.Delete){
task deleteJar(type: org.gradle.api.tasks.Delete) {
delete 'eclipse_lib/usbserial.jar'
}
//noinspection GroovyAssignabilityCheck
task createJar(type: org.gradle.api.tasks.Copy){
task createJar(type: org.gradle.api.tasks.Copy) {
from('build/intermediates/bundles/release/')
into('eclipse_lib/')
include('classes.jar')

Wyświetl plik

@ -555,6 +555,7 @@ public class FTDISioIds
new ConcreteDevice(0x05d1, 0x9006),
new ConcreteDevice(0x05d1, 0x9007),
new ConcreteDevice(0x05d1, 0x9008),
new ConcreteDevice(0x0403, 0x0), //fake FTDI reprogrammed by driver
};
public static boolean isDeviceSupported(int vendorId, int productId)

Wyświetl plik

@ -11,7 +11,8 @@ public class XdcVcpIds
private static final ConcreteDevice[] xdcvcpDevices = new ConcreteDevice[]
{
new ConcreteDevice(0x264D, 0x0232), // VCP (Virtual Com Port)
new ConcreteDevice(0x264D, 0x0120) // USI (Universal Sensor Interface)
new ConcreteDevice(0x264D, 0x0120), // USI (Universal Sensor Interface)
new ConcreteDevice(0x0483, 0x5740) //CC3D (STM)
};
public static boolean isDeviceSupported(int vendorId, int productId)

Wyświetl plik

@ -118,6 +118,7 @@ public class SerialBuffer
public synchronized void put(byte[] src)
{
if(src == null || src.length == 0) return;
if(position == -1)
position = 0;
if(debugging)
@ -148,6 +149,7 @@ public class SerialBuffer
e.printStackTrace();
}
}
if(position <= -1 ) return new byte[0];
byte[] dst = Arrays.copyOfRange(buffer, 0, position);
if(debugging)
UsbSerialDebugger.printLogGet(dst, true);

Wyświetl plik

@ -304,7 +304,8 @@ public abstract class UsbSerialDevice implements UsbSerialInterface
while(working.get())
{
byte[] data = serialBuffer.getWriteBuffer();
connection.bulkTransfer(outEndpoint, data, data.length, USB_TIMEOUT);
if(data.length > 0)
connection.bulkTransfer(outEndpoint, data, data.length, USB_TIMEOUT);
}
}

Wyświetl plik

@ -99,7 +99,8 @@ public abstract class UsbSpiDevice implements UsbSpiInterface
while(working.get())
{
byte[] data = serialBuffer.getWriteBuffer();
connection.bulkTransfer(outEndpoint, data, data.length, USB_TIMEOUT);
if(data.length > 0)
connection.bulkTransfer(outEndpoint, data, data.length, USB_TIMEOUT);
}
}