2022/7/19

Fix Bluetooth Headset, Headphone function in ubuntu 20.04

想不到 ubuntu 20.04 的 pluseaudio 不 support bluetooth 的 hsp。
所以沒辦法用 bluetooth 的 microphone (因為一直用 A2DP profile)

這一篇 說,修改 /etc/pulse/default.pa。
在 module-bluetooth-discover.so 後面加上 headset=ofono

更完整的在: 但是ubuntu 20.04 找步道 ofono-phonesim
自己加:
sudo add-apt-repository ppa:smoser/bluetooth
sudo apt-get update
sudo apt-get install ofono-phonesim
至於這個說明,和這個說明,一樣修改 /etc/pulse/default.pa,加上 auto_switch=2,會讓 bluetooth 無法連線。

其他,最多,最方便(?)的大概就是用 pipewire 了,
這一篇 說:
PipeWire acts as a drop-in replacement for PulseAudio and offers an easy way to set up Bluetooth headsets. 
It includes out-of-the-box support for A2DP sink profiles using SBC/SBC-XQ, AptX, LDAC or AAC codecs, and HFP/HSP.
所以,大概可以安心用吧(?)
安裝一樣要用 ppa:
sudo add-apt-repository ppa:pipewire-debian/pipewire-upstream
sudo apt update
sudo apt install pipewire
sudo apt install libspa-0.2-bluetooth pipewire-audio-client-libraries

systemctl --user daemon-reload
systemctl --user --now disable pulseaudio.service pulseaudio.socket
systemctl --user mask pulseaudio

systemctl --user --now enable pipewire-media-session.service
然後 check service 是否...
$ pactl info
...
Server Name: PulseAudio (on PipeWire 0.3.32)
...
如果不 OK,可以..
systemctl --user restart pipewire

要 roll-back 的話,可以:
systemctl --user unmask pulseaudio

systemctl --user --now enable pulseaudio.service pulseaudio.socket
這一篇好像是最早的文章。

結果,切到 A2DP 是 OK,切到 HSP 沒聲音,phone 跟 mic 都沒聲音。
然後這一篇說,pipewire 新版的設定檔改位置了。

結果還是一樣,沒聲音。
最後是用外接 bt dongle 才成功。
所以猜是 buildin bt firmware 問題。

另外。
這樣就要 disable internal bt,use bt dongle

$ dmesg | grep Blue
[    5.531481] Bluetooth: Core ver 2.22
[    5.532182] Bluetooth: HCI device and connection manager initialized
[    5.532188] Bluetooth: HCI socket layer initialized
[    5.532190] Bluetooth: L2CAP socket layer initialized
[    5.532198] Bluetooth: SCO socket layer initialized
[    5.697901] Bluetooth: hci0: BCM: chip id 63
[    5.698891] Bluetooth: hci0: BCM: features 0x07
[    5.714899] Bluetooth: hci0: BCM20702A
[    5.714905] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[    5.719734] Bluetooth: hci0: BCM: firmware Patch file not found, tried:
[    5.719740] Bluetooth: hci0: BCM: 'brcm/BCM20702A1-0a5c-21f3.hcd'
[    5.719741] Bluetooth: hci0: BCM: 'brcm/BCM-0a5c-21f3.hcd'
[    6.303633] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    6.303638] Bluetooth: BNEP filters: protocol multicast
[    6.303643] Bluetooth: BNEP socket layer initialized
[    7.276706] Bluetooth: RFCOMM TTY layer initialized
[    7.276717] Bluetooth: RFCOMM socket layer initialized
[    7.276724] Bluetooth: RFCOMM ver 1.11
在/lib/firmware/brcm/ 下真的沒找到 BCM-0a5c-21f3.hcd,只有 BCM-0bb4-0306.hcd
根據這邊 的說明:
This package intentended to provide firmware of Broadcom WIDCOMM® Bluetooth devices 
(including BCM20702, BCM20703, BCM43142 chipsets and other) for Linux kernel. 
Since February 2017, Broadcom ships their drivers directly to Windows Update service. 
依照 dmesg 的 filename : BCM2070A1-0a5c-21f3.hcd,download 下來, copy 到 /lib/firmware/brcm/ 後,reboot, dmesg 變成:
[    4.435281] Bluetooth: Core ver 2.22
[    4.435312] NET: Registered PF_BLUETOOTH protocol family
[    4.435314] Bluetooth: HCI device and connection manager initialized
[    4.435319] Bluetooth: HCI socket layer initialized
[    4.435322] Bluetooth: L2CAP socket layer initialized
[    4.435327] Bluetooth: SCO socket layer initialized
[    5.486378] Bluetooth: hci0: BCM: chip id 63
[    5.487374] Bluetooth: hci0: BCM: features 0x07
[    5.503384] Bluetooth: hci0: BCM20702A
[    5.503391] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[    5.508881] Bluetooth: hci0: BCM20702A1 'brcm/BCM20702A1-0a5c-21f3.hcd' Patch
[    5.942911] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    5.942916] Bluetooth: BNEP filters: protocol multicast
[    5.942921] Bluetooth: BNEP socket layer initialized
[    6.593382] Bluetooth: hci0: Broadcom Bluetooth Device
[    6.593389] Bluetooth: hci0: BCM20702A1 (001.002.014) build 1761
[    6.958593] Bluetooth: RFCOMM TTY layer initialized
[    6.958602] Bluetooth: RFCOMM socket layer initialized
[    6.958609] Bluetooth: RFCOMM ver 1.11
然後 bt headphone 的 hsp 就正常了。

所以..
  • 安裝 pipewire
  • download .hcd
才能讓 ubuntu 20.04 的 bluetooth headphone 功能恢復正常。

其他的 ref:

ref: 一直要到 ubuntu 22.10 才會內建 pipewire.

沒有留言:

張貼留言