/* * Copyright (c) 2006 Atheros Communications Inc. * All rights reserved. * * * // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // // * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern char *if_indextoname (unsigned int __ifindex, char *__ifname); #include #ifdef ANDROID #include "wireless_copy.h" #else #include #endif #include #include #include #include #include #include #include #include #undef DEBUG #undef DBGLOG_DEBUG #define ID_LEN 2 #define DBGLOG_FILE "dbglog.h" #define DBGLOGID_FILE "dbglog_id.h" #define GET_CURRENT_TIME(s) do { \ time_t t; \ t = time(NULL); \ s = strtok(ctime(&t), "\n"); \ } while (0); #ifdef ANDROID #define DEBUG 1 #include #endif #define AR6K_DBG_BUFFER_SIZE 256 struct dbg_binary_header { A_UINT8 sig; A_UINT8 ver; A_UINT16 len; A_UINT32 reserved; }; struct dbg_binary_record { A_UINT32 ts; /* Timestamp of the log */ A_UINT32 length; /* Length of the log */ A_UINT8 log[AR6K_DBG_BUFFER_SIZE]; /* log message */ }; static int ATH_WE_VERSION = 0; #define SRCDIR_FLAG 0x01 #define LOGFILE_FLAG 0x02 #define DBGREC_LIMIT_FLAG 0x04 #define RESTORE_FLAG 0x08 #define BINARY_FLAG 0x10 const char *progname; char restorefile[PATH_MAX]; char dbglogfile[PATH_MAX]; char dbglogidfile[PATH_MAX]; char dbglogoutfile[PATH_MAX]; FILE *fpout; int dbgRecLimit = 1000000; /* Million records is a good default */ int optionflag; char dbglog_id_tag[DBGLOG_MODULEID_NUM_MAX][DBGLOG_DBGID_NUM_MAX][DBGLOG_DBGID_DEFINITION_LEN_MAX]; const char options[] = "Options:\n\ -f, --logfile= [Mandatory]\n\ -g, --debug (-gg to print out dbglog info together) [Optional]\n\ -b, --binary\n\ -d, --srcdir= [Mandatory if not binary]\n\ -l, --reclimit= [Optional]\n\ -r, --restore=