Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added SCARD_E_NO_SERVICE to renewContext #154

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added SCARD_E_NO_SERVICE calls renewContext
  • Loading branch information
mbokil committed Mar 27, 2023
commit 43e40b995dcc11014aeb3b285726d23b373ab0bd
2 changes: 1 addition & 1 deletion smartcard/pcsc/PCSCCardRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def getReaderNames(self):

# get inserted readers
hresult, pcscreaders = SCardListReaders(self.hcontext, [])
if SCARD_E_SERVICE_STOPPED == hresult:
if SCARD_E_SERVICE_STOPPED == hresult or SCARD_E_NO_SERVICE == hresult:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the syntax I proposed:

        elif hresult in (SCARD_E_SERVICE_STOPPED, SCARD_E_NO_SERVICE):

to avoid the hresult repetition.

self.hcontext = PCSCContext().renewContext()
hresult, pcscreaders = SCardListReaders(self.hcontext, [])
if SCARD_E_NO_READERS_AVAILABLE == hresult:
Expand Down