Improve debug messages.

Small fix in ACR122 driver.
This commit is contained in:
Romuald Conty 2009-12-03 21:24:06 +00:00
parent e5ba266420
commit 5b767ec91e
2 changed files with 12 additions and 10 deletions

View file

@ -161,7 +161,7 @@ acr122_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, size_t *p
DBG("- %s (pos=%d)", acDeviceNames + szPos, szPos); DBG("- %s (pos=%d)", acDeviceNames + szPos, szPos);
bool bSupported = false; bool bSupported = false;
for (int i = 0; supported_devices[i]; i++) { for (int i = 0; supported_devices[i] && !bSupported; i++) {
int l = strlen(supported_devices[i]); int l = strlen(supported_devices[i]);
bSupported = 0 == strncmp(supported_devices[i], acDeviceNames + szPos, l); bSupported = 0 == strncmp(supported_devices[i], acDeviceNames + szPos, l);
} }
@ -177,7 +177,7 @@ acr122_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, size_t *p
} }
else else
{ {
DBG("%s", "Firmware version mismatch"); DBG("PCSC device [%s] is not NFC capable or not supported by libnfc.", acDeviceNames + szPos);
} }
SCardDisconnect(as.hCard,SCARD_LEAVE_CARD); SCardDisconnect(as.hCard,SCARD_LEAVE_CARD);

View file

@ -94,17 +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].acDriver); DBG("List avaible device using %s driver",drivers_callbacks_list[uiDriver].acDriver);
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 else
DBG("Not checking driver: %s",drivers_callbacks_list[uiDriver].acDriver); {
#endif DBG("No listing function avaible for %s driver",drivers_callbacks_list[uiDriver].acDriver);
}
} }
} }
@ -120,12 +120,14 @@ 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("Autodetecting available devices: %s", drivers_callbacks_list[uiDriver].acDriver); if(drivers_callbacks_list[uiDriver].pick_device != NULL) {
if(drivers_callbacks_list[uiDriver].pick_device != NULL) DBG("Autodetecting available devices using %s driver.", drivers_callbacks_list[uiDriver].acDriver);
pndd = drivers_callbacks_list[uiDriver].pick_device (); pndd = drivers_callbacks_list[uiDriver].pick_device ();
DBG("Auto-connecting %s device",drivers_callbacks_list[uiDriver].acDriver); }
if (pndd != NULL) if (pndd != NULL) {
DBG("Auto-connecting to %s using %s driver", pndd->acDevice, drivers_callbacks_list[uiDriver].acDriver);
pnd = drivers_callbacks_list[uiDriver].connect(pndd); pnd = drivers_callbacks_list[uiDriver].connect(pndd);
}
if(pnd == NULL) if(pnd == NULL)
{ {
DBG("%s Not found",drivers_callbacks_list[uiDriver].acDriver); DBG("%s Not found",drivers_callbacks_list[uiDriver].acDriver);