Search code examples
dbus

How to set a variant array with dbus-send?


making this query:

dbus-send --system --print-reply --dest=org.ofono /he910_0 org.ofono.ConnectionManager.GetContexts

I get the following structure:

array [
  struct {
     object path "/he910_0/context1"
     array [
         dict entry(
           string "AccessPointName"
           variant                   string "mobile.vodafone.it"
        )
       ....
        dict entry(
           string "Settings"
           variant                   array [
              ]
        )
     ]
  }

I'd like to set "Settings" property with dbus-send messages. I tried with:

dbus-send --system --print-reply --dest=org.ofono /he910_0/context1 org.ofono.ConnectionContext.SetProperty string:"Settings" variant:array:string:"Interface=ppp0","Method=dhcp" 

But I receive:

dbus-send: Unknown type "array"

So, the final question is: how to set a variant array through dbus-send ?


Solution

  • You can't do this with dbus-send, but you might be able to do what you want with the quite similar tool gdbus. See how to use parameters signature as "a{sv}" in dbus-send