nfc-tools/libfreefare

Configurable baud rate

kleest opened this issue · 0 comments

Since commit nfc-tools/libnfc@ddde2dd, any baud rate other than 106 leads to an explicit baud rate change request. In mifare_desfire.c, the baud rate is fixed to 424:

int
mifare_desfire_connect(FreefareTag tag)
{
ASSERT_INACTIVE(tag);
nfc_target pnti;
nfc_modulation modulation = {
.nmt = NMT_ISO14443A,
.nbr = NBR_424
};
if (nfc_initiator_select_passive_target(tag->device, modulation, tag->info.nti.nai.abtUid, tag->info.nti.nai.szUidLen, &pnti) >= 0) {

In the case of Android HCE, changing the baud rate is not necessarily supported, thus resulting in error code 01 (Timeout) which aborts the operation. Is it possible to infer the baud rate by the passed FreefareTag instead of setting it to the fixed value 424, or make it configurable somehow?

debug	libnfc.chip.pn53x	InPSL
debug	libnfc.chip.pn53x	No timeout
debug	libnfc.bus.uart	TX: 00 00 ff 05 fb d4 4e 01 02 02 d9 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 4f 
debug	libnfc.bus.uart	RX: 01 
debug	libnfc.bus.uart	RX: db 00 
debug	libnfc.chip.pn53x	Chip error: "Timeout" (01), returned error: "RF Transmission Error" (-20))