From 404dfba6e812ca54c75080ad1cedeea136774bc6 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Tue, 18 May 2010 08:13:26 +0000 Subject: [PATCH] usb_release() must be called before usb_reset(). Fix Issue 81 (Thanks to thaolx). --- libnfc/drivers/pn53x_usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libnfc/drivers/pn53x_usb.c b/libnfc/drivers/pn53x_usb.c index 766e1b4..008c68c 100644 --- a/libnfc/drivers/pn53x_usb.c +++ b/libnfc/drivers/pn53x_usb.c @@ -229,11 +229,11 @@ void pn53x_usb_disconnect(nfc_device_t* pnd) usb_spec_t* pus = (usb_spec_t*)pnd->nds; int ret; + if((ret = usb_release_interface(pus->pudh,0)) < 0) + DBG("usb_release failed %i",ret); DBG("%s","resetting USB"); usb_reset(pus->pudh); - if((ret= usb_release_interface(pus->pudh,0)) < 0) - DBG("usb_release failed %i",ret); - if((ret= usb_close(pus->pudh)) < 0) + if((ret = usb_close(pus->pudh)) < 0) DBG("usb_close failed %i",ret); free(pnd->nds); free(pnd);