Hello.

I have some questions on pcsclite. I have googled and searched the mailing list archives, but have not found any good answers.


The first issue is regarding the pcsclite implementation of SCardGetStatusChange.


In both the MS winscard API documentation and the pcsclite documentation the documentation for using SCARD_STATE_UNAWARE states:

"The application is unaware of the current state, and would like to know. The use of this value results in an _immediate_ return from state transition monitoring services. This is represented by all bits set to zero."

On MS Windows 2000, issuing SCardGetStatusChange on a single reader with SCARD_STATE_UNAWARE returns in <1ms (in most situations), making it a candidate for low-frequency polling operation (1Hz) (in addition to the regular threaded blocking use). If the card state changes, the call takes longer to complete, but this is not a problem as long as the calls return quickly when nothing has changed.

With pcsclite, the winscard_clnt.c event loop always issues at least one SYS_USleep(PCSCLITE_STATUS_WAIT) (200ms) (line 1391 in 1.2.9-beta6). This happens regardless of the dwBreakFlag variable and SCARD_STATE_UNAWARE use, and makes it very difficult to use this in a polling situation. I am not saying the implementation is incorrect, however the side-effect of the usleep always being issued is not helping us.

I know the most common use of SCardGetStatusChange is to start a thread which calls SCardGetStatusChange which blocks. However, for reasons that are too lengthy to dwelve into here, threads are not desirable for some of our client platform configurations. A 1Hz poll would be more than sufficient for our use.

Using SCardStatus is not an alternative either, since it requires a smartcard connection (on some cards, the connection process takes ~2 seconds and that is hardly good for use in a polling scheme either).

We would want the SCardGetStatusChange implementation to change so it more closely mimics the the MS implementation by not doing the 200ms wait if it already knows it is finished.

However, this won't help us much at first, since we are supposed to work with all the existing pcscd-implementations in the field.

We are contemplating writing our own client code which communicates with the pcscd dameon. By doing this, we can create a more polling friendly version of SCardGetStatusChange (presumably).

We would like to be compatible with at least 1.1.x, 1.2.0, 1.2.9 pcscd versions and those used in Mac OSX 10.2/10.3. The question then is, has the communication protocol changed much with these different versions?

Is there something else we can do to get an efficient polling scheme working without using threads?



Now for something else. I don't seem to be able to disable client side thread use with pcsc-lite-1.2.9-beta6. The following example illustrates that I'm able to disable threads with 1.2.0 but not with 1.2.9:
(I haven't looked into this much, so I apologize in advance for any oversights..)



/pcsc-lite-1.2.0> ./configure --disable-threadsafe > cnf /pcsc-lite-1.2.0> grep threadsafe cnf enable threadsafe client : false

/pcsc-lite-1.2.0> make 2> make.err > make.out
/pcsc-lite-1.2.0> ldd src/.libs/libpcsclite.so
        libc.so.6 => /lib/libc.so.6 (0x40025000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

    ------- NO PTHREAD HERE ==> OK -------




/pcsc-lite-1.2.0> make clean 2> /dev/null > /dev/null /pcsc-lite-1.2.0> ./configure --enable-threadsafe > cnf /pcsc-lite-1.2.0> grep threadsafe cnf enable threadsafe client : true

/pcsc-lite-1.2.0> make 2> make.err > make.out
/pcsc-lite-1.2.0> ldd src/.libs/libpcsclite.so
        libpthread.so.0 => /lib/libpthread.so.0 (0x40026000)
        libc.so.6 => /lib/libc.so.6 (0x40078000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

    ------- PTHREAD ENABLED ==> OK -------




/pcsc-lite-1.2.9-beta6> ./configure --disable-threadsafe > cnf /pcsc-lite-1.2.9-beta6> grep threadsafe cnf enable threadsafe client : false <============

/pcsc-lite-1.2.9-beta6> make 2> make.err > make.out
/pcsc-lite-1.2.9-beta6> ldd src/.libs/libpcsclite.so
        libpthread.so.0 => /lib/libpthread.so.0 (0x40027000)
        libc.so.6 => /lib/libc.so.6 (0x40079000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

    ------- PTHREAD ENABLED ==> ?? -------


Thanks in advance,

Oivind H. Danielsen

_______________________________________________
Muscle mailing list
[EMAIL PROTECTED]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to