Created
May 15, 2015 03:06
-
-
Save shinglyu/e44502cbb78e6e207445 to your computer and use it in GitHub Desktop.
Shell script for parsing STK logs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to capture STK log: | |
# * Enable RIL log | |
# * adb logcat | grep typeOfCommand --line-buffered | tee /tmp/stk.log | |
if [ $# -lt 1 ]; then | |
echo "Usage: stk_summary.sh <log file>" | |
exit | |
fi | |
fname=$1 | |
# Get unique set of commands issued | |
commands=$(grep -o -e "typeOfCommand\":[0-9]*" $fname | sort | uniq) | |
# Extract the code only | |
array=$(echo $commands | tr "typeOfCommand\":" "\n") | |
# Convert decimal code to hex | |
for cmd in $array; do | |
hex=$(echo "obase=16; $cmd" | bc) | |
echo "0x$hex" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example output: