Re: GP 2.2 INITIALIZE UPDATE (0x50) oddness

Ludovic Rousseau <[email protected]>
Newsgroups gmane.comp.lib.muscle
Message-ID <CAGstE8C2=KVQ76a1sUCV2wy9AVizfgT7h6TFkFF59AT7Fypp+Q@mail.gmail.com>
2013/9/20 landyman70 <[email protected]>:
> Okay, been doing a bit more investigating.
> When I run my application, I call the methods in the following order:
> SCardEstablishContext
> [loop]
> SCardConnect
> SCardStatus
> SCardTransmit (select Card Manager A0 00 00 00 03 00 00 00)
> SCardTransmit (get response [00 c0 ...])
> SCardDisconnect()
> [end of loop]
> SCardReleaseContext
>
> so in each loop i connect, get the status (for ATR) and send some commands
> then close the card.
>
> However when I do this I the first SCardTransmit returns 6D00.
> if I then run gscriptor, connect and send the same 2 APDUs it works. Once
> this has worked, my app works correctly.
>
> My calls are:
> SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext)
> SCardConnect(hContext, mszReader, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0 |
> SCARD_PROTOCOL_T1, &hCard, &dwActiveProtocol)
> SCardStatus(hCard, mszReader, dwReaderNameLen, dwState, dwActiveProtocol,
> pATR, dwATRLen)
> SCardTransmit(hCard, pioSendPci, command, sizeof(command), NULL, pRXData,
> &dwRXDataSize)
> SCardDisconnect(hCard, SCARD_LEAVE_CARD)
> SCardReleaseContext(hContext)
>
> Why is my card not responding up properly until I use gscriptor?

Maybe you should reset the card before the loop start to set the card
in a correct state.

Bye

-- 
 Dr. Ludovic Rousseau
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.