Hello everyone, I'm experiencing an issue with my Bluetooth JBL Wave Flex headphones on Ubuntu. When I connect them, they automatically set to mono (HFP) mode, which affects the audio quality. However, if I manually disconnect the headphones from Bluetooth and reconnect them, they correctly switch to stereo (A2DP) mode, and the audio quality improves significantly. I've tried several solutions, including creating scripts and udev rules to force the connection in A2DP mode, but I haven't found a definitive solution. Below are the steps I've taken and the configurations I've tried: Using pavucontrol, I was able to change the profile to "High Fidelity Playback (A2DP)", but this setting doesn't persist after disconnecting and reconnecting the headphones. Scripts and udev rules: I created a script to automatically change the audio profile when the headphones are connected: #!/bin/bash LOGFILE="/home/federico/set_a2dp.log" DEVICE_ID="bluez_card.70_50_E7_52_7C_DE" MAX_RETRIES=10 echo "$(date) - Script started" >> $LOGFILE # Function to check if PulseAudio is ready is_pulseaudio_ready() { pacmd stat >/dev/null 2>&1 return $? } # Wait for PulseAudio to be ready for i in $(seq 1 $MAX_RETRIES); do if is_pulseaudio_ready; then echo "$(date) - PulseAudio is ready" >> $LOGFILE break The udev rule to run the script when the headphones are connected. sudo nano /etc/udev/rules.d/99-bt-a2dp.rules Content: ACTION=="add", SUBSYSTEM=="bluetooth", KERNEL=="hci0:512|hci0:513", RUN+="/home/federico/set_a2dp.sh" Checking permissions: chmod +x /home/federico/set_a2dp.sh Log verification: Despite these attempts, the log shows that PulseAudio is not ready when the script runs: Fri May 31 21:16:04 -03 2024 - Script started Fri May 31 21:16:04 -03 2024 - Waiting for PulseAudio (attempt 1/10) ... Fri May 31 21:16:24 -03 2024 - Changing profile to A2DP for bluez_card.70_50_E7_52_7C_DE No PulseAudio daemon running, or not running as a session daemon. Manual connection: Currently, the only way to get the headphones to connect in stereo mode is to manually disconnect them from the Bluetooth interface and reconnect them. I don't think I should have to use a script to disconnect and reconnect the headphones. Bluetooth should connect in stereo by default. If anyone has a solution or any suggestions to resolve this issue automatically, I would greatly appreciate it! Thanks in advance for any help you can provide. Best regards, Federico
View Tag Cloud
Ubuntu Forums Code of Conduct