【问题标题】:bluez rfcomm connect failbluez rfcomm 连接失败
【发布时间】:2018-07-08 20:08:34
【问题描述】:

我正在尝试将 Ubuntu 电脑与设备连接。输入命令时,返回各种错误,包括rfcomm connect address already in usehost is downrfcomm connect now in progress

设备环境及流程如下

设备环境

  • Linux 3.4
  • Bluez 5.19
  • bt 地址 xx:xx:xx:xx:38:A4

电脑环境

  • Ubuntu 14.04
  • bluez 4
  • bt 地址 xx:xx:xx:xx:CF:F0

步骤

设备

  • insmod rfcomm.ko rtk_btusb.ko
  • dbus-daemon --config-file=/etc/dbus-1/system.conf
  • 蓝牙-C &
  • hciconfig hci0 向上
  • hciconfig hci0 piscan
  • sdptool 添加 SP
  • bluetoothctl 扫描开启
  • bluetoothctl 代理开启
  • bluetoothctl 默认代理
  • bluetoothctl 信任 xx:xx:xx:xx:CF:F0
  • bluetoothctl 对 xx:xx:xx:xx:CF:F0
  • rfcomm 绑定 0 xx:xx:xx:xx:CF:F0 1
  • chmod 666 /dev/rfcomm0
  • rfcomm 连接 0 xx:xx:xx:xx:CF:F0 1

电脑

  • sdptool 添加 SP
  • rfcomm 绑定 0 xx:xx:xx:xx:38:A4 1
  • chmod 666 /dev/rfcomm0
  • rfcomm 手表 0 1

设备显示无法连接 RFCOMM 套接字:主机已关闭

hciconfig -a 输出

hci0:   Type: BR/EDR  Bus: USB
        BD Address: 5C:F3:70:1B:38:A4  ACL MTU: 820:8  SCO MTU: 255:16
        UP RUNNING PSCAN ISCAN
        RX bytes:6888 acl:88 sco:0 events:230 errors:0
        TX bytes:4341 acl:84 sco:0 commands:87 errors:0
        Features: 0xff 0xff 0xff 0xfe 0xdb 0xff 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH HOLD SNIFF PARK
        Link mode: SLAVE ACCEPT
        Name: 'BlueZ 5.19'
        Class: 0x000000
        Service Classes: Unspecified
        Device Class: Miscellaneous,
        HCI Version: 4.0 (0x6)  Revision: 0xe2f
        LMP Version: 4.0 (0x6)  Subversion: 0x9f73
        Manufacturer: Realtek Semiconductor Corporation (93)

我的程序中是否遗漏了任何步骤?

【问题讨论】:

  • l2ping 从 PC 到设备工作,但从设备到 PC 显示连接在发送 4 次后被对等方重置。

标签: linux bluetooth embedded rfcomm


【解决方案1】:

以下步骤对我有用。

PC端

  • sdptool 添加 SP
  • rfcomm -i hci0 watch 0 1 ./picocom /dev/rfcomm0

设备端

  • sdptool 添加 SP
  • rfcomm 连接 0 xx:xx:xx:xx:xx:F0 1 &
  • picocom /dev/rfcomm0

reference

【讨论】:

    猜你喜欢
    • 2019-02-08
    • 2015-07-31
    • 2014-04-27
    • 2021-03-25
    • 1970-01-01
    • 2015-03-08
    • 2015-10-25
    • 2012-06-22
    • 1970-01-01
    相关资源
    最近更新 更多