node-dbus icon indicating copy to clipboard operation
node-dbus copied to clipboard

a{ s: Key → a{sv}: Value } not parsed correctly

Open JumpLink opened this issue 10 years ago • 6 comments

I'm working on a dbus wrapper for the NetworkManager using your dbus module, but I can't update my NetworkManager Settings. This is the interface I use: org.freedesktop.NetworkManager.Settings.Connection, when I try to call the Update method I get this error: "[Error: org.freedesktop.NetworkManager.Settings.Connection.MissingProperty]" but I give the function the same proterties I was getting with GetSettings.

See my test script for more information. See L40 for the error message I get. A similar script written in python works fine.

This is the mapping type: String_String_Variant_Map_Map - a{ s: Key → a{sv}: Value }

This is the output of my test script:

{ '802-11-wireless': 
   { security: '802-11-wireless-security',
     ssid: 
      [ 68,
        114,
        45,
        90,
        97,
        104,
        110,
        45,
        71,
        97,
        115,
        116,
        122,
        117,
        103,
        97,
        110,
        103 ],
     mode: 'infrastructure',
     'mac-address': 
      [ 120,
        146,
        156,
        9,
        247,
        250 ] },
  connection: 
   { id: 'Dr-Zahn-Gastzugang',
     uuid: 'd4d7ec60-98ed-4b43-9bc8-a541e1021bb3',
     type: '802-11-wireless' },
  ipv4: { addresses: [], dns: [], method: 'auto', routes: [] },
  '802-11-wireless-security': 
   { 'auth-alg': 'open',
     'key-mgmt': 'wpa-psk' },
  ipv6: { addresses: [], dns: [], method: 'auto', routes: [] } }


[Error: org.freedesktop.NetworkManager.Settings.Connection.MissingProperty]

JumpLink avatar Jul 19 '14 12:07 JumpLink

I don't use NetworkManager, so I have no environment to test.

could you provide correct data structure? It's good to compare and debug for me.

cfsghost avatar Jul 20 '14 01:07 cfsghost

Okay, now with the help of dbus-monitor I found out what the complete error message was and was able to identify the values ​​that operate incorrectly: I can't set the value: Settings.ipv4.addresses = [ [515025088, 24, 28485824] ]; Addresses is an array of arrays of UINT32, addresses can have multiple address tuples: [(addr, prefix, gateway), (addr, prefix, gateway), ...]

And I can't set the value: Settings['802-11-wireless'].ssid = [ 74, 117, 109, 112, 76, 105, 110, 107 ]; Ssid is a array of BYTE, In this case for the string "JumpLink".

Here an example that works without errors:

settings = {
  'connection' : {
    uuid: 'ed23c3bc-63a9-408c-826f-c1318f61088b',
    type: '802-3-ethernet',
    id: 'Bugwelder',
  },
  '802-3-ethernet': { 's390-options': {}, duplex: 'full' },
  'ipv4': {
    addresses: [],
    dns: [],
    method: 'auto',
    routes: []
  },
}

And this works not, error : "Missing Property: addresses"

settings = {
  'connection' : {
    uuid: 'ed23c3bc-63a9-408c-826f-c1318f61088b',
    type: '802-3-ethernet',
    id: 'Bugwelder',
  },
  '802-3-ethernet': { 's390-options': {}, duplex: 'full' },
  'ipv4': {
    addresses: [ [515025088, 24, 28485824] ],
    dns: [],
    method: 'manual',
    routes: []
  },
}

And this works not, too. Error: "Missing Property: ssid"

settings = {
  connection: {
    id: 'JumpLink',
    uuid: '58161f27-0366-4b88-b975-5d107603f89e',
    type: '802-11-wireless'
  },
  '802-11-wireless': {
    ssid: [ 74, 117, 109, 112, 76, 105, 110, 107 ],
    [...]
  },
  [...]
}

JumpLink avatar Jul 22 '14 07:07 JumpLink

Your module has parsed addresses = [ [515025088, 24, 28485824] ] to the dbus signature aii but it must be auu. I have changed your code, so that it is parsed to auu (see pull request #76 ), but the error is the same: Missing Property: addresses strange .. any idea?

JumpLink avatar Jul 22 '14 10:07 JumpLink

I want to pass a parameter and it's type is Struct of (String, Dict of {String, Variant}) - (sa {sv}), may I ask how to pass Senate

var subject = {
            'unix-process':
            {
                'pid': process.pid,
                'start-time': 0
            }
        };

this is my parameter, but err

wpp2014 avatar Aug 12 '15 01:08 wpp2014

I am also having issues with a JS stack trace being passed back as the error. The signature is a(ayuay) Array of ipv6 address structs. Is this possible with this library?

richguernsey avatar Jul 02 '18 17:07 richguernsey

@JumpLink wrote:

I can't set the value: Settings['802-11-wireless'].ssid = [ 74, 117, 109, 112, 76, 105, 110, 107 ]; Ssid is a array of BYTE, In this case for the string "JumpLink".

I think I may be experiencing the same problem in #228

Did you figure out how to do this?

Thanks

benfrancis avatar Mar 02 '21 19:03 benfrancis