update rccd2 for end-system integraton
[tas2555sw-android/tas2555-util-stereo.git] / rccd2 / rccd2.sh
1 #!/bin/sh
3 ADB=adb
4 RCCD2=rccd2
5 PORT=5000
6 CARD=0
7 DEBUG=1
8 LOGCAT=1
9 SAFE=""
10 DEBUG_OPTS=
12 usage()  {
13     echo "usage goes here"
14     exit 0
15 }
17 while getopts "p:c:a:r:dlsh" opt; do
18     case $opt in
19         h) usage ;;
20         p) PORT=$OPTARG ;;
21         c) CARD=$OPTARG ;;
22         a) ADB=$OPTARG ;;
23         r) RCCD2=$OPTARG ;;
24         d) DEBUG=1 ; DEBUG_OPTS="-v 10";;
25         l) LOGCAT=1 ;;
26         s) SAFE=-s ;;
27     esac
28 done
30 if [ "$DEBUG" -eq "1" ]
31 then
32     echo "PORT=$PORT"
33     echo "CARD=$CARD"
34     echo "ADB=$ADB"
35     echo "RCCD2=$RCCD2"
36     echo "SAFE=$SAFE"
37     echo "LOGCAT=$LOGCAT"
38 fi
40 ${ADB} root
41 ${ADB} remount
42 ${ADB} shell svc power stayon true
43 sleep 3
44 ${ADB} push "$RCCD2" /system/bin/rccd2
45 ${ADB} shell chmod 0777 /system/bin/rccd2
46 ${ADB} forward tcp:${PORT} tcp:${PORT}
47 ${ADB} shell rccd2 -k
48 ${ADB} shell rccd2 --port=${PORT} --card=${CARD} ${SAFE} ${DEBUG_OPTS} -v 4
49 if [ "$DEBUG" -eq "1" ]
50 then
51     echo "RCCD2 is running..."
52 fi
54 if [ "$LOGCAT" -eq "1" ]
55 then
56     ${ADB} logcat -s aic3xxx
57 fi