1List of SCardGetAttrib() commands supported by the CCID driver
2==============================================================
3
4PC/SC provides the SCardGetAttrib() function to request some attributes from
5the driver.
6
7
8PC/SC function prototype
9"""""""""""""""""""""""""
10
11LONG SCardGetAttrib(SCARDHANDLE hCard,
12    DWORD dwAttrId,
13    LPBYTE pbAttr,
14    LPDWORD pcbAttrLen);
15
16Parameters:
17
18hCard       IN      Connection made from SCardConnect
19dwAttrId    IN      Identifier for the attribute to get
20pbAttr      OUT     Pointer to a buffer that receives the attribute
21pcbAttrLen  IN/OUT  Length of the pbAttr buffer in bytes
22
23If the attribute is not supported the applications receive the error
24SCARD_E_UNSUPPORTED_FEATURE (or SCARD_E_NOT_TRANSACTED for pcsc-lite
25version < 1.3.3)
26
27
28supported attributes
29""""""""""""""""""""
30
31SCARD_ATTR_ATR_STRING
32    ATR of the card
33
34SCARD_ATTR_ICC_INTERFACE_STATUS
35    Single byte. Zero if smart card electrical contact is not active;
36    nonzero if contact is active.
37
38SCARD_ATTR_ICC_PRESENCE
39    Single byte indicating smart card presence:
40    0 = not present
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)
44    4 = card confiscated.
45
46SCARD_ATTR_VENDOR_IFD_VERSION
47    Vendor-supplied interface device version
48    DWORD in the form 0xMMmmbbbb where
49    MM = major version,
50    mm = minor version,
51    and bbbb = build number
52    It is the bcdDevice USB field.
53
54SCARD_ATTR_VENDOR_NAME
55   name of the IFD (reader) vendor. It is the iManufacturer USB field
56   (if any).
57
58SCARD_ATTR_MAXINPUT
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.
65
66SCARD_ATTR_VENDOR_IFD_SERIAL_NO
67    reader serial number (if available).
68
69
70Sample code
71===========
72
73#include <reader.h>
74
75{
76    [...]
77
78    unsigned char pbAtr[MAX_ATR_SIZE];
79    DWORD dwAtrLen;
80
81    /* use a NULL buffer to just get the needed length */
82    rv = SCardGetAttrib(hCard, SCARD_ATTR_ATR_STRING, NULL, &dwAtrLen);
83    if (rv == SCARD_S_SUCCESS)
84        printf("ATR length: %ld\n", dwAtrLen);
85
86    dwAtrLen = sizeof(pbAtr);
87    rv = SCardGetAttrib(hCard, SCARD_ATTR_ATR_STRING, pbAtr, &dwAtrLen);
88    if (rv == SCARD_S_SUCCESS)
89    {
90        for (i = 0; i < dwAtrLen; i++)
91            printf("%02X ", pbAtr[i]);
92        printf("\n");
93    }
94}
95
96