【发布时间】:2017-03-07 23:58:45
【问题描述】:
我正在尝试在 QT 应用程序中从我的 PC 和 Raspberry Pi3 连接到蓝牙低功耗设备,但尝试连接时出现此 QT 错误:
qt.bluetooth.bluez: Unknown l2cp socket error: QBluetoothSocket::UnknownSocketError "Transport endpoint is not connected"
qt.bluetooth.bluez: void QBluetoothSocketPrivate::_q_readNotify() 14 error: -1 "Resource temporarily unavailable"
qt.bluetooth.bluez: Unknown l2cp socket error: QBluetoothSocket::UnknownSocketError "Resource temporarily unavailable"
我不认为它的 QT,我怀疑 bluez 是问题所在。我发现 Linux 可以通过以下方式找到设备:
sudo hcitool lescan
并且可以通过以下方式连接:
sudo hcitool lecc <address>
所以这很好。问题是,一旦我尝试使用 gatttool(这一定是 QT 尝试做的事情),我得到以下信息:
pi@user:~$ sudo gatttool -I
[ ][LE]> connect <address>
Attempting to connect to <address>
Error: connect error: Transport endpoint is not connected (107)
[<address>][LE]>
结果是 PC 和 Raspberry 上的一些结果。 PC 上的 bluez 版本是 5.37,而 raspberry 是 5.23。
有什么想法吗? :(
【问题讨论】:
-
此链接将为您提供帮助:stackoverflow.com/questions/15657007/…。根据帖子,您需要使用 gatttool -b -I
-
回复有点晚了......每次他们更新 bluez/bluetooth 内核时,他们都会破坏其他东西。我相信当您使用 gatttool 时,内核会参与连接并执行许多其他操作,但是当您使用 hcitool 时,它会执行 hci 命令。
标签: linux qt bluetooth raspberry-pi bluez