无法将蓝牙遥控器连接到运行Linux的SBC



我正在运行纳米型Neo Air Board上的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

我也无法使用蓝牙,因为它没有检测到我的接口,即使它是初始化的,蓝牙正在运行,并且已加载模块:

# 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 Init System与我在制造商映像中找到的蓝牙初始脚本(是nanopi-neo-air_friendlylycore-xenial_4.11.2_20171113.img)并进行了调整,以便它们可以与busybox Init一起使用(Init Init图像上的系统是SystemD/Upstart)。
所以我有两个文件:

  • /etc/init.d/s35brcm_patchram_plus:patches固件(该卡使用AMPAK AP6212蓝牙/Wifi组合模块)
  • /etc/init.d/s38bluetooth:启动蓝牙

我在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

您没有浏览我的完整帖子,您需要执行以下操作 完成RFKILL和服务重新启动后的步骤:

a] bluetoothctl

Start the tool, this should detect the controller

b] [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扫描Bluez之前,您不能配对设备。

相关内容

  • 没有找到相关文章

最新更新