Created
September 25, 2025 08:24
-
-
Save palcodes/4e79bfd778611b700bc61ff0e9b2ba6b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # File: xm4.sh | |
| # Force Sony XM4 to A2DP mode | |
| HEADSET_MAC="DEVICE_ID" | |
| # Get pipewire card number | |
| CARD=$(pactl list cards | grep "$HEADSET_MAC" | awk '{print $1}') | |
| if [ -z "$CARD" ]; then | |
| echo "Headset not found. Ensure it is connected and paired." | |
| exit 1 | |
| fi | |
| echo "Reconnecting headset..." | |
| # bluetoothctl flow | |
| bluetoothctl <<EOF | |
| disconnect $HEADSET_MAC | |
| connect $HEADSET_MAC | |
| exit | |
| EOF | |
| sleep 2 | |
| echo "Headset reconnected." | |
| echo "Setting up A2DP" | |
| pactl set-card-profile "$CARD" a2dp_sink | |
| #Verify | |
| pactl list cards short | grep "$HEADSET_MAC" | |
| echo "Done. Your XM4 is now in A2DP mode." | |
| echo $CARD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment