summaryrefslogtreecommitdiffstats
path: root/Linux_x86
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2011-06-23 17:15:08 -0700
committerNick Pelly <npelly@google.com>2011-06-27 09:40:20 -0700
commitfafed3cea5231f76bcebbe95b9d3b7c2ca69483d (patch)
tree579202d577399f615cd69081884349c34b915483 /Linux_x86
parent34ff48f6cd6595a899e05fbd56f4c84891840d3f (diff)
downloadexternal_libnfc-nxp-fafed3cea5231f76bcebbe95b9d3b7c2ca69483d.zip
external_libnfc-nxp-fafed3cea5231f76bcebbe95b9d3b7c2ca69483d.tar.gz
external_libnfc-nxp-fafed3cea5231f76bcebbe95b9d3b7c2ca69483d.tar.bz2
Improve LOW_LEVEL_TRACES logging.
Log ALL buffers (including size 1 and long buffers). Use a more concise format. This is helpful for debugging FW download failures. Change-Id: I97370e8daf93ce851a036274ffa2856af05b6941
Diffstat (limited to 'Linux_x86')
-rw-r--r--Linux_x86/phDal4Nfc.c4
-rw-r--r--Linux_x86/phOsalNfc.c17
2 files changed, 10 insertions, 11 deletions
diff --git a/Linux_x86/phDal4Nfc.c b/Linux_x86/phDal4Nfc.c
index 7a4986c..577311f 100644
--- a/Linux_x86/phDal4Nfc.c
+++ b/Linux_x86/phDal4Nfc.c
@@ -739,7 +739,7 @@ retry:
if (low_level_traces)
{
- phOsalNfc_PrintData("Received buffer", (uint16_t)gReadWriteContext.nNbOfBytesRead, gReadWriteContext.pReadBuffer);
+ phOsalNfc_PrintData("RECV", (uint16_t)gReadWriteContext.nNbOfBytesRead, gReadWriteContext.pReadBuffer);
}
DAL_DEBUG("Read ok. nbToRead=%d\n", gReadWriteContext.nNbOfBytesToRead);
DAL_DEBUG("NbReallyRead=%d\n", gReadWriteContext.nNbOfBytesRead);
@@ -884,7 +884,7 @@ void phDal4Nfc_DeferredCb (void *params)
if(low_level_traces)
{
- phOsalNfc_PrintData("Send buffer", (uint16_t)gReadWriteContext.nNbOfBytesToWrite, gReadWriteContext.pWriteBuffer);
+ phOsalNfc_PrintData("SEND", (uint16_t)gReadWriteContext.nNbOfBytesToWrite, gReadWriteContext.pWriteBuffer);
}
/* DAL_DEBUG("dalMsg->transactInfo.length : %d\n", dalMsg->transactInfo.length); */
diff --git a/Linux_x86/phOsalNfc.c b/Linux_x86/phOsalNfc.c
index db336f1..0544309 100644
--- a/Linux_x86/phOsalNfc.c
+++ b/Linux_x86/phOsalNfc.c
@@ -160,16 +160,15 @@ void phOsalNfc_RaiseException(phOsalNfc_ExceptionType_t eExceptionType, uint16_t
*/
void phOsalNfc_PrintData(const char *pString, uint32_t length, uint8_t *pBuffer)
{
- char print_buffer[512]; // Max length 512 for the download mode
+ char print_buffer[length * 3 + 1];
int i;
- if(NULL!=pString && length > 1 && length < 34)
- {
- print_buffer[0] = '\0';
- for (i = 0; i < length; i++) {
- snprintf(&print_buffer[i*5], 6, " 0x%02X", pBuffer[i]);
- }
- LOGD("> NFC %s: %s", pString, print_buffer);
+ if (pString == NULL) {
+ pString = "";
+ }
+ print_buffer[0] = '\0';
+ for (i = 0; i < length; i++) {
+ snprintf(&print_buffer[i*3], 4, " %02X", pBuffer[i]);
}
+ LOGD("> %s:%s", pString, print_buffer);
}
-