bluez rfcomm connect fail

时间:2018-01-30 02:26:49

标签: linux bluetooth embedded rfcomm

我正在尝试将Ubuntu pc与设备连接。输入命令后,它会返回各种错误,包括已使用的rfcomm连接地址主机已关闭正在进行的rfcomm连接

设备环境和程序如下

设备环境

  • Linux 3.4
  • Bluez 5.19
  • bt addr xx:xx:xx:xx:38:A4

PC环境

  • Ubuntu 14.04
  • bluez 4
  • bt addr xx:xx:xx:xx:CF:F0

步骤

设备

  • insmod rfcomm.ko rtk_btusb.ko
  • dbus-daemon --config-file = / etc / dbus-1 / system.conf
  • bluetoothd -C&
  • hciconfig hci0 up
  • hciconfig hci0 piscan
  • sdptool添加SP
  • bluetoothctl扫描
  • bluetoothctl agent on
  • bluetoothctl default-agent
  • bluetoothctl trust xx:xx:xx:xx:CF:F0
  • bluetoothctl pair xx:xx:xx:xx:CF:F0
  • rfcomm bind 0 xx:xx:xx:xx:CF:F0 1
  • chmod 666 / dev / rfcomm0
  • rfcomm connect 0 xx:xx:xx:xx:CF:F0 1

PC

  • sdptool添加SP
  • rfcomm bind 0 xx:xx:xx:xx:38:A4 1
  • chmod 666 / dev / rfcomm0
  • rfcomm watch 0 1

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

hciconfig -a output

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)

我的手术中是否遗漏了任何步骤?

1 个答案:

答案 0 :(得分:0)

以下步骤适用于我。

PC端

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

设备端

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

reference