Skip to content

Commit

Permalink
PCSCCardRequest: add hack for Windows
Browse files Browse the repository at this point in the history
On Windows, when the last reader is disconnected the application gets
SCARD_E_SYSTEM_CANCELLED or SCARD_E_NO_SERVICE errors.
  • Loading branch information
LudovicRousseau committed Oct 20, 2024
1 parent ce01504 commit 770a11a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/smartcard/pcsc/PCSCCardRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ def waitforcard(self):
elif SCARD_E_UNKNOWN_READER == hresult:
pass

# this happens on Windows when the last reader is disconnected
elif hresult in (SCARD_E_SYSTEM_CANCELLED, SCARD_E_NO_SERVICE):
pass

# some error happened
elif SCARD_S_SUCCESS != hresult:
raise CardRequestException(
Expand Down Expand Up @@ -381,6 +385,10 @@ def waitforcardevent(self):
elif SCARD_E_UNKNOWN_READER == hresult:
pass

# this happens on Windows when the last reader is disconnected
elif hresult in (SCARD_E_SYSTEM_CANCELLED, SCARD_E_NO_SERVICE):
pass

# some error happened
elif SCARD_S_SUCCESS != hresult:
raise CardRequestException(
Expand Down

0 comments on commit 770a11a

Please sign in to comment.