You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

树莓派如何通过终端/SSH自动接受指定MAC的蓝牙配对请求

树莓派3自动接受指定MAC地址安卓蓝牙配对的解决方案

1. 修改蓝牙核心配置

编辑蓝牙主配置文件,开启自动配对基础规则:

sudo nano /etc/bluetooth/main.conf

找到并修改/添加以下配置项:

AutoEnable=true
AutoAcceptSolutions=true
ControllerMode=bredr

保存退出(Ctrl+O,回车,Ctrl+X)。

2. 添加指定MAC信任规则

创建自定义配对规则文件,仅允许目标安卓设备自动配对:

sudo nano /etc/bluetooth/conf.d/99-auto-pair.conf

写入以下内容,将AA:BB:CC:DD:EE:FF替换为你的安卓手机MAC地址:

[Policy]
AutoEnable=true
TrustedMACs=AA:BB:CC:DD:EE:FF

保存退出。

3. 预设设备信任状态

通过bluetoothctl预先标记目标设备为可信,避免首次配对的手动交互:

bluetoothctl

在蓝牙控制台内依次执行:

trust AA:BB:CC:DD:EE:FF
pair AA:BB:CC:DD:EE:FF
exit

4. 重启蓝牙服务生效

sudo systemctl restart bluetooth

验证与补充

  • 确保树莓派蓝牙处于可发现状态:bluetoothctl discoverable on
  • 若仍有问题,更新蓝牙组件:sudo apt update && sudo apt upgrade bluez
  • 检查蓝牙服务状态排查错误:sudo systemctl status bluetooth

内容的提问来源于stack exchange,提问作者Ganesh Aadhineni

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 15:47:33