Fix build with recent libnfc API breakage.
This commit is contained in:
parent
215439cf67
commit
688d083f63
4 changed files with 25 additions and 9 deletions
|
@ -128,9 +128,13 @@ freefare_get_tags (nfc_device_t *device)
|
||||||
nfc_configure(device,NDO_ACTIVATE_FIELD,true);
|
nfc_configure(device,NDO_ACTIVATE_FIELD,true);
|
||||||
|
|
||||||
// Poll for a ISO14443A (MIFARE) tag
|
// Poll for a ISO14443A (MIFARE) tag
|
||||||
nfc_target_info_t candidates[MAX_CANDIDATES];
|
nfc_target_t candidates[MAX_CANDIDATES];
|
||||||
size_t candidates_count;
|
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;
|
return NULL;
|
||||||
|
|
||||||
tags = malloc(sizeof (void *));
|
tags = malloc(sizeof (void *));
|
||||||
|
@ -139,7 +143,7 @@ freefare_get_tags (nfc_device_t *device)
|
||||||
|
|
||||||
for (size_t c = 0; c < candidates_count; c++) {
|
for (size_t c = 0; c < candidates_count; c++) {
|
||||||
MifareTag t;
|
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 */
|
/* (Re)Allocate memory for the found MIFARE targets array */
|
||||||
MifareTag *p = realloc (tags, (tag_count + 2) * sizeof (MifareTag));
|
MifareTag *p = realloc (tags, (tag_count + 2) * sizeof (MifareTag));
|
||||||
if (p)
|
if (p)
|
||||||
|
|
|
@ -226,8 +226,12 @@ mifare_classic_connect (MifareTag tag)
|
||||||
ASSERT_INACTIVE (tag);
|
ASSERT_INACTIVE (tag);
|
||||||
ASSERT_MIFARE_CLASSIC (tag);
|
ASSERT_MIFARE_CLASSIC (tag);
|
||||||
|
|
||||||
nfc_target_info_t pnti;
|
nfc_target_t pnti;
|
||||||
if (nfc_initiator_select_passive_target (tag->device, NM_ISO14443A_106, tag->info.abtUid, tag->info.szUidLen, &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;
|
tag->active = 1;
|
||||||
} else {
|
} else {
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
|
|
|
@ -281,8 +281,12 @@ mifare_desfire_connect (MifareTag tag)
|
||||||
ASSERT_INACTIVE (tag);
|
ASSERT_INACTIVE (tag);
|
||||||
ASSERT_MIFARE_DESFIRE (tag);
|
ASSERT_MIFARE_DESFIRE (tag);
|
||||||
|
|
||||||
nfc_target_info_t pnti;
|
nfc_target_t pnti;
|
||||||
if (nfc_initiator_select_passive_target (tag->device, NM_ISO14443A_106, tag->info.abtUid, tag->info.szUidLen, &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;
|
tag->active = 1;
|
||||||
free (MIFARE_DESFIRE (tag)->session_key);
|
free (MIFARE_DESFIRE (tag)->session_key);
|
||||||
MIFARE_DESFIRE (tag)->session_key = NULL;
|
MIFARE_DESFIRE (tag)->session_key = NULL;
|
||||||
|
|
|
@ -99,8 +99,12 @@ mifare_ultralight_connect (MifareTag tag)
|
||||||
ASSERT_INACTIVE (tag);
|
ASSERT_INACTIVE (tag);
|
||||||
ASSERT_MIFARE_ULTRALIGHT (tag);
|
ASSERT_MIFARE_ULTRALIGHT (tag);
|
||||||
|
|
||||||
nfc_target_info_t pnti;
|
nfc_target_t pnti;
|
||||||
if (nfc_initiator_select_passive_target (tag->device, NM_ISO14443A_106, tag->info.abtUid, tag->info.szUidLen, &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;
|
tag->active = 1;
|
||||||
for (int i = 0; i < MIFARE_ULTRALIGHT_PAGE_COUNT; i++)
|
for (int i = 0; i < MIFARE_ULTRALIGHT_PAGE_COUNT; i++)
|
||||||
MIFARE_ULTRALIGHT(tag)->cached_pages[i] = 0;
|
MIFARE_ULTRALIGHT(tag)->cached_pages[i] = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue