returning a 0 length array when position -1

pull/137/head
Felipe Herranz 2018-01-04 13:10:05 +01:00
rodzic 09a3f869ec
commit e9d27bbba0
4 zmienionych plików z 6 dodań i 4 usunięć

Wyświetl plik

@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.android.tools.build:gradle:2.2.3'
}
}

Wyświetl plik

@ -149,7 +149,7 @@ public class SerialBuffer
e.printStackTrace();
}
}
if(position <= -1 ) return new byte[DEFAULT_READ_BUFFER_SIZE];
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);
}
}