I am trying to develop an application that would interface with a Smart Card Reader and read information from the smart card.
Let me give you the development environment and the hardware used.
OS: Red Hat Enterprise Linux 6
IDE: Eclipse Juno CDT
Language: C/C++
Hardware:
Smart Card Reader: Omnikey 5321 (https://www.hidglobal.com/products/readers/omnikey/5321)
I have installed the driver and can find the following directories / files:
/usr/lib64/pcsc/drivers/ifd-ccid.bundle
/usr/lib64/pcsc/drivers/ifdokrfid_lnx_x64-2.10.0.1.bundle/Contents
/usr/lib64/pcsc/drivers/ifdokrfid_lnx_x64-2.10.0.1.bundle/Contents/info.plist
/usr/lib64/pcsc/drivers/ifdokrfid_lnx_x64-2.10.0.1.bundle/Contents/Linux
Contents of info.plist clearly show the "OMNIKEY CardMan 5x21" string under "ifdFriendlyName" key.
I want to use the PC/SC standard. Hence I have downloaded and installed the PCSC-lite and I have the checked that the daemon (pcscd) is running and the service status is ok.
Now comes the interesting part...
In my code, I used the following APIs in sequence.
SCARDCONTEXT oSCardContext;
SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, & SCardContext);
SCardEstablishContext() returns SCARD_S_SUCCESS. Great!
SCARDCONTEXT oSCardContext;
DWORD dwReaders = SCARD_AUTOALLOCATE;
LPSTR mszReaders;
SCardListReaders(oSCardContext, NULL, (LPSTR) & mszReaders, & dwReaders);
SCardListReaders() returns SCARD_E_NO_READERS_AVAILABLE. Not good.
At this point I go and check that the reader is properly connected. Yes it is. I verify if I can see any reader entries in the /etc/reader.conf but I find no readers listed in here. I then go to /etc/reader.conf.d but find no files in here as well. So the smart card context is empty, I presume and hence no readers are listed.
So the issue right now is that pcsc-lite cannot detect(?) my reader attached and for which driver has been installed?
Just to check I wrote a simple program using the udev library to read all the "usb" subsystem entries and am able to find the following info from udev about the card reader connected:
Device Node Path:(null)
Vendor ID:076b
Product ID:5321
Manufacturer:OMNIKEY
Product:Smart Card Reader USB
serial:(null)
So am sure the device is detectable. But why is it that PC/SC Resource Manager cannot create this context?
So, How do I resolve this?
I am new to Linux, and have been trying to solve this issue myself without asking for help. But then I see that when there is time constraint it is indeed wise to better seek help from experts and people who have worked and / or encountered such an issue.
I have been googling too much but have not seen any that have my issue. So I presume I am missing something really basic perhaps.
If there is something I need to provide, please let me know. I will do so ASAP.
I appreciate your time to read.
Regards.
EDIT :
I have updates...
I did the following:
1. I got a new card reader (SCM Microsystems) and still it was not detected.
2. The pcscd daemon was started at boot time by default. I stopped the service after I logged in, and then run in foreground mode using the command "pcscd -a -f -d" and the SCM reader was detected successfully.
3. I tried to plugin the reader in my question above, the OMNIKIEY 5321, and it was not detected.
Apprently, I arrived at the following conclusion:
1. For some reason until pcscd was stopped and run in foreground mode manually after I logged in, the readers were not detected.
2. The OMNIKEY reader / driver has a problem.
Regards.