Fix ISO/IEC 14443-4 hardware emulation.

NDO_AUTO_ISO14443_4 is now set to _true_ by default with nfc_target_init();
nfc_emulate_target() now fails (return _false_) when emulator->state_machine->io() failed;
Initialize nfc_device_t variables to _false_ in order to send correctly (see notes in nfc-device.c);
nfc_emulate_forum_tag4 prints error when nfc_emulate_target() failed.
This commit is contained in:
Romuald Conty 2011-05-24 17:10:13 +00:00
parent 975cd275d1
commit 78ce62e7b6
4 changed files with 20 additions and 11 deletions

View file

@ -118,11 +118,10 @@ nfcforum_tag4_io (struct nfc_emulator *emulator, const byte_t *data_in, const si
print_hex (data_in, data_in_len);
}
/*
* The PN532 already handle RATS
*/
if ((data_in_len == 2) && (data_in[0] == ISO144434A_RATS))
return res;
if ((data_in_len == 2) && (data_in[0] == ISO144434A_RATS)) {
// The PN532 already handle RATS, so there is nothing to do
return res;
}
if(data_in_len >= 4) {
if (data_in[CLA] != 0x00)
@ -352,7 +351,9 @@ main (int argc, char *argv[])
printf ("Connected to NFC device: %s\n", pnd->acName);
printf ("Emulating NDEF tag now, please touch it with a second NFC device\n");
nfc_emulate_target (pnd, &emulator); // contains already nfc_target_init() call
if (0 != nfc_emulate_target (pnd, &emulator)) { // contains already nfc_target_init() call
nfc_perror (pnd, "nfc_emulate_target");
}
nfc_disconnect(pnd);