Best way to talk to smart cards / pcscd?


I’m trying to package an app (Yubico Authenticator) that is using pyscard and pcscd to talk to smart card readers. What is the best way to do this? I’ve seen some example on the forums that bundles pcscd in the snap itself, is this the recommended approach? Should there be an interface to talk to pcscd?

yes and yes :slight_smile:

there is no interface yet (but i think i saw @zyga-snapd mention in another thread that there should effectively be one) and until one exists bundling is the right approach …

1 Like

Thanks for the answer.

I’ve got it to work somewhat, but I notice that pcscd seems to be running even when the app itself is not. This seems ti causes conflicts with system-wide pcscd / other snaps doing the same kind of bundling.

Is there a way to define a daemon that only runs when the main app in the snap is running ?

You probably want to disable the service with an install hook that runs snapctl stop --disable <snap-name>.<svc> and then at the top of your app script run: snapctl start --enable <snap-name>.<svc> and at the end of the app script do the same as the install hook to stop the service.

As an additional data point, Flatpak added support for for this in version 1.3.2.

FYI, I’ve taken a TODO to look at implementing a pcscd interface that is implicit on classic. I’ll post here when there is something to review/test.


That’s great! Happy to help with testing etc.