add some debuggers to help figure out why nfc-list doesn't see libusb devices
This commit is contained in:
parent
2b8232b9ab
commit
c449fe8561
4 changed files with 13 additions and 1 deletions
|
@ -144,7 +144,11 @@ acr122_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, size_t *p
|
||||||
*pszDeviceFound = 0;
|
*pszDeviceFound = 0;
|
||||||
|
|
||||||
// Test if context succeeded
|
// 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
|
// Retrieve the string array of all available pcsc readers
|
||||||
if (SCardListReaders(*pscc,NULL,acDeviceNames,(void*)&szDeviceNamesLen) != SCARD_S_SUCCESS) return false;
|
if (SCardListReaders(*pscc,NULL,acDeviceNames,(void*)&szDeviceNamesLen) != SCARD_S_SUCCESS) return false;
|
||||||
|
|
|
@ -100,6 +100,7 @@ nfc_device_t* pn531_usb_connect(const nfc_device_desc_t* pndd)
|
||||||
us.uiEndPointOut = 0;
|
us.uiEndPointOut = 0;
|
||||||
us.pudh = NULL;
|
us.pudh = NULL;
|
||||||
|
|
||||||
|
DBG("%s", "Looking for PN531 device");
|
||||||
usb_init();
|
usb_init();
|
||||||
if (usb_find_busses() < 0) return NULL;
|
if (usb_find_busses() < 0) return NULL;
|
||||||
if (usb_find_devices() < 0) return NULL;
|
if (usb_find_devices() < 0) return NULL;
|
||||||
|
|
|
@ -98,6 +98,7 @@ nfc_device_t* pn533_usb_connect(const nfc_device_desc_t* pndd)
|
||||||
us.uiEndPointOut = 0;
|
us.uiEndPointOut = 0;
|
||||||
us.pudh = NULL;
|
us.pudh = NULL;
|
||||||
|
|
||||||
|
DBG("%s", "Looking for PN533 device");
|
||||||
usb_init();
|
usb_init();
|
||||||
if (usb_find_busses() < 0) return NULL;
|
if (usb_find_busses() < 0) return NULL;
|
||||||
if (usb_find_devices() < 0) return NULL;
|
if (usb_find_devices() < 0) return NULL;
|
||||||
|
|
|
@ -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)
|
if (drivers_callbacks_list[uiDriver].list_devices != NULL)
|
||||||
{
|
{
|
||||||
|
DBG("Checking driver: %s",drivers_callbacks_list[uiDriver]);
|
||||||
size_t szN = 0;
|
size_t szN = 0;
|
||||||
if (drivers_callbacks_list[uiDriver].list_devices (pnddDevices + (*pszDeviceFound), szDevices - (*pszDeviceFound), &szN))
|
if (drivers_callbacks_list[uiDriver].list_devices (pnddDevices + (*pszDeviceFound), szDevices - (*pszDeviceFound), &szN))
|
||||||
{
|
{
|
||||||
*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) {
|
if (pndd == NULL) {
|
||||||
// No device description specified: try to automatically claim a device
|
// No device description specified: try to automatically claim a device
|
||||||
|
DBG("%s","Autodetecting available devices...");
|
||||||
pndd = drivers_callbacks_list[uiDriver].pick_device ();
|
pndd = drivers_callbacks_list[uiDriver].pick_device ();
|
||||||
pnd = drivers_callbacks_list[uiDriver].connect(pndd);
|
pnd = drivers_callbacks_list[uiDriver].connect(pndd);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue