BPI-R2 Kernel bluetooth module

(Frank W.) #61

started new attempt to get BT working…

currently produces this output:

4.19-bt.log (59,6 KB)

most interesting should be this:

[   42.614751] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6620.defAnt'.
[   42.622142] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6628.defAnt'.
[   42.629537] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6630.defAnt'.
[   42.637254] [WMT-CORE][E]wmt_core_stp_init(648):WMT-CORE: no hif info!
[   42.643739] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 649, (0)
[   42.651807] [WMT-CORE][E]opfunc_pwr_on(918):WMT-CORE: wmt_core_stp_init fail (-1)
[   42.659267] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 919, (0)
[   42.667330] [WMT-CORE][E]wmt_core_ctrl(500):WMT-CORE: wmt_core_ctrl failed: id(5), type(1), value(0) iRet:(-1)
[   42.677280] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 501, (0)
[   42.685313] [WMT-CORE][E]wmt_core_ctrl(500):WMT-CORE: wmt_core_ctrl failed: id(5), type(0), value(0) iRet:(-1)
[   42.695255] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 501, (0)
[   42.703316] [WMT-CORE][E]wmt_core_ctrl(500):WMT-CORE: wmt_core_ctrl failed: id(3), type(0), value(0) iRet:(-2)
[   42.713261] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 501, (0)

first lead to

did not know how critical it is…before it tries to read from config-file, but this seems to broke init-procedure

first three lines are from the /system/etc/firmware/WMT_SOC.cfg


but the check itself seems not to check the config

it relies on a struct where the bit is set in

if not breaked before (but i don’t see that message in my log…maybe i need define-debug here too)

this looks also interesting:

maybe we have to call stp_uart_launcher with different parameters to activate hif…a bit later i see this:

[   43.439140] DEBUG: Passed mtk_bt_hci_open 314 
[   43.443555] mtk_bt_hci_open func on failed with 0
[   44.848357] [WMT-CORE][E]opfunc_hif_conf(874):WMT-CORE: WMT HIF info added
[   44.856498] DEBUG: Passed _mtk_wcn_wmt_func_on 160

(Frank W.) #62

anyone who can help here?

for me it looks like opfunc_hif_conf (function where WMT_OP_HIF_BIT is set) is called to late (after wmt_core_stp_init where it is needed) but i dont understand the flow…

opfunc_hif_conf is called over a struct wmt_core_opfunc

and used here

but where is it called?? @Jackzeng any idea?

bluetooth should mainly be handled in drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.c but i don’t know the complete flow yet

(Frank W.) #63

with a patch from alxchk i got BT working (successful pairing)

  • first call wifi.sh (or at least call wmt_loader + stp-uart-launcher)
  • then load BT-module “modprobe stp_chrdev_bt”

here my log:

root@bpi-r2:~# bluetoothctl                                                     
[NEW] Controller 00:00:46:85:90:01 bpi-r2 [default]                             
[bluetooth]# power on                                                           
Changing power on succeeded                                                     
[bluetooth]# scan on                                                            
Discovery started                                                               
[CHG] Controller 00:00:46:85:90:01 Discovering: yes                             
[NEW] Device 00:14:03:05:08:AE 00-14-03-05-08-AE                                
[NEW] Device 9C:8C:6E:4A:F8:23 [TV] Samsung 8 Series (65)                       
[NEW] Device B4:9D:0B:5F:2A:B9 Aquaris X5 Plus                                  
[CHG] Device 00:14:03:05:08:AE LegacyPairing: no                                
[CHG] Device 00:14:03:05:08:AE Name: BPI-R2                                     
[CHG] Device 00:14:03:05:08:AE Alias: BPI-R2                                    
[bluetooth]# scan off                                                           
[CHG] Device B4:9D:0B:5F:2A:B9 RSSI is nil                                      
[CHG] Device 9C:8C:6E:4A:F8:23 RSSI is nil                                      
[CHG] Device 00:14:03:05:08:AE RSSI is nil                                      
[CHG] Controller 00:00:46:85:90:01 Discovering: no                              
Discovery stopped                                                               
[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                                   
[CHG] Device B4:9D:0B:5F:2A:B9 Modalias: bluetooth:v000Fp1200d1436              
[CHG] Device B4:9D:0B:5F:2A:B9 ServicesResolved: yes                            
[CHG] Device B4:9D:0B:5F:2A:B9 Paired: yes                                      
Pairing successful                                                              
[bluetooth]# exit                                                               
[DEL] Controller 00:00:46:85:90:01 bpi-r2 [default]

(Junxiao Shi) #64

I tested this kernel revision. Pairing with cellphone works, but Bluetooth Low Energy does not work.

Client program running on BPI-R2:

from bluepy.btle import Scanner

scanner = Scanner()
devices = scanner.scan(10.0)

for dev in devices:
    print("Device %s (%s), RSSI=%d dB" % (dev.addr, dev.addrType, dev.rssi))
    for (adtype, desc, value) in dev.getScanData():
        print("  %s = %s" % (desc, value))

When I run this program on RPI-3B, several BLE devices are discovered. BPI-R2 cannot discover any device. bluepy library internally uses bluez-5.47, so bluez version isn’t a problem.

BPI-R2 kernel log: https://pastebin.com/uBwrjucW

(Frank W.) #65

@jackzeng do you have an idea where the problem can be? in the BT driver i’ve found no reference to BTLE