ccid emulated card (v1, for usb-ccid v3)
cover ccid emulated card (v1, for usb-ccid v3)
Meant to be applied after the usb-ccid v3 patch on the list. Causes --enable-smartcard to depend on libcac_card, library for emulating CAC compliant smart cards at http://cgit.freedesktop.org/~alon/cac_card/
hw/ccid-card-emulated.c: new device
Makefile.objs: add ccid-card-emulated.o if --enable-smartcard
configure: dependency on libcac_card if --enable-smartcard hw/usb-ccid.c: added a TODO note hw/ccid-card-passthru.c: removed does-nothing print method.
Alon Levy (1):
add ccid-card-emulated device
Makefile.objs | 2 +- configure | 20 ++ hw/ccid-card-emulated.c | 497 +++++++++++++++++++++++++++++++++++++++++++++++ hw/ccid-card-passthru.c | 6 - hw/usb-ccid.c | 2 + 5 files changed, 520 insertions(+), 7 deletions(-) create mode 100644 hw/ccid-card-emulated.c
Signature · 1 line
1.7.3.1
PATCH 1/1 add ccid-card-emulated device
Signed-off-by Alon Levy <[email protected]>
--- Makefile.objs | 2 +- configure | 20 ++ hw/ccid-card-emulated.c | 497 +++++++++++++++++++++++++++++++++++++++++++++++ hw/ccid-card-passthru.c | 6 - hw/usb-ccid.c | 2 + 5 files changed, 520 insertions(+), 7 deletions(-) create mode 100644 hw/ccid-card-emulated.c
Makefile.objs +1 -1
@@ -173,7 +173,7 @@ hw-obj-$(CONFIG_FDC) += fdc.o hw-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o hw-obj-$(CONFIG_APM) += pm_smbus.o apm.o hw-obj-$(CONFIG_DMA) += dma.o -hw-obj-$(CONFIG_SMARTCARD) += usb-ccid.o ccid-card-passthru.o +hw-obj-$(CONFIG_SMARTCARD) += usb-ccid.o ccid-card-passthru.o ccid-card-emulated.o # PPC devices hw-obj-$(CONFIG_OPENPIC) += openpic.o
configure +20 -0
@@ -2113,6 +2113,26 @@ EOF fi fi +# check for libcaccard for smartcard support +if test "$smartcard" != "no" ; then + cat > $TMPC << EOF +#include <vscard_common.h> +int main() { return 0; } +EOF + smartcard_cflags=$($pkgconfig --cflags cac_card cac_card 2>/dev/null) + smartcard_libs=$($pkgconfig --libs cac_card cac_card 2>/dev/null) + if $pkgconfig --atleast-version=0.0.1 cac_card &&\ + compile_prog "$smartcard_cflags" "$smartcard_libs" ; then + smartcard="yes" + QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags" + else + if test "smartcard" = "yes" ; then + feature_not_found "smartcard" + fi + smartcard="no" + fi +fi + ########################################## ##########################################
hw/ccid-card-emulated.c new file +497 -0
497 lines not on this page · raw message
hw/ccid-card-passthru.c +0 -6
@@ -225,11 +225,6 @@ static int passthru_exitfn(CCIDCardState *base)return 0 ; } -static void passthru_print (Monitor *mon,CCIDCardState *card,int indent) -{ -monitor_printf (mon,"%*s <info here>\n" , indent,"" ); -} -static void passthru_pre_save (void *opaque) {PassthruState *card = opaque;
@@ -262,7 +257,6 @@ static CCIDCardInfo passthru_card_info = { .qdev.vmsd = &passthru_vmstate, .initfn = passthru_initfn, .exitfn = passthru_exitfn, - .print = passthru_print, .get_atr = passthru_get_atr, .apdu_from_guest = passthru_apdu_from_guest, .qdev.props = (Property []) {
hw/usb-ccid.c +2 -0
@@ -1137,6 +1137,8 @@ void ccid_card_card_error(CCIDCardState *card, uint64_t error) s->bmCommandStatus =COMMAND_STATUS_FAILED ; s->last_answer_error = error;DPRINTF (1 ,"VSC_Error: %lX\n" , s->last_answer_error); +/* TODO: these error's should be more verbose and propogated to the guest. +* */ ccid_write_data_block_answer (s,NULL ,0 ); }
Signature · 1 line
1.7.3.1