1 List of SCardGetAttrib() commands supported by the CCID driver
2 ==============================================================
4 PC/SC provides the SCardGetAttrib() function to request some attributes from
8 PC/SC function prototype
9 """""""""""""""""""""""""
11 LONG SCardGetAttrib(SCARDHANDLE hCard,
18 hCard IN Connection made from SCardConnect
19 dwAttrId IN Identifier for the attribute to get
20 pbAttr OUT Pointer to a buffer that receives the attribute
21 pcbAttrLen IN/OUT Length of the pbAttr buffer in bytes
23 If the attribute is not supported the applications receive the error
24 SCARD_E_UNSUPPORTED_FEATURE (or SCARD_E_NOT_TRANSACTED for pcsc-lite
34 SCARD_ATTR_ICC_INTERFACE_STATUS
35 Single byte. Zero if smart card electrical contact is not active;
36 nonzero if contact is active.
38 SCARD_ATTR_ICC_PRESENCE
39 Single byte indicating smart card presence:
41 1 = card present but not swallowed (applies only if reader supports
42 smart card swallowing)
43 2 = card present (and swallowed if reader supports smart card swallowing)
46 SCARD_ATTR_VENDOR_IFD_VERSION
47 Vendor-supplied interface device version
48 DWORD in the form 0xMMmmbbbb where
51 and bbbb = build number
52 It is the bcdDevice USB field.
54 SCARD_ATTR_VENDOR_NAME
55 name of the IFD (reader) vendor. It is the iManufacturer USB field
59 maximum size of an APDU supported by the reader.
60 format is unsigned 32-bit unsing the byte order of the platform.
61 Correct readers should support up to 261 bytes (CLA + INS + P1 + P2 +
62 Lc + 255 bytes of data) but some readers support less (253 bytes only
63 for example). It is a problem for T=1 cards when the reader works in
64 APDU mode instead of TPDU and for T=0 cards.
66 SCARD_ATTR_VENDOR_IFD_SERIAL_NO
67 reader serial number (if available).
70 DWORD in the form 0xDDDDCCCC with:
71 DDDD equal to 0x0020 for USB devices
72 CCCC equal to bus number in the high byte and device address in the
83 unsigned char pbAtr[MAX_ATR_SIZE];
86 /* use a NULL buffer to just get the needed length */
87 rv = SCardGetAttrib(hCard, SCARD_ATTR_ATR_STRING, NULL, &dwAtrLen);
88 if (rv == SCARD_S_SUCCESS)
89 printf("ATR length: %ld\n", dwAtrLen);
91 dwAtrLen = sizeof(pbAtr);
92 rv = SCardGetAttrib(hCard, SCARD_ATTR_ATR_STRING, pbAtr, &dwAtrLen);
93 if (rv == SCARD_S_SUCCESS)
95 for (i = 0; i < dwAtrLen; i++)
96 printf("%02X ", pbAtr[i]);