赞
踩
系统:linux(buidroot)
蓝牙模组:RTL8821CS(WIFI+蓝牙)
正基和海华的模块都使用内核的默认CONFIG_BT_HCIUART驱动,而Realtek使用自己的hci uart驱动,源码目录为external\rkwifibt\realtek\bluetooth_uart_driver,且使用ko方式加载,所以使用Realtek时一定把内核的CONFIG_BT_HCIUART去掉!
—Networking support
---Bluetooth subsystem support
---Bluetooth device drivers
< > HCI UART driver
[root@RK356X:/]# cat usr/bin/bt_pcba_test
#!/bin/sh
killall rtk_hciattach
echo 0 > /sys/class/rfkill/rfkill0/state
sleep 2
echo 1 > /sys/class/rfkill/rfkill0/state
sleep 2
insmod /usr/lib/modules/hci_uart.ko
rtk_hciattach -n -s 115200 /dev/ttyS1 rtk_h5 &
hciconfig hci0 up
注意ttyS需要根据蓝牙模块使用的那个uart以及rk3568.dtsi文件中serial* 与 uart*的对应关系决定。如硬件连接使用uart1,对应关系为serial1 = &uart1,那么这里为ttyS1。
[root@RK356X:/usr/bin]# ./bt_pcba_test
[root@RK356X:/usr/bin]# hciconfig hci0 up
[22482.267737] rtk_btcoex: Open BTCOEX
[22482.531203] Bluetooth: hu 00000000fb5d06b2 retransmitting 1 pkts
[22482.533957] rtk_btcoex: BTCOEX hci_rev 0xaa99
[22482.534019] rtk_btcoex: BTCOEX lmp_subver 0x821a
[root@RK356X:/usr/bin]# hciconfig -a
hci0: Type: Primary Bus: UART
BD Address: 88:12:AC:41:CD:93 ACL MTU: 1021:8 SCO MTU: 255:12
UP RUNNING
RX bytes:2131 acl:0 sco:0 events:60 errors:0
TX bytes:1727 acl:0 sco:0 commands:61 errors:0
Features: 0xff 0xff 0xff 0xfe 0xdb 0xfd 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'RTK_BT_4.1'
Class: 0x000000
Service Classes: Unspecified
Device Class: Miscellaneous,
[ 465.213943 HCI Version: 4.1 (0x7) Revision: 0xaa99
LMP ]Vers ion: 4.1 (0x7) Subversion: 0x821a
Manufacturer: Rrealttek Semiconductor Corporation (93)
k_btcoex: B[root@RK356X:/usr/bin]# TCOEX hci_rev 0xaa99
[ 465.213989] rtk_btcoex: BTCOEX lmp_subver 0x821a
[root@RK356X:/usr/bin]# hcitool scan
Scanning ...
[22635.796917] rtk_btcoex: hci (periodic)inq start
[22636.051175] Bluetooth: hu 00000000fb5d06b2 retransmitting 1 pkts
[22646.293830] rtk_btcoex: inquiry complete
80:9F:9B:02:30:AB 50D5P_CC16
74:EF:4B:95:EC:72 OPPO Find X5
90:DF:7D:5E:B8:D6 真我GT 大师探索版
90:F0:52:92:6B:54 MEGA C
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。