[英]Having difficulty pairing with a bluetooth OBDII device on Ubuntu
I'm attempting to pair with a automotive OBDII bluetooth device from a Beaglebone Black running Ubuntu Linux, and not having a ton of luck.我正在尝试与运行 Ubuntu Linux 的 Beaglebone Black 的汽车 OBDII 蓝牙设备配对,但运气不佳。
I was able, initially to set up hci0 using bluez-simple-agent, although it never asked me for a PIN.我最初能够使用 bluez-simple-agent 设置 hci0,尽管它从未要求我提供 PIN。 The PIN for this device is supposed to be "1234".
该设备的 PIN 应该是“1234”。 Now, when I run bluez-simple-agent, I get this:
现在,当我运行 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
Which would be fine if it was working, but when I try to bind using rfcomm, I repeatedly get either "Can't connect RFCOMM socket: Invalid exchange" (first time after restarting the device) and then "Can't connect RFCOMM socket: Connection refused" every time thereafter.如果它正在工作,那会很好,但是当我尝试使用 rfcomm 进行绑定时,我反复得到“无法连接 RFCOMM 套接字:无效交换”(重启设备后第一次)然后“无法连接 RFCOMM 套接字” :此后每次都拒绝连接”。
This is my /etc/bluetooth/rfcomm.conf file:这是我的 /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";
}
And running "rfcomm bind 0" does successfully create a device at /dev/rfcomm0:运行“rfcomm bind 0”确实在 /dev/rfcomm0 成功创建了一个设备:
rfcomm0: 00:0D:18:A0:4E:35 channel 16 clean
However, trying to read from /dev/rfcomm0, gives me this:但是,尝试从 /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$
And thereafter, rfcomm returns this:此后,rfcomm 返回:
ubuntu@ubuntu-armhf:/etc/bluetooth$ rfcomm
rfcomm0: 00:0D:18:A0:4E:35 channel 16 closed
I think I am using the correct channel (16) based on the result of "sdptool records"根据“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
Any help would be greatly appreciated, because I'm pretty well out of ideas at this point.任何帮助将不胜感激,因为此时我完全没有想法。
Refs:参考:
Remove the paired device from bluetooth settings and add it again从蓝牙设置中删除配对设备并重新添加
I know this is a little bit late but since I got here may be there is some other people struggling with it so I will post what worked for me, using what I suppose is the same device (OBDII ELM327 Blue Connector).我知道这有点晚了,但自从我来到这里以来,可能还有其他人在努力解决这个问题,所以我会发布对我有用的东西,使用我认为是相同的设备(OBDII ELM327 蓝色连接器)。
[USING BBB WITH DEBIAN WHEEZY] [将 BBB 与 DEBIAN WHEEZY 结合使用]
/etc/bluetooth/
/etc/bluetooth/
下有以下 rfcomm.conf 文件rfcomm0 {
bind yes;
device AA:BB:CC:DD:EE:FF; # Remote device's MAC
channel 16;
comment "OBDII";
}
# rfcomm connect rfcomm0
Each time the BBB is connected to a device, it seems it saves its configuration under /var/lib/bluetooth/XX:XX:XX:XX:XX:XX
(MAC Address of the Bluetooth dongle gotten with hcitool dev)每次 BBB 连接到设备时,它似乎将其配置保存在
/var/lib/bluetooth/XX:XX:XX:XX:XX:XX
下(使用 hcitool dev 获得的蓝牙加密狗的 MAC 地址)
/var/lib/bluetooth/XX:XX:XX:XX:XX:XX
folder with a cron job at boot, adding the following line to cron, using " crontrab -e
" command on console/var/lib/bluetooth/XX:XX:XX:XX:XX:XX
文件夹中的所有内容,并在启动时使用 cron 作业,添加cron 的下一行,在控制台上使用“ crontrab -e
”命令$ @reboot rm /var/lib/bluetooth/*
So each time it boots up again, I'm able to re-establish the connection using Linux commands when necesary.所以每次它再次启动时,我都可以在需要时使用 Linux 命令重新建立连接。
I know this is little bit tricky and I don't know how good or bad is removing the bluetooth folder but it works for me, if you have any other comment or suggestion please let me know.我知道这有点棘手,我不知道删除蓝牙文件夹的好坏,但它对我有用,如果您有任何其他意见或建议,请告诉我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.