summaryrefstree
path: root/system/bin/freecomm_debug.sh
blob: 6a8a00223765049d7e2754e6698c6fbf41be2b26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/system/bin/sh
cd /system/bin/
#. freecomm_init.sh
#export DEBUG_STUB="/mnt/sdcard/debug/debug_stub.sh"
#time_last=0
#time_now=0
echo "log_debug test start........" > /data/log_debug.txt
sdcard0=$EXTERNAL_STORAGE
sdcard0_src=$EMULATED_STORAGE_SOURCE
sdcard1=$SECONDARY_STORAGE
echo $sdcard0 >/data/log_debug.txt
echo $sdcard1 >/data/log_debug.txt


log_started=0
while [ 1 ]
do
echo "log_debug test" >> /data/log_debug.txt
#sdcard_mounted=$(busybox mount|busybox grep "external_sd type vfat" |cut -d ' ' -f5)	#if mount got "vfat"
#in_sdcard_mounted=$(busybox mount|busybox grep "emmc type vfat" |busybox cut -d ' ' -f5)	#if mount got "vfat"
#ex_sdcard_mounted=$(busybox mount|busybox grep "sdcard type vfat" |busybox cut -d ' ' -f5)	#if mount got "vfat"
in_sdcard_mounted=$(busybox mount|busybox grep "$sdcard0 type vfat" |busybox cut -d ' ' -f5)	#if mount got "vfat"
in_sdcard_mounted1=$(busybox mount|busybox grep "$sdcard0 type fuse" |busybox cut -d ' ' -f5)	#if mount got "fuse"
in_sdcard_mounted2=$(busybox mount|busybox grep "$sdcard0_src type fuse" |busybox cut -d ' ' -f5)	#if mount got "fuse"
ex_sdcard_mounted=$(busybox mount|busybox grep "$sdcard1 type vfat" |busybox cut -d ' ' -f5)	#if mount got "vfat"
ex_sdcard_mounted1=$(busybox mount|busybox grep "$sdcard1 type fuse" |busybox cut -d ' ' -f5)	#if mount got "fuse"
log_debug_enable=$(getprop persist.sys.log.debug.enable)

#if [ "$log_started" == "0" -a "$log_debug_enable" == "1" -a "$sdcard_mounted" == "vfat" ];then
if [ "$log_started" == "0" -a "$log_debug_enable" == "1" ] && [ "$in_sdcard_mounted" == "fuse" -o "$in_sdcard_mounted1" == "fuse" -o "$in_sdcard_mounted2" == "fuse" ];then
	. /system/bin/log_debug.sh 
	log_started=1
elif [ "$log_started" == "0" -a "$log_debug_enable" == "2" ] && [ "$ex_sdcard_mounted1" == "fuse" -o "$ex_sdcard_mounted" == "vfat" ];then
	. /system/bin/log_debug.sh 
	log_started=1
else 
	if [ "$log_started" == "1" -a "$log_debug_enable" == "0" ];then
	#echo "stop log debug" >> /data/debug-err-log.txt
		busybox killall log_debug_logcat
		busybox killall cat
		rm /data/log_debug_logcat
		rm /data/cat
		log_started=0
	#echo "log debug not enabled"
	#else
	#	echo "log_enable = \"$log_debug_enable\"" >> /data/debug-err-log.txt
	#	echo "log_started= \"$log_started\"" >> /data/debug-err-log.txt
	fi
fi

#if [ -e $DEBUG_STUB ]; then
#	cd /mnt/sdcard/debug
#	time_now=$(stat debug_stub.sh |grep Modify | cut -c 9-27)
#	if [ "$time_last" != "$time_now" ];
#	then
#	date >> /mnt/sdcard/debug/log.txt
#	chmod 777 debug_stub.sh
#	. debug_stub.sh
#	time_last=$time_now	
#	cat debug_stub.sh >> /mnt/sdcard/debug/log.txt
#	echo -e "\r\nExecute End\r\n" >> /mnt/sdcard/debug/log.txt
#	fi
#fi
sleep 10
done