summarylogtreecommitdiffstats
path: root/bt-auto-enable-a2dp
diff options
context:
space:
mode:
authorSaren Arterius2019-04-28 00:28:52 +0800
committerSaren Arterius2019-04-28 00:28:52 +0800
commit61a0ea6744b66158d172c217de7058a06881f4de (patch)
tree189ab35f67c4bb2f94a1e39d971a80d1bc69b1c8 /bt-auto-enable-a2dp
parent962efd9042c5d4f49b138c2b2c51cbe8b18fa319 (diff)
downloadaur-pulseaudio-bt-auto-enable-a2dp.tar.gz
19
Diffstat (limited to 'bt-auto-enable-a2dp')
-rw-r--r--bt-auto-enable-a2dp16
1 files changed, 15 insertions, 1 deletions
diff --git a/bt-auto-enable-a2dp b/bt-auto-enable-a2dp
index 970343b72e65..dfa07ceb6b0a 100644
--- a/bt-auto-enable-a2dp
+++ b/bt-auto-enable-a2dp
@@ -16,7 +16,21 @@ function enable_a2dp() {
expect -re \".*Device $mac ServicesResolved: yes\"
"
# enable card in pulseaudio
- pactl set-card-profile $pulsecard a2dp_sink
+ a2dp_profiles=(
+ 'a2dp_sink_ldac'
+ 'a2dp_sink_aptx_hd'
+ 'a2dp_sink_aptx'
+ 'a2dp_sink_aac'
+ 'a2dp_sink_sbc'
+ 'a2dp_sink' )
+
+ for profile in "${a2dp_profiles[@]}"
+ do
+ if [[ `pactl list cards | grep ${profile}` ]]; then
+ pactl set-card-profile $pulsecard ${profile} && break
+ fi
+ done
+
logger -p info "mac $mac enabled"
headsetname=`bt-device -l | perl -ne '/(.*) \('$mac'\)/ and print "$1\n"'`