From 688d083f639f37e9e32ba437c1ce534061b081bd Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Fri, 15 Oct 2010 12:58:29 +0000 Subject: [PATCH] Fix build with recent libnfc API breakage. --- libfreefare/freefare.c | 10 +++++++--- libfreefare/mifare_classic.c | 8 ++++++-- libfreefare/mifare_desfire.c | 8 ++++++-- libfreefare/mifare_ultralight.c | 8 ++++++-- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/libfreefare/freefare.c b/libfreefare/freefare.c index b1228b3..1b3304a 100644 --- a/libfreefare/freefare.c +++ b/libfreefare/freefare.c @@ -128,9 +128,13 @@ freefare_get_tags (nfc_device_t *device) nfc_configure(device,NDO_ACTIVATE_FIELD,true); // Poll for a ISO14443A (MIFARE) tag - nfc_target_info_t candidates[MAX_CANDIDATES]; + nfc_target_t candidates[MAX_CANDIDATES]; size_t candidates_count; - if (!nfc_initiator_list_passive_targets(device, NM_ISO14443A_106, candidates, MAX_CANDIDATES, &candidates_count)) + nfc_modulation_t modulation = { + .nmt = NMT_ISO14443A, + .nbr = NBR_106 + }; + if (!nfc_initiator_list_passive_targets(device, modulation, candidates, MAX_CANDIDATES, &candidates_count)) return NULL; tags = malloc(sizeof (void *)); @@ -139,7 +143,7 @@ freefare_get_tags (nfc_device_t *device) for (size_t c = 0; c < candidates_count; c++) { MifareTag t; - if ((t = freefare_tag_new(device, candidates[c].nai))) { + if ((t = freefare_tag_new(device, candidates[c].nti.nai))) { /* (Re)Allocate memory for the found MIFARE targets array */ MifareTag *p = realloc (tags, (tag_count + 2) * sizeof (MifareTag)); if (p) diff --git a/libfreefare/mifare_classic.c b/libfreefare/mifare_classic.c index 2937123..9c4abd5 100644 --- a/libfreefare/mifare_classic.c +++ b/libfreefare/mifare_classic.c @@ -226,8 +226,12 @@ mifare_classic_connect (MifareTag tag) ASSERT_INACTIVE (tag); ASSERT_MIFARE_CLASSIC (tag); - nfc_target_info_t pnti; - if (nfc_initiator_select_passive_target (tag->device, NM_ISO14443A_106, tag->info.abtUid, tag->info.szUidLen, &pnti)) { + nfc_target_t pnti; + nfc_modulation_t modulation = { + .nmt = NMT_ISO14443A, + .nbr = NBR_106 + }; + if (nfc_initiator_select_passive_target (tag->device, modulation, tag->info.abtUid, tag->info.szUidLen, &pnti)) { tag->active = 1; } else { errno = EIO; diff --git a/libfreefare/mifare_desfire.c b/libfreefare/mifare_desfire.c index 1c7ed95..ab8dc22 100644 --- a/libfreefare/mifare_desfire.c +++ b/libfreefare/mifare_desfire.c @@ -281,8 +281,12 @@ mifare_desfire_connect (MifareTag tag) ASSERT_INACTIVE (tag); ASSERT_MIFARE_DESFIRE (tag); - nfc_target_info_t pnti; - if (nfc_initiator_select_passive_target (tag->device, NM_ISO14443A_106, tag->info.abtUid, tag->info.szUidLen, &pnti)) { + nfc_target_t pnti; + nfc_modulation_t modulation = { + .nmt = NMT_ISO14443A, + .nbr = NBR_106 + }; + if (nfc_initiator_select_passive_target (tag->device, modulation, tag->info.abtUid, tag->info.szUidLen, &pnti)) { tag->active = 1; free (MIFARE_DESFIRE (tag)->session_key); MIFARE_DESFIRE (tag)->session_key = NULL; diff --git a/libfreefare/mifare_ultralight.c b/libfreefare/mifare_ultralight.c index ec34273..9632d34 100644 --- a/libfreefare/mifare_ultralight.c +++ b/libfreefare/mifare_ultralight.c @@ -99,8 +99,12 @@ mifare_ultralight_connect (MifareTag tag) ASSERT_INACTIVE (tag); ASSERT_MIFARE_ULTRALIGHT (tag); - nfc_target_info_t pnti; - if (nfc_initiator_select_passive_target (tag->device, NM_ISO14443A_106, tag->info.abtUid, tag->info.szUidLen, &pnti)) { + nfc_target_t pnti; + nfc_modulation_t modulation = { + .nmt = NMT_ISO14443A, + .nbr = NBR_106 + }; + if (nfc_initiator_select_passive_target (tag->device, modulation, tag->info.abtUid, tag->info.szUidLen, &pnti)) { tag->active = 1; for (int i = 0; i < MIFARE_ULTRALIGHT_PAGE_COUNT; i++) MIFARE_ULTRALIGHT(tag)->cached_pages[i] = 0;