aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/ccid-card-passthru.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-02-11 15:09:33 +0000
committerPeter Maydell <peter.maydell@linaro.org>2016-02-11 15:09:33 +0000
commitfc1ec1acffd29d54c0c4266d30d38b2399d42f4f (patch)
tree38dd37dda993a32ca05e05102bb1838769613a12 /hw/usb/ccid-card-passthru.c
parentf16368459957603b8b3efa83353cc7e13ab6abd3 (diff)
parent1834ed3afc578b8dbf39838cfdf27d457771a334 (diff)
downloadqemu-fc1ec1acffd29d54c0c4266d30d38b2399d42f4f.zip
qemu-fc1ec1acffd29d54c0c4266d30d38b2399d42f4f.tar.gz
qemu-fc1ec1acffd29d54c0c4266d30d38b2399d42f4f.tar.bz2
Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2016-02-11' into staging
trivial patches for 2016-02-11 # gpg: Signature made Thu 11 Feb 2016 12:16:04 GMT using RSA key ID A4C3D7DB # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" # gpg: aka "Michael Tokarev <mjt@corpit.ru>" # gpg: aka "Michael Tokarev <mjt@debian.org>" * remotes/mjt/tags/pull-trivial-patches-2016-02-11: w32: include winsock2.h before windows.h Adds keycode 86 to the hid_usage_keys translation table. s390x: remove s390-zipl.rom Passthru CCID card: QOMify Emulated CCID card: QOMify ES1370: QOMify char: fix parameter name / type in BSD codepath qmp-spec: fix index in doc rdma: remove check on time_spent when calculating mbs qemu-sockets: simplify error handling cpu: cpu_save/cpu_load is no more qom: Correct object_property_get_int() description man: virtfs-proxy-helper: Rework awkward sentence remove libtool support Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/usb/ccid-card-passthru.c')
-rw-r--r--hw/usb/ccid-card-passthru.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index 2e4d95f..c0e90e5 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -39,8 +39,6 @@ static const uint8_t DEFAULT_ATR[] = {
0x13, 0x08
};
-
-#define PASSTHRU_DEV_NAME "ccid-card-passthru"
#define VSCARD_IN_SIZE 65536
/* maximum size of ATR - from 7816-3 */
@@ -59,6 +57,10 @@ struct PassthruState {
uint8_t debug;
};
+#define TYPE_CCID_PASSTHRU "ccid-card-passthru"
+#define PASSTHRU_CCID_CARD(obj) \
+ OBJECT_CHECK(PassthruState, (obj), TYPE_CCID_PASSTHRU)
+
/*
* VSCard protocol over chardev
* This code should not depend on the card type.
@@ -317,7 +319,7 @@ static void ccid_card_vscard_event(void *opaque, int event)
static void passthru_apdu_from_guest(
CCIDCardState *base, const uint8_t *apdu, uint32_t len)
{
- PassthruState *card = DO_UPCAST(PassthruState, base, base);
+ PassthruState *card = PASSTHRU_CCID_CARD(base);
if (!card->cs) {
printf("ccid-passthru: no chardev, discarding apdu length %d\n", len);
@@ -328,7 +330,7 @@ static void passthru_apdu_from_guest(
static const uint8_t *passthru_get_atr(CCIDCardState *base, uint32_t *len)
{
- PassthruState *card = DO_UPCAST(PassthruState, base, base);
+ PassthruState *card = PASSTHRU_CCID_CARD(base);
*len = card->atr_length;
return card->atr;
@@ -336,7 +338,7 @@ static const uint8_t *passthru_get_atr(CCIDCardState *base, uint32_t *len)
static int passthru_initfn(CCIDCardState *base)
{
- PassthruState *card = DO_UPCAST(PassthruState, base, base);
+ PassthruState *card = PASSTHRU_CCID_CARD(base);
card->vscard_in_pos = 0;
card->vscard_in_hdr = 0;
@@ -400,7 +402,7 @@ static void passthru_class_initfn(ObjectClass *klass, void *data)
}
static const TypeInfo passthru_card_info = {
- .name = PASSTHRU_DEV_NAME,
+ .name = TYPE_CCID_PASSTHRU,
.parent = TYPE_CCID_CARD,
.instance_size = sizeof(PassthruState),
.class_init = passthru_class_initfn,