wifi/BT芯片RTL8723DS驱动移植和测试之二蓝牙篇

目录

1、根文件系统添加库和蓝牙工具

2、内核配置

(1)自带串口驱动不可选

(2)增加RFCOMM和ble的支持

(3)User level driver support

(4)HID driver

3、测试

4、报错说明

(1)Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead

(2)D-Bus setup failed: Name already in use

(3)Failed to connect: org.bluez.Error.Failed

文档参照  


该文直接介绍蓝牙的移植,移植buildroot如何由busybox改为systemd初始化系统,以及怎样编译移植busybox到根文件系统中,我会另起两篇博客单独讲解。

使用systemd启动方式制作buildroot根文件系统_汉尼拔勇闯天涯的博客-CSDN博客

编译移植busybox软件包_汉尼拔勇闯天涯的博客-CSDN博客

1、根文件系统添加库和蓝牙工具

ncurses

hciconfig命令由Buildroot中的 BR2_PACKAGE_BLUEZ5_UTILS 生成

BR2_TOOLCHAIN_EXTERNAL_LOCALE
BR2_TOOLCHAIN_EXTERNAL_WCHAR
BR2_USE_WCHAR
BR2_STATIC_LIBS    //不能选
BR2_PACKAGE_SCONESERVER
BR2_PACKAGE_SCONESERVER_BLUETOOTH
BR2_PACKAGE_BLUEZ5_UTILS
bluez
bluez-tools
我把bluez-utils 5.x下的所有子选项都选中了。

BR2_PACKAGE_DBUS

BR2_PACKAGE_DBUS_GLIB


buildroot 中要添加 libiconv 库支持:

Toolchain
  -->Copy gconv libraries


2、内核配置


(1)自带串口驱动不可选

正基和海华的模块都使用内核的默认 CONFIG_BT_HCIUART 驱动,而Realtek使用自己的hci uart驱动,
源码目录为: external\rkwifibt\realtek\bluetooth_uart_driver , 且使用ko方式加载,所以使
用Realtek时一定要把内核的CONFIG_BT_HCIUART配置去掉!
正点没有提供蓝牙源码,我是从瑞芯微开发板中找到的。


(2)增加RFCOMM和ble的支持

Networking support
    -->Bluetooth subsystem support
    -->Bluetooth Classic (BR/EDR) features
        -->RFCOMM protocol support
            -->RFCOMM TTY support
        -->BNEP protocol support、
            -->Multicast filter support
            -->Protocol filter support
        -->HIDP protocol support
        -->Bluetooth High Speed (HS) features
    -->Bluetooth Low Energy (LE) features


(3)User level driver support

Device Drivers 
    -->Input device support 
        -->Miscellaneous devices
            -->User level driver support


(4)HID driver

Device Drivers 
    -->HID support
        -->Generic HID driver

3、测试


复制正点提供的两个文件rtl8723d_config和rtl8723d_fw到路径lib/firmware/rtlbt(新建路径)下

cd /home/
lsmod
insmod cfg80211.ko
insmod 8723ds.ko
insmod hci_uart.ko
lsmod
hciconfig -a  //此时能看到hci0
./atk-bluetooth-init.sh
hciconfig
hciconfig hci0 up
hciconfig -a
hciconfig hci0 leadv 3   //设置为低功耗广播模式
hciconfig hci0 name "hannibal"
hciconfig hci0 piscan  //设置蓝牙设备可被发现
export $(dbus-launch)
mkdir /home/ble_rcv/
/usr/libexec/bluetooth/obexd -r /home/ble_rcv/ -a -d &  //指定蓝牙的接收路径
bluetoothctl  //使用交互工具
    power on
    agent on
    scan on
    scan off
    devices
    pair   DC:21:48:9F:D9:8A  //配对
    connect  DC:21:48:9F:D9:8A  //其实配对成功了,就不用connect了
    trust  DC:21:48:9F:D9:8A

4、报错说明


(1)Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead

/usr/libexec/bluetooth/obexd -r /home/ble_rcv/ -a -d &


报错:  Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead
先执行这个 export $(dbus-launch),上述的报错便没有了。


(2)D-Bus setup failed: Name already in use

运行过了export $(dbus-launch) 和 /usr/libexec/bluetooth/obexd -r /home/ble_rcv/ -a -d &

/usr/libexec/bluetooth/bluetoothd -d -C -n &


D-Bus setup failed: Name already in use
这个错误没管它,一开始是以为buildroot中勾选的dbus不能用呢,后来硬件重启之后,这个错误就不存在了。


(3)Failed to connect: org.bluez.Error.Failed

bluetoothctl中执行connect 某个mac 报错  Failed to connect: org.bluez.Error.Failed
bluetoothctl执行pair配对就行了,不用执行connect。
如果执行其他命令也有上述报错,可以先移除设备
remove DC:21:48:9F:D9:8A
再重新操作。

文档参照  


https://blog.csdn.net/li_huaqingfeng/article/details/118528639
https://blog.csdn.net/li_huaqingfeng/article/details/119007397
《Rockchip_Developer_Guide_Linux_WIFI_BT_CN.pdf》
《【正点原子】STM32MP1嵌入式Linux驱动开发指南V2.0.pdf》
《【正点原子】STM32MP157快速体验V1.6.pdf》

  • 1
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

汉尼拔勇闯天涯

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值