RFCOMM连接由于引脚而被拒绝

时间:2017-01-31 02:22:02

标签: linux raspberry-pi raspbian bluez

我在覆盆子pi上连接到串口到蓝牙设备时遇到问题。

在bluetoothctl中我扫描ip并尝试配对(在信任之后),但我被拒绝了,我从来没有得到过提示。

我也试过

rfcomm connect /dev/rfcomm1 <bt_addr> 1

我检查hci转储并查看hci事件

HCI Command: PIN Code request

然后在我看到

之下
HCI Command: PIN Code request Negative reply

但我永远不会选择放入我的销钉。我已经连接到其他蓝牙设备没有这个问题,但由于某种原因我在这个项目enter link description here上看到了这个

我正在使用更新版本的bluez,因此hcid.conf不再存在,不幸的是,我的大多数搜索都将该文件作为解决方案。我怎么能用更新的bluez版本解决这个问题?当我尝试连接时有没有办法注入该引脚?

我能够连接Android设备和Windows操作系统并读取数据,但由于某种原因,linux给了我一个问题

谢谢

1 个答案:

答案 0 :(得分:1)

您缺少在bluetoothctl中注册代理以获取提示。您可以按顺序尝试以下命令。

简而言之,

hciconfig hci0 up
systemctl start bluetooth
bluetoothctl
[bluetooth]# discoverable on
[bluetooth]# pairable on
[bluetooth]# agent NoInputNoOutput
[bluetooth]# scan on
[bluetooth]# scan off #after you found the device
[bluetooth]# trust 44:D8:84:02:A3:17
[bluetooth]# pair 44:D8:84:02:A3:17
[bluetooth]# connect 44:D8:84:02:A3:17

&#34; 代理商&#34;有各种可能的选项。检查以下日志。

root@mx6q:~# hciconfig    
hci0:   Type: BR/EDR  Bus: USB
    BD Address: 00:02:72:A9:B6:45  ACL MTU: 1021:7  SCO MTU: 64:1
    UP RUNNING PSCAN 
    RX bytes:1038 acl:0 sco:0 events:50 errors:0
    TX bytes:1405 acl:0 sco:0 commands:49 errors:0

root@mx6q:~# hciconfig hci0 up
root@mx6q:~# systemctl start bluetooth
root@mx6q:~# ps -ef | grep bluetooth
root       324     1  0 00:07 ?        00:00:00 /usr/lib/bluez5/bluetooth/bluetoothd
root       339   314  0 04:25 pts/0    00:00:00 grep bluetooth
root@mx6q:~# 
root@mx6q:~# bluetoothctl 
[NEW] Controller 00:02:72:A9:B6:45 BlueZ 5.33 [default]
[bluetooth]# discoverable on
Changing discoverable on succeeded
[CHG] Controller 00:02:72:A9:B6:45 Discoverable: yes
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# agent 
DisplayOnly      DisplayYesNo     KeyboardDisplay  KeyboardOnly     NoInputNoOutput  off              on               
[bluetooth]# agent NoInputNoOutput 
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:02:72:A9:B6:45 Discovering: yes
[NEW] Device 44:D8:84:02:A3:17 Parthiban
[bluetooth]# scan off
[CHG] Device 44:D8:84:02:A3:17 RSSI is nil
Discovery stopped
[CHG] Controller 00:02:72:A9:B6:45 Discovering: no
[bluetooth]# trust 44:D8:84:02:A3:17
[CHG] Device 44:D8:84:02:A3:17 Trusted: yes
Changing 44:D8:84:02:A3:17 trust succeeded
[bluetooth]# pair 44:D8:84:02:A3:17
Attempting to pair with 44:D8:84:02:A3:17
[CHG] Device 44:D8:84:02:A3:17 Connected: yes
[CHG] Device 44:D8:84:02:A3:17 Modalias: usb:v05ACp12A0d0930
[CHG] Device 44:D8:84:02:A3:17 UUIDs: 00000000-deca-fade-deca-deafdecacafe
[CHG] Device 44:D8:84:02:A3:17 UUIDs: 00001000-0000-1000-8000-00805f9b34fb
[CHG] Device 44:D8:84:02:A3:17 UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[CHG] Device 44:D8:84:02:A3:17 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device 44:D8:84:02:A3:17 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device 44:D8:84:02:A3:17 UUIDs: 00001116-0000-1000-8000-00805f9b34fb
[CHG] Device 44:D8:84:02:A3:17 UUIDs: 0000111f-0000-1000-8000-00805f9b34fb
[CHG] Device 44:D8:84:02:A3:17 UUIDs: 0000112f-0000-1000-8000-00805f9b34fb
[CHG] Device 44:D8:84:02:A3:17 UUIDs: 00001132-0000-1000-8000-00805f9b34fb
[CHG] Device 44:D8:84:02:A3:17 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 44:D8:84:02:A3:17 Paired: yes
Pairing successful
[CHG] Device 44:D8:84:02:A3:17 Connected: no
[bluetooth]#