nfc-tools / libfreefare

A convenience API for NFC cards manipulations on top of libnfc.
Other
395 stars 106 forks source link

Configurable baud rate #110

Open kleest opened 5 years ago

kleest commented 5 years ago

Since commit nfc-tools/libnfc@ddde2dd8f2749e2c2a9302f60e9dd747f0da46e9, 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: https://github.com/nfc-tools/libfreefare/blob/5459806659d5f6aa0e7705b88c48775ea6c861a6/libfreefare/mifare_desfire.c#L287-L297 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))