User Tools

Site Tools


Translations of this page:

en:bpi-r64:bluetooth

Table of Contents

Bluetooth

need patch from https://patchwork.kernel.org/patch/10728073/ (v5 does not work!) and increased sleep in https://elixir.bootlin.com/linux/v5.0-rc5/source/drivers/soc/mediatek/mtk-scpsys.c#L248

change

usleep_range(12000, 12100);

to

msleep(50);

this is already done in my repo (5.4)

:!: CONFIG_BT_MTKUART needs to be module to load firmware (has to be done after rootfs is mounted)

root@bpi-r64:~# mkdir -p /lib/firmware/mediatek
root@bpi-r64:~# wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/mediatek/mt7622pr2h.bin
root@bpi-r64:~# cp mt7622pr2h.bin /lib/firmware/mediatek/
root@bpi-r64:~# apt-get update
root@bpi-r64:~# apt-get install bluez
root@bpi-r64:~# reboot

#boot kernel with applied tty-patch and increased scpsys-sleep

bluetoothctl

# bluetoothctl
[bluetooth]# help                                                                                                                     
Menu main:                                                                                                                            
Available commands:                                                                                                                   
-------------------                                                                                                                   
advertise                                         Advertise Options Submenu                                                           
scan                                              Scan Options Submenu                                                                
gatt                                              Generic Attribute Submenu                                                           
list                                              List available controllers                                                          
show [ctrl]                                       Controller information                                                              
select <ctrl>                                     Select default controller                                                           
devices                                           List available devices                                                              
paired-devices                                    List paired devices                                                                 
system-alias <name>                               Set controller alias                                                                
reset-alias                                       Reset controller alias                                                              
power <on/off>                                    Set controller power                                                                
pairable <on/off>                                 Set controller pairable mode                                                        
discoverable <on/off>                             Set controller discoverable mode                                                    
agent <on/off/capability>                         Enable/disable agent with given capability                                          
default-agent                                     Set agent as the default one                                                        
advertise <on/off/type>                           Enable/disable advertising with given type                                          
set-alias <alias>                                 Set device alias                                                                    
scan <on/off>                                     Scan for devices                                                                    
info [dev]                                        Device information                                                                  
pair [dev]                                        Pair with device                                                                    
trust [dev]                                       Trust device                                                                        
untrust [dev]                                     Untrust device                                                                      
block [dev]                                       Block device                                                                        
unblock [dev]                                     Unblock device                                                                      
remove <dev>                                      Remove device                                                                       
connect <dev>                                     Connect device                                                                      
disconnect [dev]                                  Disconnect device                                                                   
menu <name>                                       Select submenu                                                                      
version                                           Display version                                                                     
quit                                              Quit program                                                                        
exit                                              Quit program                                                                        
help                                              Display help about this program                                                     
export                                            Print evironment variables
[bluetooth]# power on                                                                                                                 
Changing power on succeeded                                                                                                           
[bluetooth]# agent on                                                                                                                 
Agent is already registered                                                                                                           
[bluetooth]# default-agent                                                                                                            
Default agent request successful                                                                                                      
[bluetooth]# scan on                                                                                                                  
Discovery started                                                                                                                     
[CHG] Controller 00:00:46:76:22:01 Discovering: yes                                                                                   
[bluetooth]# devices  #already paired, so remove first                           
Device B4:9D:0B:5F:2A:B9 Aquaris X5 Plus
[bluetooth]# remove B4:9D:0B:5F:2A:B9                                                                                                 
[DEL] Device B4:9D:0B:5F:2A:B9 Aquaris X5 Plus                                                                                        
Device has been removed                                                                                                               
[NEW] Device B4:9D:0B:5F:2A:B9 Aquaris X5 Plus                                                                                        
[bluetooth]# pair B4:9D:0B:5F:2A:B9                                                                                                   
Attempting to pair with B4:9D:0B:5F:2A:B9                                                                                             
[CHG] Device B4:9D:0B:5F:2A:B9 Connected: yes                                                                                                                                                                         
Request confirmation                                                                                                                  
[agent] Confirm passkey 953871 (yes/no): yes                                                                                          
[CHG] Device B4:9D:0B:5F:2A:B9 Paired: yes                                                                                            
Connection successful                                                                                                                 
[CHG] Device B4:9D:0B:5F:2A:B9 UUIDs: 00001103-0000-1000-8000-00805f9b34fb                                                            
...                                                            
[CHG] Device B4:9D:0B:5F:2A:B9 UUIDs: 936da01f-9abd-4d9d-80c7-02af85c822a8                                                            
Authorize service                                                                                                                     
[agent] Authorize service 00001108-0000-1000-8000-00805f9b34fb (yes/no): Request canceled                                             
[CHG] Device B4:9D:0B:5F:2A:B9 ServicesResolved: no                                                                                   
[CHG] Device B4:9D:0B:5F:2A:B9 Connected: no

issues

grep bluetooth /var/log/syslog

if it shows something like this on connect:

bluetoothd[197]: a2dp-source profile connect failed for MAC:OF:BT:DEVICE: Protocol not available

you need to install pulseaudio-module-bluetooth and restart bluetoothd

apt install --no-install-recommends pulseaudio-module-bluetooth
systemctl restart bluetooth
en/bpi-r64/bluetooth.txt · Last modified: 2023/06/08 17:06 by 127.0.0.1