From ab312299d6ecfd36e28deb04ed13c39e98bf21b8 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Tue, 12 Jun 2012 16:46:20 +0000 Subject: [PATCH] pn53x_reset_settings() now resets CRC, parity, easyframing and crypto1. These settings are quite specifics and should be reset in other functions that call pn53x_reset_settings() too: i.e. nfc_initiator_init_secure_element() --- libnfc/chips/pn53x.c | 12 ++++++++++++ libnfc/nfc.c | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 32f791d..2178324 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -129,6 +129,18 @@ pn53x_reset_settings(struct nfc_device *pnd) if ((res = pn53x_write_register(pnd, PN53X_REG_CIU_BitFraming, SYMBOL_TX_LAST_BITS, 0x00)) < 0) { return res; } + // Make sure we reset the CRC and parity to chip handling. + if ((res = pn53x_set_property_bool(pnd, NP_HANDLE_CRC, true)) < 0) + return res; + if ((res = pn53x_set_property_bool(pnd, NP_HANDLE_PARITY, true)) < 0) + return res; + // Activate "easy framing" feature by default + if ((res = pn53x_set_property_bool(pnd, NP_EASY_FRAMING, true)) < 0) + return res; + // Deactivate the CRYPTO1 cipher, it may could cause problems when still active + if ((res = pn53x_set_property_bool(pnd, NP_ACTIVATE_CRYPTO1, false)) < 0) + return res; + return NFC_SUCCESS; } diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 421ffac..d8a8c73 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -363,18 +363,6 @@ nfc_initiator_init(nfc_device *pnd) // Disallow multiple frames if ((res = nfc_device_set_property_bool(pnd, NP_ACCEPT_MULTIPLE_FRAMES, false)) < 0) return res; - // Make sure we reset the CRC and parity to chip handling. - if ((res = nfc_device_set_property_bool(pnd, NP_HANDLE_CRC, true)) < 0) - return res; - if ((res = nfc_device_set_property_bool(pnd, NP_HANDLE_PARITY, true)) < 0) - return res; - // Activate "easy framing" feature by default - if ((res = nfc_device_set_property_bool(pnd, NP_EASY_FRAMING, true)) < 0) - return res; - // Deactivate the CRYPTO1 cipher, it may could cause problems when still active - if ((res = nfc_device_set_property_bool(pnd, NP_ACTIVATE_CRYPTO1, false)) < 0) - return res; - HAL(initiator_init, pnd); }