scdaemon loses connection when I unplug/replug a crypto-stick

Phil Benchoff benchoff at bev.net
Wed Sep 8 17:45:54 CEST 2010


On Tue, Sep 07, 2010 at 07:21:56PM -0400, Grant Olson wrote:
> I'm on OSX Snow Leopord, the latest version of MacGPG2.
> 
> When I remove my cryptostick and plug it back in, scdaemon doesn't see
> it anymore.  This causes gpg-agent to complain that it can't find a
> smart-card.  If I manually lookup the PID for scdaemon and give it a
> "kill -9" things work again.
> 
> I imagine that the cryptostick is a little unique in this regard.  Most
> people would have a reader that's more permanently attached, but with
> the crypto-stick, the reader is integrated with the card.
> 
> Anyone know of an easy way for me to fix this?
> 
> -- 
> Grant

I discovered the same thing yesterday.  GnuPG 2.0.16 on Linux.  The
built-in ccid driver is being used:

# Start with the GPF Crypto Stick plugged in
# Built-in ccid
m-6:/usr/local/src/Aladdin/ccid-1.3.13 (2)
$ scdaemon --server -v
scdaemon[7428]: handler for fd -1 started

scdaemon[7428]: reader slot 0: using ccid driver
scdaemon[7428]: slot 0: ATR=3B DA 18 FF 81 B1 FE 75 1F 03 00 31 C5 73 C0 01 40 00 90 00 0C
OK GNU Privacy Guard's Smartcard server ready
scdaemon[7428]: updating slot 0 status: 0x0000->0x0007 (0->1)
serialno
scdaemon[7428]: reader slot 0: using ccid driver
scdaemon[7428]: slot 0: ATR=3B DA 18 FF 81 B1 FE 75 1F 03 00 31 C5 73 C0 01 40 00 90 00 0C
# bunch of debug messages deleted here
OK
# Crypto Stick removed
scdaemon[7428]: updating slot 0 status: 0x0007->0x0000 (1->1)
# Crypto Stick inserted
serialno
scdaemon[7428]: ccid_transceive failed: (0x1000c)
scdaemon[7428]: apdu_send_simple(0) failed: no reader
scdaemon[7428]: no supported card application found: No such device
ERR 100696144 No such device <SCD>

--------------------------------------------------------------------------

PCSC knows about USB events and works a little bit differently.  So long
as no scdaemon command is issued while the device is unplugged, it recovers
from removal and insertion.  As soon as a command is issued with the device
unplugged, it never sees the reader again:


# PCSC-lite 1.4.6 and ccid 1.3.13
$ scdaemon --server -v
scdaemon[7573]: handler for fd -1 started
scdaemon[7573]: reader slot 0: not connected
scdaemon[7573]: slot 0: ATR=3B DA 18 FF 81 B1 FE 75 1F 03 00 31 C5 73 C0 01 40 00 90 00 0C
OK GNU Privacy Guard's Smartcard server ready
scdaemon[7573]: updating slot 0 status: 0x0000->0x0007 (0->1)
serialno
scdaemon[7573]: AID: D2 76 00 01 24 01 02 00 00 05 00 00 06 87 00 00
# Bunch of messages deleted here
OK
# Crypto Stick removed
scdaemon[7573]: updating slot 0 status: 0x0007->0x0000 (1->2)
# Crypto Stick inserted
scdaemon[7573]: updating slot 0 status: 0x0000->0x0007 (2->3)
serialno
scdaemon[7573]: AID: D2 76 00 01 24 01 02 00 00 05 00 00 06 87 00 00
# Bunch of messages deleted here
OK
# Crypto Stick removed
scdaemon[7573]: updating slot 0 status: 0x0007->0x0000 (3->4)
# Attempt command with no reader
serialno
scdaemon[7573]: PC/SC RESET failed: invalid value (0x80100011)
ERR 100663404 Card error <SCD>
# Crypto Stick inserted
reset
OK
serialno
ERR 100663404 Card error <SCD>

It appears that once scdaemon decides there is no reader, it needs to
be restarted.

Phil



More information about the Gnupg-users mailing list