Hello, On Jan 20, 2011, at 1:46 AM, Douglas E. Engert wrote:
> Attached is a patch to the cardmod code to do the following: > > (1) Fix an uninitialized stricture by by using calloc > in stead of malloc. With out this it was having problems > with checking the status on the reader. malloc->calloc is always good. > (2) Implement a change that this should work for Brian Thomas > that allows one to not detect the reader when creating > the sc_context. This uses the > SC_CONTEXT_PARAM_DONT_DETECT_READERS flag in the ctx_params > > (The more I think about this, this should be the default > to not detect the readers during the sc_create_ctx, as > a flag on opensc.conf could control this instead.) I think the approach of not auto-detecting readers on context creation is better approach than the flag. At the same time I don't see any other reasons NOT to detect readers, only when initializing the pcsc driver (and I mean pcsc-driver, not the copy in reader-pcsc.c) with the pre-existing handles. Also, reducing one to a single context creation function (sc_establish_context wrapper vs sc_context_create) would do good. > (2) Eliminate the storing of the SCARDCONTEXT and SCARDHANDLE > in the registry. Instead, cardmod.c will store them > in its VENDOR_SCPECIFIC structure, call sc_context_create > with the SC_CONTEXT_PARAM_DONT_DETECT_READERS flag set > in the ctx_params. It will then modify the ctx, > and then call sc_ctx_detect_readers that will call the > cardmod code in reader-pcsc.c that will use the SCARDCONTEXT > and SCARDHANDLE. Using non-windows names (pcsc_context, pcsc_card_handle) would be better than phchmTypeName. Other than that, it looks good, I'll do the mentioned changes in a sec. -- @MartinPaljak.net +3725156495 _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel