<commit_before>List of SCardGetAttrib() commands supported by the CCID driver
==============================================================

PC/SC provides the SCardGetAttrib() function to request some attributes from
the driver.


PC/SC function prototype
"""""""""""""""""""""""""

LONG SCardGetAttrib(SCARDHANDLE hCard,
    DWORD dwAttrId,
    LPBYTE pbAttr,
    LPDWORD pcbAttrLen);

Parameters:

hCard       IN      Connection made from SCardConnect
dwAttrId    IN      Identifier for the attribute to get
pbAttr      OUT     Pointer to a buffer that receives the attribute
pcbAttrLen  IN/OUT  Length of the pbAttr buffer in bytes

If the attribute is not supported the applications receive the error
SCARD_E_UNSUPPORTED_FEATURE (or SCARD_E_NOT_TRANSACTED for pcsc-lite
version < 1.3.3)


supported attributes
""""""""""""""""""""

SCARD_ATTR_ATR_STRING
    ATR of the card

SCARD_ATTR_ICC_INTERFACE_STATUS
    Single byte. Zero if smart card electrical contact is not active;
    nonzero if contact is active.

SCARD_ATTR_ICC_PRESENCE
    Single byte indicating smart card presence:
    0 = not present
    1 = card present but not swallowed (applies only if reader supports
    smart card swallowing)
    2 = card present (and swallowed if reader supports smart card swallowing)
    4 = card confiscated.

SCARD_ATTR_VENDOR_IFD_VERSION
    Vendor-supplied interface device version
    DWORD in the form 0xMMmmbbbb where
    MM = major version,
    mm = minor version,
    and bbbb = build number
    It is the bcdDevice USB field.

SCARD_ATTR_VENDOR_NAME
   name of the IFD (reader) vendor. It is the iManufacturer USB field
   (if any).

SCARD_ATTR_MAXINPUT
   maximum size of an APDU supported by the reader.
   format is unsigned 32-bit unsing the byte order of the platform.
   Correct readers should support up to 261 bytes (CLA + INS + P1 + P2 +
   Lc + 255 bytes of data) but some readers support less (253 bytes only
   for example). It is a problem for T=1 cards when the reader works in
   APDU mode instead of TPDU and for T=0 cards.

SCARD_ATTR_VENDOR_IFD_SERIAL_NO
    reader serial number (if available).


Sample code
===========

#include <reader.h>

{
    [...]

    unsigned char pbAtr[MAX_ATR_SIZE];
    DWORD dwAtrLen;

    /* use a NULL buffer to just get the needed length */
    rv = SCardGetAttrib(hCard, SCARD_ATTR_ATR_STRING, NULL, &dwAtrLen);
    if (rv == SCARD_S_SUCCESS)<commit_msg>SCARDGETATTRIB.txt: document SCARD_ATTR_CHANNEL_ID<commit_after>List of SCardGetAttrib() commands supported by the CCID driver
==============================================================

PC/SC provides the SCardGetAttrib() function to request some attributes from
the driver.


PC/SC function prototype
"""""""""""""""""""""""""

LONG SCardGetAttrib(SCARDHANDLE hCard,
    DWORD dwAttrId,
    LPBYTE pbAttr,
    LPDWORD pcbAttrLen);

Parameters:

hCard       IN      Connection made from SCardConnect
dwAttrId    IN      Identifier for the attribute to get
pbAttr      OUT     Pointer to a buffer that receives the attribute
pcbAttrLen  IN/OUT  Length of the pbAttr buffer in bytes

If the attribute is not supported the applications receive the error
SCARD_E_UNSUPPORTED_FEATURE (or SCARD_E_NOT_TRANSACTED for pcsc-lite
version < 1.3.3)


supported attributes
""""""""""""""""""""

SCARD_ATTR_ATR_STRING
    ATR of the card

SCARD_ATTR_ICC_INTERFACE_STATUS
    Single byte. Zero if smart card electrical contact is not active;
    nonzero if contact is active.

SCARD_ATTR_ICC_PRESENCE
    Single byte indicating smart card presence:
    0 = not present
    1 = card present but not swallowed (applies only if reader supports
    smart card swallowing)
    2 = card present (and swallowed if reader supports smart card swallowing)
    4 = card confiscated.

SCARD_ATTR_VENDOR_IFD_VERSION
    Vendor-supplied interface device version
    DWORD in the form 0xMMmmbbbb where
    MM = major version,
    mm = minor version,
    and bbbb = build number
    It is the bcdDevice USB field.

SCARD_ATTR_VENDOR_NAME
   name of the IFD (reader) vendor. It is the iManufacturer USB field
   (if any).

SCARD_ATTR_MAXINPUT
   maximum size of an APDU supported by the reader.
   format is unsigned 32-bit unsing the byte order of the platform.
   Correct readers should support up to 261 bytes (CLA + INS + P1 + P2 +
   Lc + 255 bytes of data) but some readers support less (253 bytes only
   for example). It is a problem for T=1 cards when the reader works in
   APDU mode instead of TPDU and for T=0 cards.

SCARD_ATTR_VENDOR_IFD_SERIAL_NO
    reader serial number (if available).

SCARD_ATTR_CHANNEL_ID
    DWORD in the form 0xDDDDCCCC with:
    DDDD equal to 0x0020 for USB devices
    CCCC equal to bus number in the high byte and device address in the
    low byte

Sample code
===========

#include <reader.h>

{
    [...]

    unsigned char pbAtr[MAX_ATR_SIZE];
    DWORD dwAtrLen;

    /* use a NULL buffer to just get the needed length */
    rv = SCardGetAttrib(hCard, SCARD_ATTR_ATR_STRING, NULL, &dwAtrLen);
    if (rv == SCARD_S_SUCCESS)
{'fraction_non_alphanumeric': 0.0862954186413902, 'fraction_numerical': 0.010268562401263823, 'mean_word_length': 3.689814814814815, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1411042', 'n_tokens_mistral': 1572, 'n_tokens_neox': 1525, 'n_words': 613}