BlueZ 给出“缺少 CAP_NET_ADMIN 权限”错误

BlueZ 给出“缺少 CAP_NET_ADMIN 权限”错误

我需要确定问题的根源。错误消息是:

qt.bluetooth.bluez: Missing CAP_NET_ADMIN permission. Cannot determine whether a found address is of random or public type.
qt.bluetooth.bluez: SDP scan failure QProcess::NormalExit 3

My C/C++ code , based on QT , scans for "bluetoooth service " and fails to complete. It just times out as it should when the scan is completed.

Otherwise my code works as expected, hence no OS problem...
This error is posted by "bluez" - so why not look there first? 
I was hoping somebody knows the answer...

I'll czech bluez.  

答案1

以下是为什么会发生这种情况的部分解释。

https://unix.stackexchange.com/questions/96106/bluetooth-le-scan-as-non-root

以下是我的看法:实际的蓝牙调用层次结构似乎是:

蓝牙的 QT 实现(库)称为“蓝牙(模块)”。
请注意,此模块在每个 QT 版本中都不相同,并且实际上在某些版本中缺失。

QT 模块“库”是“bluez”的QT 复制/修改。

“bluez”基于“hci”。

注意 - 我直接使用了“hci”,绕过了“bluez”,没有发现直接使用它的任何问题。实际上,QT 实现缺少物理重置“上次成功调用后找到的蓝牙设备”的功能。因此,我使用“hci”重置上次找到的蓝牙设备的未知数据库。

现在有 QT C/C++ 示例 btscanner 示例按预期工作 - 返回附近的设备并且其“服务”btchat 基本上执行相同的操作,但因上述错误而失败。

这两个示例仅实现了三个信号 start found device finish

**btchat 中没有“找到设备”信号**,btscanner 中有!!

因此“问题”在于 btchat 对“bluez”的实现,并且 btchat 使用不同的 QT 函数 - 添加了另一层来调用/使用“bluez”...

由于 QT 函数的使用是实时的,因此找到调用的顺序以及卡住的位置是一项挑战。

相关内容