Skip to content

Commit

Permalink
Hardware keys: Fix PCSC daemon recovery on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
StarGate01 authored and droidmonkey committed Aug 11, 2024
1 parent 14619cb commit 672a9fe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/keys/drivers/YubiKeyInterfacePCSC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ namespace
rv = SCardListReaders(context, nullptr, nullptr, &dwReaders);
// On windows, USB hot-plugging causes the underlying API server to die
// So on every USB unplug event, the API context has to be recreated
if (rv == SCARD_E_SERVICE_STOPPED) {
// On Linux, restarting the pcsc daemon causes the API server to die as well
if (rv == SCARD_E_SERVICE_STOPPED || rv == SCARD_E_NO_SERVICE) {
// Dont care if the release works since the handle might be broken
SCardReleaseContext(context);
rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, nullptr, nullptr, &context);
Expand Down

0 comments on commit 672a9fe

Please sign in to comment.