USB card reader emulated by QEMU announces presence of PIN pad. OpenSC will not request PIN from user in this case and assumes PIN is being entered off-band on external device. Unfortunately QEMU does not seem to offer PIN entry and access to card always fails.
Changing device to not announce non-existing capability fixes it and allows to use OpenSC framework with emulated card. --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -398,7 +398,7 @@ static const uint8_t qemu_ccid_descriptor[] = { * u16 wLcdLayout; XXYY Number of lines (XX) and chars per * line for LCD display used for PIN entry. 0000 - no LCD */ - 0x01, /* + 0x00, /* * u8 bPINSupport; 01h PIN Verification, * 02h PIN Modification */