Recognize smart card reader type using winscard visual C++ 6.0
-
Dear all, I get a program that can recognize reader type (contact or contactless reader) before any smart card is inserted into reader. Generally I used SCardEstablishContext[^] and SCardListReaders[^] functions in order to load name of readers. Those two function have just two dynamic variable, handle of reader and list of reader name. Do anybody know how separated contact reader type from contactless reader type without insert any smartcard? Please help me... Thanks before....
-
Dear all, I get a program that can recognize reader type (contact or contactless reader) before any smart card is inserted into reader. Generally I used SCardEstablishContext[^] and SCardListReaders[^] functions in order to load name of readers. Those two function have just two dynamic variable, handle of reader and list of reader name. Do anybody know how separated contact reader type from contactless reader type without insert any smartcard? Please help me... Thanks before....
Dear Eka Candra, To understand reader's type one can access to its attributes and read default clock rate. Schematic code:
SCARDCONTEXT hContext;
SCARDHANDLE hCard;
DWORD dwActiveProtocol;
LONG status;LPCSTR szReader; // PC/SC reader name to check;
// Assume that context is already established
// Make direct connection to PC/SC card reader. No card needed for these step.
status = SCardConnect(hContext, szReader, SCARD_SHARE_DIRECT, 0, hCard, &dwActiveProtocol);
// Get attribute SCARD_ATTR_DEFAULT_CLK.
BYTE pbAttr[4];
DWORD pcbAttrLen = 4;
status = SCardGetAttrib(hCard, SCARD_ATTR_DEFAULT_CLK, pbAttr, pcbAttrLen);
// Cast pbAttr to decimal integer. It will be Default clock rate in kHz.
// For ISO 14443 contactless card reader it equals to 13560 (i.e. 13.56MHz)
// For contact card reader it's something from 1000 to 5000 (i.e. from 1MHz to 5MHz)
status = SCardDisconnect(hCard, SCARD_LEAVE_CARD);The method I offer supposes that you are looking for ISO14443 contactless card reader. At least in Windows it works.
-
Dear Eka Candra, To understand reader's type one can access to its attributes and read default clock rate. Schematic code:
SCARDCONTEXT hContext;
SCARDHANDLE hCard;
DWORD dwActiveProtocol;
LONG status;LPCSTR szReader; // PC/SC reader name to check;
// Assume that context is already established
// Make direct connection to PC/SC card reader. No card needed for these step.
status = SCardConnect(hContext, szReader, SCARD_SHARE_DIRECT, 0, hCard, &dwActiveProtocol);
// Get attribute SCARD_ATTR_DEFAULT_CLK.
BYTE pbAttr[4];
DWORD pcbAttrLen = 4;
status = SCardGetAttrib(hCard, SCARD_ATTR_DEFAULT_CLK, pbAttr, pcbAttrLen);
// Cast pbAttr to decimal integer. It will be Default clock rate in kHz.
// For ISO 14443 contactless card reader it equals to 13560 (i.e. 13.56MHz)
// For contact card reader it's something from 1000 to 5000 (i.e. from 1MHz to 5MHz)
status = SCardDisconnect(hCard, SCARD_LEAVE_CARD);The method I offer supposes that you are looking for ISO14443 contactless card reader. At least in Windows it works.
I seriously doubt Eka is still looking for an answer 11½ years later. :doh:
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer