summaryrefslogtreecommitdiffstats
path: root/scd/iso7816.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2020-08-12 16:06:49 +0200
committerWerner Koch <wk@gnupg.org>2020-08-12 16:06:49 +0200
commit9a8d7e41bba1926158a21ebdda542241493ef983 (patch)
tree6bc39decf6d542b22e743062ca41466aca861ac8 /scd/iso7816.c
parentcommon: Pass the WAYLAND_DISPLAY envvar along (diff)
downloadgnupg2-9a8d7e41bba1926158a21ebdda542241493ef983.tar.xz
gnupg2-9a8d7e41bba1926158a21ebdda542241493ef983.zip
scd: Map some error codes from libusb to ccid-driver error codes.
* scd/ccid-driver.h (CCID_DRIVER_ERR_USB_*): New error codes. * scd/apdu.h: New SW_HOST error codes. * scd/apdu.c (host_sw_string): Print them * scd/ccid-driver.c (map_libusb_error): New. (ccid_open_usb_reader, bulk_in, abort_cmd): Map libusb error codes. * scd/iso7816.c (map_sw): Map new codes to gpg-error. -- This change will help to get low level error conditions from hipher application code. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'scd/iso7816.c')
-rw-r--r--scd/iso7816.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/scd/iso7816.c b/scd/iso7816.c
index a841f77e0..5316d0b3b 100644
--- a/scd/iso7816.c
+++ b/scd/iso7816.c
@@ -89,6 +89,13 @@ map_sw (int sw)
case SW_HOST_ABORTED: ec = GPG_ERR_INV_RESPONSE; break;
case SW_HOST_NO_PINPAD: ec = GPG_ERR_NOT_SUPPORTED; break;
case SW_HOST_CANCELLED: ec = GPG_ERR_CANCELED; break;
+ case SW_HOST_USB_OTHER: ec = GPG_ERR_EIO; break;
+ case SW_HOST_USB_IO: ec = GPG_ERR_EIO; break;
+ case SW_HOST_USB_ACCESS: ec = GPG_ERR_EACCES; break;
+ case SW_HOST_USB_NO_DEVICE: ec = GPG_ERR_ENODEV; break;
+ 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;
default:
if ((sw & 0x010000))