LudovicRousseau / pyscard

pyscard smartcard library for python
http://pyscard.sourceforge.net/
GNU Lesser General Public License v2.1
396 stars 113 forks source link

smartcard.reader.ReaderFactory.ReaderFactory.readers(groups) is giving the empty list #125

Closed kalyank23 closed 1 year ago

kalyank23 commented 2 years ago

Your system information

Please describe your issue in as much detail as possible:

Describe what you expected should happen. "smartcard.reader.ReaderFactory.ReaderFactory.readers(groups)" method should return the list of readers

Describe what did happen. "smartcard.reader.ReaderFactory.ReaderFactory.readers(groups)" method returning empty list intermittently

Steps for reproducing this issue:

  1. Connect the Yubikey token

  2. Run the below command multiple times. from smartcard import System print(System.readers())

  3. Verify that it wont print [] always

We are seeing the below in event viewer logs of that system sometimes, will that be a problem?

image

But the working machines and this machine also has the same services status in control panel

image

Do we need to start that "Smart Card Device Enumeration Service"?

LudovicRousseau commented 2 years ago

First, I suggest to upgrade your pyscard to version 2.0.2

I would suspect a problem in Windows PC/SC layer. I do not use Windows so I can't really help. You would need a tool to spy the Windows WinSCard answers to check if the empty list comes from Windows itself or is a bug in pyscard.

antonio-fr commented 2 years ago

Very weird behavior. Check twice that you are running v2.0.1 as you declare. Because from what I can think about, this issue really looks like this one, affecting v2.0.2. The effect is that it returns an empty reader list in some conditions, and this is what you observe. The 2.0.2 version has an issue in Windows when the last reader is disconnected, any new reader connected is not found. This was fixed recently and will be ok in the next release. There is not known issue to me in v2.0.1 in Windows.

LudovicRousseau commented 2 years ago

Try again with PySCard version 2.0.3 I just released.

LudovicRousseau commented 2 years ago

Does version 2.0.3 solves the problem?

LudovicRousseau commented 2 years ago

In your sample code smartcard.reader.ReaderFactory.ReaderFactory.readers(groups) what is the value of the groups variable?

LudovicRousseau commented 1 year ago

No feedback since 1 year. Closing.