Wifi-Hal: Provide additional debug info incase of NAN error

Bug: 35625752
Change-Id: Ic582e5b79fa5822b4b7042e3edb22b9d4cbfaf43
diff --git a/qcwcn/wifi_hal/nan.cpp b/qcwcn/wifi_hal/nan.cpp
index f3a7457..7efa503 100644
--- a/qcwcn/wifi_hal/nan.cpp
+++ b/qcwcn/wifi_hal/nan.cpp
@@ -674,6 +674,7 @@
                                      wifi_interface_handle iface,
                                      char* iface_name)
 {
+    ALOGV("NAN_DP_INTERFACE_CREATE");
     int ret = WIFI_SUCCESS;
     struct nlattr *nlData;
     NanCommand *nanCommand = NULL;
@@ -721,6 +722,7 @@
                                      wifi_interface_handle iface,
                                      char* iface_name)
 {
+    ALOGV("NAN_DP_INTERFACE_DELETE");
     int ret = WIFI_SUCCESS;
     struct nlattr *nlData;
     NanCommand *nanCommand = NULL;
@@ -768,6 +770,7 @@
                                       wifi_interface_handle iface,
                                       NanDataPathInitiatorRequest* msg)
 {
+    ALOGV("NAN_DP_REQUEST_INITIATOR");
     int ret = WIFI_SUCCESS;
     struct nlattr *nlData, *nlCfgSecurity, *nlCfgQos;
     NanCommand *nanCommand = NULL;
@@ -870,6 +873,7 @@
                                         wifi_interface_handle iface,
                                         NanDataPathIndicationResponse* msg)
 {
+    ALOGV("NAN_DP_INDICATION_RESPONSE");
     int ret = WIFI_SUCCESS;
     struct nlattr *nlData, *nlCfgSecurity, *nlCfgQos;
     NanCommand *nanCommand = NULL;
@@ -961,6 +965,7 @@
                         wifi_interface_handle iface,
                         NanDataPathEndRequest* msg)
 {
+    ALOGV("NAN_DP_END");
     int ret = WIFI_SUCCESS;
     struct nlattr *nlData;
     NanCommand *nanCommand = NULL;
diff --git a/qcwcn/wifi_hal/nan_req.cpp b/qcwcn/wifi_hal/nan_req.cpp
index 964aa79..735936d 100644
--- a/qcwcn/wifi_hal/nan_req.cpp
+++ b/qcwcn/wifi_hal/nan_req.cpp
@@ -1470,6 +1470,7 @@
 
 int NanCommand::putNanCapabilities(transaction_id id)
 {
+    ALOGV("NAN_CAPABILITIES");
     size_t message_len = sizeof(NanCapabilitiesReqMsg);
 
     pNanCapabilitiesReqMsg pFwReq = (pNanCapabilitiesReqMsg)malloc(message_len);
@@ -1499,7 +1500,7 @@
 
 int NanCommand::putNanAvailabilityDebug(NanAvailabilityDebug debug)
 {
-
+    ALOGV("NAN_AVAILABILITY_DEBUG");
     size_t message_len = sizeof(NanTestModeReqMsg);
     ALOGV("Message Len %zu", message_len);
 
diff --git a/qcwcn/wifi_hal/nan_rsp.cpp b/qcwcn/wifi_hal/nan_rsp.cpp
index f7d786d..3521b99 100644
--- a/qcwcn/wifi_hal/nan_rsp.cpp
+++ b/qcwcn/wifi_hal/nan_rsp.cpp
@@ -341,27 +341,36 @@
                                      u32 valueRcvd,
                                      void* pResponse)
 {
-    int i = 0;
+    int i = 0, j = 0;
     u16 msg_id; /* Based on the message_id in the header determine the Indication type */
     NanResponseMsg *pRsp;
     NanPublishTerminatedInd* pRspInd;
     NanDisabledInd* pRspdInd;
+    char tlvInfo[NAN_ERROR_STR_LEN];
 
     if (isNanResponse()) {
         pRsp = (NanResponseMsg*)pResponse;
         for (i = 0; i < (int)(sizeof(errorCodeTranslation)/ sizeof(errorCode)); i++) {
-                if (errorCodeTranslation[i].firmwareError == firmwareErrorRecvd) {
-                        pRsp->status =  errorCodeTranslation[i].frameworkError;
-                        strlcpy(pRsp->nan_error, errorCodeTranslation[i].nan_error, NAN_ERROR_STR_LEN);
-                        break;
+            if (errorCodeTranslation[i].firmwareError == firmwareErrorRecvd) {
+                pRsp->status =  errorCodeTranslation[i].frameworkError;
+                strlcpy(pRsp->nan_error, errorCodeTranslation[i].nan_error, NAN_ERROR_STR_LEN);
+                if (NAN_I_STATUS_INVALID_TLV_TYPE == firmwareErrorRecvd) {
+                    for (j = 0; j < (int)(sizeof(tlvToStr)/sizeof(verboseTlv)); j++) {
+                        if (tlvToStr[j].tlvType == valueRcvd) {
+                            strlcpy(tlvInfo, tlvToStr[i].strTlv, NAN_ERROR_STR_LEN);
+                            break;
+                        }
+                    }
                 }
+                strlcat(pRsp->nan_error, tlvInfo, sizeof(pRsp->nan_error));
+                break;
+            }
         }
         if (i == (int)(sizeof(errorCodeTranslation)/sizeof(errorCode))) {
                 pRsp->status =  NAN_STATUS_INTERNAL_FAILURE;
                 strlcpy(pRsp->nan_error, "NAN Discovery engine failure", NAN_ERROR_STR_LEN);
         }
-        ALOGD("%s: Status : %d", __FUNCTION__, pRsp->status);
-        ALOGD("%s: Value : %s", __FUNCTION__, pRsp->nan_error);
+        ALOGD("%s: Status: %d Error Info[value %d]: %s", __FUNCTION__, pRsp->status, valueRcvd, pRsp->nan_error);
     } else {
         msg_id = getIndicationType();
 
@@ -381,8 +390,7 @@
                         pRspInd->reason =  NAN_STATUS_INTERNAL_FAILURE;
                         strlcpy(pRspInd->nan_reason, "NAN Discovery engine failure", NAN_ERROR_STR_LEN);
                 }
-                ALOGD("%s: Status : %d", __FUNCTION__, pRspInd->reason);
-                ALOGD("%s: Value : %s", __FUNCTION__, pRspInd->nan_reason);
+                ALOGD("%s: Status: %d Error Info[value %d]: %s", __FUNCTION__, pRspInd->reason, valueRcvd, pRspInd->nan_reason);
                 break;
         case NAN_INDICATION_DISABLED:
                 pRspdInd = (NanDisabledInd*)pResponse;
@@ -397,8 +405,7 @@
                         pRspdInd->reason =  NAN_STATUS_INTERNAL_FAILURE;
                         strlcpy(pRspdInd->nan_reason, "NAN Discovery engine failure", NAN_ERROR_STR_LEN);
                 }
-                ALOGD("%s: Status : %d", __FUNCTION__, pRspdInd->reason);
-                ALOGD("%s: Value : %s", __FUNCTION__, pRspdInd->nan_reason);
+                ALOGD("%s: Status: %d Error Info[value %d]: %s", __FUNCTION__, pRspdInd->reason, valueRcvd, pRspdInd->nan_reason);
                 break;
         }
     }