• 【RV1106/RV1103】RV1103增加RTL8723BS


    Kernel 部分支持

    配置 menuconfig

    WiFi 功能支持

    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

    Bluetooth 功能支持

    在这里插入图片描述

    正基和海华的模块都使用内核的默认 CONFIG_BT_HCIUART 驱动,而Realtek使用自己的hci uart驱动,源码目录为: external\rkwifibt\realtek\bluetooth_uart_driver , 且使用ko方式加载,所以使用Realtek时一定要把内核的CONFIG_BT_HCIUART配置去掉!如下图,不要选上!!!
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

    原SDK的Busybox配置

    在这里插入图片描述
    增加rfkill的支持

    rkwifibt文件 交叉编译内核驱动和rtk_hciattach程序

    交叉编译 hci_uart.ko 内核驱动模块

    目录在:rkwifibt/realtek/bluetooth_uart_driver
    修改Makefile

    MODULE_NAME = hci_uart
    
    ifneq ($(KERNELRELEASE),)
    	obj-m :=$(MODULE_NAME).o
    	$(MODULE_NAME)-y := hci_ldisc.o hci_h4.o hci_rtk_h5.o rtk_coex.o
    	#cc1: all warnings being treated as errors解决办法
    	CFLAGS = -Wall -Wpointer-arith -Wno-unused
    	KBUILD_CFLAGS += -w
    else
    	PWD := $(shell pwd)
    	KDIR := /home/liefyuan/rv1103/luckfox-pico-main/sysdrv/source/kernel
    
    all:
    	$(MAKE) -C $(KDIR) M=$(PWD) modules
    
    clean:
    	rm -rf *.o *.mod *.mod.c *.mod.o *.ko *.symvers *.order *.a
    endif
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    编译命令:

    make ARCH=arm CROSS_COMPILE=arm-rockchip830-linux-uclibcgnueabihf-
    
    • 1

    将会得到:hci_uart.ko

    交叉编译 rtk_hciattach

    目录:rkwifibt/realtek/rtk_hciattach

    修改Makefile

    CFLAGS := -Wall -g
    CC := $(CROSS_COMPILE)gcc
    all: rtk_hciattach
    OBJS := hciattach.o hciattach_rtk.o hciattach_h4.o rtb_fwc.o
    
    rtk_hciattach: $(OBJS)
    	$(CC) -o rtk_hciattach $(OBJS)
    
    %.o: %.c
    	$(CC) $(CFLAGS) -c $< -o $@
    
    clean:
    	rm -f $(OBJS)  rtk_hciattach
    
    tags: FORCE
    	ctags -R
    	find ./ -name "*.h" -o -name "*.c" -o -name "*.cc" -o -name "*.cpp" > cscope.files
    	cscope -bkq -i cscope.files
    PHONY += FORCE
    FORCE:
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    编译命令:

    make ARCH=arm CROSS_COMPILE=arm-rockchip830-linux-uclibcgnueabihf- all
    
    • 1

    将会得到:rtk_hciattach

    在这个目录里面有个文件:rtb_fwc.c 有对固件位置的描述:

    #define FIRMWARE_DIRECTORY	"/lib/firmware/rtlbt/"
    #define BT_CONFIG_DIRECTORY	"/lib/firmware/rtlbt/"
    #define EXTRA_CONFIG_FILE	"/opt/rtk_btconfig.txt"
    #define BT_ADDR_FILE		"/opt/bdaddr"
    #define BDADDR_STRING_LEN	17
    
    • 1
    • 2
    • 3
    • 4
    • 5

    所以需要拷贝BT固件到自己开发板文件系统的:/lib/firmware/rtlbt 目录。

    开发板上需要的文件:

    • /opt/rtk_btconfig.txt
    • /lib/firmware/rtlbt/rtl8723b_config
    • /lib/firmware/rtlbt/rtl8723b_fw
    • /opt/rtk_hciattach
    • /opt/hci_uart.ko

    BT 部分

    需要一个文件夹:rkwifibt-1.0.0 (我从RV1126的SDK里面找到的)

    # insmod hci_uart.ko
    [  242.292615] Bluetooth: HCI UART driver ver 2.2.74e8f89.20210423-153941
    [  242.292# 653] Bluetooth: HCI H4 protocol initialized
    [  242.292662] Bluetooth: HCI Realtek H5 protocol initialized
    [  242.292669] rtk_btcoex: rtk_btcoex_init: version: 1.2
    [  242.292676] rtk_btcoex: create workqueue
    [  242.292894] rtk_btcoex: alloc buffers 1408, 2240 for ev and l2
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    # ./rtk_hciattach -n -s 115200 /dev/ttyS5 rtk_h5
    Realtek Bluetooth init uart with init speed:115200, final_speed:115200, type:HCI UART H5
    Realtek Bluetooth :Realtek hciattach version 2.5
    
    Realtek Bluetooth :3-wire sync pattern resend : 1, len: 8
    
    Realtek Bluetooth :Get SYNC Resp Pkt
    
    Realtek Bluetooth :Get SYNC pkt-active mode
    
    Realtek Bluetooth :3-wire config pattern resend : 1 , len: 10
    Realtek Bluetooth :Get CONFG pkt-active mode
    
    Realtek Bluetooth :Get CONFG resp pkt-active mode
    
    Realtek Bluetooth :H5 init finished
    
    Realtek Bluetooth :config offset(f4),length(8)
    Realtek Bluetooth :config baud rate to :4928002, hwflowcontrol:5f, 1
    Realtek Bluetooth :config offset(27),length(1)
    Realtek Bluetooth :config offset(fe),length(1)
    Realtek Bluetooth :config offset(15b),length(4)
    Realtek Bluetooth :config offset(1e3),length(1)
    Realtek Bluetooth :Get config baud rate from config file:4928002
    Realtek Bluetooth :Load FW OK
    Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command
    
    Realtek Bluetooth :Received reliable seqno 0 from card
    Realtek Bluetooth :receive hci command complete event with command:1001
    
    Realtek Bluetooth :Read RTK LMP version with Status:0
    Realtek Bluetooth :gLmpVersion = 0x8723
    Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :receive hci command complete event with command:fc6d
    
    Realtek Bluetooth :Read RTK rom version with Status:0
    Realtek Bluetooth :rtk_hw_cfg.eversion = 1
    Realtek Bluetooth :rtk_get_fw_project_id: opcode 0, len 1, data 1
    Realtek Bluetooth :fw_ver 0x1e3ee40e, patch_num 2
    Realtek Bluetooth :patch length is 0x5e90
    Realtek Bluetooth :start offset is 0x4f00
    Realtek Bluetooth :fw: exists, config file: exists
    Realtek Bluetooth :baudrate in change speed command: 0x2 0x80 0x92 0x4
    ....
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 99
    
    Realtek Bluetooth :Send FW last command
    Realtek Bluetooth :hci_download_patch tx_index:100 rx_index: 99
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 100
    
    Realtek Bluetooth :Init Process finished
    [  267.653151] Bluetooth: h5_Realtek Bluetooth post process
    Device setup complete
    open
    [  267.653191] Bluetooth: hci_uart_register_dev
    [  267.660539] rtk_btcoex: Open BTCOEX
    [  267.663640] rtk_btcoex: BTCOEX hci_rev 0x1e3e
    [  267.663669] rtk_btcoex: BTCOEX lmp_subver 0xe40e
    [  269.707229] Bluetooth: __hci_uart_flush: hdev 27dbab53 tty 71c11fc3
    [  269.707306] Bluetooth: hci_uart_close: hdev 27dbab53
    [  269.707332] Bluetooth: __hci_uart_flush: hdev 27dbab53 tty 71c11fc3
    [  269.707354] rtk_btcoex: Close BTCOEX
    [  269.707372] rtk_btcoex: -x
    [  335.605060] RTL8723BS: rtw_set_802_11_connect(wlan0)  fw_state = 0x00000008
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70

    文件系统部分

    需要借助buildroot来构建一些蓝牙相关的软件例如:bluez5
    我尝试了手动交叉编译这些软件,卡在了bluez5这里已经花费我20h。而借用Buildroot只花费了2h。

    xxxx_defconfig

    BR2_arm=y
    BR2_cortex_a7=y
    BR2_ARM_FPU_NEON_VFPV4=y
    BR2_TOOLCHAIN_EXTERNAL=y
    BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
    BR2_TOOLCHAIN_EXTERNAL_PATH="/home/liefyuan/luckfox-pico-main/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf"
    BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-rockchip830-linux-uclibcgnueabihf"
    BR2_TOOLCHAIN_EXTERNAL_GCC_8=y
    BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_10=y
    BR2_TOOLCHAIN_EXTERNAL_WCHAR=y
    BR2_TOOLCHAIN_EXTERNAL_HAS_SSP=y
    BR2_TOOLCHAIN_EXTERNAL_CXX=y
    BR2_INIT_NONE=y
    # BR2_TARGET_ENABLE_ROOT_LOGIN is not set
    BR2_SYSTEM_BIN_SH_NONE=y
    BR2_SYSTEM_ENABLE_NLS=y
    # BR2_PACKAGE_BUSYBOX is not set
    BR2_PACKAGE_DBUS_CPP=y
    BR2_PACKAGE_DBUS_TRIGGERD=y
    BR2_PACKAGE_BLUEZ_TOOLS=y
    BR2_PACKAGE_BLUEZ5_UTILS=y
    BR2_PACKAGE_BLUEZ5_UTILS_CLIENT=y
    BR2_PACKAGE_BLUEZ5_UTILS_TOOLS=y
    BR2_PACKAGE_BLUEZ5_UTILS_DEPRECATED=y
    BR2_PACKAGE_BLUEZ5_UTILS_EXPERIMENTAL=y
    # BR2_TARGET_ROOTFS_TAR is not set
    BR2_PACKAGE_HOST_UTIL_LINUX=y
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27

    我的Buildroot版本是:Buildroot-2023.02.06
    上面的配置出来的文件系统非常干净,看一下(make graph-depends)依赖图
    在这里插入图片描述
    大概只有12MB左右。

    蓝牙测试

    dbus 安装测试遇到的问题

    使用dbus-daemon --system --print-pid --print-address命令来启动dbus后台程序为了和蓝牙通讯。

    # dbus-daemon --system --print-pid --print-address
    dbus-daemon[469]: Failed to start message bus: Failed to bind socket "/run/dbus/system_bus_socket": No such file or directory
    
    • 1
    • 2

    需要创建目录/run/dbus

    # mkdir -p /run/dbus
    
    • 1
    # dbus-daemon --system --print-pid --print-address
    unix:path=/run/dbus/system_bus_socket,guid=6973ec2014fa0880afbdcae3000000b1
    dbus-daemon[461]: Failed to start message bus: Could not get UID and GID for username "dbus"
    
    • 1
    • 2
    • 3

    需要创建一个用户名叫dbus,密码不需要,我文件系统里面没有adduser命令,所以只能在/etc/passwd文件里面最后添加:

    dbus:0:0:0:::
    
    • 1

    然后就可以正常了。如下

    # dbus-daemon --system --print-pid --print-address
    unix:path=/run/dbus/system_bus_socket,guid=8e19ed4e6e585e498d7c956c0000046a
    474
    
    • 1
    • 2
    • 3

    hci0出来

    安装.ko:insmod hci_uart.ko

    # insmod hci_uart.ko
    [   32.387318] Bluetooth: HCI UART driver ver 2.2.74e8f89.20210423-153941
    [   32.38734# 9] Bluetooth: HCI H4 protocol initialized
    [   32.387356] Bluetooth: HCI Realtek H5 protocol initialized
    [   32.387363] rtk_btcoex: rtk_btcoex_init: version: 1.2
    [   32.387369] rtk_btcoex: create workqueue
    [   32.387582] rtk_btcoex: alloc buffers 1408, 2240 for ev and l2
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    运行:./rtk_hciattach -n -s 115200 ttyS5 rtk_h5 &

    # ./rtk_hciattach -n -s 115200 ttyS5 rtk_h5 &
    # [   46.923577] of_dma_request_slave_channel: dma-names property of node Realtek Bluetooth init uart with i'/nit speed:115200,115200, type:HCI UART H5
    seriRealtek Bluetooth :Realtek hciattach version 2.5
    
    al@ff4f0000' misRealtek Bluetooth :3-wire sync pattern resend : 1, len: 8
    
    Realtek Bluetooth :Get SYNC Resp Pkt
    
    Realtek Bluetooth :Get SYNC pkt-active mode
    
    Realtek Bluetooth :3-wire config pattern resend : 1 , len: 10
    Realtek Bluetooth :Get CONFG pkt-active mode
    
    Realtek Bluetooth :Get CONFG resp pkt-active mode
    
    sing Realtek Bluetooth :H5 init finished
    
    or empty
    [  Realtek Bluetooth :config offset(f4),length(8)
    Realtek Bluetooth :config baud rate to :4928002, hwflowcontrol:5f, 1
    Realtek Bluetooth :config offset(27),length(1)
    Realtek Bluetooth :config offset(fe),length(1)
    Realtek Bluetooth :config offset(15b),length(4)
    Realtek Bluetooth :config offset(1e3),length(1)
    Realtek Bluetooth :Get config baud rate from config file:4928002
     46.923698] dw-apb-uart ff4f0000.serial: failed to request DMA, use Realtek Bluetooth :Load FW OK
    Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command
    
    Realtek Bluetooth :Received reliaible seqno 0 from card
    Realtek Bluetooth :receive hci command complete event with command:1001
    
    Realtek Bluetooth :Read RTK LMP version with Status:0
    nterrupt mode
    Realtek Bluetooth :gLmpVersion = 0x8723
    Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :receive hci command complete event with command:fc6d
    
    Realtek Bluetooth :Read RTK rom version with Status:0
    Realtek Bluetooth :rtk_hw_cfg.eversion = 1
    Realtek Bluetooth :rtk_get_fw_project_id: opcode 0, len 1, data 1
    Realtek Bluetooth :fw_ver 0x1e3ee40e, patch_num 2
    Realtek Bluetooth :patch length is 0x5e90
    Realtek Bluetooth :start offset is 0x4f00
    Realtek Bluetooth :fw: exists, config file: exists
    Realtek Bluetooth :baudrate in change speed command: 0x2 0x80 0x92 0x4
    
    Realtek Bluetooth :Received reliable seqno 2 from card
    Realtek Bluetooth :receive hci command complete event with command:fc17
    
    Realtek Bluetooth :Change BD Rate with status:0
    Realtek Bluetooth :final_speed 1500000
    
    Realtek Bluetooth :hw flow control enable
    Realtek Bluetooth :iEndIndex:96  iLastPacketLen:71 iAdditionpkt:4
    
    Realtek Bluetooth :hci_download_patch tx_index:0 rx_index: -1
    
    Realtek Bluetooth :Received reliable seqno 3 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 0
    
    Realtek Bluetooth :hci_download_patch tx_index:1 rx_index: 0
    
    Realtek Bluetooth :Received reliable seqno 4 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 1
    
    Realtek Bluetooth :hci_download_patch tx_index:2 rx_index: 1
    
    Realtek Bluetooth :Received reliable seqno 5 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 2
    
    Realtek Bluetooth :hci_download_patch tx_index:3 rx_index: 2
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 3
    
    Realtek Bluetooth :hci_download_patch tx_index:4 rx_index: 3
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 4
    
    Realtek Bluetooth :hci_download_patch tx_index:5 rx_index: 4
    
    Realtek Bluetooth :Received reliable seqno 0 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 5
    
    Realtek Bluetooth :hci_download_patch tx_index:6 rx_index: 5
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 6
    
    Realtek Bluetooth :hci_download_patch tx_index:7 rx_index: 6
    
    Realtek Bluetooth :Received reliable seqno 2 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 7
    
    Realtek Bluetooth :hci_download_patch tx_index:8 rx_index: 7
    
    Realtek Bluetooth :Received reliable seqno 3 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 8
    
    Realtek Bluetooth :hci_download_patch tx_index:9 rx_index: 8
    
    Realtek Bluetooth :Received reliable seqno 4 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 9
    
    Realtek Bluetooth :hci_download_patch tx_index:10 rx_index: 9
    
    Realtek Bluetooth :Received reliable seqno 5 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 10
    
    Realtek Bluetooth :hci_download_patch tx_index:11 rx_index: 10
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 11
    
    Realtek Bluetooth :hci_download_patch tx_index:12 rx_index: 11
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 12
    
    Realtek Bluetooth :hci_download_patch tx_index:13 rx_index: 12
    
    Realtek Bluetooth :Received reliable seqno 0 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 13
    
    Realtek Bluetooth :hci_download_patch tx_index:14 rx_index: 13
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 14
    
    Realtek Bluetooth :hci_download_patch tx_index:15 rx_index: 14
    
    Realtek Bluetooth :Received reliable seqno 2 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 15
    
    Realtek Bluetooth :hci_download_patch tx_index:16 rx_index: 15
    
    Realtek Bluetooth :Received reliable seqno 3 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 16
    
    Realtek Bluetooth :hci_download_patch tx_index:17 rx_index: 16
    
    Realtek Bluetooth :Received reliable seqno 4 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 17
    
    Realtek Bluetooth :hci_download_patch tx_index:18 rx_index: 17
    
    Realtek Bluetooth :Received reliable seqno 5 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 18
    
    Realtek Bluetooth :hci_download_patch tx_index:19 rx_index: 18
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 19
    
    Realtek Bluetooth :hci_download_patch tx_index:20 rx_index: 19
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 20
    
    Realtek Bluetooth :hci_download_patch tx_index:21 rx_index: 20
    
    Realtek Bluetooth :Received reliable seqno 0 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 21
    
    Realtek Bluetooth :hci_download_patch tx_index:22 rx_index: 21
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 22
    
    Realtek Bluetooth :hci_download_patch tx_index:23 rx_index: 22
    
    Realtek Bluetooth :Received reliable seqno 2 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 23
    
    Realtek Bluetooth :hci_download_patch tx_index:24 rx_index: 23
    
    Realtek Bluetooth :Received reliable seqno 3 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 24
    
    Realtek Bluetooth :hci_download_patch tx_index:25 rx_index: 24
    
    Realtek Bluetooth :Received reliable seqno 4 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 25
    
    Realtek Bluetooth :hci_download_patch tx_index:26 rx_index: 25
    
    Realtek Bluetooth :Received reliable seqno 5 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 26
    
    Realtek Bluetooth :hci_download_patch tx_index:27 rx_index: 26
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 27
    
    Realtek Bluetooth :hci_download_patch tx_index:28 rx_index: 27
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 28
    
    Realtek Bluetooth :hci_download_patch tx_index:29 rx_index: 28
    
    Realtek Bluetooth :Received reliable seqno 0 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 29
    
    Realtek Bluetooth :hci_download_patch tx_index:30 rx_index: 29
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 30
    
    Realtek Bluetooth :hci_download_patch tx_index:31 rx_index: 30
    
    Realtek Bluetooth :Received reliable seqno 2 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 31
    
    Realtek Bluetooth :hci_download_patch tx_index:32 rx_index: 31
    
    Realtek Bluetooth :Received reliable seqno 3 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 32
    
    Realtek Bluetooth :hci_download_patch tx_index:33 rx_index: 32
    
    Realtek Bluetooth :Received reliable seqno 4 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 33
    
    Realtek Bluetooth :hci_download_patch tx_index:34 rx_index: 33
    
    Realtek Bluetooth :Received reliable seqno 5 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 34
    
    Realtek Bluetooth :hci_download_patch tx_index:35 rx_index: 34
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 35
    
    Realtek Bluetooth :hci_download_patch tx_index:36 rx_index: 35
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 36
    
    Realtek Bluetooth :hci_download_patch tx_index:37 rx_index: 36
    
    Realtek Bluetooth :Received reliable seqno 0 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 37
    
    Realtek Bluetooth :hci_download_patch tx_index:38 rx_index: 37
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 38
    
    Realtek Bluetooth :hci_download_patch tx_index:39 rx_index: 38
    
    Realtek Bluetooth :Received reliable seqno 2 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 39
    
    Realtek Bluetooth :hci_download_patch tx_index:40 rx_index: 39
    
    Realtek Bluetooth :Received reliable seqno 3 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 40
    
    Realtek Bluetooth :hci_download_patch tx_index:41 rx_index: 40
    
    Realtek Bluetooth :Received reliable seqno 4 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 41
    
    Realtek Bluetooth :hci_download_patch tx_index:42 rx_index: 41
    
    Realtek Bluetooth :Received reliable seqno 5 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 42
    
    Realtek Bluetooth :hci_download_patch tx_index:43 rx_index: 42
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 43
    
    Realtek Bluetooth :hci_download_patch tx_index:44 rx_index: 43
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 44
    
    Realtek Bluetooth :hci_download_patch tx_index:45 rx_index: 44
    
    Realtek Bluetooth :Received reliable seqno 0 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 45
    
    Realtek Bluetooth :hci_download_patch tx_index:46 rx_index: 45
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 46
    
    Realtek Bluetooth :hci_download_patch tx_index:47 rx_index: 46
    
    Realtek Bluetooth :Received reliable seqno 2 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 47
    
    Realtek Bluetooth :hci_download_patch tx_index:48 rx_index: 47
    
    Realtek Bluetooth :Received reliable seqno 3 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 48
    
    Realtek Bluetooth :hci_download_patch tx_index:49 rx_index: 48
    
    Realtek Bluetooth :Received reliable seqno 4 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 49
    
    Realtek Bluetooth :hci_download_patch tx_index:50 rx_index: 49
    
    Realtek Bluetooth :Received reliable seqno 5 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 50
    
    Realtek Bluetooth :hci_download_patch tx_index:51 rx_index: 50
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 51
    
    Realtek Bluetooth :hci_download_patch tx_index:52 rx_index: 51
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 52
    
    Realtek Bluetooth :hci_download_patch tx_index:53 rx_index: 52
    
    Realtek Bluetooth :Received reliable seqno 0 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 53
    
    Realtek Bluetooth :hci_download_patch tx_index:54 rx_index: 53
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 54
    
    Realtek Bluetooth :hci_download_patch tx_index:55 rx_index: 54
    
    Realtek Bluetooth :Received reliable seqno 2 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 55
    
    Realtek Bluetooth :hci_download_patch tx_index:56 rx_index: 55
    
    Realtek Bluetooth :Received reliable seqno 3 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 56
    
    Realtek Bluetooth :hci_download_patch tx_index:57 rx_index: 56
    
    Realtek Bluetooth :Received reliable seqno 4 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 57
    
    Realtek Bluetooth :hci_download_patch tx_index:58 rx_index: 57
    
    Realtek Bluetooth :Received reliable seqno 5 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 58
    
    Realtek Bluetooth :hci_download_patch tx_index:59 rx_index: 58
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 59
    
    Realtek Bluetooth :hci_download_patch tx_index:60 rx_index: 59
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 60
    
    Realtek Bluetooth :hci_download_patch tx_index:61 rx_index: 60
    
    Realtek Bluetooth :Received reliable seqno 0 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 61
    
    Realtek Bluetooth :hci_download_patch tx_index:62 rx_index: 61
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 62
    
    Realtek Bluetooth :hci_download_patch tx_index:63 rx_index: 62
    
    Realtek Bluetooth :Received reliable seqno 2 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 63
    
    Realtek Bluetooth :hci_download_patch tx_index:64 rx_index: 63
    
    Realtek Bluetooth :Received reliable seqno 3 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 64
    
    Realtek Bluetooth :hci_download_patch tx_index:65 rx_index: 64
    
    Realtek Bluetooth :Received reliable seqno 4 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 65
    
    Realtek Bluetooth :hci_download_patch tx_index:66 rx_index: 65
    
    Realtek Bluetooth :Received reliable seqno 5 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 66
    
    Realtek Bluetooth :hci_download_patch tx_index:67 rx_index: 66
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 67
    
    Realtek Bluetooth :hci_download_patch tx_index:68 rx_index: 67
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 68
    
    Realtek Bluetooth :hci_download_patch tx_index:69 rx_index: 68
    
    Realtek Bluetooth :Received reliable seqno 0 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 69
    
    Realtek Bluetooth :hci_download_patch tx_index:70 rx_index: 69
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 70
    
    Realtek Bluetooth :hci_download_patch tx_index:71 rx_index: 70
    
    Realtek Bluetooth :Received reliable seqno 2 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 71
    
    Realtek Bluetooth :hci_download_patch tx_index:72 rx_index: 71
    
    Realtek Bluetooth :Received reliable seqno 3 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 72
    
    Realtek Bluetooth :hci_download_patch tx_index:73 rx_index: 72
    
    Realtek Bluetooth :Received reliable seqno 4 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 73
    
    Realtek Bluetooth :hci_download_patch tx_index:74 rx_index: 73
    
    Realtek Bluetooth :Received reliable seqno 5 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 74
    
    Realtek Bluetooth :hci_download_patch tx_index:75 rx_index: 74
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 75
    
    Realtek Bluetooth :hci_download_patch tx_index:76 rx_index: 75
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 76
    
    Realtek Bluetooth :hci_download_patch tx_index:77 rx_index: 76
    
    Realtek Bluetooth :Received reliable seqno 0 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 77
    
    Realtek Bluetooth :hci_download_patch tx_index:78 rx_index: 77
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 78
    
    Realtek Bluetooth :hci_download_patch tx_index:79 rx_index: 78
    
    Realtek Bluetooth :Received reliable seqno 2 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 79
    
    Realtek Bluetooth :hci_download_patch tx_index:80 rx_index: 79
    
    Realtek Bluetooth :Received reliable seqno 3 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 80
    
    Realtek Bluetooth :hci_download_patch tx_index:81 rx_index: 80
    
    Realtek Bluetooth :Received reliable seqno 4 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 81
    
    Realtek Bluetooth :hci_download_patch tx_index:82 rx_index: 81
    
    Realtek Bluetooth :Received reliable seqno 5 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 82
    
    Realtek Bluetooth :hci_download_patch tx_index:83 rx_index: 82
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 83
    
    Realtek Bluetooth :hci_download_patch tx_index:84 rx_index: 83
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 84
    
    Realtek Bluetooth :hci_download_patch tx_index:85 rx_index: 84
    
    Realtek Bluetooth :Received reliable seqno 0 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 85
    
    Realtek Bluetooth :hci_download_patch tx_index:86 rx_index: 85
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 86
    
    Realtek Bluetooth :hci_download_patch tx_index:87 rx_index: 86
    
    Realtek Bluetooth :Received reliable seqno 2 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 87
    
    Realtek Bluetooth :hci_download_patch tx_index:88 rx_index: 87
    
    Realtek Bluetooth :Received reliable seqno 3 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 88
    
    Realtek Bluetooth :hci_download_patch tx_index:89 rx_index: 88
    
    Realtek Bluetooth :Received reliable seqno 4 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 89
    
    Realtek Bluetooth :hci_download_patch tx_index:90 rx_index: 89
    
    Realtek Bluetooth :Received reliable seqno 5 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 90
    
    Realtek Bluetooth :hci_download_patch tx_index:91 rx_index: 90
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 91
    
    Realtek Bluetooth :hci_download_patch tx_index:92 rx_index: 91
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 92
    
    Realtek Bluetooth :hci_download_patch tx_index:93 rx_index: 92
    
    Realtek Bluetooth :Received reliable seqno 0 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 93
    
    Realtek Bluetooth :hci_download_patch tx_index:94 rx_index: 93
    
    Realtek Bluetooth :Received reliable seqno 1 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 94
    
    Realtek Bluetooth :hci_download_patch tx_index:95 rx_index: 94
    
    Realtek Bluetooth :Received reliable seqno 2 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 95
    
    Realtek Bluetooth :hci_download_patch tx_index:96 rx_index: 95
    
    Realtek Bluetooth :Received reliable seqno 3 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 96
    
    Realtek Bluetooth :hci_download_patch tx_index:97 rx_index: 96
    
    Realtek Bluetooth :Received reliable seqno 4 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 97
    
    Realtek Bluetooth :hci_download_patch tx_index:98 rx_index: 97
    
    Realtek Bluetooth :Received reliable seqno 5 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 98
    
    Realtek Bluetooth :hci_download_patch tx_index:99 rx_index: 98
    
    Realtek Bluetooth :Received reliable seqno 6 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 99
    
    Realtek Bluetooth :Send FW last command
    Realtek Bluetooth :hci_download_patch tx_index:100 rx_index: 99
    
    Realtek Bluetooth :Received reliable seqno 7 from card
    Realtek Bluetooth :rtk_hw_cfg.rx_index 100
    
    Realtek Bluetooth :Init Process finished
    [   48.864039] Bluetooth: h5_open
    Realtek Bluetooth post process
    Device setup com[   48.864091] Bluetopleteot
    h: hci_uart_register_dev
    [   48.871291] rtk_btcoex: Open BTCOEX
    [   48.875794] rtk_btcoex: BTCOEX hci_rev 0x1e3e
    [   48.875815] rtk_btcoex: BTCOEX lmp_subver 0xe40e
    [   51.040637] Bluetooth: __hci_uart_flush: hdev 5ae14a4f tty 8bc69d32
    [   51.040720] Bluetooth: hci_uart_close: hdev 5ae14a4f
    [   51.040747] Bluetooth: __hci_uart_flush: hdev 5ae14a4f tty 8bc69d32
    [   51.040767] rtk_btcoex: Close BTCOEX
    [   51.040786] rtk_btcoex: -x
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355
    • 356
    • 357
    • 358
    • 359
    • 360
    • 361
    • 362
    • 363
    • 364
    • 365
    • 366
    • 367
    • 368
    • 369
    • 370
    • 371
    • 372
    • 373
    • 374
    • 375
    • 376
    • 377
    • 378
    • 379
    • 380
    • 381
    • 382
    • 383
    • 384
    • 385
    • 386
    • 387
    • 388
    • 389
    • 390
    • 391
    • 392
    • 393
    • 394
    • 395
    • 396
    • 397
    • 398
    • 399
    • 400
    • 401
    • 402
    • 403
    • 404
    • 405
    • 406
    • 407
    • 408
    • 409
    • 410
    • 411
    • 412
    • 413
    • 414
    • 415
    • 416
    • 417
    • 418
    • 419
    • 420
    • 421
    • 422
    • 423
    • 424
    • 425
    • 426
    • 427
    • 428
    • 429
    • 430
    • 431
    • 432
    • 433
    • 434
    • 435
    • 436
    • 437
    • 438
    • 439
    • 440
    • 441
    • 442
    • 443
    • 444
    • 445
    • 446
    • 447
    • 448
    • 449
    • 450
    • 451
    • 452
    • 453
    • 454
    • 455
    • 456
    • 457
    • 458
    • 459
    • 460
    • 461
    • 462
    • 463
    • 464
    • 465
    • 466
    • 467
    • 468
    • 469
    • 470
    • 471
    • 472
    • 473
    • 474
    • 475
    • 476
    • 477
    • 478
    • 479
    • 480
    • 481
    • 482
    • 483
    • 484
    • 485
    • 486
    • 487
    • 488
    • 489
    • 490
    • 491
    • 492
    • 493
    • 494
    • 495
    • 496
    • 497
    • 498
    • 499
    • 500
    • 501
    • 502
    • 503
    • 504
    • 505
    • 506
    • 507
    • 508
    • 509
    • 510
    • 511
    • 512
    • 513
    • 514
    • 515
    • 516
    • 517
    • 518
    • 519
    • 520
    • 521
    • 522
    • 523
    • 524
    • 525
    • 526
    • 527
    • 528
    • 529
    • 530
    • 531
    • 532
    • 533
    • 534
    • 535
    • 536
    • 537
    • 538
    • 539
    • 540
    • 541
    • 542
    • 543
    • 544
    • 545
    • 546
    • 547
    • 548
    • 549
    • 550
    • 551
    • 552
    • 553
    • 554
    • 555
    • 556
    • 557
    • 558
    • 559
    • 560
    • 561
    • 562
    • 563
    • 564
    • 565
    • 566
    • 567
    • 568
    • 569
    • 570
    • 571
    • 572
    • 573
    • 574
    • 575
    • 576
    • 577

    使用命令:hciconfig

    # hciconfig
    hci0:   Type: Primary  Bus: UART
            BD Address: 84:20:96:B1:4D:92  ACL MTU: 1021:8  SCO MTU: 255:16
            DOWN
            RX bytes:1057 acl:0 sco:0 events:30 errors:0
            TX bytes:827 acl:0 sco:0 commands:30 errors:0
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    打开hci0使用命令:hciconfig hci0 up

    # hciconfig -a
    hci0:   Type: Primary  Bus: UART
            BD Address: 84:20:96:B1:4D:92  ACL MTU: 1021:8  SCO MTU: 255:16
            DOWN
            RX bytes:1057 acl:0 sco:0 events:30 errors:0
            TX bytes:827 acl:0 sco:0 commands:30 errors:0
            Features: 0xff 0xff 0xff 0xfe 0xdb 0xff 0x7b 0x87
            Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
            Link policy: RSWITCH HOLD SNIFF PARK
            Link mode: PERIPHERAL ACCEPT
    
    # hciconfig hci0 up
    [  301.298323] rtk_btcoex: Open BTCOEX
    [  301.573864] Bluetooth: hu 8958aa1c retransmitting 1 pkts
    [  301.576198] rtk_btcoex: BTCOEX hci_rev 0x1e3e
    [  301.576224] rtk_btcoex: BTCOEX lmp_subver 0xe40e
    # hciconfig
    hci0:   Type: Primary  Bus: UART
            BD Address: 84:20:96:B1:4D:92  ACL MTU: 1021:8  SCO MTU: 255:16
            DOWN
            RX bytes:1057 acl:0 sco:0 events:30 errors:0
            TX bytes:859 acl:0 sco:0 commands:30 errors:0
    
    # hciconfig hci0 up
    [  109.720402] rtk_btcoex: Open BTCOEX
    [  109.973975] Bluetooth: hu 8e040b96 retransmitting 1 pkts
    [  109.976315] rtk_btcoex: BTCOEX hci_rev 0x1e3e
    [  109.976346] rtk_btcoex: BTCOEX lmp_subver 0xe40e
    # hciconfig
    hci0:   Type: Primary  Bus: UART
            BD Address: 84:20:96:B1:4D:92  ACL MTU: 1021:8  SCO MTU: 255:16
            UP RUNNING
            RX bytes:2113 acl:0 sco:0 events:60 errors:0
            TX bytes:1518 acl:0 sco:0 commands:61 errors:0
    
    # hciconfig -a
    hci0:   Type: Primary  Bus: UART
            BD Address: 84:20:96:B1:4D:92  ACL MTU: 1021:8  SCO MTU: 255:16
            UP RUNNING
            RX bytes:2113 acl:0 sco:0 events:60 errors:0
            TX bytes:1518 acl:0 sco:0 commands:61 errors:0
            Features: 0xff 0xff 0xff 0xfe 0xdb 0xff 0x7b 0x87
            Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
            Link policy: RSWITCH HOLD SNIFF PARK
            Link mode: PERIPHERAL ACCEPT
    [  134.027303] Bluetooth: hu 8e040b96 retransmitting 1 pkts
            Name: 'RTK_BT_4.0'
            Class: 0x000000
            Service Classes: Unspecified
            Device Class: Miscellaneous,
            HCI Version: 4.0 (0x6)  Revision: 0x1e3e
            LMP Version: 4.0 (0x6)  Subversion: 0xe40e
            Manufacturer: Realtek Semiconductor Corporation (93)
    
    # [  134.037521] rtk_btcoex: BTCOEX hci_rev 0x1e3e
    [  134.037549] rtk_btcoex: BTCOEX lmp_subver 0xe40e
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56

    查看当前系统中全部的蓝牙设备信息:hciconfig -a
    开启指定名称的蓝牙设备:hciconfig hci0 up
    关闭指定名称的蓝牙设备:hciconfig hci0 down
    重置指定名称的蓝牙设备:hciconfig hci0 reset

    打开dbus

    # mkdir -p /run/dbus
    # dbus-daemon --system --print-pid --print-address
    unix:path=/run/dbus/system_bus_socket,guid=efd8f0def3b1d532a9e4538f000001a4
    465
    
    • 1
    • 2
    • 3
    • 4

    进入目录/usr/libexec/bluetooth/bluetoothd运行命令:bluetoothd -n -d &

    # cd /usr/libexec/bluetooth/
    # ./bluetoothd -n -d &
    
    • 1
    • 2
    # ./bluetoothd -n -d &
    # bluetoothd[479]: Bluetooth daemon 5.65
    bluetoothd[479]: src/adapter.c:adapter_init() sending read version command
    bluetoothd[479]: Starting SDP server
    bluetoothd[479]: src/sdpd-service.c:register_device_id() Adding device id record for 0002:1d6b:0246:0541
    bluetoothd[479]: src/plugin.c:plugin_init() Loading builtin plugins
    bluetoothd[479]: src/plugin.c:add_plugin() Loading hostname plugin
    bluetoothd[479]: src/plugin.c:add_plugin() Loading wiimote plugin
    bluetoothd[479]: src/plugin.c:add_plugin() Loading autopair plugin
    bluetoothd[479]: src/plugin.c:add_plugin() Loading policy plugin
    bluetoothd[479]: src/plugin.c:add_plugin() Loading network plugin
    bluetoothd[479]: src/plugin.c:add_plugin() Loading gap plugin
    bluetoothd[479]: src/plugin.c:add_plugin() Loading scanparam plugin
    bluetoothd[479]: src/plugin.c:add_plugin() Loading deviceinfo plugin
    bluetoothd[479]: src/plugin.c:add_plugin() Loading battery plugin
    bluetoothd[479]: src/plugin.c:plugin_init() Loading plugins /usr/lib/bluetooth/plugins
    bluetoothd[479]: profiles/network/manager.c:read_config() Config options: Security=true
    bluetoothd[479]: src/rfkill.c:rfkill_init() Failed to open RFKILL control device
    bluetoothd[479]: src/main.c:main() Entering main loop
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0xffff] command 0x0001
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0xffff] command 0x0001 complete: 0x00
    bluetoothd[479]: Bluetooth management interface 1.18 initialized
    bluetoothd[479]: src/adapter.c:read_version_complete() sending read supported commands command
    bluetoothd[479]: src/adapter.c:read_version_complete() sending read index list command
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0xffff] command 0x0002
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0xffff] command 0x0002 complete: 0x00
    bluetoothd[479]: src/adapter.c:read_commands_complete() Number of commands: 79
    bluetoothd[479]: src/adapter.c:read_commands_complete() Number of events: 40
    bluetoothd[479]: src/adapter.c:read_commands_complete() enabling kernel-side connection control
    bluetoothd[479]: src/adapter.c:read_commands_complete() kernel supports the set_blocked_keys op
    bluetoothd[479]: src/adapter.c:read_commands_complete() kernel supports controller cap command
    bluetoothd[479]: src/adapter.c:read_commands_complete() kernel supports exp features
    bluetoothd[479]: src/adapter.c:read_commands_complete() kernel supports set system confic
    bluetoothd[479]: src/adapter.c:read_commands_complete() kernel supports suspend/resume events
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0xffff] command 0x0003
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0xffff] command 0x0003 complete: 0x00
    bluetoothd[479]: src/adapter.c:read_index_list_complete() Number of controllers: 1
    bluetoothd[479]: src/adapter.c:read_index_list_complete() Found index 0
    bluetoothd[479]: src/adapter.c:index_added() index 0
    bluetoothd[479]: src/adapter.c:reset_adv_monitors() sending remove Adv Monitor command with handle 0
    bluetoothd[479]: src/adapter.c:btd_adapter_new() System name: BlueZ 5.65
    bluetoothd[479]: src/adapter.c:btd_adapter_new() Major class: 0
    bluetoothd[479]: src/adapter.c:btd_adapter_new() Minor class: 0
    bluetoothd[479]: src/adapter.c:btd_adapter_new() Modalias: usb:v1D6Bp0246d0541
    bluetoothd[479]: src/adapter.c:btd_adapter_new() Discoverable timeout: 180 seconds
    bluetoothd[479]: src/adapter.c:btd_adapter_new() Pairable timeout: 0 seconds
    bluetoothd[479]: src/adapter.c:index_added() sending read info command for index 0
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0053
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0053 complete: 0x00
    bluetoothd[479]: src/adapter.c:reset_adv_monitors_complete() Removed all Adv Monitors
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0049
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0049 complete: 0x00
    bluetoothd[479]: src/adapter.c:read_exp_features_complete() index 0 status 0x00
    bluetoothd[479]: src/adapter.c:read_exp_features_complete() 671b10b5-42c0-4696-9227-eb28d1b049d6 flags 0 action 0
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0004
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0004 complete: 0x00
    bluetoothd[479]: src/adapter.c:read_info_complete() index 0 status 0x00
    bluetoothd[479]: src/adapter.c:clear_uuids() sending clear uuids command for index 0
    bluetoothd[479]: src/adapter.c:clear_devices() sending clear devices command for index 0
    bluetoothd[479]: src/adapter.c:set_mode() sending set mode command for index 0
    bluetoothd[479]: src/adapter.c:set_mode() sending set mode command for index 0
    bluetoothd[479]: src/adapter.c:set_mode() sending set mode command for index 0
    bluetoothd[479]: src/adapter.c:set_privacy() sending set privacy command for index 0
    bluetoothd[479]: src/adapter.c:set_privacy() setting privacy mode 0x00 for index 0
    bluetoothd[479]: src/gatt-database.c:btd_gatt_database_new() GATT Manager registered for adapter: /org/bluez/hci0
    bluetoothd[479]: src/adapter.c:adapter_service_add() /org/bluez/hci0
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10001
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000007-0000-1000-8000-00805f9
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001800-0000-1000-8000-00805f9
    bluetoothd[479]: src/adapter.c:adapter_service_insert() /org/bluez/hci0
    bluetoothd[479]: src/adapter.c:add_uuid() sending add uuid command for index 0
    bluetoothd[479]: src/adapter.c:adapter_service_add() /org/bluez/hci0
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10002
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000007-0000-1000-8000-00805f9
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001801-0000-1000-8000-00805f9
    bluetoothd[479]: src/adapter.c:adapter_service_insert() /org/bluez/hci0
    bluetoothd[479]: src/adapter.c:add_uuid() sending add uuid command for index 0
    bluetoothd[479]: src/adapter.c:adapter_service_add() /org/bluez/hci0
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10003
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000007-0000-1000-8000-00805f9
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9
    bluetoothd[479]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 0000180a-0000-1000-8000-00805f9
    bluetoothd[479]: src/adapter.c:adapter_service_insert() /org/bluez/hci0
    bluetoothd[479]: src/adapter.c:add_uuid() sending add uuid command for index 0
    bluetoothd[479]: src/advertising.c:btd_adv_manager_new() LE Advertising Manager created for adapter: /org/bluez/hci0
    bluetoothd[479]: plugins/policy.c:policy_adapter_probe()
    bluetoothd[479]: plugins/hostname.c:hostname_probe()
    bluetoothd[479]: profiles/network/manager.c:panu_server_probe() path /org/bluez/hci0
    bluetoothd[479]: profiles/network/server.c:server_register() Registered interface org.bluez.NetworkServer1 on path /org/bluez/hci0
    bluetoothd[479]: profiles/network/manager.c:gn_server_probe() path /org/bluez/hci0
    bluetoothd[479]: profiles/network/manager.c:nap_server_probe() path /org/bluez/hci0
    bluetoothd[479]: src/adapter.c:btd_adapter_unblock_address() hci0 00:00:00:00:00:00
    bluetoothd[479]: src/adapter.c:load_link_keys() hci0 keys 0 debug_keys 0
    bluetoothd[479]: src/adapter.c:load_ltks() hci0 keys 0
    bluetoothd[479]: src/adapter.c:load_irks() hci0 irks 0
    bluetoothd[479]: src/adapter.c:load_conn_params() hci0 conn params 0
    bluetoothd[479]: src/adapter.c:load_connections() sending get connections command for index 0
    bluetoothd[479]: src/adapter.c:adapter_service_insert() /org/bluez/hci0
    bluetoothd[479]: src/adapter.c:add_uuid() sending add uuid command for index 0
    bluetoothd[479]: src/adapter.c:set_did() hci0 source 2 vendor 1d6b product 246 version 541
    bluetoothd[479]: src/adapter.c:adapter_register() Adapter /org/bluez/hci0 registered
    bluetoothd[479]: src/adapter.c:set_dev_class() sending set device class command for index 0
    bluetoothd[479]: src/adapter.c:set_name() sending set local name command for index 0
    bluetoothd[479]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0011
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0011 complete: 0x00
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0034
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0034 complete: 0x00
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x000b
    [  918.880428] Bluetooth: hu 8958aa1c retransmitting 1 pkts
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x000b complete: 0x00
    bluetoothd[479]: src/adapter.c:new_settings_callback() Settings: 0x000000c1
    bluetoothd[479]: src/adapter.c:settings_changed() Changed settings: 0x00000040
    bluetoothd[479]: src/adapter.c:settings_changed() Pending settings: 0x00000000
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x000d
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x000d complete: 0x00
    bluetoothd[479]: src/adapter.c:new_settings_callback() Settings: 0x000002c1
    bluetoothd[479]: src/adapter.c:settings_changed() Changed settings: 0x00000200
    bluetoothd[479]: src/adapter.c:settings_changed() Pending settings: 0x00000000
    bluetoothd[479]: src/adapter.c:trigger_passive_scanning()
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x002d
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x002d complete: 0x00
    bluetoothd[479]: src/adapter.c:new_settings_callback() Settings: 0x00000ac1
    bluetoothd[479]: src/adapter.c:settings_changed() Changed settings: 0x00000800
    bluetoothd[479]: src/adapter.c:settings_changed() Pending settings: 0x00000000
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x002f
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x2f status: 0x0b
    bluetoothd[479]: Failed to set privacy: Rejected (0x0b)
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0010
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0010 complete: 0x00
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0010
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0010 complete: 0x00
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0010
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0010 complete: 0x00
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x003d
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x003d complete: 0x00
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0027
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0027 complete: 0x00
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0012
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0012 complete: 0x00
    bluetoothd[479]: src/adapter.c:load_link_keys_complete() link keys loaded for hci0
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0013
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0013 complete: 0x00
    bluetoothd[479]: src/adapter.c:load_ltks_complete() LTKs loaded for hci0
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0030
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0030 complete: 0x00
    bluetoothd[479]: src/adapter.c:load_irks_complete() IRKs loaded for hci0
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0035
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0035 complete: 0x00
    bluetoothd[479]: src/adapter.c:load_conn_params_complete() Connection Parameters loaded for hci0
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0015
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0015 complete: 0x00
    bluetoothd[479]: src/adapter.c:get_connections_complete() Connection count: 0
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0010
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0010 complete: 0x00
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0028
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0028 complete: 0x00
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x000e
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x000e complete: 0x00
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x000f
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x000f complete: 0x00
    bluetoothd[479]: src/adapter.c:local_name_changed_callback() Name: BlueZ 5.65
    bluetoothd[479]: src/adapter.c:local_name_changed_callback() Short name:
    bluetoothd[479]: src/adapter.c:local_name_changed_callback() Current alias: BlueZ 5.65
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0046
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0046 complete: 0x00
    bluetoothd[479]: src/adapter.c:set_blocked_keys_complete() Successfully set blocked keys for index 0
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173

    运行bluetoothctl 进入交互模式

    # bluetoothctl
    [bluetooth]# bluetoothd[479]: src/agent.c:add_default_agent() Default agent set to :1.2 /org/bluez/agent
    bluetoothd[479]: src/adapter.c:set_mode() sending set mode command for index 0
    bluetoothd[479]: src/agent.c:agent_ref() 0x5236c8: ref=1
    bluetoothd[479]: src/agent.c:register_agent() agent :1.2
    Agent registered
    [bluetooth]# bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0009
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0009 complete: 0x00
    bluetoothd[479]: src/adapter.c:new_settings_callback() Settings: 0x00000ad1
    bluetoothd[479]: src/adapter.c:settings_changed() Changed settings: 0x00000010
    bluetoothd[479]: src/adapter.c:settings_changed() Pending settings: 0x00000000
    bluetoothd[479]: src/shared/mgmt.c:send_request() [0x0000] command 0x0018
    bluetoothd[479]: src/shared/mgmt.c:can_read_data() [0x0000] command 0x0018 complete: 0x00
    [CHG] Controller 84:20:96:B1:4D:92 Pairable: yes
    [bluetooth]# power on
    [bluetooth]# agent on
    [bluetooth]# scan on
    [bluetooth]#
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19

    这样看起来,进入蓝牙命令交互之后,是不正常的。

    退出该交互界面的方法是:按下 Ctrl + d 组合键来退出 Bluetoothctl 交互模式

    运行:power on相当于打开蓝牙
    运行:agent on
    查找设备:scan on或者devices查找可配对设备
    配对:pair MACaddress(刚刚查找的配对设备的mac地址) 这一步需要在手机确认
    连接:connect MACaddress(刚刚查找的配对设备的mac地址)
    信任设备:trust MACaddress(刚刚查找的配对设备的mac地址)

    使用hcitool来操作

    上一节中在bluetoothctl没法操作。找到hcitool来操作:

    命令:

    # hcitool -help
    hcitool - HCI Tool ver 5.65
    Usage:
            hcitool [options] <command> [command parameters]
    Options:
            --help  Display help
            -i dev  HCI device
    Commands:
            dev     Display local devices
            inq     Inquire remote devices
            scan    Scan for remote devices
            name    Get name from remote device
            info    Get information from remote device
            spinq   Start periodic inquiry
            epinq   Exit periodic inquiry
            cmd     Submit arbitrary HCI commands
            con     Display active connections
            cc      Create connection to remote device
            dc      Disconnect from remote device
            sr      Switch central/peripheral role
            cpt     Change connection packet type
            rssi    Display connection RSSI
            lq      Display link quality
            tpl     Display transmit power level
            afh     Display AFH channel map
            lp      Set/display link policy settings
            lst     Set/display link supervision timeout
            auth    Request authentication
            enc     Set connection encryption
            key     Change connection link key
            clkoff  Read clock offset
            clock   Read local or remote clock
            lescan  Start LE scan
            leinfo  Get LE remote information
            lealadd Add device to LE Accept List
            lealrm  Remove device from LE Accept List
            lealsz  Read size of LE Accept List
            lealclr Clear LE Accept List
            lewladd Deprecated. Use lealadd instead.
            lewlrm  Deprecated. Use lealrm instead.
            lewlsz  Deprecated. Use lealsz instead.
            lewlclr Deprecated. Use lealclr instead.
            lerladd Add device to LE Resolving List
            lerlrm  Remove device from LE Resolving List
            lerlclr Clear LE Resolving List
            lerlsz  Read size of LE Resolving List
            lerlon  Enable LE Address Resolution
            lerloff Disable LE Address Resolution
            lecc    Create a LE Connection
            ledc    Disconnect a LE Connection
            lecup   LE Connection Update
    
    For more information on the usage of each command use:
            hcitool <command> --help
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    dev    显示本地设备
    
    inq    查询远程设备
    
    scan  扫描远程设备
    
    name  从远程设备获取名称
    
    info    从远程设备获取信息
    
    spinq    开始定期查询
    
    epinq   退出定期查询
    
    cmd      提交任意HCI命令
    
    con    显示活动连接
    
    cc       创建到远程设备的连接
    
    dc      断开与远程设备的连接
    
    sr       切换 主/从 角色
    
    cpt     更改连接数据包类型
    
    rssi   显示连接RSSI
    
    lq     显示链接质量
    
    tpl    显示发射功率水平
    
    afh   显示AFH通道图
    
    lp    设置/显示链接策略设置
    
    lst    设置/显示链接时间超时
    
    auth  请求身份验证
    
    enc    设置连接加密
    
    key    更改连接链接密钥
    
    clkoff  读时钟偏移
    
    clock   读取本地或远程时钟
    
    lescan      开始LE扫描
    
    lewladd    将设备添加到LE白名单
    
    lewlrm   从LE白名单中删除设备
    
    lewlsz    阅读LE的尺寸白色清单
    
    lewlclr  清除LE白名单
    
    lecc    创建一个LE连接
    
    ledc   断开LE连接
    
    lecup  LE连接更新
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63

    BLE扫描:

    # hcitool lescan
    LE Scan ...
    65:CB:01:01:36:A9 (unknown)
    73:EA:18:45:5B:94 (unknown)
    52:A3:99:59:87:56 (unknown)
    45:62:42:A1:1E:B4 (unknown)
    2D:98:31:2F:12:6C (unknown)
    3F:5B:7D:70:B0:4B (unknown)
    63:BC:FD:06:D9:D1 (unknown)
    55:28:0A:62:B6:88 (unknown)
    56:03:BC:EC:4F:23 (unknown)
    54:FA:90:91:81:AC (unknown)
    1A:58:FD:49:AD:7A (unknown)
    D5:19:20:99:CE:D0 (unknown)
    4A:96:02:E4:D4:83 (unknown)
    6D:CB:2F:84:52:12 (unknown)
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    BT扫描:

    # hcitool scan
    Scanning ...
    [  850.534585] rtk_btcoex: hci (periodic)inq start
    [  860.777952] rtk_btcoex: inquiry complete
            A4:55:90:0F:90:E6       Redmi K40 Pro+
    
    • 1
    • 2
    • 3
    • 4
    • 5

    扫描出我的手机蓝牙。
    本地设备信息:

    # hcitool device
    Devices:
            hci0    84:20:96:B1:4D:92
    
    
    • 1
    • 2
    • 3
    • 4

    直到这里,我才知道我其实用手机已经扫出了这个蓝牙!因为不知道为啥设备名没有显示出来!在这里插入图片描述

    使用流程

    # killall dbus-daemon
    # dbus-daemon --system --print-pid --print-address
    dbus-daemon[506]: Failed to start message bus: The pid file "/run/messagebus.pid" exists, if the message bus is not running, remove this file
    # rm /run/messagebus.pid
    # dbus-daemon --system --print-pid --print-address
    unix:path=/run/dbus/system_bus_socket,guid=8a134621f46f224f0917e8b0000000f3
    509
    # cd /oem/usr/ko
    # insmod hci_uart.ko
    # ./rtk_hciattach -n -s 115200 /dev/ttyS5 rtk_h5 &
    # cat /sys/class/rfkill/rfkill2/uevent
    RFKILL_NAME=hci0
    RFKILL_TYPE=bluetooth
    RFKILL_STATE=0
    # echo 1 > /sys/class/rfkill/rfkill2/state
    # cat /sys/class/rfkill/rfkill2/uevent
    RFKILL_NAME=hci0
    RFKILL_TYPE=bluetooth
    RFKILL_STATE=1
    # hciconfig hci0 up
    [  447.000989] rtk_btcoex: Open BTCOEX
    [  447.254506] Bluetooth: hu 33b9d83c retransmitting 1 pkts
    [  447.256865] rtk_btcoex: BTCOEX hci_rev 0x373e
    [  447.256893] rtk_btcoex: BTCOEX lmp_subver 0x6962
    hci0:   Type: Primary  Bus: UART
            BD Address: 84:20:96:B1:4D:92  ACL MTU: 820:8  SCO MTU: 255:16
            UP RUNNING
            RX bytes:2135 acl:0 sco:0 events:61 errors:0
            TX bytes:1321 acl:0 sco:0 commands:62 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: PERIPHERAL ACCEPT
    [  481.707830] Bluetooth: hu 33b9d83c retransmitting 1 pkts
            Name: 'RTK_BT_4.0'
            Class: 0x000000
            Service Classes: Unspecified
            Device Class: Miscellaneous,
            HCI Version: 4.0 (0x6)  Revision: 0x373e
            LMP Version: 4.0 (0x6)  Subversion: 0x6962
            Manufacturer: Realtek Semiconductor Corporation (93)
    
    # [  481.717734] rtk_btcoex: BTCOEX hci_rev 0x373e
    [  481.717804] rtk_btcoex: BTCOEX lmp_subver 0x6962
    # cd /usr/libexec/bluetooth/
    # ./bluetoothd -n -d &
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46

    报错处理

    hci0 up不了

    在运行

    • dbus:dbus-daemon --system --print-pid --print-address
    • ko:insmod hci_uart.ko
    • 初始化:./rtk_hciattach -n -s 115200 /dev/ttyS5 rtk_h5 &

    就可以看到hci0了

    # hciconfig hci0 up
    Can't init device hci0: Unknown error 132 (22)
    
    • 1
    • 2

    电源没有打开导致的
    查看有哪些天线开关:

    # ls /sys/class/rfkill/
    rfkill0  rfkill1  rfkill2
    
    • 1
    • 2

    查看你的hci0对应哪个rfkillX

    # cat /sys/class/rfkill/rfkill0/uevent
    RFKILL_NAME=bt_default
    RFKILL_TYPE=bluetooth
    RFKILL_STATE=0
    # cat /sys/class/rfkill/rfkill1/uevent
    RFKILL_NAME=phy0
    RFKILL_TYPE=wlan
    RFKILL_STATE=1
    # cat /sys/class/rfkill/rfkill2/uevent
    RFKILL_NAME=hci0
    RFKILL_TYPE=bluetooth
    RFKILL_STATE=0
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    如上,rfkill2对应的是hci0,而且状态是关闭的。
    打开命令

    echo 1 > /sys/class/rfkill/rfkill2/state
    
    • 1

    如下,打开成功。

    # cat /sys/class/rfkill/rfkill2/uevent
    RFKILL_NAME=hci0
    RFKILL_TYPE=bluetooth
    RFKILL_STATE=1
    
    
    • 1
    • 2
    • 3
    • 4
    • 5

    再次打开就可以了。

    # hciconfig hci0 up
    [  657.905172] rtk_btcoex: Open BTCOEX
    [  658.161233] Bluetooth: hu 52138c09 retransmitting 1 pkts
    [  658.163591] rtk_btcoex: BTCOEX hci_rev 0x373e
    [  658.163618] rtk_btcoex: BTCOEX lmp_subver 0x6962
    # hciconfig -a
    hci0:   Type: Primary  Bus: UART
            BD Address: 84:20:96:B1:4D:92  ACL MTU: 820:8  SCO MTU: 255:16
            UP RUNNING
            RX bytes:2681 acl:0 sco:0 events:75 errors:0
            TX bytes:2407 acl:0 sco:0 commands:78 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: PERIPHERAL ACCEPT
            Name: 'BlueZ 5.65'
            Class: 0x000000
            Service Classes: Unspecified
            Device Class: Miscellaneous,
            HCI Version: 4.0 (0x6)  Revision: 0x373e
            LMP Version: 4.0 (0x6)  Subversion: 0x6962
            Manufacturer: Realtek Semiconductor Corporation (93)
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23

    蓝牙版本代号

    • 蓝牙版本 4.0 (0x6)
    • 蓝牙版本 4.1 (0x7)
    • 蓝牙版本 4.2 (0x8)
    • 蓝牙版本 5.0 (0x9)
    • 蓝牙版本 5.1 (0xa)
    • 蓝牙版本 5.2 (0xb)
    • 蓝牙版本 5.3 (0xc)
    • 蓝牙版本 5.4 (0xd)

    AIC8800DW 如下打印信息确认是:Bluetooth 5.4

    # hciconfig -a
    hci0:   Type: Primary  Bus: USB
            BD Address: E8:51:9E:22:DC:64  ACL MTU: 1021:9  SCO MTU: 255:4
            UP RUNNING
            RX bytes:4890 acl:0 sco:0 events:122 errors:0
            TX bytes:1315 acl:0 sco:0 commands:102 errors:0
            Features: 0xbf 0x2e 0x4d 0xfe 0xd8 0x3f 0x7b 0x87
            Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV3
            Link policy: RSWITCH SNIFF
            Link mode: PERIPHERAL ACCEPT
            Name: 'BlueZ 5.65'
            Class: 0x000000
            Service Classes: Unspecified
            Device Class: Miscellaneous,
            HCI Version:  (0xd)  Revision: 0xb
            LMP Version:  (0xd)  Subversion: 0xb
            Manufacturer: not assigned (2875)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    BT运行脚本

    #!/bin/ash
    killall dbus-daemon # 杀死原有的DBUS进程
    
    rm /run/messagebus.pid # 要想开启新的DBUS需要删除这个文件
    
    dbus-daemon --system --print-pid --print-address # 开启一个新的DBUS进程
    
    cd /oem/usr/ko  # 进入存放内核模块目录
    
    insmod hci_uart.ko # 安装蓝牙串口内核模块
    
    ./rtk_hciattach -n -s 115200 /dev/ttyS5 rtk_h5 & # 指定串口号和波特率与通信协议并初始化模块
    
    echo 1 > /sys/class/rfkill/rfkill2/state # 打开对应的射频设备开关
    
    hciconfig hci0 up # 打开蓝牙设备
    
    cd /usr/libexec/bluetooth/ # 进入目录
    ./bluetoothd -n -d & # 开启BT服务进程
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    常用软件命令

    https://zhuanlan.zhihu.com/p/537174819?utm_id=0

    • 打开/关闭/重置hci设备:hciconfig hci0 up/down/reset
    • 认证打开/关闭:hciconfig hci0 auth/noauth,直接体现在进行蓝牙连接时,是否输入连接PIN密码,用于PIN配对
    • 查看/改变蓝牙主从状态:hciconfig hci0 lmhciconfig hci0 lm slave
    • 查看/设置蓝牙名称:hciconfig hci0 namehciconfig hci0 name Donge
    • 开启/关闭广播:hciconfig hci0 leadv/ noleadv
    • 查看支持的链路层状态:hciconfig hci0 lestates

    不知道解决的:进入bluetoothctl交互后命名没有反应

  • 相关阅读:
    使用redis+lua通过原子减解决超卖问题【示例】
    vue + el-checkbox 单选功能
    为什么我写了路由懒加载但代码却没有分割?
    kubernetes 之 minikube折腾记
    C#底层库--数据库访问帮助类(MySQL版)
    win10利用minikube在自己的电脑上搭建k8s
    Gossip协议是什么
    Java,集合框架,关于Map接口与Collections工具类
    接口与外设数据传送方式(笔记)
    K8S:Pod概念、分类及相关的策略
  • 原文地址:https://blog.csdn.net/qq_28877125/article/details/134043288