mirror of
https://github.com/mik3y/usb-serial-for-android
synced 2025-06-08 00:16:13 +00:00
Rewind output buffer before copying.
This commit is contained in:
parent
3f271aab81
commit
f35468e0f8
@ -20,14 +20,14 @@
|
|||||||
|
|
||||||
package com.hoho.android.usbserial.util;
|
package com.hoho.android.usbserial.util;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
|
|
||||||
import android.hardware.usb.UsbRequest;
|
import android.hardware.usb.UsbRequest;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.hoho.android.usbserial.driver.UsbSerialDriver;
|
import com.hoho.android.usbserial.driver.UsbSerialDriver;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class which services a {@link UsbSerialDriver} in its {@link #run()}
|
* Utility class which services a {@link UsbSerialDriver} in its {@link #run()}
|
||||||
* method.
|
* method.
|
||||||
@ -173,6 +173,7 @@ public class SerialInputOutputManager implements Runnable {
|
|||||||
if (mWriteBuffer.position() > 0) {
|
if (mWriteBuffer.position() > 0) {
|
||||||
len = mWriteBuffer.position();
|
len = mWriteBuffer.position();
|
||||||
outBuff = new byte[len];
|
outBuff = new byte[len];
|
||||||
|
mWriteBuffer.rewind();
|
||||||
mWriteBuffer.get(outBuff, 0, len);
|
mWriteBuffer.get(outBuff, 0, len);
|
||||||
mWriteBuffer.clear();
|
mWriteBuffer.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user