From 1596255506d88269bb931190bae5a613c3517161 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 1 Oct 2013 12:27:19 +0200 Subject: [PATCH] driver Arygon: don't try to send commands if reset failed --- libnfc/drivers/arygon.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libnfc/drivers/arygon.c b/libnfc/drivers/arygon.c index d7229f8..3d99f61 100644 --- a/libnfc/drivers/arygon.c +++ b/libnfc/drivers/arygon.c @@ -206,10 +206,8 @@ struct arygon_descriptor { }; static void -arygon_close(nfc_device *pnd) +arygon_close_step2(nfc_device *pnd) { - pn53x_idle(pnd); - // Release UART port uart_close(DRIVER_DATA(pnd)->port); @@ -223,6 +221,13 @@ arygon_close(nfc_device *pnd) nfc_device_free(pnd); } +static void +arygon_close(nfc_device *pnd) +{ + pn53x_idle(pnd); + arygon_close_step2(pnd); +} + static nfc_device * arygon_open(const nfc_context *context, const nfc_connstring connstring) { @@ -313,7 +318,7 @@ arygon_open(const nfc_context *context, const nfc_connstring connstring) // Check communication using "Reset TAMA" command if (arygon_reset_tama(pnd) < 0) { - arygon_close(pnd); + arygon_close_step2(pnd); return NULL; }