Hi,

I am doing a project in which I am using the ACR 122U contactless
reader (from ACS) with the pcsc-lite middleware and the ccid driver.
In fact, it is a cross platform project for which most of it is
already written for Windows.

The reader is detected as it should by pcscd and cards are detected as
well, so one would assume everything works as it should.
However, the ScardGetStatusChange returns some odd values.

To test the function without the whole project around it, I used
following code to test its behaviour:



int main(int argc, char *argv[])
{
       SCARDCONTEXT hContext;
       LONG rv, retCode;
       SCARD_READERSTATE_A rgReaderStates[1];
       char *readerNamesBuffer = NULL;
       DWORD cch = SCARD_AUTOALLOCATE;

       rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL,
&hContext);
       rv = SCardIsValidContext(hContext);

       retCode = SCardListReaders(hContext, NULL,
(LPTSTR)&readerNamesBuffer, &cch);

       rgReaderStates[0].szReader =  readerNamesBuffer;
       rgReaderStates[0].dwCurrentState = SCARD_STATE_UNAWARE;

       rv = SCardGetStatusChange(hContext, INFINITE, rgReaderStates, 1);  #1

       rgReaderStates[0].dwCurrentState = rgReaderStates[0].dwEventState;

       rv = SCardGetStatusChange(hContext, INFINITE, rgReaderStates, 1); #2

       rgReaderStates[0].dwCurrentState = rgReaderStates[0].dwEventState;

       rv = SCardGetStatusChange(hContext, INFINITE, rgReaderStates, 1); #3

       rv = SCardReleaseContext(hContext);

       return 0;
}

So first I create a context and retrieve a list of available readers,
from which I pick the first (and only).
Then, I set the currentstate to unaware in order to let pcsc tell me
which state the reader is in.

The first occurrence of SCardGetStatusChange immediately returns an
eventstate with value 131090.
Thereafter, the second time SCardGetStatusChange gets called, the
eventstate return value is 393234. This is immediately as well.
Then, the third occurrence of ScardGetStatusChange blocks until I put
a card on the reader (which I would expect it to do). When I put a
card on the reader, the eventstate value is 458687.

These are all quite large values, is this normal? Looking at this
website:
http://pyscard.sourceforge.net/epydoc/smartcard.scard.scard-module.html,
I get the feeling something is awfully wrong, but I can't figure out
what I am doing wrong.

Does anyone have any ideas about this?

Thanks
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to