统一远程:蓝牙:无法连接到 SDP

Non*_*tme 16 bluetooth networking

我今天安装了 Unified Remote,希望我可以将它与我的蓝牙适配器一起使用,以使用我的手机控制我的 PC。但是当我安装 Unified Remote 并加载 Web 界面时,出现了以下错误:

蓝牙:无法连接到 SDP

谷歌对这个错误绝对没有任何帮助,所以这是我在这里唯一的机会之一。

一些输出:

noneatme@noneatme-desktop:/etc/bluetooth$ sudo sdptool browse local
Failed to connect to SDP server on FF:FF:FF:00:00:00: Connection refused

Ubuntu 16.04

noneatme@noneatme-desktop:/etc/bluetooth$ uname -a
Linux noneatme-desktop 4.4.0-22-generic #40-Ubuntu SMP Thu May 12 22:03:46 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

noneatme@noneatme-desktop:/etc/bluetooth$ /usr/lib/bluetooth/bluetoothd -C
D-Bus setup failed: Connection ":1.129" is not allowed to own the service "org.bluez" due to security policies in the configuration file
(it works with sudo)
Run Code Online (Sandbox Code Playgroud)

使用 --compat 参数启动 Bluetoothd 不会解决问题。

我能做什么?

/edit:我通过以 sudo 身份启动统一远程服务器来解决这个问题。这真的是我唯一的选择吗?

小智 27

您需要在兼容模式下运行蓝牙守护程序以提供不推荐使用的命令行界面。您正在运行 Bluez5 并且需要一些 Bluez4 函数。你可以通过编辑这个文件来做到这一点

/etc/systemd/system/dbus-org.bluez.service 并改变这条线

ExecStart=/usr/lib/bluetooth/bluetoothd 对此

ExecStart=/usr/lib/bluetooth/bluetoothd --compat

然后像这样重新启动蓝牙

sudo systemctl daemon-reload
sudo systemctl restart bluetooth
Run Code Online (Sandbox Code Playgroud)

并且您还必须更改权限 /var/run/sdp

sudo chmod 777 /var/run/sdp
Run Code Online (Sandbox Code Playgroud)

最后重启统一远程服务器


小智 7

另一个解决方案:

编辑/etc/systemd/system/dbus-org.bluez.service:

ExecStart=/usr/lib/bluetooth/bluetoothd --compat
ExecStartPost=/bin/chmod 777 /var/run/sdp
Run Code Online (Sandbox Code Playgroud)

因为 /var/run/sdp 的权限似乎在每次重新启动时都会重置。