SPRK + sphero不与蓝牙配对(Ubuntu 14.04和RasPi)

时间:2018-04-13 17:19:45

标签: bluetooth raspberry-pi bluetooth-lowenergy robotics bluez

我正在尝试按照mmwise教程(https://github.com/mmwise/sphero_ros)在ROS环境中使用我的sphero SPRK +。我无法使用bluetoothctl或蓝牙屏幕将SPRK +连接到我的PC。

我已尝试使用带有靛蓝ROS的Oracle Virtualbox Ubuntu 14.04和带有ROS拉伸的Raspberry Pi 3。 bluetoothctl的错误完全相同,如下:

[bluetooth]# pair F7:AF:AF:64:39:66
Attempting to pair with F7:AF:AF:64:39:66
[CHG] Device F7:AF:AF:64:39:66 Connected: yes
Failed to pair: org.bluez.Error.AuthenticationFailed
[CHG] Device F7:AF:AF:64:39:66 Connected: no

如果我在配对前连接到SPRK +,它会成功并更改为

[bluetooth]# connect F7:AF:AF:64:39:66
Attempting to connect to F7:AF:AF:64:39:66
[CHG] Device F7:AF:AF:64:39:66 Connected: yes
Connection successful
[NEW] Primary Service
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0008
        00001801-0000-1000-8000-00805f9b34fb
        Generic Attribute Profile
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0008/char0009
        00002a05-0000-1000-8000-00805f9b34fb
        Service Changed
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0008/char0009/desc000b
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Primary Service
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service000c
        22bb746f-2ba0-7554-2d6f-726568705327
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service000c/char000d
        22bb746f-2ba1-7554-2d6f-726568705327
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service000c/char000f
        22bb746f-2ba6-7554-2d6f-726568705327
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service000c/char000f/desc0011
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Primary Service
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012
        22bb746f-2bb0-7554-2d6f-726568705327
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0013
        22bb746f-2bb1-7554-2d6f-726568705327
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0013/desc0015
        00002904-0000-1000-8000-00805f9b34fb
        Characteristic Format
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0016
        22bb746f-2bb2-7554-2d6f-726568705327
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0016/desc0018
        00002904-0000-1000-8000-00805f9b34fb
        Characteristic Format
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0019
        22bb746f-2bb6-7554-2d6f-726568705327
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0019/desc001b
        00002904-0000-1000-8000-00805f9b34fb
        Characteristic Format
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0019/desc001c
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char001d
        22bb746f-2bb7-7554-2d6f-726568705327
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char001d/desc001f
        00002904-0000-1000-8000-00805f9b34fb
        Characteristic Format
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0020
        22bb746f-2bb8-7554-2d6f-726568705327
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0020/desc0022
        00002904-0000-1000-8000-00805f9b34fb
        Characteristic Format
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0023
        22bb746f-2bb9-7554-2d6f-726568705327
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0023/desc0025
        00002904-0000-1000-8000-00805f9b34fb
        Characteristic Format
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0026
        22bb746f-2bba-7554-2d6f-726568705327
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0026/desc0028
        00002904-0000-1000-8000-00805f9b34fb
        Characteristic Format
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0029
        22bb746f-2bbd-7554-2d6f-726568705327
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char002b
        22bb746f-2bbe-7554-2d6f-726568705327
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char002b/desc002d
        00002904-0000-1000-8000-00805f9b34fb
        Characteristic Format
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char002e
        22bb746f-2bbf-7554-2d6f-726568705327
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char002e/desc0030
        00002904-0000-1000-8000-00805f9b34fb
        Characteristic Format
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0031
        22bb746f-3bba-7554-2d6f-726568705327
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0012/char0031/desc0033
        00002904-0000-1000-8000-00805f9b34fb
        Characteristic Format
[NEW] Primary Service
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0034
        00001016-d102-11e1-9b23-00025b00a5a5
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0034/char0035
        00001013-d102-11e1-9b23-00025b00a5a5
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0034/char0037
        00001017-d102-11e1-9b23-00025b00a5a5
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0034/char0039
        00001014-d102-11e1-9b23-00025b00a5a5
        Vendor specific
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service0034/char0039/desc003b
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Primary Service
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service003c
        0000180a-0000-1000-8000-00805f9b34fb
        Device Information
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service003c/char003d
        00002a27-0000-1000-8000-00805f9b34fb
        Hardware Revision String
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service003c/char003f
        00002a25-0000-1000-8000-00805f9b34fb
        Serial Number String
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service003c/char003f/desc0041
        00002904-0000-1000-8000-00805f9b34fb
        Characteristic Format
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service003c/char0042
        00002a24-0000-1000-8000-00805f9b34fb
        Model Number String
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service003c/char0044
        00002a29-0000-1000-8000-00805f9b34fb
        Manufacturer Name String
[NEW] Characteristic
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service003c/char0046
        00002a26-0000-1000-8000-00805f9b34fb
        Firmware Revision String
[NEW] Descriptor
        /org/bluez/hci0/dev_F7_AF_AF_64_39_66/service003c/char0046/desc0048
        00002904-0000-1000-8000-00805f9b34fb
        Characteristic Format
[CHG] Device F7:AF:AF:64:39:66 UUIDs: 00001016-d102-11e1-9b23-00025b00a5a5
[CHG] Device F7:AF:AF:64:39:66 UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device F7:AF:AF:64:39:66 UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device F7:AF:AF:64:39:66 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb
[CHG] Device F7:AF:AF:64:39:66 UUIDs: 22bb746f-2ba0-7554-2d6f-726568705327
[CHG] Device F7:AF:AF:64:39:66 UUIDs: 22bb746f-2bb0-7554-2d6f-726568705327
[CHG] Device F7:AF:AF:64:39:66 ServicesResolved: yes
[SK-3966]#

然后进一步尝试将结果配对

[SK-3966]# pair
Attempting to pair with
Failed to pair: org.bluez.Error.AuthenticationFailed
[CHG] Device F7:AF:AF:64:39:66 ServicesResolved: no
[CHG] Device F7:AF:AF:64:39:66 Connected: no

尝试使用Ubuntu 14.04中的常规蓝牙设置屏幕进行连接导致设置“SK-3999”失败。

我已经尝试将我的pi用户添加到另一篇文章中找到的lp组,我很确定我的蓝牙工作正常,因为它扫描并找到了东西。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

您看到的bluetoothctl的行为是预期的。在BLE中,身份验证和加密与特征(数据)绑定。当您尝试连接外围设备时,会发生GATT发现,服务得到解决并且连接成功建立。

但是,当您第一次尝试向外围设备读取数据或从外围设备写入数据时,就会验证GATT服务的安全要求并生成配对请求并进行配对。

这就是bluetoothctl connect成功和pair失败的原因。

如果您的外围设备上的GATT服务需要身份验证,那么您 可能需要知道验证引脚,具体取决于设备的IO功能。以下是使用bluetoothctl进行身份验证的示例:

[bluetooth]# agent DisplayYesNo
Agent is already registered
[bluetooth]#pair 00:45:41:34:04:BA:8B
Request confirmation
[agent] Confirm passkey 547334 (yes/no): yes

蓝牙低功耗中的身份验证方法取决于连接设备的IO功能。例如,智能手机的IO功能是KeyBoardDisplay,BLE腕带的IO功能是NoInputNoOutput。有问题的BLE设备的文档应该详细说明其身份验证方法。