diff options
-rw-r--r-- | NitrokeyManager.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index b3c92a1..162ad93 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -136,11 +136,18 @@ using nitrokey::misc::strcpyT; try{ if (d->connect()){ device = d; - const auto status = get_status_storage(); - const auto sc_id = status.ActiveSmartCardID_u32; - const auto sd_id = status.ActiveSD_CardID_u32; + std::string id; + try { + const auto status = get_status_storage(); + const auto sc_id = status.ActiveSmartCardID_u32; + const auto sd_id = status.ActiveSD_CardID_u32; + id = std::to_string(sc_id) + ":" + std::to_string(sd_id); + } + catch (const LongOperationInProgressException &e) { + LOGD1(std::string("Long operation in progress, setting ID to: ") + p); + id = p; + } - auto id = std::to_string(sc_id) + ":" + std::to_string(sd_id); connected_devices_byID[id] = d; res.push_back(id); LOGD1( std::string("Found: ") + p + " => " + id); @@ -173,6 +180,9 @@ using nitrokey::misc::strcpyT; try{ get_status(); } + catch (const LongOperationInProgressException &){ + //ignore + } catch (const DeviceCommunicationException &){ d->disconnect(); connected_devices_byID[id] = nullptr; |