summaryrefslogtreecommitdiffstats
path: root/Linux_x86
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2011-06-07 10:37:09 -0700
committerNick Pelly <npelly@google.com>2011-06-08 15:02:23 -0700
commit4812a72ceaada294477b4c2015c42cb8bcbe93a4 (patch)
treeda9dd62e2a02b9e242ebb36088e7513edc0831d4 /Linux_x86
parent76ca35725bb84dfda7eb6f970e8f069275f17770 (diff)
downloadexternal_libnfc-nxp-4812a72ceaada294477b4c2015c42cb8bcbe93a4.zip
external_libnfc-nxp-4812a72ceaada294477b4c2015c42cb8bcbe93a4.tar.gz
external_libnfc-nxp-4812a72ceaada294477b4c2015c42cb8bcbe93a4.tar.bz2
Patch to dynamically enable NFC LOW_LEVEL_TRACES
low level traces can be enabled at run-time with: adb shell setprop debug.nfc.LOW_LEVEL_TRACES 1 and disabled with adb shell setprop debug.nfc.LOW_LEVEL_TRACES 0 NFC must be turned off and on again for this change to take affect. Change-Id: Iefdc4873b3ee5bc697f34b307c22c06a6eda0667 Signed-off-by: Nick Pelly <npelly@google.com>
Diffstat (limited to 'Linux_x86')
-rw-r--r--Linux_x86/phDal4Nfc.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/Linux_x86/phDal4Nfc.c b/Linux_x86/phDal4Nfc.c
index a8803e2..2428f6c 100644
--- a/Linux_x86/phDal4Nfc.c
+++ b/Linux_x86/phDal4Nfc.c
@@ -33,6 +33,8 @@
#include <stdlib.h>
#ifdef ANDROID
#include <linux/ipc.h>
+#include <cutils/log.h>
+#include <cutils/properties.h> // for property_get
#else
#include <sys/msg.h>
#endif
@@ -98,6 +100,7 @@ static phDal4Nfc_SContext_t gDalContext;
static pphDal4Nfc_SContext_t pgDalContext;
static phHal_sHwReference_t * pgDalHwContext;
static sem_t nfc_read_sem;
+static int low_level_traces;
#ifdef USE_MQ_MESSAGE_QUEUE
static phDal4Nfc_DeferredCall_Msg_t nDeferedMessage;
static mqd_t nDeferedCallMessageQueueId;
@@ -117,6 +120,21 @@ static void phDal4Nfc_FillMsg (phDal4Nfc_Message_t *pDalMsg, phOsalN
DAL API IMPLEMENTATION
------------------------------------------------------------------------------------*/
+static void refresh_low_level_traces() {
+#ifdef ANDROID
+ char value[1];
+ property_get("debug.nfc.LOW_LEVEL_TRACES", value, "");
+ if (value[0]) {
+ low_level_traces = atoi(value);
+ DAL_DEBUG("debug.nfc.LOW_LEVEL_TRACES = %X", mode);
+ }
+#endif
+
+#ifdef LOW_LEVEL_TRACES
+ low_level_traces = 1;
+#endif
+}
+
/*-----------------------------------------------------------------------------
FUNCTION: phDal4Nfc_Register
@@ -216,6 +234,8 @@ NFCSTATUS phDal4Nfc_Init(void *pContext, void *pHwRef )
{
NFCSTATUS result = NFCSTATUS_SUCCESS;
+ refresh_low_level_traces();
+
if ((NULL != pContext) && (NULL != pHwRef))
{
pContext = pgDalContext;
@@ -707,9 +727,11 @@ retry:
else
{
i2c_error_count = 0;
-#ifdef LOW_LEVEL_TRACES
- phOsalNfc_PrintData("Received buffer", (uint16_t)gReadWriteContext.nNbOfBytesRead, gReadWriteContext.pReadBuffer);
-#endif
+
+ if (low_level_traces)
+ {
+ phOsalNfc_PrintData("Received buffer", (uint16_t)gReadWriteContext.nNbOfBytesRead, gReadWriteContext.pReadBuffer);
+ }
DAL_DEBUG("Read ok. nbToRead=%d\n", gReadWriteContext.nNbOfBytesToRead);
DAL_DEBUG("NbReallyRead=%d\n", gReadWriteContext.nNbOfBytesRead);
DAL_PRINT("ReadBuff[]={ ");
@@ -851,9 +873,10 @@ void phDal4Nfc_DeferredCb (void *params)
case PHDAL4NFC_WRITE_MESSAGE:
DAL_PRINT(" Dal deferred write called \n");
-#ifdef LOW_LEVEL_TRACES
- phOsalNfc_PrintData("Send buffer", (uint16_t)gReadWriteContext.nNbOfBytesToWrite, gReadWriteContext.pWriteBuffer);
-#endif
+ if(low_level_traces)
+ {
+ phOsalNfc_PrintData("Send buffer", (uint16_t)gReadWriteContext.nNbOfBytesToWrite, gReadWriteContext.pWriteBuffer);
+ }
/* DAL_DEBUG("dalMsg->transactInfo.length : %d\n", dalMsg->transactInfo.length); */
/* Make a Physical WRITE */