Skip to content

Commit

Permalink
FTDI driver tested
Browse files Browse the repository at this point in the history
  • Loading branch information
felHR85 committed May 28, 2014
1 parent a53e715 commit 8932506
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 17 deletions.
Binary file not shown.
Binary file modified bin/classes/com/felhr/usbserial/UsbSerialDevice$WorkerThread.class
Binary file not shown.
Binary file not shown.
Binary file modified bin/classes/com/felhr/usbserial/UsbSerialDevice.class
Binary file not shown.
Binary file modified bin/usbserial.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions src/com/felhr/usbserial/FTDISerialDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ private static void copyData(byte[] src, byte[] dst)
int j = 0; // dst index
while(i <= src.length-1)
{
if(i != 0 || i != 1)
if(i != 0 && i != 1)
{
if(i % 64 == 0 && i >= 64)
{
{
i += 2;
}else
{
Expand Down
21 changes: 6 additions & 15 deletions src/com/felhr/usbserial/UsbSerialDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,12 @@ public void run()
// FTDI devices reserves two first bytes of an IN endpoint with info about
// modem and Line.
if(isFTDIDevice())
{
Log.i(CLASS_ID, String.valueOf(data.length));
byte[] data2 = FTDISerialDevice.FTDIUtilities.adaptArray(data);
// Clear buffer and execute the callback
serialBuffer.clearReadBuffer();
onReceivedData(data2);
requestIN.queue(serialBuffer.getReadBuffer(), SerialBuffer.DEFAULT_READ_BUFFER_SIZE);

}else
{
// Clear buffer and execute the callback
serialBuffer.clearReadBuffer();
onReceivedData(data);
requestIN.queue(serialBuffer.getReadBuffer(), SerialBuffer.DEFAULT_READ_BUFFER_SIZE);
}
data = FTDISerialDevice.FTDIUtilities.adaptArray(data);

// Clear buffer, execute the callback and queue another request
serialBuffer.clearReadBuffer();
onReceivedData(data);
requestIN.queue(serialBuffer.getReadBuffer(), SerialBuffer.DEFAULT_READ_BUFFER_SIZE);
}
}
}
Expand Down

0 comments on commit 8932506

Please sign in to comment.