[Pcsclite-muscle] How to recover from momentary loss of pcscd connection in psycard.
Ben Mehlman
ben.mehlman
Tue Oct 18 05:46:29 PDT 2016
Thanks Ludovic.
Normally pcscd wouldn't be shut down., and the init/systemd script
priorities set up such that pcscd is always running before the client
application. But this is a long running, embedded application where it is
conceivable that pcscd might be for example updated during operation. And
yes these updates can be scripted (at the moment we use saltstack) to
ensure that the application is restarted after pcscd is restarted, so the
error shouldn't (with care) happen. But we might find this too complicated
in the field and want it to be more tolerant of the order in which things
are brought up and down.
In my development work where I am running pcscd in the foreground, I saw
this error occur and that it results in an easily recognizable exception,
so I want to be able to recover from it. But if the structure of the
library doesn't allow it, I can recover from it by having my application
exit and be respawned, or have it close all descriptors and re-exec itself
if running in the foreground. But these are heavy handed approaches and
I'd hoped to find something more elegant.
Thanks
Ben
On Tue, Oct 18, 2016 at 3:39 AM, Ludovic Rousseau <
ludovic.rousseau at gmail.com> wrote:
> Hello,
>
> 2016-10-18 3:58 GMT+02:00 Ben Mehlman <ben.mehlman at sweetsams.com>:
>
>>
>> Using the higher level classes of pyscard (CardRequest, CardService).. if
>> pcscd is shut down temporarily, it results in a ListReadersException. I
>> would like to catch this exception, retry, and recover from it when pcscd
>> becomes available again.
>>
>> I tried recreating the CardRequest but that wasn't sufficient to recreate
>> the connection to pcscd.
>> Is there a correct way to handle this?
>>
>
> You need to re-establish a connection to the server using
> SCardEstablishContext().
> That may not be easy to do from the high level API.
>
> Why is pcscd shut down?
>
> Bye
>
> --
> Dr. Ludovic Rousseau
>
> _______________________________________________
> Pcsclite-muscle mailing list
> Pcsclite-muscle at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pcsclite-muscle/attachments/20161018/27ade37d/attachment.html>
More information about the pcsclite-muscle
mailing list