From 3fd18f5ff11a0efffa8a1a2a672351dd6da63d39 Mon Sep 17 00:00:00 2001 From: Michele Balistreri Date: Tue, 16 Aug 2022 07:03:53 +0200 Subject: [PATCH] add 500ms sleep on card unreadable --- keycard_context.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/keycard_context.go b/keycard_context.go index 13d9c81..8e0a471 100644 --- a/keycard_context.go +++ b/keycard_context.go @@ -3,6 +3,7 @@ package statuskeycardgo import ( "crypto/sha512" "fmt" + "time" "github.com/ebfe/scard" "github.com/ethereum/go-ethereum/crypto" @@ -111,6 +112,7 @@ func (kc *keycardContext) run() { // error connecting to card l(err.Error()) kc.runErr = err + time.Sleep(500 * time.Millisecond) close(kc.connected) _ = kc.cardCtx.Release() return @@ -118,7 +120,9 @@ func (kc *keycardContext) run() { status, err := card.Status() if err != nil { + l(err.Error()) kc.runErr = err + time.Sleep(500 * time.Millisecond) close(kc.connected) _ = kc.cardCtx.Release() return