dotnfc / libnfc

Automatically exported from code.google.com/p/libnfc
GNU Lesser General Public License v3.0
1 stars 0 forks source link

nfc_initiator_target_is_present() does not support Felica & Mifare on PN532 #266

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
nfc_initiator_target_is_present() relies on PN53x Diagnose command but Diagnose 
on PN532 is less powerful than on PN533.
We should implement our own SW Diagnose to support as many card types as 
possible.

Original issue reported on code.google.com by yob...@gmail.com on 28 Jan 2014 at 8:14

GoogleCodeExporter commented 9 years ago
See also report of Mikma on the mailing list:

Hardware:
pn532 via PL2303 USB converter.

Software:
Ubuntu 13.04
libnfc 1.7.0 (same problem in git master)

/Mikma

Partial debug trace of nfc-mfultralight r <file>, edited to call 
nfc_initiator_target_is_present after nfc_initiator_select_passive_target.

NFC device: pn532_uart:/dev/ttyUSB1 opened
debug   libnfc.chip.pn53x   InListPassiveTarget
debug   libnfc.chip.pn53x   No timeout
debug   libnfc.bus.uart TX: 00 00 ff 04 fc d4 4a 01 00 e1 00 
debug   libnfc.bus.uart RX: 00 00 ff 00 ff 00 
debug   libnfc.chip.pn53x   PN53x ACKed
debug   libnfc.bus.uart RX: 00 00 ff 0f f1 
debug   libnfc.bus.uart RX: d5 4b 
debug   libnfc.bus.uart RX: 01 01 00 44 00 07 04 45 6c da 4b 28 80 
debug   libnfc.bus.uart RX: 11 00 
debug   libnfc.chip.pn53x   Diagnose
debug   libnfc.chip.pn53x   Timeout value: 700
debug   libnfc.bus.uart TX: 00 00 ff 03 fd d4 00 06 26 00 
debug   libnfc.bus.uart RX: 00 00 ff 00 ff 00 
debug   libnfc.chip.pn53x   PN53x ACKed
debug   libnfc.bus.uart RX: 00 00 ff 03 fd 
debug   libnfc.bus.uart RX: d5 01 
debug   libnfc.bus.uart RX: 27 
debug   libnfc.bus.uart RX: 03 00 
debug   libnfc.chip.pn53x   Chip error: "Command Not Acceptable" (27), returned 
error: "Invalid argument(s)" (-2))

$ diff -u nfc-mfultralight.c{.orig,}
--- nfc-mfultralight.c.orig 2013-09-03 16:48:07.000000000 +0200
+++ nfc-mfultralight.c  2014-01-26 03:12:45.509598136 +0100
@@ -258,6 +258,11 @@
     nfc_exit(context);
     exit(EXIT_FAILURE);
   }
+
+  int res;
+  res = nfc_initiator_target_is_present(pnd, &nt);
+  printf("Present: %d\n", res);
+
   // Test if we are dealing with a MIFARE compatible tag

   if (nt.nti.nai.abtAtqa[1] != 0x44) {

Original comment by yob...@gmail.com on 28 Jan 2014 at 8:22

GoogleCodeExporter commented 9 years ago
Fixed through several commits, including 
05579fde097ff7c98f76d91c5e5093bc170671ef and 
71eda315c70c9acdd69b84bcea9e83c5edacfde0

Original comment by yob...@gmail.com on 4 Feb 2014 at 10:49