Commit 5b0126b4 authored by hydrargyrum's avatar hydrargyrum

headset-bluez: enable a bluetooth headset and out or in/out mode

parent 3a669054
#!/bin/sh -e
# license: Do What The Fuck You Want To Public License version 2 [http://www.wtfpl.net/]
# Enable a bluetooth headset and out or in/out mode.
find_bluez () {
pactl list short "$1" | grep bluez | grep -v monitor | awk '{print $2}'
}
card=$(find_bluez cards)
if [ "$1" = inout ]
then
pactl set-card-profile "$card" headset_head_unit
sink=$(find_bluez sinks)
pactl set-default-sink "$sink"
pactl set-sink-mute "$sink" 0
src=$(find_bluez sources)
pactl set-default-source "$src"
pactl set-source-mute "$src" 0
elif [ "$1" = out ]
then
pactl set-card-profile "$card" a2dp_sink
sink=$(find_bluez sinks)
pactl set-default-sink "$sink"
pactl set-sink-mute "$sink" 0
else
cat <<- EOF
usage: $0 {out | inout}
Enable a bluetooth headset and set either:
- in/out mode: mono audio output + microphone (HSP/HFP)
- out mode: high-quality output, no microphone (A2DP)
EOF
exit 64
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment