0

我在 nanopi NEO 空气板上运行 buildroot 生成的 linux 映像(内核 4.11.2),我很难连接到我的 ruwido 遥控器。
当我使用 hcitool 扫描设备时,我可以看到它:

# hcitool lescan
LE Scan ...
<snip>
5C:F8:21:85:8E:67 ruwido
<snip>

但我无法建立连接(它就像遥控器不在这里):

# hcitool cc 5C:F8:21:85:8E:67
Can't create connection: Input/output error

我唯一能做的就是获取一些有关它的信息:

# hcitool leinfo 5C:F8:21:85:8E:67
Requesting information ...
        Handle: 64 (0x0040)
        LMP Version: 4.0 (0x6) LMP Subversion: 0x140
        Manufacturer: Texas Instruments Inc. (13)
        Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00

我也不能使用 bluetoothctl,因为它没有检测到我的界面,即使它已初始化,bluetoothd 正在运行并且模块已加载:

# lsmod
Module                  Size  Used by
bnep                   20480  2
hci_uart               61440  1
btbcm                  16384  1 hci_uart
btqca                  16384  1 hci_uart
btintel                16384  1 hci_uart
bluetooth             348160  12 hci_uart,btintel,btqca,bnep,btbcm
brcmfmac              245760  0
brcmutil               16384  1 brcmfmac
sunxi_cir              16384  0
# ps -e | grep bluetooth
  553 root     /usr/sbin/bluetoothd
  731 root     grep bluetooth
# sudo hciconfig -a
hci0:   Type: Primary  Bus: UART
        BD Address: F7:93:3E:74:CF:62  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING 
        RX bytes:12593 acl:7 sco:0 events:292 errors:0
        TX bytes:2050 acl:4 sco:0 commands:155 errors:0
        Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
        Link policy: RSWITCH SNIFF 
        Link mode: SLAVE ACCEPT 
        Name: 'NanoPi-NEO-Air'
        Class: 0x000000
        Service Classes: Unspecified
        Device Class: Miscellaneous, 
        HCI Version: 4.1 (0x7)  Revision: 0x0
        LMP Version: 4.1 (0x7)  Subversion: 0x2209
        Manufacturer: Broadcom Corporation (15)

# bluetoothctl 
Agent registered
[bluetooth]# power on
No default controller available

我的问题是,如何将遥控器配对并连接到电路板?不管是通过 hcitool、bluetoothctl 还是其他工具。

更新

感谢Prabhakar Lad 的评论,bluetoothctl 现在正在检测接口,但是问题仍然存在并且问题似乎已经缩小:

# rfkill unblock all
# hciconfig hci0 up
# hciconfig -a
hci0:   Type: Primary  Bus: UART
        BD Address: AA:AA:AA:AA:AA:AA  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING PSCAN 
        RX bytes:1930 acl:0 sco:0 events:101 errors:0
        TX bytes:1587 acl:0 sco:0 commands:103 errors:0
        Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
        Link policy: RSWITCH SNIFF 
        Link mode: SLAVE ACCEPT 
        Name: 'BlueZ 5.47'
        Class: 0x000000
        Service Classes: Unspecified
        Device Class: Miscellaneous, 
        HCI Version: 4.1 (0x7)  Revision: 0x0
        LMP Version: 4.1 (0x7)  Subversion: 0x2209
        Manufacturer: Broadcom Corporation (15)

# bluetoothctl
[NEW] Controller F7:93:3E:74:CF:62 BlueZ 5.47 [default]
[NEW] Device 5C:F8:21:85:8E:67 ruwido
Agent registered
[bluetooth]# agent on
Agent is already registered
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# scan on
Discovery started
[CHG] Controller F7:93:3E:74:CF:62 Discovering: yes
<snip>
[NEW] Device 5C:F8:21:85:8E:67 ruwido
<snip>
[bluetooth]# scan off
<snip>
[CHG] Device 5C:F8:21:85:8E:67 RSSI is nil
<snip>
[CHG] Controller F7:93:3E:74:CF:62 Discovering: no
Discovery stopped
[bluetooth]# pair 5C:F8:21:85:8E:67
Attempting to pair with 5C:F8:21:85:8E:67
[CHG] Device 5C:F8:21:85:8E:67 Connected: yes
[ruwido]# [  501.424858] Bluetooth: hci0 unexpected SMP command 0x0b from 5c:f8:21:85:8e:67
[CHG] Device 5C:F8:21:85:8E:67 Connected: no
[bluetooth]# pair 5C:F8:21:85:8E:67
Attempting to pair with 5C:F8:21:85:8E:67
Failed to pair: org.bluez.Error.ConnectionAttemptFailed

SMP错误似乎与蓝牙低功耗安全有关,所以我应该使用不同的工具进行配对吗?

附加信息

我实际上将busybox初始化系统与我在制造商的图像中找到的蓝牙初始化脚本(即nanopi-neo-air_FriendlyCore-Xenial_4.11.2_20171113.img)一起使用并进行了调整,以便它们可以与busybox init(图像是 systemd/upstart)。
所以我有两个文件:

我在 buildroot 2017.08.1 中使用 bluez 5.47 和以下选项:

BR2_PACKAGE_BLUEZ_TOOLS=y
# BR2_PACKAGE_BLUEZ_UTILS is not set
BR2_PACKAGE_BLUEZ5_UTILS=y
BR2_PACKAGE_BLUEZ5_UTILS_OBEX=y
BR2_PACKAGE_BLUEZ5_UTILS_CLIENT=y
BR2_PACKAGE_BLUEZ5_UTILS_DEPRECATED=y
# BR2_PACKAGE_BLUEZ5_UTILS_EXPERIMENTAL is not set
# BR2_PACKAGE_BLUEZ5_PLUGINS_HEALTH is not set
# BR2_PACKAGE_BLUEZ5_PLUGINS_MIDI is not set
# BR2_PACKAGE_BLUEZ5_PLUGINS_NFC is not set
# BR2_PACKAGE_BLUEZ5_PLUGINS_SAP is not set
BR2_PACKAGE_BLUEZ5_UTILS_TEST=y
# BR2_PACKAGE_BLUEZ5_UTILS_GATTTOOL is not set
4

1 回答 1

0

您没有阅读我的完整帖子,您需要在完成 rfkill 和服务重启后执行以下步骤:

一个]bluetoothctl

Start the tool, this should detect the controller

乙][bluetooth]# agent on

Turn on the pairing agent

C][bluetooth]# scan on

Let bluez detect your device, look in my post it should print you baddr (5C:F8:21:85:8E:67)

d][bluetooth]# scan off

Turn off scanning once your device is discovered

e] [蓝牙]# 对 5C:F8:21:85:8E:67

Now pair to the device

现在应该配对了。注意:在 bluez 扫描设备之前,您无法配对设备。

于 2017-12-08T09:20:14.110 回答