From 6f353013fdd148cce637bdbb32ff4d0b22d99e3e Mon Sep 17 00:00:00 2001 From: Adam Laurie Date: Mon, 7 Dec 2009 22:18:32 +0000 Subject: [PATCH] minor fixes to pn531/pn533 list routines and some more debugging --- src/lib/drivers/pn531_usb.c | 5 ++++- src/lib/drivers/pn533_usb.c | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib/drivers/pn531_usb.c b/src/lib/drivers/pn531_usb.c index ce4788d..5f3c1cb 100644 --- a/src/lib/drivers/pn531_usb.c +++ b/src/lib/drivers/pn531_usb.c @@ -60,9 +60,12 @@ bool pn531_usb_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, s pn53x_usb_list_devices(&pnddDevices[0], szDevices, pszDeviceFound, idvendor, idproduct, PN531_USB_DRIVER_NAME); if(*pszDeviceFound == szDevices) + { + DBG("Found %d devices",*pszDeviceFound); return true; + } firstpass= *pszDeviceFound; - pn53x_usb_list_devices(&pnddDevices[firstpass], szDevices, pszDeviceFound, idvendor_alt, idproduct_alt, PN531_USB_DRIVER_NAME); + pn53x_usb_list_devices(&pnddDevices[firstpass], szDevices - firstpass, pszDeviceFound, idvendor_alt, idproduct_alt, PN531_USB_DRIVER_NAME); (*pszDeviceFound) += firstpass; DBG("Found %d devices",*pszDeviceFound); diff --git a/src/lib/drivers/pn533_usb.c b/src/lib/drivers/pn533_usb.c index 5a6982c..93eaea6 100644 --- a/src/lib/drivers/pn533_usb.c +++ b/src/lib/drivers/pn533_usb.c @@ -41,7 +41,7 @@ nfc_device_desc_t * pn533_usb_pick_device (void) } if (szN == 0) { - ERR("%s", "No device found"); + DBG("%s", "No device found"); return NULL; } } @@ -60,11 +60,15 @@ bool pn533_usb_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, s pn53x_usb_list_devices(&pnddDevices[0], szDevices, pszDeviceFound, idvendor, idproduct, PN533_USB_DRIVER_NAME); if(*pszDeviceFound == szDevices) + { + DBG("Found %d devices",*pszDeviceFound); return true; + } firstpass= *pszDeviceFound; - pn53x_usb_list_devices(&pnddDevices[firstpass], szDevices, pszDeviceFound, idvendor_alt, idproduct_alt, PN533_USB_DRIVER_NAME); + pn53x_usb_list_devices(&pnddDevices[firstpass], szDevices - firstpass, pszDeviceFound, idvendor_alt, idproduct_alt, PN533_USB_DRIVER_NAME); (*pszDeviceFound) += firstpass; + DBG("Found %d devices",*pszDeviceFound); if(*pszDeviceFound) return true; return false;