0

在 openbmc 上工作,并试图通过 busctl 创建一个日志条目。我看到 Create 调用需要 ssa{ss}:

# busctl introspect xyz.openbmc_project.Logging
/xyz/openbmc_project/logging xyz.openbmc_project.Logging.Create      
interface -              -             - .Create                      
method    ssa{ss}        -             -

但是,我拨打电话的尝试失败了:

# busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging xyz.openbmc_project.Logging.Create Create ssa{ss} 1 "This is a Test" "xyz.openbmc_project.Logging.Entry.Level.Error" "ARG1" "ARG2"
Failed to parse 'xyz.openbmc_project.Logging.Entry.Level.Error' number of array entries: Invalid argument

猜测问题与参数的格式有关。有任何想法吗?

4

1 回答 1

0

我没有openbmc,所以我无法对此进行测试,但是您的陈述可能有一些问题。

后面的数字ssa{ss}是指数组的长度,所以我认为它在错误的位置。我希望它在两个字符串之后("This is a Test""xyz.openbmc_project.Logging.Entry.Level.Error"你的例子中)

例如

busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging xyz.openbmc_project.Logging.Create Create ssa{ss} "This is a Test" "xyz.openbmc_project.Logging.Entry.Level.Error" 1 "ARG1" "ARG2"

我在https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Logging/Create.interface.yaml#L7找到了我认为的文档

"ARG1"如果and "ARG2"were "KEY1"and ,您的示例可能会更清楚"VALUE1"。我认为如果您有两个键/值对,以下情况将是正确的:

busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging xyz.openbmc_project.Logging.Create Create ssa{ss} "This is a Test" "xyz.openbmc_project.Logging.Entry.Level.Error" 2 "KEY1" "VALUE1" "KEY2" "VALUE2"

使用 busctl 时,我总是需要一些试验和错误才能得到正确的结果。在另一个正在运行的终端中,dbus-monitor有时可能有助于调试。

于 2020-09-23T07:00:20.317 回答