tarina

git clone https://git.tarina.org/tarina
Log | Files | Refs | README | LICENSE

dp_audio_playback.sh (2359B)


      1 #!/bin/bash
      2 
      3 #/*
      4 # * Copyright (C) 2013-2016 Intel Corporation
      5 # *
      6 # * This program is free software; you can redistribute it and/or modify
      7 # * it under the terms of the GNU General Public License as published by
      8 # * the Free Software Foundation; either version 2 of the License, or
      9 # * (at your option) any later version.
     10 # *
     11 # * This program is distributed in the hope that it will be useful,
     12 # * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 # * GNU General Public License for more details.
     15 # *
     16 # */
     17 
     18 #set test freq table (HZ)
     19 freq_table="10 31 73 155 380 977 1932 4119 8197 16197"
     20 
     21 #set test number of channels
     22 test_channel=2
     23 
     24 #get device number for DP
     25 DP_device_num=0
     26 $ABAT_TEST_PATH/dp_audio_subdevice_number.sh
     27 DP_device_num=$?
     28 if [ $DP_device_num = 77 ]; then
     29 	echo "Prompt: Can not get device with DP audio or \
     30 show the wrong connection type as HDMI in ELD info"
     31 	exit 1
     32 fi
     33 
     34 #To get DP audio device number
     35 DP_card_number=$(aplay -l | grep "HDMI 0" | cut -b 6)
     36 if [ "$DP_card_number" = "" ]; then
     37 	echo "Error: Can not get Display audio card."
     38 	exit 1
     39 fi
     40 
     41 DP_device="hw:$DP_card_number,$DP_device_num"
     42 echo $device
     43 sleep 2
     44 
     45 #get Analog audio record card number
     46 record_card_number=$(arecord -l | grep "Analog" | cut -b 6)
     47 if [ "$record_card_number" = "" ]; then
     48 	echo "Can not get record card number."
     49 	exit 1
     50 fi
     51 
     52 #get Analog audio record device number
     53 record_device_number=$(arecord -l | grep "Analog"| cut -d " " -f 8 |cut -b 1)
     54 echo $record_device_number
     55 if [ "$record_device_number" = "" ]; then
     56         echo "Can not get record device number"
     57         exit 1
     58 fi
     59 
     60 #Notice: to loopback the DP audio output to the analog audio input
     61 record_device="hw:$record_card_number,$record_device_number"
     62 test_flag=0
     63 
     64 echo -e "\e[31m Notice: to loopback the DP audio \
     65 output to the analog audio input"
     66 echo -e "\e[0m"
     67 read -p "Press enter to continue"
     68 
     69 #call alsabat to do the test for each frequency in the freq_table
     70 for freq in $freq_table
     71 	do
     72 		alsabat -P $DP_device -C plug$record_device -c $test_channel -F $freq
     73 		if [ $? = 0 ]; then
     74 			echo "Test target frequency:$freq for DP audio playback--Passed" \
     75 >> $ABAT_TEST_LOG_FILE
     76 		else
     77 			echo "Test target frequency:$freq for DP audio playback--Failed" \
     78 >> $ABAT_TEST_LOG_FILE
     79 			test_flag=1
     80 		fi
     81 	done
     82 
     83 exit $test_flag