On 2/7/2011 3:05 PM, Andre Zepezauer wrote:
> On Mon, 2011-02-07 at 14:27 -0600, Douglas E. Engert wrote:
>>
>> On 2/7/2011 11:26 AM, Douglas E. Engert wrote:
>>>
>>>
>>> On 2/3/2011 11:58 PM, Martin Paljak wrote:
>>>>
>>>> On Feb 3, 2011, at 10:04 PM, Douglas E. Engert wrote:
>>>>
>>>> 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". The reader 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.)
>>>
>>> I agree, a new entry point use_reader would work. I will look at adding such
>>> and entry point that will be ignored by the other drivers, and callable
>>> as sc_ctx_use_reader(ctx, void *, void *)
>>>
>>
>> Attached is a patch that implements a sc_ctx_use_reader, to pass in two void
>> pointers to an underling driver. The code to use this from cardmod.c to the
>> cardmod code in reader-pcsc.c (or where ever it ends up) will be added as 
>> part
>> of a much larger patch.
>>
>> The intent is to keep this sc_ctx_use_reader patch simple and small so it
>> can be committed soon.
>
> The essence of both proposals side-by-sideĀ¹:

Actually not.

The use_reader version can be called multiple times to change the handles
as this  is one of the major issues I found with the way the BaseCSP calls
the cardmod. The cardmod.c can then call sc_ctx_use_reader just after
the call to sc_context_create, and can call it later if the BaseCSP
provides different handles.


>
> Patch A: Index: src/libopensc/opensc.h
> ===================================================================
> --- src/libopensc/opensc.h      (revision 5188)
> +++ src/libopensc/opensc.h      (working copy)
> @@ -359,7 +359,7 @@
>   struct sc_reader_operations {
>          /* Called during sc_establish_context(), when the driver
>           * is loaded */
> -       int (*init)(struct sc_context *ctx);
> +       int (*init)(struct sc_context *ctx, void *init_data);
>
>
> Patch B: Index: src/libopensc/opensc.h
> ===================================================================
> --- src/libopensc/opensc.h      (revision 5187)
> +++ src/libopensc/opensc.h      (working copy)
> @@ -388,6 +388,8 @@
>                          int timeout, void **reader_states);
>          /* Reset a reader */
>          int (*reset)(struct sc_reader *, int);
> +       /* used to pass in reader handles in cardmod mode */
> +       int (*use_reader)(struct sc_context *ctx, void * pcsc_context_handle, 
> void * pcsc_card_handle);
>
> Regards
> Andre
>
> [1] in chronological order of submission
>
>

-- 

  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