From 7c03c8cc65e68f1d77a5a5a497025191fe5df5e9 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 23 Feb 2011 10:15:34 +0100 Subject: Lock scdaemon to CCID if once found. This solves a problem where ccid was used, the card unplugged and then scdaemon tries to find a new (plugged in) reader and thus will eventually try PC/SC over and over again. Also added an explicit --kill command to gpgconf. --- scd/ChangeLog | 4 ++++ scd/apdu.c | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'scd') diff --git a/scd/ChangeLog b/scd/ChangeLog index 0006f743c..0a614c855 100644 --- a/scd/ChangeLog +++ b/scd/ChangeLog @@ -1,3 +1,7 @@ +2011-02-23 Werner Koch + + * apdu.c (apdu_open_reader): Lock in to CCID if used once. + 2011-01-25 NIIBE Yutaka , Grant Olson (wk) diff --git a/scd/apdu.c b/scd/apdu.c index 8080b42a1..176ab914b 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -1,5 +1,6 @@ /* apdu.c - ISO 7816 APDU functions and low level I/O - * Copyright (C) 2003, 2004, 2008, 2009, 2010 Free Software Foundation, Inc. + * Copyright (C) 2003, 2004, 2008, 2009, 2010, + * 2011 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -2355,12 +2356,25 @@ apdu_open_reader (const char *portstr, int *r_no_service) #ifdef HAVE_LIBUSB if (!opt.disable_ccid) { + static int once_available; int i; const char *s; slot = open_ccid_reader (portstr); if (slot != -1) - return slot; /* got one */ + { + once_available = 1; + return slot; /* got one */ + } + + /* If we ever loaded successfully loaded a CCID reader we never + want to fallback to another driver. This solves a problem + where ccid was used, the card unplugged and then scdaemon + tries to find a new reader and will eventually try PC/SC over + and over again. To reset this flag "gpgconf --kill scdaemon" + can be used. */ + if (once_available) + return -1; /* If a CCID reader specification has been given, the user does not want a fallback to other drivers. */ -- cgit v1.2.3