Skip to content

Instantly share code, notes, and snippets.

@carcigenicate
Created August 22, 2024 14:43
Show Gist options
  • Save carcigenicate/02785c4426c48bed2511656b5578dbee to your computer and use it in GitHub Desktop.
Save carcigenicate/02785c4426c48bed2511656b5578dbee to your computer and use it in GitHub Desktop.
#! /bin/env bash
# Attempts to set the mic profile to HFP since it randomly started defaulting to A2DP, which doesn't allow mic input
command="pacmd set-card-profile bluez_card.your_card handsfree_head_unit"
count=0
maxCount=100
output=$(eval $command)
while [[ ! -z "$output" ]] && [[ $count -lt maxCount ]]
do
sleep 0.5
output=$(eval $command)
((count++))
done
if [[ $count -eq $maxCount ]]; then
echo "Failed to enable mic after $maxCount tries"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment