首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不同的gatttool和bluetoothctl与raspberry pi 3蓝牙的连接结果

不同的gatttool和bluetoothctl与raspberry pi 3蓝牙的连接结果
EN

Stack Overflow用户
提问于 2016-11-10 10:19:16
回答 2查看 2.4K关注 0票数 2

当我尝试使用gatttool和bluetoothctl连接到蓝牙设备时,gatttool显示“连接被拒绝”,但bluetoothctl成功连接到它。

bluetoothctl和gatttool有什么区别?

由于我需要在gatttool中使用char-write-cmd命令,如何使gatttool工作?

代码语言:javascript
复制
$ ./gatttool -b 00:13:04:0C:6C:26 -I
[00:13:04:0C:6C:26][LE]> connect
Attempting to connect to 00:13:04:0C:6C:26
Error: connect error: Connection refused (111)
[00:13:04:0C:6C:26][LE]> exit


$ bluetoothctl
[NEW] Controller B8:27:EB:07:26:C8 raspberrypi [default]
[NEW] Device 00:13:04:0C:6C:26 MEDXING-NIBP
[bluetooth]# connect 00:13:04:0C:6C:26
Attempting to connect to 00:13:04:0C:6C:26
[CHG] Device 00:13:04:0C:6C:26 Connected: yes
Connection successful
[bluetooth]# info 00:13:04:0C:6C:26
Device 00:13:04:0C:6C:26
    Name: MEDXING-NIBP
    Alias: MEDXING-NIBP
    Paired: no
    Trusted: no
    Blocked: no
    Connected: yes
    LegacyPairing: no
    UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
    UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
    UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
    UUID: Unknown                   (0000ffb0-0000-1000-8000-00805f9b34fb)
[bluetooth]# exit
EN

回答 2

Stack Overflow用户

发布于 2017-09-17 19:36:23

解决方案:只需将-t随机添加到gatttool命令行,它就会连接!

票数 0
EN

Stack Overflow用户

发布于 2018-06-22 21:53:12

就像@Zibri说的那样,所需的命令是:

代码语言:javascript
复制
sudo gatttool -b 00:13:04:0C:6C:26 -t random -I

此外,更新Bluez也是一个好主意,这里有一个好方法,可以从https://github.com/getsenic/gatt-python的“从源代码安装BlueZ”一节开始。

代码语言:javascript
复制
#First, consulte the Bluez version with 
bluetoothd --version
#If is not the last one indicated on http://www.bluez.org/, continue with the next steps, reeplace <5.50> with the most updated number version. 
sudo systemctl stop bluetooth
sudo apt-get update
sudo apt-get install libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev libdbus-glib-1-dev unzip
cd
mkdir bluez
cd bluez
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.50.tar.xz
tar xf bluez-5.50.tar.xz
cd bluez-5.50
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-library
make
sudo make install
sudo ln -svf /usr/libexec/bluetooth/bluetoothd /usr/sbin/
sudo install -v -dm755 /etc/bluetooth
sudo install -v -m644 src/main.conf /etc/bluetooth/main.conf
sudo systemctl daemon-reload
sudo systemctl start bluetooth
#Check the new version
bluetoothd --version
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40519019

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档