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

limit 16 reader #13

Open
catafestaxx opened this issue Aug 17, 2016 · 15 comments
Open

limit 16 reader #13

catafestaxx opened this issue Aug 17, 2016 · 15 comments

Comments

@catafestaxx
Copy link

as it does to remove the 16 reader limit must use 24 pc a reader would like to help me?

@LudovicRousseau
Copy link
Owner

See #8

@LudovicRousseau
Copy link
Owner

I is a known "limitation".
I created a bug (in 2012) at https://alioth.debian.org/tracker/index.php?func=detail&aid=313579&group_id=30105&atid=410088 and will implement it "when I have time".

Contact me if you want to sponsor this development.

@LudovicRousseau
Copy link
Owner

Since the PCSC project moved from alioth to salsa, the bug is now at https://salsa.debian.org/rousseau/PCSC/issues/4

@avassdal
Copy link

avassdal commented Sep 8, 2020

I would become a sponsor for this if i know that this limitation could be removed asap

@LudovicRousseau
Copy link
Owner

@avassdal please contact me on my email ludovic.rousseau at free.fr

@tatulea
Copy link

tatulea commented Sep 23, 2020

Is there any update on this? :)

@LudovicRousseau
Copy link
Owner

@tatulea do you want to be a sponsor? I have no news from @avassdal

@crypteo
Copy link

crypteo commented Oct 19, 2023

Hi,

I'm using pyscard on Ubuntu 22 and need to support more than 16 readers
So I followed #8.

I re-compiled pcsclite and ccid latest version, and made sure everything was working fine with the default limit.
Then I re-compiled after changing 16 for 24 in both src/ccid_ifdhandler.h and src/PCSC/pcsclite.h.in.
But only 8 cards are visible and they don't even work.

Is there anything else I'm supposed to do ?

@aroth-fastprotect
Copy link

For a project of ours we patched the pcscd to increase the limit with the following two patches:
pcscd-max-readers.patch.txt
ccid-max-readers.patch.txt

We have it working with up to 14 readers.

@crypteo
Copy link

crypteo commented Oct 23, 2023

This is exactly what I did.
I checked the debug log of pcscd and all the cards seems to be detected properly. Could this be a problem with the python interface ?
I'm using a external script going like this :

from smartcard.System import readers
class sCard():
    def __init__(self, card):
        r = readers()
        reader = r[card]
        self.card = card
        self.conn = reader.createConnection()
        self.conn.connect(CardConnection.T1_protocol)

Trying again, I got this error when calling readers() :

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9b in position 0: invalid start byte

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/tcaapp/query.py", line 438, in <module>
    main()
  File "/opt/tcaapp/query.py", line 361, in handle_client
    scObj = sCard(card)
  File "/opt/tcaapp/query.py", line 49, in __init__
    r = readers()
  File "/usr/local/lib/python3.10/dist-packages/smartcard/System.py", line 41, in readers
    return smartcard.reader.ReaderFactory.ReaderFactory.readers(groups)
  File "/usr/local/lib/python3.10/dist-packages/smartcard/reader/ReaderFactory.py", line 58, in readers
    zreaders += fm(groups)
  File "/usr/local/lib/python3.10/dist-packages/smartcard/pcsc/PCSCReader.py", line 114, in readers
    pcsc_readers = __PCSCreaders__(hcontext, groups)
  File "/usr/local/lib/python3.10/dist-packages/smartcard/pcsc/PCSCReader.py", line 43, in __PCSCreaders__
    hresult, readers = SCardListReaders(hcontext, groups)
  File "/usr/local/lib/python3.10/dist-packages/smartcard/scard/scard.py", line 686, in SCardListReaders
    return _scard.SCardListReaders(hcontext, readergroups)
SystemError: <built-in function SCardListReaders> returned a result with an exception set

@LudovicRousseau
Copy link
Owner

Do you see all the readers when using pcsc_scan?
https://blog.apdu.fr/posts/2014/03/level-1-smart-card-support-on-gnulinux/

Can you copy/paste here the output of pcsc_scan?

@crypteo
Copy link

crypteo commented Oct 25, 2023

Nothing much from pcsc_scan with the compiled version

Compiled with 24 :

PC/SC device scanner
V 1.7.0 (c) 2001-2022, Ludovic Rousseau <ludovic.rousseau@free.fr>
Using reader plug'n play mechanism
Scanning present readers...
Waiting for the first reader... found one
Scanning present readers...
Waiting for the first reader... found one
Scanning present readers...
Waiting for the first reader... found one
Scanning present readers...
Waiting for the first reader... found one
Scanning present readers...
Waiting for the first reader... found one
Scanning present readers...
Waiting for the first reader... found one
Scanning present readers...
Waiting for the first reader... found one
Scanning present readers...
Waiting for the first reader... SCardGetStatusChange: Unknown error: 0x00000034

With the working pcsc compiled with 16 :

PC/SC device scanner
V 1.7.0 (c) 2001-2022, Ludovic Rousseau <ludovic.rousseau@free.fr>
Scanning present readers...
0: Alcor Micro AU9540 00 00
1: Alcor Micro AU9540 01 00
2: Generic Smart Card Reader Interface [Smart Card Reader Interface] (20070818000000000) 02 00
3: Generic Smart Card Reader Interface [Smart Card Reader Interface] (20070818000000000) 03 00
4: Alcor Micro AU9540 04 00
5: Alcor Micro AU9540 05 00
6: Alcor Micro AU9540 06 00
7: Alcor Micro AU9540 07 00
8: Alcor Micro AU9540 08 00
9: Generic Smart Card Reader Interface [Smart Card Reader Interface] (20070818000000000) 09 00
10: Alcor Micro AU9540 0A 00
11: Alcor Micro AU9540 0B 00
12: Alcor Micro AU9540 0C 00
13: Alcor Micro AU9540 0D 00
14: Alcor Micro AU9540 0E 00
15: Generic Smart Card Reader Interface [Smart Card Reader Interface] (20070818000000000) 0F 00
SCardGetStatusChange: Invalid parameter given.

@LudovicRousseau
Copy link
Owner

@crypteo it looks like you use 2 sides (pcscd and libpcsclite) with different values of  PCSCLITE_MAX_READERS_CONTEXTS. My guess if that you have 2 different libpcsclite.so.1 files in your system. Maybe one in /usr/lib/ and the other in /usr/local/lib/ or something like that.

In the case with 16 it is also NOT working correctly. You should not have the error "SCardGetStatusChange: Invalid parameter given."

@crypteo
Copy link

crypteo commented Oct 26, 2023

Indeed, even though I removed all the original packages, there was still lib files left. I should have double checked it.
After removing manually, I had to rebuild everything. And seems to work now :)
Thank for your help.

@LudovicRousseau
Copy link
Owner

I just discover that Windows limit is at 10 readers. And it looks like it is not possible to have more. Or course you can't change a value in the source code and rebuild Windows :-)
Limitation of 10 smartcard readers in Windows Server 2012 R2, Windows 8, and later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants