mirror of
https://github.com/mik3y/usb-serial-for-android.git
synced 2026-08-15 10:22:56 +00:00
more configurable debug log, disabled by default (#389)
This commit is contained in:
+4
-1
@@ -26,6 +26,7 @@ import java.util.EnumSet;
|
||||
public abstract class CommonUsbSerialPort implements UsbSerialPort {
|
||||
|
||||
private static final String TAG = CommonUsbSerialPort.class.getSimpleName();
|
||||
public static boolean DEBUG = false;
|
||||
private static final int DEFAULT_WRITE_BUFFER_SIZE = 16 * 1024;
|
||||
private static final int MAX_READ_SIZE = 16 * 1024; // = old bulkTransfer limit
|
||||
|
||||
@@ -238,7 +239,9 @@ public abstract class CommonUsbSerialPort implements UsbSerialPort {
|
||||
actualLength = mConnection.bulkTransfer(mWriteEndpoint, writeBuffer, requestLength, requestTimeout);
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "Wrote " + actualLength + "/" + requestLength + " offset " + offset + "/" + src.length + " timeout " + requestTimeout);
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Wrote " + actualLength + "/" + requestLength + " offset " + offset + "/" + src.length + " timeout " + requestTimeout);
|
||||
}
|
||||
if (actualLength <= 0) {
|
||||
if (timeout != 0 && MonotonicClock.millis() >= endTime) {
|
||||
SerialTimeoutException ex = new SerialTimeoutException("Error writing " + requestLength + " bytes at offset " + offset + " of total " + src.length + ", rc=" + actualLength);
|
||||
|
||||
+3
-1
@@ -223,7 +223,9 @@ public class SerialInputOutputManager implements Runnable {
|
||||
}
|
||||
int len = mSerialPort.read(buffer, mReadTimeout);
|
||||
if (len > 0) {
|
||||
if (DEBUG) Log.d(TAG, "Read data len=" + len);
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Read data len=" + len);
|
||||
}
|
||||
final Listener listener = getListener();
|
||||
if (listener != null) {
|
||||
final byte[] data = new byte[len];
|
||||
|
||||
Reference in New Issue
Block a user