调用 RegisterProfile 时出现 org.freedesktop.DBus.Error.UnknownMethod 错误

Posted

技术标签:

【中文标题】调用 RegisterProfile 时出现 org.freedesktop.DBus.Error.UnknownMethod 错误【英文标题】:Getting org.freedesktop.DBus.Error.UnknownMethod error on calling RegisterProfile 【发布时间】:2018-04-20 16:49:55 【问题描述】:

我正在尝试使用 bluetoothctl (bluez5.42) 注册配置文件。 我运行 bluetoothctl 如下:

bluez-5.42/dev/client# ./bluetoothctl 
[NEW] Controller 00:50:43:22:29:D9 pe-lt571-0 [default]
[bluetooth]# register-profile 00000017-0000-1000-8000-00805f9
Failed to register profile: org.freedesktop.DBus.Error.UnknownMethod

只是补充一下,我在 Linux 内核 4.4 上。 在开始 bluetoothctl 之前,我已经运行了 bluetoothd。 另外,我检查了使用 d-feet 做同样的事情,我得到了同样的错误。

为什么会出现未知方法错误?是设置问题吗?

我在 dbus 监视器上得到以下信息

method call sender=:1.89 -> dest=org.bluez serial=20 path=/org/bluez/hci0; interface=org.bluez.GattManager1; member=RegisterProfile
   object path "/org/bluez/profile"
   array [
      string "00000100-0000-1000-8000-00805f9"
   ]
   array [
   ]

【问题讨论】:

【参考方案1】:

org.bluez.GattManager1 DBus 接口上没有名为 RegisterProfile 的方法。它是 bluez-5.42 的 bluetoothctl 代码中的一个错误,已在 bluez-5.46 中修复。 RegisterProfile 方法在 org.bluez.ProfileManager1 接口上。

从 bluez-5.46 和更高版本的带有 bluetoothctl 的注册配置文件不存在。如果要注册蓝牙配置文件,请查看 bluez 源目录中的 test/test-hfp python 脚本。它展示了如何在 org.bluez.ProfileManager1 上使用 RegisterProfile 方法。另请参阅 doc/profile-api.txt 以了解此接口上可用的方法。

或者如果您想注册 GATT 服务,请参阅 bluez 源中的 test/test-gatt-profile python 脚本和 doc/gatt-api.txt。

【讨论】:

感谢拉维。实际上我使用了 gatt-services.c 中的 RegisterApplication

以上是关于调用 RegisterProfile 时出现 org.freedesktop.DBus.Error.UnknownMethod 错误的主要内容,如果未能解决你的问题,请参考以下文章

注册时出现password cannot include a common word or phrase 怎么解决

批量删除联系人时出现“If-Match or If-None-Match header or entry etag attribute required”错误

运行matlab时出现这个错误。是啥意思Error: Missing operator, comma, or semicolon.

安装torch7时出现致命错误:errno.h: No such file or directory

执行shell时出现No such file or directory问题

执行shell时出现No such file or directory问题