Patch for scdaemon and reader/smartcard combo devices

Grant Olson kgo at
Fri Jan 21 06:11:27 CET 2011

Meant to send this to the list...

-------- Original Message --------
Subject: Re: Patch for scdaemon and reader/smartcard combo devices
Date: Fri, 21 Jan 2011 00:09:05 -0500
From: Grant Olson <kgo at>
To: NIIBE Yutaka <gniibe at>

On 1/20/11 11:18 PM, NIIBE Yutaka wrote:
> 2011-01-21 13:08, Grant Olson wrote:
>> I just want to confirm, did this work before?  Some parts of the code
>> seem to be able to handle multiple readers.  Other parts seem to say we
>> can really only use one reader.  I just want to make sure this is a new
>> error.
> Yes, this is new error.
> Now, I confirmed that scdaemon (2.0.14 with my own patches) works fine
> with two different tokens interchangeably.


This is actually similar to the error I was getting on Mac OSX only.  I
removed the offending line, and incorporated the stuff from your
original patch, and it actually seems to be working for me.

At the moment, I don't have two cards/readers to test, but I should be
getting some next week.  If its not too much trouble, could you try this
patch on top of my original one?  I'm hoping it'll take care of both
issues you encountered.

I'll continue to run with the new code on OSX and Ubuntu over the weekend...

diff --git a/scd/apdu.c b/scd/apdu.c
index 1bdc673..ccb192b 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -1416,7 +1416,7 @@ reset_pcsc_reader_wrapped (int slot)
       /* If the error code is no smart card or no reader, we should not
          this a major error and close the wrapper.  */
       sw = pcsc_error_to_sw (err);
-      if (err == PCSC_E_NO_SMARTCARD || err == PCSC_E_UNKNOWN_READER)
+      if (err == PCSC_E_NO_SMARTCARD)
         return sw;
       goto command_failed;
diff --git a/scd/command.c b/scd/command.c
index f1b0d49..95ed702 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -309,7 +309,7 @@ do_reset (ctrl_t ctrl, int send_reset)
       if (apdu_reset (slot))
-          slot_table[slot].reset_failed = 1;
+          slot_table[slot].valid = 0;


"I am gravely disappointed. Again you have made me unleash my dogs of war."

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 570 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20110121/fea670d7/attachment.pgp>

More information about the Gnupg-devel mailing list