Settings | Sign in | Sign up

There are currently 2 posts.

交叉编译bluez蓝牙协议栈(安装到板子上的/opt/bluez目录)

Floor 4 巨大八爪鱼 7/1/25 16:07

加载蓝牙驱动模块:insmod ~/test/modules/aic_btusb.ko


添加messagebus用户和组:

(系统用户,且不可登录。-S表示编号从100开始)

addgroup -S messagebus

adduser -G messagebus -SDH messagebus


启动dbus-daemon进程:

rm /opt/bluez/var/run/dbus/pid

/opt/bluez/bin/dbus-daemon --system


复制配置文件:cp ~/bluetooth/dbus-1/system.d/bluetooth.conf /opt/bluez/share/dbus-1/system.d/

(不复制的话无法启动bluetoothd后台进程,会报D-Bus setup failed: Connection ":1.0" is not allowed to own the service "org.bluez" due to security policies in the configuration file的错误)


启动bluetoothd后台进程:LD_LIBRARY_PATH=/opt/bluez/lib /opt/bluez/libexec/bluetooth/bluetoothd &

打开蓝牙:LD_LIBRARY_PATH=/opt/bluez/lib /opt/bluez/bin/bluetoothctl power on

扫描蓝牙设备:LD_LIBRARY_PATH=/opt/bluez/lib /opt/bluez/bin/bluetoothctl scan on

巨大八爪鱼 7/1/25 17:18
还有一个LD_LIBRARY_PATH=/opt/bluez/lib /opt/bluez/bin/bluetoothctl devices命令可以查看已扫描到的蓝牙设备。

Content converter:

Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
©2010-2025 Purasbar Ver3.0 [Mobile] [Desktop]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported license.