Closed yika1999 closed 6 years ago
You can't use 0 for dwPreferredProtocols
.
See the SCardConnect()
documentation https://pyscard.sourceforge.io/epydoc/smartcard.scard.scard-module.html#SCardConnect
Value of dwPreferredProtocols Meaning
SCARD_PROTOCOL_T0 Use the T=0 protocol
SCARD_PROTOCOL_T1 Use the T=1 protocol
SCARD_PROTOCOL_RAW Use with memory type cards
Maybe SCARD_PROTOCOL_RAW
is your best option.
Another option is to open a bugreport at Apple. https://bugreport.apple.com/
0 is a valid value for pcsc-lite on GNU/Linux. See http://pcsclite.alioth.debian.org/api/group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5
Surely I've seen that '0' is a valid value on Windows as well.
But there is no SCARD_PROTOCOL_RAW
which is 255.
Can I know why there is the difference?
https://msdn.microsoft.com/en-us/library/windows/desktop/aa379473(v=vs.85).aspx
0 : This parameter may be zero only if dwShareMode is set to SCARD_SHARE_DIRECT. In this case, no protocol negotiation will be performed by the drivers until an IOCTL_SMARTCARD_SET_PROTOCOL control directive is sent with SCardControl.
SCARD_PROTOCOL_RAW
is not really used in pcsc-lite in fact.
Your problem is a bug/missing feature in the PC/SC provided by Apple.
I checked the below code in Windows 7 x64, but it failed in Mac. I've got the error
If I changed '0' to T0 or T1, it works but it was not what I want.
Here's the full code.