gpt4 book ai didi

linux - RFCOMM 连接因 pin 而被拒绝

转载 作者:太空宇宙 更新时间:2023-11-04 10:25:08 26 4
gpt4 key购买 nike

我在连接到我的树莓派上的串口转蓝牙设备时遇到问题。

在 bluetoothctl 中,我扫描 ip 并尝试配对(在信任之后),但我被拒绝了,而且我从未收到输入 pin 的提示。

我也试过

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 版本解决这个问题?有没有办法在我尝试连接时注入(inject)该 pin?

我能够连接 android 设备和 windows 操作系统并读取数据,但出于某种原因,linux 给我带来了问题

谢谢

最佳答案

您缺少在 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

agent”有多种可能的选项。检查以下日志。

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]#

关于linux - RFCOMM 连接因 pin 而被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41948702/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com