Loading hw/usb/ccid-card-emulated.c +2 −2 Original line number Diff line number Diff line Loading @@ -547,7 +547,7 @@ static void emulated_realize(CCIDCardState *base, Error **errp) card, QEMU_THREAD_JOINABLE); } static void emulated_exitfn(CCIDCardState *base) static void emulated_unrealize(CCIDCardState *base, Error **errp) { EmulatedState *card = EMULATED_CCID_CARD(base); VEvent *vevent = vevent_new(VEVENT_LAST, NULL, NULL); Loading Loading @@ -582,7 +582,7 @@ static void emulated_class_initfn(ObjectClass *klass, void *data) CCIDCardClass *cc = CCID_CARD_CLASS(klass); cc->realize = emulated_realize; cc->exitfn = emulated_exitfn; cc->unrealize = emulated_unrealize; cc->get_atr = emulated_get_atr; cc->apdu_from_guest = emulated_apdu_from_guest; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); Loading hw/usb/ccid-card-passthru.c +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" #include <cacard/vscard_common.h> #include "chardev/char-fe.h" #include "qemu/error-report.h" Loading hw/usb/ccid.h +3 −1 Original line number Diff line number Diff line Loading @@ -28,13 +28,15 @@ typedef struct CCIDCardInfo CCIDCardInfo; * into the smartcard device (hw/ccid-card-*.c) */ typedef struct CCIDCardClass { /*< private >*/ DeviceClass parent_class; /*< public >*/ const uint8_t *(*get_atr)(CCIDCardState *card, uint32_t *len); void (*apdu_from_guest)(CCIDCardState *card, const uint8_t *apdu, uint32_t len); void (*exitfn)(CCIDCardState *card); void (*realize)(CCIDCardState *card, Error **errp); void (*unrealize)(CCIDCardState *card, Error **errp); } CCIDCardClass; /* Loading hw/usb/dev-smartcard-reader.c +11 −14 Original line number Diff line number Diff line Loading @@ -500,16 +500,6 @@ static void ccid_card_apdu_from_guest(CCIDCardState *card, } } static void ccid_card_exitfn(CCIDCardState *card) { CCIDCardClass *cc = CCID_CARD_GET_CLASS(card); if (cc->exitfn) { cc->exitfn(card); } } static bool ccid_has_pending_answers(USBCCIDState *s) { return s->pending_answers_num > 0; Loading Loading @@ -1271,18 +1261,25 @@ void ccid_card_card_inserted(CCIDCardState *card) ccid_on_slot_change(s, true); } static int ccid_card_exit(DeviceState *qdev) static void ccid_card_unrealize(DeviceState *qdev, Error **errp) { CCIDCardState *card = CCID_CARD(qdev); CCIDCardClass *cc = CCID_CARD_GET_CLASS(card); USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent); USBCCIDState *s = USB_CCID_DEV(dev); Error *local_err = NULL; if (ccid_card_inserted(s)) { ccid_card_card_removed(card); } ccid_card_exitfn(card); if (cc->unrealize) { cc->unrealize(card, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); return; } } s->card = NULL; return 0; } static void ccid_card_realize(DeviceState *qdev, Error **errp) Loading Loading @@ -1472,7 +1469,7 @@ static void ccid_card_class_init(ObjectClass *klass, void *data) DeviceClass *k = DEVICE_CLASS(klass); k->bus_type = TYPE_CCID_BUS; k->realize = ccid_card_realize; k->exit = ccid_card_exit; k->unrealize = ccid_card_unrealize; k->props = ccid_props; } Loading Loading
hw/usb/ccid-card-emulated.c +2 −2 Original line number Diff line number Diff line Loading @@ -547,7 +547,7 @@ static void emulated_realize(CCIDCardState *base, Error **errp) card, QEMU_THREAD_JOINABLE); } static void emulated_exitfn(CCIDCardState *base) static void emulated_unrealize(CCIDCardState *base, Error **errp) { EmulatedState *card = EMULATED_CCID_CARD(base); VEvent *vevent = vevent_new(VEVENT_LAST, NULL, NULL); Loading Loading @@ -582,7 +582,7 @@ static void emulated_class_initfn(ObjectClass *klass, void *data) CCIDCardClass *cc = CCID_CARD_CLASS(klass); cc->realize = emulated_realize; cc->exitfn = emulated_exitfn; cc->unrealize = emulated_unrealize; cc->get_atr = emulated_get_atr; cc->apdu_from_guest = emulated_apdu_from_guest; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); Loading
hw/usb/ccid-card-passthru.c +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" #include <cacard/vscard_common.h> #include "chardev/char-fe.h" #include "qemu/error-report.h" Loading
hw/usb/ccid.h +3 −1 Original line number Diff line number Diff line Loading @@ -28,13 +28,15 @@ typedef struct CCIDCardInfo CCIDCardInfo; * into the smartcard device (hw/ccid-card-*.c) */ typedef struct CCIDCardClass { /*< private >*/ DeviceClass parent_class; /*< public >*/ const uint8_t *(*get_atr)(CCIDCardState *card, uint32_t *len); void (*apdu_from_guest)(CCIDCardState *card, const uint8_t *apdu, uint32_t len); void (*exitfn)(CCIDCardState *card); void (*realize)(CCIDCardState *card, Error **errp); void (*unrealize)(CCIDCardState *card, Error **errp); } CCIDCardClass; /* Loading
hw/usb/dev-smartcard-reader.c +11 −14 Original line number Diff line number Diff line Loading @@ -500,16 +500,6 @@ static void ccid_card_apdu_from_guest(CCIDCardState *card, } } static void ccid_card_exitfn(CCIDCardState *card) { CCIDCardClass *cc = CCID_CARD_GET_CLASS(card); if (cc->exitfn) { cc->exitfn(card); } } static bool ccid_has_pending_answers(USBCCIDState *s) { return s->pending_answers_num > 0; Loading Loading @@ -1271,18 +1261,25 @@ void ccid_card_card_inserted(CCIDCardState *card) ccid_on_slot_change(s, true); } static int ccid_card_exit(DeviceState *qdev) static void ccid_card_unrealize(DeviceState *qdev, Error **errp) { CCIDCardState *card = CCID_CARD(qdev); CCIDCardClass *cc = CCID_CARD_GET_CLASS(card); USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent); USBCCIDState *s = USB_CCID_DEV(dev); Error *local_err = NULL; if (ccid_card_inserted(s)) { ccid_card_card_removed(card); } ccid_card_exitfn(card); if (cc->unrealize) { cc->unrealize(card, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); return; } } s->card = NULL; return 0; } static void ccid_card_realize(DeviceState *qdev, Error **errp) Loading Loading @@ -1472,7 +1469,7 @@ static void ccid_card_class_init(ObjectClass *klass, void *data) DeviceClass *k = DEVICE_CLASS(klass); k->bus_type = TYPE_CCID_BUS; k->realize = ccid_card_realize; k->exit = ccid_card_exit; k->unrealize = ccid_card_unrealize; k->props = ccid_props; } Loading