1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| int SamGetAtr( u32 readerIndex, unsigned char *atr, unsigned char* atrLength, int slot, int reset, int mode)
{
unsigned char cmd[5];
unsigned char rsp[252];
unsigned short rspLen;
u32 samReaderIdx = g_ReaderContext[readerIndex].samReaderIndex;
/* Build command */
cmd[0] = 0x80;
cmd[1] = 0x36;
cmd[2] = 0x00;
cmd[3] = 0x00;
cmd[4] = *atrLength;
/* Send command and get response */
rspLen = sizeof(rsp);
TRACEBUF_DEBUG(cmd, 5);
g_ReaderContext[readerIndex].deviceLastError = sSmartISOEx( g_ReaderContext[samReaderIdx].cscHandle, g_ReaderContext[readerIndex].samSlot, 5, cmd, &rspLen, rsp );
TRACEBUF_DEBUG(rsp, rspLen);
TRACE_DEBUG("err = %d", g_ReaderContext[readerIndex].deviceLastError);
if ( g_ReaderContext[readerIndex].deviceLastError != ERR_NONE )
return ERROR_PCD;
/* OK */
*atrLength = (unsigned char)rspLen - 2;
memcpy( atr, rsp, *atrLength );
return ERROR_NONE;
(void)slot;
(void)reset;
(void)mode;
} |
Partager