check ATRs even for forced card driver

some card drivers depend on a card type which is initialized by matching the card's ATR
This commit is contained in:
Frank Morgner 2015-04-14 13:26:27 +02:00 committed by Viktor Tarasov
parent 96556dea7b
commit a7a903fd81
1 changed files with 6 additions and 2 deletions

View File

@ -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) {