无法连接到 Raspberry Pi 上的 BLE 设备 [英] Cannot connect to BLE device on Raspberry Pi

查看:72
本文介绍了无法连接到 Raspberry Pi 上的 BLE 设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试连接到 Raspberry Pi 2 上的 BLE 设备(心率传感器、Polar H7).我使用此处找到的最新版本的 bluez (5.35):http://www.bluez.org/download/但是当我尝试使用 gatttool 进行连接时,总是出现连接被拒绝"错误.

I'm trying to connect to a BLE device (Heart rate sensor, Polar H7), on a Raspberry Pi 2. I use the last version of bluez (5.35) found here: http://www.bluez.org/download/ But when I'm trying to connect using gatttool, I always have "connection refused" error.

这就是我所做的:

pi@raspberrypi ~ $ sudo su
root@raspberrypi:/home/pi# hciconfig dev
hci0:   Type: BR/EDR  Bus: USB
        BD Address: 5C:F3:70:69:54:3D  ACL MTU: 1021:8 SCO MTU: 64:1
        DOWN
        RX bytes:616 acl:0 sco:0 events:34 errors:0
        TX bytes:380 acl:0 sco:0 commands:34 errors:0

root@raspberrypi:/home/pi# hciconfig dev up
root@raspberrypi:/home/pi# hcitool lescan
LE Scan ...
00:22:D0:6D:E0:E6 (unknown)
00:22:D0:6D:E0:E6 Polar H7 6DE0E61C
^Croot@raspberrypi:/home/pi# hcitool lecc 00:22:D0:6D:E0:E6
Connection handle 64
root@raspberrypi:/home/pi# gatttool -b 00:22:D0:6D:E0:E6 -I
[00:22:D0:6D:E0:E6][LE]> connect
Attempting to connect to 00:22:D0:6D:E0:E6
Error connect: Connection refused (111)
[00:22:D0:6D:E0:E6][LE]> 

我试着关注这个话题:即使可以使用 hcitool lescan 发现设备,BLE gatttool 也无法连接但它对我不起作用.

I tried to follow this topic: BLE gatttool cannot connect even though device is discoverable with hcitool lescan but it did not work for me.

推荐答案

我不得不在 /etc/bluetooth/main.conf 中禁用插件 pnat -> <代码>DisablePlugins=pnat.我读到它不稳定,但我对这个插件了解不多.

I had to disable the plugin pnat in /etc/bluetooth/main.conf -> DisablePlugins=pnat. I read that it's unstable, but I don't know much about this plugin.

这篇关于无法连接到 Raspberry Pi 上的 BLE 设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆