我将修改整个帖子,因为我对问题 + 相关故障排除步骤有了更深入的了解。我有一台 Trimble R1 GPS 设备,它没有指定对 Ubuntu 的支持,但是...
我将修改整篇文章,因为我对这个问题 + 相关的故障排除步骤有了更深入的了解。我有一台 Trimble R1 GPS 设备,它没有指定对 Ubuntu 的支持,但是有适用于 Windows 的驱动程序以及适用于 Android 和 iOS 的应用程序。我需要将串行端口绑定到蓝牙 GPS 设备,这样我就可以读取 NMEA 语句。我使用的是 Raspberry Pi。
尝试使用时 bluetoothctl
, pair XX:XX:XX:XX:XX:XX
似乎工作正常,但是 connect XX:XX:XX:XX:XX:XX
命令返回 Failed to connect: org.bluez.Error.NotAvailable br-connection-profile-unavailable
检查 btmon 显示在设备(我假设)请求断开连接之前,某些数据似乎被交换:
...
> HCI Event: Number of Completed Packets (0x13) plen 5 #33 [hci0] 9.312221
Num handles: 1
Handle: 12 Address: 0C:61:CF:24:53:D7 (Texas Instruments)
Count: 1
#31: len 24 (0 Kb/s)
Latency: 235 msec (2-235 msec ~127 msec)
Channel: 66 [PSM 1 mode Basic (0x00)] {chan 0}
Channel Latency: 235 msec (3-235 msec ~119 msec)
< ACL Data TX: Handle 12 flags 0x00 dlen 12 #34 [hci0] 11.586892
L2CAP: Disconnection Request (0x06) ident 5 len 4
Destination CID: 66
Source CID: 64
> ACL Data RX: Handle 12 flags 0x02 dlen 12 #35 [hci0] 11.592545
L2CAP: Disconnection Response (0x07) ident 5 len 4
Destination CID: 66
Source CID: 64
> HCI Event: Number of Completed Packets (0x13) plen 5 #36 [hci0] 11.812223
Num handles: 1
Handle: 12 Address: 0C:61:CF:24:53:D7 (Texas Instruments)
Count: 1
#34: len 12 (0 Kb/s)
Latency: 225 msec (2-235 msec ~176 msec)
< HCI Command: Disconnect (0x01|0x0006) plen 3 #37 [hci0] 13.599716
Handle: 12 Address: 0C:61:CF:24:53:D7 (Texas Instruments)
Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4 #38 [hci0] 13.600151
Disconnect (0x01|0x0006) ncmd 1
Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4 #39 [hci0] 13.697542
Status: Success (0x00)
Handle: 12 Address: 0C:61:CF:24:53:D7 (Texas Instruments)
Reason: Connection Terminated By Local Host (0x16)
@ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0001} [hci0] 13.697592
BR/EDR Address: 0C:61:CF:24:53:D7 (Texas Instruments)
Reason: Connection terminated by local host (0x02)
我还尝试将 rfcomm 端口直接绑定到地址:
sudo rfcomm bind rfcommx 0C:61:CF:24:53:D7 x
蓝牙 GPS 有多个不同的可用通道,因此我最终将每个通道绑定到不同的 rfcomm 端口。使用 gpsd 和 cgps 检查输出未显示任何通道上发生任何数据传输。
结果如下 sdptool browse XX:XX:XX:XX:XX:XX
:
Browsing 0C:61:CF:24:53:D7 ...
Service Name: COM1
Service RecHandle: 0x10006
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Serial Port" (0x1101)
Version: 0x0100
Service Name: COM2
Service RecHandle: 0x10005
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 2
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Serial Port" (0x1101)
Version: 0x0100
Service Name: COM3
Service RecHandle: 0x10004
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 3
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Serial Port" (0x1101)
Version: 0x0100
Service Name: GNSS Server
Service RecHandle: 0x10008
Service Class ID List:
"Serial Port" (0x1101)
"" (0x1136)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 4
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"" (0x1135)
Version: 0x0100
Failed to connect to SDP server on 0C:61:CF:24:53:D7: Connection refused
我不确定最后一个错误是否与此处的连接有关。当我在 Windows 机器上使用此设备时,我能够从中获取 NMEA 语句 COM13
。我没有看到此处弹出该服务名称。