Philippe Mathieu-Daudé <f4...@amsat.org> writes: > Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> > --- > hw/usb/ccid.h | 9 +++++-- > hw/usb/ccid-card-emulated.c | 45 ++++++++++++++++++---------------- > hw/usb/ccid-card-passthru.c | 10 ++++---- > hw/usb/dev-smartcard-reader.c | 57 > +++++++++++++++---------------------------- > 4 files changed, 56 insertions(+), 65 deletions(-) > [...] > diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c > index e646eb243b..a2b608a953 100644 > --- a/hw/usb/ccid-card-emulated.c > +++ b/hw/usb/ccid-card-emulated.c > @@ -27,6 +27,7 @@ > */ > > #include "qemu/osdep.h" > +#include "qapi/error.h" > #include <eventt.h> > #include <vevent.h> > #include <vreader.h> > @@ -480,7 +481,7 @@ static uint32_t parse_enumeration(char *str, > return ret; > } > > -static int emulated_initfn(CCIDCardState *base) > +static void emulated_realize(CCIDCardState *base, Error **errp) > { > EmulatedState *card = EMULATED_CCID_CARD(base); > VCardEmulError ret; > @@ -495,7 +496,8 @@ static int emulated_initfn(CCIDCardState *base) > card->reader = NULL; > card->quit_apdu_thread = 0; > if (init_event_notifier(card) < 0) { > - return -1; > + error_setg(errp, TYPE_EMULATED_CCID ": event notifier creation > failed"); > + return; > } > > card->backend = 0; > @@ -505,11 +507,12 @@ static int emulated_initfn(CCIDCardState *base) > } > > if (card->backend == 0) { > - printf("backend must be one of:\n"); > + error_setg(errp, TYPE_EMULATED_CCID ": no backend specified.");
No period at end of error_setg() messages, please. More of the same below. > + error_append_hint(errp, "backend must be one of:\n"); > for (ptable = backend_enum_table; ptable->name != NULL; ++ptable) { > - printf("%s\n", ptable->name); > + error_append_hint(errp, "%s\n", ptable->name); > } > - return -1; > + return; > } > > /* TODO: a passthru backened that works on local machine. third card > type?*/ [...]