【问题标题】:RFCOMM Connection refused because of pinRFCOMM 连接被拒绝,因为 pin
【发布时间】:2017-06-16 08:46:28
【问题描述】:

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

在 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 版本解决此问题?当我尝试连接时,有没有办法注入该引脚?

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

谢谢

【问题讨论】:

    标签: linux raspberry-pi raspbian bluez


    【解决方案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
    

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

    【讨论】:

    • 谢谢帕蒂班,我尝试了你的建议,但不幸的是我仍然得到相同的结果。
    • 你能分享一下你在尝试上述命令集时的输出吗?
    猜你喜欢
    • 2019-02-08
    • 2017-08-08
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-20
    • 1970-01-01
    相关资源
    最近更新 更多