Re: RES: Parallel Process with readers - pcsc-lite

Frank Marien <[email protected]>
Newsgroups gmane.comp.lib.muscle
Message-ID <[email protected]>
On 07/03/13 22:02, Michael StJohns wrote:
> At 03:45 PM 7/3/2013, Ludovic Rousseau wrote:
>> 2013/7/3 MURILO COSTA <[email protected]>:
>>> I thought that maybe can be a Java problem, do you know some software to do this kind of test (parallelism) ? I'll check if pcsc-tools can do that...
>> I guess it is a javax.smartcardio "limitation".
>>
>> You need to create one context per reader using SCardEstablishContext.
>> I bet the Java wrapper creates only one context for all the readers.
>> In pcsc-lite the context is associated to a mutex. So all your
>> commands will block on the same mutex even if they use different
>> readers.
>> I don't know if is it easy or even possible to avoid this Java wrapper
>> "feature".
>
> Probably not - here's the source code from the default provider implementation for JDK7.  It even comments that it uses the same context id for each of these:
>
>
>
>
> final class PCSCTerminals extends CardTerminals {
>
>     // SCARDCONTEXT, currently shared between all threads/terminals
>     private static long contextId;
>
>     // terminal state used by waitForCard()
>     private Map<String,ReaderState> stateMap;
>
>     PCSCTerminals() {
>         // empty
>     }
>
>     static synchronized void initContext() throws PCSCException {
>         if (contextId == 0) {
>             contextId = SCardEstablishContext(SCARD_SCOPE_USER);
>         }
>     }
>
>
> One way around this is to grab the source code and build yourself a different provider using the code as a base.
I'm looking at doing exactly that to solve a different problem.. not
entirely sure that I'll end up implementing the full javax.smartcardio,
though. Probably only CardTerminal and Card, inside the current
commons-eid API.
I guess that would allow me to implement that will separate contexts.
Looking at the JRE8 sources for that.

Still.. I think we're missing something, here. If it's inherent in
libj2pcsc (java wrapper) or javax.smartcardio (and it looks like it from
the sources above), then why I can I read 5 photos from 5 eID's in the
same required to read one, and also, why would Murilo *not* have the
issue on Windows? Different implementation there?

-f

>
> Mike
>
>
>
>
>>> Do you think that issue have some relationship with this Ludovic post:
>>> http://ludovicrousseau.blogspot.com.br/2013/06/ccid-descriptor-statistics_7148.html
>> No.
>>
>> Bye
>>
>> --
>> Dr. Ludovic Rousseau
>>
>> _______________________________________________
>> Muscle mailing list
>> [email protected]
>> http://lists.musclecard.com/mailman/listinfo/muscle_lists.musclecard.com
>
>
> _______________________________________________
> Muscle mailing list
> [email protected]
> http://lists.musclecard.com/mailman/listinfo/muscle_lists.musclecard.com
>
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.