diff options
author | Werner Koch <[email protected]> | 2007-04-03 16:57:37 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2007-04-03 16:57:37 +0000 |
commit | 3bbc481935713a0661a5084f624c72ae3b59a3ce (patch) | |
tree | 0d44a3635b8f0aa555133dbfe5d08cf9aae731ca /scd/command.c | |
parent | kbx/ (diff) | |
download | gnupg-3bbc481935713a0661a5084f624c72ae3b59a3ce.tar.gz gnupg-3bbc481935713a0661a5084f624c72ae3b59a3ce.zip |
Add a way to get a listing of available CCID readers.
Diffstat (limited to '')
-rw-r--r-- | scd/command.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scd/command.c b/scd/command.c index 579145711..93df064af 100644 --- a/scd/command.c +++ b/scd/command.c @@ -38,6 +38,9 @@ #include "app-common.h" #include "apdu.h" /* Required for apdu_*_reader (). */ #include "exechelp.h" +#ifdef HAVE_LIBUSB +#include "ccid-driver.h" +#endif /* Maximum length allowed as a PIN; used for INQUIRE NEEDPIN */ #define MAXLEN_PIN 100 @@ -1382,12 +1385,16 @@ cmd_unlock (assuan_context_t ctx, char *line) Supported values of WHAT are: socket_name - Return the name of the socket. + status - Return the status of the current slot (in the future, may also return the status of all slots). The status is a list of one-character flags. The following flags are currently defined: 'u' Usable card present. This is the normal state during operation. 'r' Card removed. A reset is necessary. These flags are exclusive. + + reader_list - Return a list of detected card readers. Does + currently only work with the internal CCID driver. */ static int @@ -1427,6 +1434,20 @@ cmd_getinfo (assuan_context_t ctx, char *line) } rc = assuan_send_data (ctx, &flag, 1); } + else if (!strcmp (line, "reader_list")) + { +#ifdef HAVE_LIBUSB + char *s = ccid_get_reader_list (); +#else + char *s = NULL; +#endif + + if (s) + rc = assuan_send_data (ctx, s, strlen (s)); + else + rc = gpg_error (GPG_ERR_NO_DATA); + xfree (s); + } else rc = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT"); return rc; |