From 6a97e694ec488d1c9cd4e7ba734085627240c8d7 Mon Sep 17 00:00:00 2001 From: Adam Laurie Date: Sun, 13 Dec 2009 17:38:50 +0000 Subject: [PATCH] preserve PCSC device name --- src/lib/drivers/acr122.c | 7 +++++-- src/lib/nfc.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/drivers/acr122.c b/src/lib/drivers/acr122.c index aed81cb..c3c39fd 100644 --- a/src/lib/drivers/acr122.c +++ b/src/lib/drivers/acr122.c @@ -200,6 +200,7 @@ nfc_device_t* acr122_connect(const nfc_device_desc_t* pndd) SCARDCONTEXT *pscc; + DBG("Connecting to %s",pndd->acDevice); // We no longer support connecting with a NULL if(pndd == NULL) return NULL; // Test if context succeeded @@ -211,6 +212,7 @@ nfc_device_t* acr122_connect(const nfc_device_desc_t* pndd) if (SCardConnect(*pscc,pndd->acDevice,SCARD_SHARE_DIRECT,0,&(as.hCard),(void*)&(as.ioCard.dwProtocol)) != SCARD_S_SUCCESS) { // We can not connect to this device. + DBG("%s","PCSC connect failed"); return NULL; } } @@ -227,8 +229,9 @@ nfc_device_t* acr122_connect(const nfc_device_desc_t* pndd) // Done, we found the reader we are looking for pnd = malloc(sizeof(nfc_device_t)); - strncpy(pnd->acName,pcFirmware, DEVICE_NAME_LENGTH - 1); - pnd->acName[DEVICE_NAME_LENGTH - 1] = '\0'; + strcpy(pnd->acName,pndd->acDevice); + strcpy(pnd->acName + strlen(pnd->acName)," / "); + strcpy(pnd->acName + strlen(pnd->acName),pcFirmware); pnd->nc = NC_PN532; pnd->nds = (nfc_device_spec_t)pas; pnd->bActive = true; diff --git a/src/lib/nfc.c b/src/lib/nfc.c index 340ca8d..93a22a5 100644 --- a/src/lib/nfc.c +++ b/src/lib/nfc.c @@ -157,7 +157,7 @@ nfc_device_t* nfc_connect(nfc_device_desc_t* pndd) if (!pnd->pdc->transceive(pnd->nds,pncmd_get_firmware_version,2,abtFw,&szFwLen)) { // Failed to get firmware revision??, whatever...let's disconnect and clean up and return err - ERR("Failed to get firmware revision for: %s", pnd->acName); + DBG("Failed to get firmware revision for: %s", pnd->acName); pnd->pdc->disconnect(pnd); return NULL; }