diff --git a/src/libopensc/card.c b/src/libopensc/card.c index 48f15579..33a55a89 100644 --- a/src/libopensc/card.c +++ b/src/libopensc/card.c @@ -190,10 +190,14 @@ int sc_connect_card(sc_reader_t *reader, sc_card_t **card_out) } if (driver != NULL) { - /* Forced driver, or matched via ATR mapping from - * config file */ + /* Forced driver, or matched via ATR mapping from config file */ card->driver = driver; + memcpy(card->ops, card->driver->ops, sizeof(struct sc_card_operations)); + if (card->ops->match_card != NULL) + if (card->ops->match_card(card) != 1) + sc_log(ctx, "driver '%s' match_card() failed: %s (will continue anyway)", card->driver->name, sc_strerror(r)); + if (card->ops->init != NULL) { r = card->ops->init(card); if (r) {