Page MenuHome GnuPG

New scdaemon command to watch device removal
Closed, ResolvedPublic

Description

For an application like gpa or screenlocker which uses Poldi, it is good to have a command (say, LIST_DEVICE), like:

$ gpg-connect-agent "SCD LIST_DEVICE [some-option] --watch"
S <same status report from scdaemon>
...
OK
$ 

Here, I assume --watch option asks scdaemon to keep watching the status and reporting it.
With no --watch option, it simply returns list of devices (or... list of cards, list of apps, list of keygrips and device, list of card readers. I'm not yet sure what exactly is better).

Event Timeline

gniibe triaged this task as Normal priority.
gniibe created this task.
gniibe added a project: Feature Request.
gniibe changed the task status from Open to Testing.Apr 2 2020, 8:46 AM
gniibe added a project: Restricted Project.

Push the change to master.

It runs like:

$ gpg-connect-agent "scd devinfo --watch" /bye
S DEVINFO_START
S DEVINFO_END
S DEVINFO_STATUS new
S DEVINFO_START
S DEVICE generic D276000124010200F517000000010000 openpgp
S DEVINFO_END
S DEVINFO_STATUS removal
S DEVINFO_START
S DEVINFO_END
OK
$ 
aheinecke added a subscriber: aheinecke.

When testing under Windows "scd devinfo --watch" returns immediately with ERR 100663614 Service is not running <SCD>
Probably also if you would use PC/SC on Linux but I have not tested this.

This caused T5359 for Kleopatra which also shows a problem in the error handling of Kleopatra.

Ah, I see that when there is no card reader, it returns "Service is not running" with PC/SC.
Let's fix that.

Looks good to me, it no longer returns immediately with the error when there are no readers and the command itself seems to work. Thanks.

scd devinfo --watch

S DEVINFO_START
S DEVICE yubikey D2760001240100000006120808550000 piv
S DEVICE yubikey D2760001240100000006120808550000 openpgp
S DEVICE zeitcontrol D276000124010201000500002D9A0000 openpgp
S DEVINFO_END
S DEVINFO_STATUS removal
S DEVINFO_START
S DEVICE yubikey D2760001240100000006120808550000 piv
S DEVICE yubikey D2760001240100000006120808550000 openpgp
S DEVINFO_END
S DEVINFO_STATUS new
S DEVINFO_START
S DEVICE zeitcontrol D276000124010201000500002D9A0000 openpgp
S DEVICE yubikey D2760001240100000006120808550000 piv
S DEVICE yubikey D2760001240100000006120808550000 openpgp
S DEVINFO_END