aboutsummaryrefslogtreecommitdiffstats
path: root/scd/apdu.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2019-09-11 01:36:29 +0000
committerNIIBE Yutaka <[email protected]>2019-09-11 01:36:29 +0000
commit441106cdf0fdd310e3b36370186849167db11345 (patch)
treee95d691d86c89a97ce15ff73f212cc4edf80f6de /scd/apdu.c
parentscd,pcsc: Support multiple card readers. (diff)
downloadgnupg-441106cdf0fdd310e3b36370186849167db11345.tar.gz
gnupg-441106cdf0fdd310e3b36370186849167db11345.zip
scd,pcsc: Fix for initializing PC/SC.
* scd/apdu.c (pcsc_init): Load it at first. (apdu_open_reader): Check for the CCID internal driver. Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'scd/apdu.c')
-rw-r--r--scd/apdu.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/scd/apdu.c b/scd/apdu.c
index 56955500b..958b47e1a 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -1062,14 +1062,6 @@ pcsc_init (void)
static int pcsc_api_loaded;
long err;
- err = pcsc_establish_context (PCSC_SCOPE_SYSTEM, NULL, NULL, &pcsc.context);
- if (err)
- {
- log_error ("pcsc_establish_context failed: %s (0x%lx)\n",
- pcsc_error_string (err), err);
- return -1;
- }
-
/* Lets try the PC/SC API */
if (!pcsc_api_loaded)
{
@@ -1152,6 +1144,15 @@ pcsc_init (void)
return -1;
}
pcsc_api_loaded = 1;
+
+ err = pcsc_establish_context (PCSC_SCOPE_SYSTEM, NULL, NULL,
+ &pcsc.context);
+ if (err)
+ {
+ log_error ("pcsc_establish_context failed: %s (0x%lx)\n",
+ pcsc_error_string (err), err);
+ return -1;
+ }
}
return 0;
@@ -2051,10 +2052,13 @@ apdu_open_reader (struct dev_list *dl, int app_empty)
int slot;
#ifdef HAVE_LIBUSB
- if (dl->table)
+ if (!opt.disable_ccid)
{ /* CCID readers. */
int readerno;
+ if (!dl->table)
+ return -1;
+
/* See whether we want to use the reader ID string or a reader
number. A readerno of -1 indicates that the reader ID string is
to be used. */