On 2/3/2011 11:58 PM, Martin Paljak wrote:
>
> On Feb 3, 2011, at 10:04 PM, Douglas E. Engert wrote:
>
>> I have updates #321 with a new version of the cardmod patch
>> and would like to start to commit it in pieces.
>>
>> Piece 1 is the attachment I sent on 1/28 as new.martin.patch
>> based on Martin's patch from 1/19. This was the patch that would
>> work for Brian. The main change is adding two parameters to all
>> the *_detect_readers routines.  Martin's patch already required these
>> to be added in a number of places.
>>
>> Is there any objection to adding this patch now?
>
> I would consider using a new hook, like "use_reader" or  
> "use_pcsc_parameters" to send the
> arguments to reader-pcsc.c and set the (pcsc, not cardmod) driver to "cardmod 
> state".

OK, I like that. This still has to be done before any call to 
sc_ctx_detect_readers.
So you original patch to require the application to call sc_ctx_detect_readers 
is
still needed. So do you want to commit it?

The cardmod.c routines would call sc_context_create  which would setup the pcsc 
driver.
Then cardmod.c would call your use_reader, or use_pcsc_parameters or
pcsc_use_single_reader(ctx, pcsc_context_handle, pcsc_card_handle) Or does it
need to be wrappered as sc_ctx_use_reader?

The cardmod_detect_reader could be converted to be this pcsc_use_single_reader.

>Thereader operations API is by no means set in stone. Nor is there need to 
>abstract it away
> too much, the usage pattern is known and the code path to implement it should 
> be as simple
> as possible (sc_XXX wrapper that will not be used by any other reader driver, 
> like sc_cancel
> and sc_wait_for_event are examples of "somewhat bad ideas". Yet it is a 
> working pattern.
>
Or does it need to be wrappered as sc_ctx_use_reader? I assume the other 
drivers would
would not provide this entry point.

Also keep in mind that in a single machine with a single opensc.conf the 
cardmod minidriver
might by used by the BaseCSP for Microsoft applications, and PKCS#11 used by 
other application
like FireFox and Thunderbird.

So would the ctx.c still have:
642     #ifdef ENABLE_CARDMOD
643     if(strcmp(ctx->app_name, "cardmod") == 0) {
644         ctx->reader_driver = sc_get_cardmod_driver();
645     }
646     #endif

Or could this be abstracted to use some parameters in the opensc.conf if 
appname = cardmod?

Even if that was done a routine is still needed to pass in the reader handles.



-- 

  Douglas E. Engert  <deeng...@anl.gov>
  Argonne National Laboratory
  9700 South Cass Avenue
  Argonne, Illinois  60439
  (630) 252-5444
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to