From 468027ba2b76e46c3e3abd8387eb4a68ca9711d2 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Mon, 9 May 2011 10:44:44 +0000 Subject: [PATCH] chips/pn53x: PN532 now goes in LowVBat mode when setting idle mode from target mode. --- libnfc/chips/pn53x.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 2b04e8b..30d48da 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -668,7 +668,18 @@ pn53x_idle (nfc_device_t *pnd) { switch (CHIP_DATA (pnd)->operating_mode) { case TARGET: - return pn53x_InRelease (pnd, 0); + // InRelease used in target mode stops the target emulation and no more + // tag are seen from external initiator + if (!pn53x_InRelease (pnd, 0)) { + return false; + } + if (CHIP_DATA (pnd)->type == PN532) { + // Use PowerDown to go in "Low VBat" power mode + if (!pn53x_PowerDown (pnd)) { + return false; + } + CHIP_DATA (pnd)->power_mode = LOWVBAT; + } break; case INITIATOR: // Deselect all active communications @@ -680,7 +691,7 @@ pn53x_idle (nfc_device_t *pnd) return false; } if (CHIP_DATA (pnd)->type == PN532) { - // Use InPowerDown to go in "Low VBat" + // Use PowerDown to go in "Low VBat" power mode if (!pn53x_PowerDown (pnd)) { return false; }