1#!/system/bin/sh
2# Run a loopback test in the background after a delay.
3# To run the script, enter these commands once:
4#    adb disable-verity
5#    adb reboot
6#    adb remount
7#    adb sync
8#    adb push loopback.sh /data/
9# For each test run:
10#    adb shell "nohup sh /data/loopback.sh &"
11# Quickly connect USB audio if needed, either manually or via Tigertail switch.
12# Wait until the test completes, restore USB to host if needed, and then:
13#    adb pull /data/loopreport.txt
14#    adb pull /data/loopback_all.wav
15#    adb pull /data/loopback_echos.wav
16
17SLEEP_TIME=10
18TEST_COMMAND="/data/nativetest/aaudio_loopback/aaudio_loopback -pl -Pl -C1 -n2 -m2 -te -d5"
19# Partial list of options:
20#   -pl (output) performance mode: low latency
21#   -Pl input performance mode: low latency
22#   -C1 input channel count: 1
23#   -n2 number of bursts: 2
24#   -m2 mmap policy: 2
25#   -t? test mode: -tm for sine magnitude, -te for echo latency, -tf for file latency
26#   -d5 device ID
27# For full list of available options, see AAudioArgsParser.h and loopback.cpp
28
29echo "Plug in USB Mir and Fun Plug."
30echo "Test will start in ${SLEEP_TIME} seconds: ${TEST_COMMAND}"
31sleep ${SLEEP_TIME}
32date > /data/loopreport.txt
33${TEST_COMMAND} >> /data/loopreport.txt
34date >> /data/loopreport.txt
35