FreeCalypso > hg > fc-pcsc-tools
view libcommon/atr.c @ 174:cc6a4b48dc2a
doc/Low-level-commands: readef extended
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 02 Mar 2021 04:34:05 +0000 |
parents | f7145c77b7fb |
children |
line wrap: on
line source
#include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <pcsclite.h> #include <winscard.h> #include <reader.h> #include "cardif.h" #define MAX_ATR_BYTES 33 retrieve_atr() { u_char atrbuf[MAX_ATR_BYTES]; LONG rv; DWORD dwAttrLen; unsigned n; dwAttrLen = MAX_ATR_BYTES; rv = SCardGetAttrib(hCard, SCARD_ATTR_ATR_STRING, atrbuf, &dwAttrLen); if (rv != SCARD_S_SUCCESS) { fprintf(stderr, "SCardGetAttrib for ATR: %s\n", pcsc_stringify_error(rv)); return(-1); } printf("ATR:"); for (n = 0; n < dwAttrLen; n++) printf(" %02X", atrbuf[n]); putchar('\n'); return(0); }