vendor_samsung_universal757.../universal7570-common/vendor/bin/moredump
2019-05-24 17:27:16 +05:30

50 lines
1.4 KiB
Bash

#!/vendor/bin/sh
# Invoke the moredump.bin tool building appropriate filename.
#
# The output is redirected to /dev/null because when called
# from the call_usermode_helper() kernel API on Android
# garbage gets written into the output file.
#
base_dir=`cat /sys/module/scsc_mx/parameters/base_dir`
fw_var=`cat /sys/module/scsc_mx/parameters/firmware_variant`
fw_suffix=`cat /sys/module/scsc_mx/parameters/firmware_hw_ver`
build_type="`getprop ro.build.type`"
if [ "$fw_suffix" = "manual" ];
then
fw_suffix=""
fi
#xml_dir=$base_dir/$fw_var$fw_suffix/debug/hardware/moredump
xml_dir=$base_dir/$fw_var/debug/hardware/moredump
log_strings=$base_dir/$fw_var$fw_suffix/debug/common/log-strings.bin
[ "x${build_type}" == "xuser" ] && moredump_dir=/data/log/wifi || moredump_dir=/sdcard/log
if [ ! -d $moredump_dir ]
then
mkdir -p $moredump_dir
fi
sync
if [ "x${build_type}" == "xuser" ]
then
out_name=$moredump_dir/moredump_last
rm -f "$out_name.cmm" >/dev/null 2>&1
sync
else
out_name=$moredump_dir/moredump_`date +%Y_%m_%d__%H_%M_%S`
fi
## Dump LogRing, Logcat, Kernel
## We force mxlog collection (-f), regardless of mxman state (as this is the first panic)
mx_logger_dump.sh -d $moredump_dir -f || true
## Trigger Moredump itself
moredump.bin $out_name.cmm -xml_path $xml_dir -log_strings $log_strings 2>/dev/null >/dev/null
exit_code=$?
chmod 775 $out_name.cmm
sync
exit $exit_code