increase read timeout
This commit is contained in:
parent
f9df2be80f
commit
99dbb24067
|
@ -12,6 +12,7 @@ public class LedgerUSBChannel implements CardChannel {
|
|||
private static final int HID_BUFFER_SIZE = 64;
|
||||
private static final int LEDGER_DEFAULT_CHANNEL = 1;
|
||||
private static final int TAG_APDU = 0x05;
|
||||
private static final int READ_TIMEOUT = 20000;
|
||||
|
||||
private HidDevice hidDevice;
|
||||
|
||||
|
@ -44,7 +45,7 @@ public class LedgerUSBChannel implements CardChannel {
|
|||
byte[] responseData = null;
|
||||
|
||||
while ((responseData = unwrapResponseAPDU(response.toByteArray())) == null) {
|
||||
if (hidDevice.read(chunk, 500) < 0) {
|
||||
if (hidDevice.read(chunk, READ_TIMEOUT) < 0) {
|
||||
throw new IOException("Read failed");
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ public class LedgerUSBManager implements HidServicesListener {
|
|||
|
||||
private static final int VID = 0x2c97;
|
||||
private static final int PID = 0x0001;
|
||||
private static final int SCAN_INTERVAL_MS = 500;
|
||||
private static final int PAUSE_INTERVAL_MS = 5000;
|
||||
|
||||
private HidServices hidServices;
|
||||
private CardListener listener;
|
||||
|
@ -21,8 +23,8 @@ public class LedgerUSBManager implements HidServicesListener {
|
|||
|
||||
HidServicesSpecification hidServicesSpecification = new HidServicesSpecification();
|
||||
hidServicesSpecification.setAutoShutdown(true);
|
||||
hidServicesSpecification.setScanInterval(500);
|
||||
hidServicesSpecification.setPauseInterval(5000);
|
||||
hidServicesSpecification.setScanInterval(SCAN_INTERVAL_MS);
|
||||
hidServicesSpecification.setPauseInterval(PAUSE_INTERVAL_MS);
|
||||
hidServicesSpecification.setScanMode(ScanMode.SCAN_AT_FIXED_INTERVAL_WITH_PAUSE_AFTER_WRITE);
|
||||
|
||||
hidServices = HidManager.getHidServices(hidServicesSpecification);
|
||||
|
|
Loading…
Reference in New Issue