add some debuggers to help figure out why nfc-list doesn't see libusb devices

This commit is contained in:
Adam Laurie 2009-12-01 22:28:41 +00:00
parent 2b8232b9ab
commit c449fe8561
4 changed files with 13 additions and 1 deletions

View file

@ -144,7 +144,11 @@ acr122_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, size_t *p
*pszDeviceFound = 0;
// Test if context succeeded
if (!(pscc = acr122_get_scardcontext ())) return false;
if (!(pscc = acr122_get_scardcontext ()))
{
DBG("%s","PCSC-LITE daemon not found");
return false;
}
// Retrieve the string array of all available pcsc readers
if (SCardListReaders(*pscc,NULL,acDeviceNames,(void*)&szDeviceNamesLen) != SCARD_S_SUCCESS) return false;

View file

@ -100,6 +100,7 @@ nfc_device_t* pn531_usb_connect(const nfc_device_desc_t* pndd)
us.uiEndPointOut = 0;
us.pudh = NULL;
DBG("%s", "Looking for PN531 device");
usb_init();
if (usb_find_busses() < 0) return NULL;
if (usb_find_devices() < 0) return NULL;

View file

@ -98,6 +98,7 @@ nfc_device_t* pn533_usb_connect(const nfc_device_desc_t* pndd)
us.uiEndPointOut = 0;
us.pudh = NULL;
DBG("%s", "Looking for PN533 device");
usb_init();
if (usb_find_busses() < 0) return NULL;
if (usb_find_devices() < 0) return NULL;

View file

@ -94,12 +94,17 @@ nfc_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, size_t *pszD
{
if (drivers_callbacks_list[uiDriver].list_devices != NULL)
{
DBG("Checking driver: %s",drivers_callbacks_list[uiDriver]);
size_t szN = 0;
if (drivers_callbacks_list[uiDriver].list_devices (pnddDevices + (*pszDeviceFound), szDevices - (*pszDeviceFound), &szN))
{
*pszDeviceFound += szN;
}
}
#ifdef DEBUG
else
DBG("Not checking driver: %s",drivers_callbacks_list[uiDriver]);
#endif
}
}
@ -115,6 +120,7 @@ nfc_device_t* nfc_connect(nfc_device_desc_t* pndd)
{
if (pndd == NULL) {
// No device description specified: try to automatically claim a device
DBG("%s","Autodetecting available devices...");
pndd = drivers_callbacks_list[uiDriver].pick_device ();
pnd = drivers_callbacks_list[uiDriver].connect(pndd);
} else {