mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-13 22:21:09 +02:00
2006-09-01 Marcus Brinkmann <marcus@g10code.de>
* command.c (cmd_getinfo): Handle status command.
This commit is contained in:
parent
9bdb549dc4
commit
59a5681e63
@ -1,3 +1,7 @@
|
|||||||
|
2006-09-01 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* command.c (cmd_getinfo): Handle status command.
|
||||||
|
|
||||||
2006-08-30 Marcus Brinkmann <marcus@g10code.de>
|
2006-08-30 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* command.c (do_reset): Delay resetting CTRL->reader_slot until
|
* command.c (do_reset): Delay resetting CTRL->reader_slot until
|
||||||
|
@ -295,7 +295,7 @@ get_reader_slot (void)
|
|||||||
|
|
||||||
/* If the card has not yet been opened, do it. Note that this
|
/* If the card has not yet been opened, do it. Note that this
|
||||||
function returns an Assuan error, so don't map the error a second
|
function returns an Assuan error, so don't map the error a second
|
||||||
time */
|
time. */
|
||||||
static assuan_error_t
|
static assuan_error_t
|
||||||
open_card (ctrl_t ctrl, const char *apptype)
|
open_card (ctrl_t ctrl, const char *apptype)
|
||||||
{
|
{
|
||||||
@ -1355,7 +1355,12 @@ cmd_unlock (assuan_context_t ctx, char *line)
|
|||||||
Supported values of WHAT are:
|
Supported values of WHAT are:
|
||||||
|
|
||||||
socket_name - Return the name of the socket.
|
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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1372,6 +1377,29 @@ cmd_getinfo (assuan_context_t ctx, char *line)
|
|||||||
else
|
else
|
||||||
rc = gpg_error (GPG_ERR_NO_DATA);
|
rc = gpg_error (GPG_ERR_NO_DATA);
|
||||||
}
|
}
|
||||||
|
else if (!strcmp (line, "status"))
|
||||||
|
{
|
||||||
|
ctrl_t ctrl = assuan_get_pointer (ctx);
|
||||||
|
int slot = ctrl->reader_slot;
|
||||||
|
char flag = 'r';
|
||||||
|
|
||||||
|
if (!ctrl->server_local->card_removed && slot != -1)
|
||||||
|
{
|
||||||
|
struct slot_status_s *ss;
|
||||||
|
|
||||||
|
if (!(slot >= 0 && slot < DIM(slot_table)))
|
||||||
|
BUG ();
|
||||||
|
|
||||||
|
ss = &slot_table[slot];
|
||||||
|
|
||||||
|
if (!ss->valid)
|
||||||
|
BUG ();
|
||||||
|
|
||||||
|
if (ss->any && (ss->status & 1))
|
||||||
|
flag = 'u';
|
||||||
|
}
|
||||||
|
rc = assuan_send_data (ctx, &flag, 1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
rc = set_error (Parameter_Error, "unknown value for WHAT");
|
rc = set_error (Parameter_Error, "unknown value for WHAT");
|
||||||
return rc;
|
return rc;
|
||||||
@ -1752,7 +1780,7 @@ update_reader_status_file (void)
|
|||||||
will set this on any card change because a reset or
|
will set this on any card change because a reset or
|
||||||
SERIALNO request must be done in any case. */
|
SERIALNO request must be done in any case. */
|
||||||
if (ss->any)
|
if (ss->any)
|
||||||
update_card_removed (ss->slot, 1);
|
update_card_removed (ss->slot, 1); /* XXX: MB: Should be idx? */
|
||||||
|
|
||||||
ss->any = 1;
|
ss->any = 1;
|
||||||
ss->status = status;
|
ss->status = status;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user