【问题标题】:Having difficulty pairing with a bluetooth OBDII device on Ubuntu在 Ubuntu 上与蓝牙 OBDII 设备配对有困难
【发布时间】:2013-10-09 14:16:39
【问题描述】:

我正在尝试与运行 Ubuntu Linux 的 Beaglebone Black 中的汽车 OBDII 蓝牙设备配对,但运气不佳。

最初我可以使用 bluez-simple-agent 设置 hci0,尽管它从未要求我输入 PIN。此设备的 PIN 应该是“1234”。现在,当我运行 bluez-simple-agent 时,我得到了这个:

ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo bluez-simple-agent hci0 00:0D:18:A0:4E:35
Creating device failed: org.bluez.Error.AlreadyExists: Already Exists

如果它工作正常就好了,但是当我尝试使用 rfcomm 进行绑定时,我反复收到“无法连接 RFCOMM 套接字:无效交换”(重新启动设备后的第一次)然后“不能此后每次都连接 RFCOMM 套接字:连接被拒绝。

这是我的 /etc/bluetooth/rfcomm.conf 文件:

rfcomm0 {
    # Automatically bind the device at startup
    bind no;

    # Bluetooth address of the device
    device 00:0D:18:A0:4E:35;

    # RFCOMM channel for the connection
    channel 16;

    # Description of the connection
    comment "OBDII";
}

并且运行“rfcomm bind 0”确实成功地在 /dev/rfcomm0 创建了一个设备:

rfcomm0: 00:0D:18:A0:4E:35 channel 16 clean 

但是,尝试从 /dev/rfcomm0 读取数据时,我得到了这个:

ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo cat /dev/rfcomm0
cat: /dev/rfcomm0: Invalid exchange
ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo cat /dev/rfcomm0
cat: /dev/rfcomm0: Connection refused
ubuntu@ubuntu-armhf:/etc/bluetooth$ 

然后,rfcomm 返回:

ubuntu@ubuntu-armhf:/etc/bluetooth$ rfcomm
rfcomm0: 00:0D:18:A0:4E:35 channel 16 closed 

根据“sdptool 记录”的结果,我认为我使用了正确的通道 (16)

ubuntu@ubuntu-armhf:/etc/bluetooth$ sudo sdptool records 00:0D:18:A0:4E:35 
...
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 16
Profile Descriptor List:
  "Serial Port" (0x1101)
    Version: 0x0100

任何帮助都将不胜感激,因为我现在完全没有想法。

参考:

【问题讨论】:

  • 关于发现错误为“创建设备失败:org.bluez.Error.AlreadyExists:已经存在”,因为设备已经创建,请尝试使用这些 dbus 命令删除该设备 1. dbus-send --system --type=method_call --print-reply --dest=org.bluez "/org/bluez/bluetooth_PID/hci0"org.bluez.Adapter.GetProperties 2. dbus-send --system --type=method_call --print-reply --dest=org.bluez "/org/bluez/3858/hci0" org.bluez.Adapter.RemoveDevice objpath:"/org/bluez/3858/hci0/dev_00_0D_18_A0_4E_35" ,在此之后尝试再次配对代理实用程序。

标签: ubuntu bluetooth bluez beagleboneblack elm327


【解决方案1】:

从蓝牙设置中删除配对设备并重新添加

【讨论】:

    【解决方案2】:

    我知道这有点晚了,但既然我到了这里,可能还有其他人在为此苦苦挣扎,所以我会发布对我有用的东西,使用我认为是相同的设备(OBDII ELM327 蓝色连接器),

    [在 DEBIAN WHEEZY 中使用 BBB]

    1. 我在 /etc/bluetooth/ 下有以下 rfcomm.conf 文件

      rfcomm0 {
      绑定是;
      设备 AA:BB:CC:DD:EE:FF; # 远程设备的 MAC
      第 16 频道;
      评论“OBDII”;
      }

    2. $# rfcomm connect rfcomm0

    每次 BBB 连接到设备时,它似乎都会将其配置保存在 /var/lib/bluetooth/XX:XX:XX:XX:XX:XX 下(通过 hcitool dev 获得的蓝牙加密狗的 MAC 地址)

    1. 我正在做什么以确保它下次连接,我正在删除 /var/lib/bluetooth/XX:XX:XX:XX:XX:XX forlder 的所有内容,并在启动时使用 cron 作业,将以下行添加到 cron,在控制台上使用“crontrab -e”命令

    $ @reboot rm /var/lib/bluetooth/*

    所以每次重新启动时,我都可以在必要时使用 Linux 命令重新建立连接

    我知道这有点棘手,我不知道删除蓝牙文件夹的好坏,但它对我有用,如果您有任何其他意见或建议,请告诉我

    问候

    【讨论】:

      猜你喜欢
      • 2021-04-26
      • 1970-01-01
      • 2016-09-26
      • 2018-05-26
      • 1970-01-01
      • 1970-01-01
      • 2013-05-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多