3 #--------------------------------------
5 #--------------------------------------
9 eval $(tzplatform-get TZ_USER_DOWNLOADS)
12 BLUETOOTH_DEBUG=${1}/bluetooth
15 #BT_DUMP_DIR=${TZ_USER_DOWNLOADS}/.bt_dump
16 BT_DUMP_DIR=/opt/usr/media/Downloads/.bt_dump
18 if [ "$1" = "syslog" ]
20 DUMP_BASE_DIR=${BT_DUMP_DIR}
21 BLUETOOTH_DEBUG=${DUMP_BASE_DIR}/bluetooth
24 BT_DUMP_TMP_DIR=/tmp/bt_dump
25 LOG_FILE="bt_hcidump.log"
29 if [ -e btmon.log.1 -a -e btmon.log ]
31 /usr/bin/tail -c +17 btmon.log > btmon.log_bin
32 /bin/cat btmon.log.1 btmon.log_bin > final.log
33 /usr/bin/btsnoop -s final.log
36 /bin/rm -f btmon.log_bin btmon.log.1 btmon.log final.log
37 LOG_FILE="btsnoop_*.log"
39 /bin/rm -f btmon.log_bin btmon.log.1 btmon.log
40 /bin/mv final.log btmon.log
43 elif [ -e bt_hcidump.log.1 -a -e bt_hcidump.log ]
45 /usr/bin/tail -c +17 bt_hcidump.log > bt_hcidump.log_bin
46 /bin/cat bt_hcidump.log.1 bt_hcidump.log_bin > bt_hcidump.log
47 /bin/rm -f bt_hcidump.log_bin bt_hcidump.log.1
50 /usr/bin/btsnoop -s btmon.log
54 LOG_FILE="btsnoop_*.log"
60 if [ "${LOG_FILE}a" != "a" ]
62 /usr/bin/rename .log .cfa ${LOG_FILE}
66 if [ ! -e ${BT_DUMP_DIR} ]
68 if [ "$1" = "syslog" ]
70 /bin/mkdir -p ${BT_DUMP_DIR}
71 /bin/chown 200:200 ${BT_DUMP_DIR}
77 if [ "$1" = "syslog" ]
79 cp /var/log/messages ${BT_DUMP_DIR}/messages_`date "+%b_%d_%H:%M:%S_%Y"`
80 cp /var/log/messages.0 ${BT_DUMP_DIR}/messages.0_`date "+%b_%d_%H:%M:%S_%Y"`
81 # Skip the orginal bt_dump extract part
85 if [ ${DUMP_BASE_DIR} ]
90 /bin/mkdir -p ${BLUETOOTH_DEBUG}
91 ${CHOWN} 200:200 ${BLUETOOTH_DEBUG}
93 /bin/mkdir -p ${BT_DUMP_TMP_DIR}
94 /bin/cp -rf ${BT_DUMP_DIR}/* ${BT_DUMP_TMP_DIR}
99 if [ -e "${BT_DUMP_TMP_DIR}/old_hcidump" ]
101 cd ${BT_DUMP_TMP_DIR}/old_hcidump
105 cd ${BT_DUMP_TMP_DIR}
106 /bin/tar czf ${BLUETOOTH_DEBUG}/bt_dump.tar.gz *
108 cd ${BLUETOOTH_DEBUG}
109 ${CHOWN} 200:200 ${BLUETOOTH_DEBUG}/bt_dump.tar.gz
110 /bin/rm -rf ${BT_DUMP_TMP_DIR}