1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

disconnectafter wake-up bug fix by Bob Dunlop.

This commit is contained in:
Werner Koch 2006-08-21 08:40:45 +00:00
parent 368170215f
commit b122c9b6be
2 changed files with 29 additions and 11 deletions

View File

@ -1,3 +1,12 @@
2006-08-21 Werner Koch <wk@g10code.com>
* pcsc-wrapper.c (handle_open, handle_close): Reset card and
protocol on error/close.
(handle_status): Don't set the stae if the state is unknown.
(handle_reset): Ignore an error if already disconnected. May
happen due to system wake-up after hibernation. Suggested by Bob
Dunlop.
2006-06-28 Werner Koch <wk@g10code.com> 2006-06-28 Werner Koch <wk@g10code.com>
* app-openpgp.c (do_writekey): Fixed computation of memmove * app-openpgp.c (do_writekey): Fixed computation of memmove

View File

@ -474,6 +474,8 @@ handle_open (unsigned char *argbuf, size_t arglen)
pcsc_release_context (pcsc_context); pcsc_release_context (pcsc_context);
free (current_rdrname); free (current_rdrname);
current_rdrname = NULL; current_rdrname = NULL;
pcsc_card = 0;
pcsc_protocol = 0;
request_failed (err); request_failed (err);
return; return;
} }
@ -527,6 +529,8 @@ handle_close (unsigned char *argbuf, size_t arglen)
free (current_rdrname); free (current_rdrname);
current_rdrname = NULL; current_rdrname = NULL;
pcsc_release_context (pcsc_context); pcsc_release_context (pcsc_context);
pcsc_card = 0;
pcsc_protocol = 0;
request_succeeded (NULL, 0); request_succeeded (NULL, 0);
} }
@ -567,6 +571,8 @@ handle_status (unsigned char *argbuf, size_t arglen)
} }
status = 0; status = 0;
if ( !(rdrstates[0].event_state & PCSC_STATE_UNKNOWN) )
{
if ( (rdrstates[0].event_state & PCSC_STATE_PRESENT) ) if ( (rdrstates[0].event_state & PCSC_STATE_PRESENT) )
status |= 2; status |= 2;
if ( !(rdrstates[0].event_state & PCSC_STATE_MUTE) ) if ( !(rdrstates[0].event_state & PCSC_STATE_MUTE) )
@ -577,6 +583,7 @@ handle_status (unsigned char *argbuf, size_t arglen)
if ( (status & 6) == 6 if ( (status & 6) == 6
&& !(rdrstates[0].event_state & PCSC_STATE_INUSE) ) && !(rdrstates[0].event_state & PCSC_STATE_INUSE) )
status |= 1; status |= 1;
}
/* First word is identical to the one used by apdu.c. */ /* First word is identical to the one used by apdu.c. */
buf[0] = 0; buf[0] = 0;
@ -618,6 +625,8 @@ handle_reset (unsigned char *argbuf, size_t arglen)
if (pcsc_card) if (pcsc_card)
{ {
err = pcsc_disconnect (pcsc_card, PCSC_LEAVE_CARD); err = pcsc_disconnect (pcsc_card, PCSC_LEAVE_CARD);
if (err == 0x80100003) /* Invalid handle. (already disconnected) */
err = 0;
if (err) if (err)
{ {
fprintf (stderr, PGM": pcsc_disconnect failed: %s (0x%lx)\n", fprintf (stderr, PGM": pcsc_disconnect failed: %s (0x%lx)\n",