Change some nfc_target_mode_t to insist on the restrictions offer these mode
This commit is contained in:
parent
572499f598
commit
0fe30e3db7
7 changed files with 12 additions and 12 deletions
|
@ -87,7 +87,7 @@ main (int argc, const char *argv[])
|
||||||
printf ("NFC device will now act as this D.E.P. target:\n");
|
printf ("NFC device will now act as this D.E.P. target:\n");
|
||||||
print_nfc_dep_info ( nt.nti.ndi );
|
print_nfc_dep_info ( nt.nti.ndi );
|
||||||
printf ("Waiting for initiator request...\n");
|
printf ("Waiting for initiator request...\n");
|
||||||
if(!nfc_target_init (pnd, NTM_DEP, nt, abtRx, &szRx)) {
|
if(!nfc_target_init (pnd, NTM_DEP_ONLY, nt, abtRx, &szRx)) {
|
||||||
nfc_perror(pnd, "nfc_target_init");
|
nfc_perror(pnd, "nfc_target_init");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ main (int argc, char *argv[])
|
||||||
.nti.nai.szAtsLen = 0,
|
.nti.nai.szAtsLen = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!nfc_target_init (pnd, NTM_ISO14443_4_PICC, nt, abtRx, &szRx)) {
|
if (!nfc_target_init (pnd, NTM_ISO14443_4_PICC_ONLY, nt, abtRx, &szRx)) {
|
||||||
nfc_perror (pnd, "nfc_target_init");
|
nfc_perror (pnd, "nfc_target_init");
|
||||||
ERR("Could not come out of auto-emulation, no command was received");
|
ERR("Could not come out of auto-emulation, no command was received");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
|
@ -118,7 +118,7 @@ nfc_target_emulate_tag(nfc_device_t* pnd, const nfc_target_t nt)
|
||||||
byte_t abtTx[MAX_FRAME_LEN];
|
byte_t abtTx[MAX_FRAME_LEN];
|
||||||
bool loop = true;
|
bool loop = true;
|
||||||
|
|
||||||
if (!nfc_target_init (pnd, NTM_PASSIVE, nt, abtRx, &szRx)) {
|
if (!nfc_target_init (pnd, NTM_PASSIVE_ONLY, nt, abtRx, &szRx)) {
|
||||||
nfc_perror (pnd, "nfc_target_init");
|
nfc_perror (pnd, "nfc_target_init");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ main (int argc, char *argv[])
|
||||||
.nti.nai.szUidLen = 4,
|
.nti.nai.szUidLen = 4,
|
||||||
.nti.nai.szAtsLen = 0,
|
.nti.nai.szAtsLen = 0,
|
||||||
};
|
};
|
||||||
if (!nfc_target_init (pnd, NTM_PASSIVE, nt, abtRecv, &szRecvBits)) {
|
if (!nfc_target_init (pnd, NTM_PASSIVE_ONLY, nt, abtRecv, &szRecvBits)) {
|
||||||
ERR ("Could not come out of auto-emulation, no command was received");
|
ERR ("Could not come out of auto-emulation, no command was received");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ main (int argc, char *argv[])
|
||||||
.nti.nai.szAtsLen = 0,
|
.nti.nai.szAtsLen = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!nfc_target_init (pndTag, NTM_PASSIVE, nt, abtReaderRx, &szReaderRxBits)) {
|
if (!nfc_target_init (pndTag, NTM_PASSIVE_ONLY, nt, abtReaderRx, &szReaderRxBits)) {
|
||||||
ERR ("%s", "Initialization of NFC emulator failed");
|
ERR ("%s", "Initialization of NFC emulator failed");
|
||||||
nfc_disconnect (pndTag);
|
nfc_disconnect (pndTag);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
|
@ -283,11 +283,11 @@ typedef enum {
|
||||||
/** Configure the PN53x to accept all initiator mode */
|
/** Configure the PN53x to accept all initiator mode */
|
||||||
NTM_NORMAL = 0x00,
|
NTM_NORMAL = 0x00,
|
||||||
/** Configure the PN53x to accept to be initialized only in passive mode */
|
/** Configure the PN53x to accept to be initialized only in passive mode */
|
||||||
NTM_PASSIVE = 0x01,
|
NTM_PASSIVE_ONLY = 0x01,
|
||||||
/** Configure the PN53x to accept to be initialized only as DEP target */
|
/** Configure the PN53x to accept to be initialized only as DEP target */
|
||||||
NTM_DEP = 0x02,
|
NTM_DEP_ONLY = 0x02,
|
||||||
/** Configure the PN532 to accept to be initialized only as ISO/IEC14443-4 PICC */
|
/** Configure the PN532 to accept to be initialized only as ISO/IEC14443-4 PICC */
|
||||||
NTM_ISO14443_4_PICC = 0x04
|
NTM_ISO14443_4_PICC_ONLY = 0x04
|
||||||
} nfc_target_mode_t;
|
} nfc_target_mode_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1026,17 +1026,17 @@ pn53x_target_init (nfc_device_t * pnd, const nfc_target_mode_t ntm, const nfc_ta
|
||||||
// XXX I (Romuald) don't think that a good thing to select NDO_EASY_FRAMING here, that's a user choice...
|
// XXX I (Romuald) don't think that a good thing to select NDO_EASY_FRAMING here, that's a user choice...
|
||||||
switch(ntm)
|
switch(ntm)
|
||||||
{
|
{
|
||||||
case NTM_PASSIVE:
|
case NTM_PASSIVE_ONLY:
|
||||||
pn53x_set_parameter(pnd, PARAM_AUTO_ATR_RES, false);
|
pn53x_set_parameter(pnd, PARAM_AUTO_ATR_RES, false);
|
||||||
pn53x_configure(pnd, NDO_EASY_FRAMING, false);
|
pn53x_configure(pnd, NDO_EASY_FRAMING, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NTM_DEP:
|
case NTM_DEP_ONLY:
|
||||||
pn53x_set_parameter(pnd, PARAM_AUTO_ATR_RES, true);
|
pn53x_set_parameter(pnd, PARAM_AUTO_ATR_RES, true);
|
||||||
pn53x_configure(pnd, NDO_EASY_FRAMING, true);
|
pn53x_configure(pnd, NDO_EASY_FRAMING, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NTM_ISO14443_4_PICC:
|
case NTM_ISO14443_4_PICC_ONLY:
|
||||||
if(pnd->nc != NC_PN532) {
|
if(pnd->nc != NC_PN532) {
|
||||||
// This mode is not supported by pn531 neither pn533
|
// This mode is not supported by pn531 neither pn533
|
||||||
pnd->iLastError = DENOTSUP;
|
pnd->iLastError = DENOTSUP;
|
||||||
|
|
Loading…
Add table
Reference in a new issue