diff --git a/scd/apdu.h b/scd/apdu.h index 7c23e02fd..d042c7cde 100644 --- a/scd/apdu.h +++ b/scd/apdu.h @@ -81,7 +81,9 @@ enum { SW_HOST_USB_NO_DEVICE = 0x10024, SW_HOST_USB_BUSY = 0x10026, SW_HOST_USB_TIMEOUT = 0x10027, - SW_HOST_USB_OVERFLOW = 0x10028 + SW_HOST_USB_OVERFLOW = 0x10028, + SW_HOST_UI_CANCELLED = 0x10030, + SW_HOST_UI_TIMEOUT = 0x10031 }; struct dev_list; diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c index eed8e0320..021f9ac64 100644 --- a/scd/ccid-driver.c +++ b/scd/ccid-driver.c @@ -2148,7 +2148,16 @@ bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length, } } if (CCID_COMMAND_FAILED (buffer)) - print_command_failed (buffer); + { + int ec; + + ec = CCID_ERROR_CODE (buffer); + print_command_failed (buffer); + if (ec == 0xEF) + return CCID_DRIVER_ERR_UI_CANCELLED; + else if (ec == 0xF0) + return CCID_DRIVER_ERR_UI_TIMEOUT; + } /* Check whether a card is at all available. Note: If you add new error codes here, check whether they need to be ignored in diff --git a/scd/ccid-driver.h b/scd/ccid-driver.h index 232483544..18cbc87f0 100644 --- a/scd/ccid-driver.h +++ b/scd/ccid-driver.h @@ -116,6 +116,8 @@ enum { #define CCID_DRIVER_ERR_USB_BUSY 0x10026 #define CCID_DRIVER_ERR_USB_TIMEOUT 0x10027 #define CCID_DRIVER_ERR_USB_OVERFLOW 0x10028 +#define CCID_DRIVER_ERR_UI_CANCELLED 0x10030 +#define CCID_DRIVER_ERR_UI_TIMEOUT 0x10031 struct ccid_driver_s; typedef struct ccid_driver_s *ccid_driver_t; diff --git a/scd/iso7816.c b/scd/iso7816.c index ef02d64cc..f14c14f69 100644 --- a/scd/iso7816.c +++ b/scd/iso7816.c @@ -96,6 +96,8 @@ map_sw (int sw) case SW_HOST_USB_BUSY: ec = GPG_ERR_EBUSY; break; case SW_HOST_USB_TIMEOUT: ec = GPG_ERR_TIMEOUT; break; case SW_HOST_USB_OVERFLOW: ec = GPG_ERR_EOVERFLOW; break; + case SW_HOST_UI_CANCELLED: ec = GPG_ERR_CANCELED; break; + case SW_HOST_UI_TIMEOUT: ec = GPG_ERR_TIMEOUT; break; default: if ((sw & 0x010000))