diff options
| author | Nagaraj <c_lnun@qca.qualcomm.com> | 2014-09-11 16:40:16 -0700 |
|---|---|---|
| committer | AnjaneeDevi Kapparapu <c_akappa@qti.qualcomm.com> | 2014-09-16 11:08:29 +0530 |
| commit | 1726a49cdbae2d3649d9dff503bf309e74fcef6c (patch) | |
| tree | 064bf9c3fb3fdafb9e40342374be3d78e4a2e5a4 /tools/fwdebuglog | |
| parent | b73e6563d7f16c76c633c89067d57ca92449e4dc (diff) | |
Fix cnss log submit issue to QXDM.
Fixed the log submit to QXDM and added the run time
debug option.
Change-Id: If403bbca445c0ede909596abac83a7273284c2e5
CRs-Fixed: 713200
Diffstat (limited to 'tools/fwdebuglog')
| -rw-r--r-- | tools/fwdebuglog/cld-diag-parser.c | 51 | ||||
| -rw-r--r-- | tools/fwdebuglog/cld-diag-parser.h | 2 | ||||
| -rw-r--r-- | tools/fwdebuglog/cld-fwlog-netlink.c | 9 |
3 files changed, 50 insertions, 12 deletions
diff --git a/tools/fwdebuglog/cld-diag-parser.c b/tools/fwdebuglog/cld-diag-parser.c index 323b6436077e..879775148912 100644 --- a/tools/fwdebuglog/cld-diag-parser.c +++ b/tools/fwdebuglog/cld-diag-parser.c @@ -40,6 +40,7 @@ #include <android/log.h> #define FWDEBUG_LOG_NAME "ROME" +#define FWDEBUG_NAME "ROME_DEBUG" #define android_printf(...) \ __android_log_print(ANDROID_LOG_INFO, FWDEBUG_LOG_NAME, __VA_ARGS__); #endif @@ -68,6 +69,12 @@ static diag_entry *gdiag_db = NULL; static file_header *gdiag_header = NULL; static int32_t gisdiag_init = FALSE; static int gdiag_sock_fd = 0, goptionflag = 0; +#ifdef CONFIG_ANDROID_LOG +#define debug_printf(...) do { \ + if (goptionflag & DEBUG_FLAG) \ + __android_log_print(ANDROID_LOG_INFO, FWDEBUG_NAME, __VA_ARGS__); \ +} while(0) +#endif /* * macros to safely extract 8, 16, 32, or 64-bit values from byte buffer @@ -807,8 +814,29 @@ process_diagfw_msg(uint8_t *datap, uint16_t len, uint32_t optionflag, char *payload; char buf[BUF_SIZ], payload_buf[BUF_SIZ]; char *start = buf; - int32_t hashInd = 0, i =0; + int32_t hashInd = 0, i =0, j =0; diag_entry *entry = NULL; + int ret = 0, total_dump_len = 0; + uint8_t *debugp = datap; + char dump_buffer[BUF_SIZ]; + + if (optionflag & DEBUG_FLAG) { + memset(dump_buffer, 0, sizeof(dump_buffer)); + debug_printf("process_diagfw_msg hex dump start len %d", len); + for (i = 0; i < len; i++) { + ret = snprintf(dump_buffer + j,BUF_SIZ, "0x%x ", debugp[i]); + j += ret; + if (!(i % 16) && (i!=0)) { + total_dump_len += 16; + debug_printf("%s", dump_buffer); + memset(dump_buffer, 0, sizeof(dump_buffer)); + j = 0; + } + } + if (total_dump_len != len) + debug_printf("%s", dump_buffer); + debug_printf("process_diagfw_msg hex dump end"); + } if (!gisdiag_init) { /* If cnss_diag is started if WIFI already ON, @@ -853,7 +881,7 @@ process_diagfw_msg(uint8_t *datap, uint16_t len, uint32_t optionflag, payloadlen = DIAG_GET_PAYLEN16(header2); debug_printf("DIAG_TYPE_FW_EVENT: id = %d" " payloadlen = %d \n", id, payloadlen); - if (optionflag == QXDM_FLAG) { + if (optionflag & QXDM_FLAG) { if (payloadlen) event_report_payload(id, payloadlen, payload); else @@ -867,12 +895,19 @@ process_diagfw_msg(uint8_t *datap, uint16_t len, uint32_t optionflag, payloadlen = DIAG_GET_PAYLEN16(header2); debug_printf("DIAG_TYPE_FW_LOG: id = %d" " payloadlen = %d \n", id, payloadlen); - if (optionflag == QXDM_FLAG) { - log_header_type *pHdr = (log_header_type*)(payload); - if (log_status(pHdr->code)) { - log_set_timestamp(pHdr); - log_submit(pHdr); - } + if (optionflag & QXDM_FLAG) { + /* Allocate a log buffer */ + uint8_t *logbuff = (uint8_t*) log_alloc(id, + sizeof(log_hdr_type)+payloadlen); + if ( logbuff != NULL ) { + /* Copy the log data */ + memcpy(logbuff + sizeof(log_hdr_type), payload, + payloadlen); + /* Commit the log buffer */ + log_commit(logbuff); + } + else + debug_printf("log_alloc failed for len = %d ", payloadlen); } } break; diff --git a/tools/fwdebuglog/cld-diag-parser.h b/tools/fwdebuglog/cld-diag-parser.h index 5770d33bd0e5..0750f4c60671 100644 --- a/tools/fwdebuglog/cld-diag-parser.h +++ b/tools/fwdebuglog/cld-diag-parser.h @@ -128,6 +128,7 @@ #define CONSOLE_FLAG 0x02 #define QXDM_FLAG 0x04 #define SILENT_FLAG 0x08 +#define DEBUG_FLAG 0x0A #define ATH6KL_FWLOG_PAYLOAD_SIZE 1500 @@ -212,7 +213,6 @@ static inline unsigned int get_32(const unsigned char *pos) #define RESTART_LEVEL \ "echo related > /sys/bus/msm_subsys/devices/subsys4/restart_level" #define DB_FILE_PATH "/firmware/image/Data.msc" -#define debug_printf #define BUF_SIZ 256 #define WLAN_LOG_TO_DIAG(xx_ss_id, xx_ss_mask, xx_fmt) \ diff --git a/tools/fwdebuglog/cld-fwlog-netlink.c b/tools/fwdebuglog/cld-fwlog-netlink.c index 38a21f9ff743..7e2c19997f29 100644 --- a/tools/fwdebuglog/cld-fwlog-netlink.c +++ b/tools/fwdebuglog/cld-fwlog-netlink.c @@ -84,6 +84,7 @@ const char options[] = -c, --console (prints the logs in the console)\n\ -s, --silent (No print will come when logging)\n\ -q, --qxdm (prints the logs in the qxdm)\n\ +-d, --debug (more prints in logcat, check logcat -s ROME_DEBUG, example to use: -q -d or -c -d)\n\ The options can also be given in the abbreviated form --option=x or -o x. The options can be given in any order"; struct sockaddr_nl src_addr, dest_addr; @@ -422,11 +423,12 @@ int32_t main(int32_t argc, char *argv[]) {"console", 0, NULL, 'c'}, {"qxdm", 0, NULL, 'q'}, {"silent", 0, NULL, 's'}, + {"debug", 0, NULL, 'd'}, { 0, 0, 0, 0} }; while (1) { - c = getopt_long (argc, argv, "f:scqr:", long_options, &option_index); + c = getopt_long (argc, argv, "f:scqdr:", long_options, &option_index); if (c == -1) break; switch (c) { @@ -456,12 +458,13 @@ int32_t main(int32_t argc, char *argv[]) } } - if (!(optionflag & (LOGFILE_FLAG | CONSOLE_FLAG | QXDM_FLAG | SILENT_FLAG))) { + if (!(optionflag & (LOGFILE_FLAG | CONSOLE_FLAG | QXDM_FLAG | SILENT_FLAG + | DEBUG_FLAG))) { usage(); return -1; } - if (optionflag == QXDM_FLAG) { + if (optionflag & QXDM_FLAG) { /* Intialize the fd required for diag APIs */ if (TRUE != Diag_LSM_Init(NULL)) { |
