aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2003-10-31 12:12:36 +0000
committerWerner Koch <[email protected]>2003-10-31 12:12:36 +0000
commitc8fb3836fb5c296d771457ed2dfb1c837a17bc08 (patch)
tree9bb7021cd7e3d7bb5a6543cf24a1d756d6cd60a2
parentnew command (diff)
downloadgnupg-c8fb3836fb5c296d771457ed2dfb1c837a17bc08.tar.gz
gnupg-c8fb3836fb5c296d771457ed2dfb1c837a17bc08.zip
* apdu.c (close_ct_reader, close_pcsc_reader): Implemented.
(get_ccid_error_string): New. Not very useful messages, though.
-rw-r--r--scd/ChangeLog8
-rw-r--r--scd/apdu.c17
-rw-r--r--scd/ccid-driver.c3
3 files changed, 24 insertions, 4 deletions
diff --git a/scd/ChangeLog b/scd/ChangeLog
index 0b683d506..d3282b38a 100644
--- a/scd/ChangeLog
+++ b/scd/ChangeLog
@@ -1,5 +1,13 @@
+2003-10-30 Werner Koch <[email protected]>
+
+ * apdu.c (close_ct_reader, close_pcsc_reader): Implemented.
+ (get_ccid_error_string): New. Not very useful messages, though.
+
2003-10-25 Werner Koch <[email protected]>
+ * ccid-driver.c (ccid_open_reader): Return an error if no USB
+ devices are found.
+
* command.c (cmd_genkey, cmd_passwd): Fixed faulty use of
!spacep().
diff --git a/scd/apdu.c b/scd/apdu.c
index 9f5d36e09..27304c8b5 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -363,7 +363,7 @@ open_ct_reader (int port)
static int
close_ct_reader (int slot)
{
- /* FIXME: Implement. */
+ CT_close (slot);
reader_table[slot].used = 0;
return 0;
}
@@ -594,7 +594,7 @@ pcsc_send_apdu (int slot, unsigned char *apdu, size_t apdulen,
static int
close_pcsc_reader (int slot)
{
- /* FIXME: Implement. */
+ pcsc_release_context (reader_table[slot].pcsc.context);
reader_table[slot].used = 0;
return 0;
}
@@ -608,6 +608,15 @@ close_pcsc_reader (int slot)
Internal CCID driver interface.
*/
+static const char *
+get_ccid_error_string (long err)
+{
+ if (!err)
+ return "okay";
+ else
+ return "unknown CCID error";
+}
+
static int
open_ccid_reader (void)
{
@@ -973,7 +982,7 @@ apdu_open_reader (const char *portstr)
pcsc_disconnect = dlsym (handle, "SCardDisconnect");
pcsc_status = dlsym (handle, "SCardStatus");
#ifdef _WIN32
- if (pcsc_status)
+ if (!pcsc_status)
pcsc_status = dlsym (handle, "SCardStatusA");
#endif
pcsc_begin_transaction = dlsym (handle, "SCardBeginTransaction");
@@ -1062,7 +1071,7 @@ error_string (int slot, long rc)
return ct_error_string (rc);
#ifdef HAVE_LIBUSB
else if (reader_table[slot].is_ccid)
- return "no CCID driver error strings yet";
+ return get_ccid_error_string (rc);
#endif
#ifdef HAVE_OPENSC
else if (reader_table[slot].is_osc)
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index 8868a2cfc..099dae240 100644
--- a/scd/ccid-driver.c
+++ b/scd/ccid-driver.c
@@ -494,6 +494,9 @@ ccid_open_reader (ccid_driver_t *handle, int readerno)
shallow copy of the list created internally by usb_init ? */
usb_free_match (match);
+ if (!rc && !*handle)
+ rc = -1; /* In case we didn't enter the while lool at all. */
+
return rc;
}