Home | History | Annotate | Download | only in tools
      1 #!/bin/bash
      2 # Telephony Debug Intents
      3 #set -x
      4 
      5 file_name='tdi'
      6 
      7 # Get the command as the first parameter
      8 cmd=$1
      9 shift
     10 
     11 function dc_errors()
     12 {
     13     if [ "$1" == "" ]; then
     14         echo "Usage: $file_name $cmd <dc> <count> <cause> <retry-time>"
     15         echo "  <dc> must specifiy the DataConnection such as DC or GsmDC-1"
     16         echo "  <count> := number of times to retry"
     17         echo "  <cause> := From DataConnection.FailCause; such as -3 for SIGNAL_LOST"
     18         echo "  <retry-time> := suggested retry time in milli-seconds"
     19         exit
     20     fi
     21     the_DC=$1
     22     echo "the_DC=$the_DC"
     23 
     24     if [ "$2" != "" ]; then
     25         counter="--ei counter $2";
     26     fi
     27     echo "counter=$counter"
     28 
     29     if [ "$3" != "" ]; then
     30         fail_cause="--ei fail_cause $3";
     31     fi
     32     echo "fail_cause=$fail_cause"
     33 
     34     if [ "$4" != "" ]; then
     35         suggested_retry_time="--ei suggested_retry_time $4";
     36     fi
     37     echo "suggested_retry_time=$suggested_retry_time"
     38 
     39 
     40     adb shell am broadcast -a com.android.internal.telephony.$the_DC.action_fail_bringup $counter $fail_cause $suggested_retry_time
     41 }
     42 
     43 
     44 case ${cmd} in
     45 	dce) dc_errors "$@";;
     46     # Add more commands in the future
     47 	*) echo 'Broadcast telephony debug intents'; echo 'usage: tdi [dce]'; echo '  dce=DC errors';;
     48 esac
     49