Skip to contentSkip to conversation

Object path last number

DISCUSSION [email protected] 2 participants 5 messages May 9, 2023

lore
Share & tools
lore
#0 lore raw

Hi,

I am trying to interface a dynamic dbus client to the IWD dbus interface for simple commands such as GetOrderedNetworks() or Scan().
The thing is that the object path of those methods starts with "/net/connman/iwd/" followed by the phy (I only have one interface so I guess it will be 0) and then a number.
As I want to be dynamic I try to restart iwd to try to observe a specific pattern in the last number of this object path. I have observe that this number is incremented by one at each restart of the iwd service. But I saw this number jumping (by 5 sometimes).

So I was wondering If I want to call the Scan method, how can I get the correct number for the object path dynamically ?

Thanks

Clément

Ce message et toutes les pieces jointes (ci-apres le "message") sont etablis a l'intention exclusive de ses destinataires.
Si vous recevez ce message par erreur, merci de le detruire et d'en avertir immediatement l'expediteur par e-mail.
Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. Les communications sur Internet n'etant pas securisees, l'expediteur informe qu'il ne peut accepter aucune responsabilite quant au contenu de ce message. This mail message and attachments (the "message") are solely intended for the addresses. It is confidential in nature.
If you receive this message in error, please delete it and immediately notify the sender by e-mail.
Any use other than its intended purpose, dissemination or disclosure, either whole or partial, is prohibited except if formal approval is granted. As communication on the Internet is not secure, the sender does not accept responsibility for the content of this message.

#1 lore raw

Hi Clement,

Quoted 8 lines · On 5/9/23 6:15 AM, [email protected] wrote:

Hi,

I am trying to interface a dynamic dbus client to the IWD dbus interface for simple commands such as GetOrderedNetworks() or Scan().
The thing is that the object path of those methods starts with "/net/connman/iwd/" followed by the phy (I only have one interface so I guess it will be 0) and then a number.
As I want to be dynamic I try to restart iwd to try to observe a specific pattern in the last number of this object path. I have observe that this number is incremented by one at each restart of the iwd service. But I saw this number jumping (by 5 sometimes).

So I was wondering If I want to call the Scan method, how can I get the correct number for the object path dynamically ?

The last number is actually the interface index, but the path itself isn't something you need to worry about deriving yourself. Instead you can use the org.freedesktop.DBus.ObjectManager interface and GetManagedObjects() method. This returns all the object paths and interfaces for IWD.

If your working with Python you can check out IWD's test framework as a guide:

https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/autotests/util/iwd.py#n1143

Thanks,
James

Quoted 13 lines

Thanks

Clément

Ce message et toutes les pieces jointes (ci-apres le "message") sont etablis a l'intention exclusive de ses destinataires.
Si vous recevez ce message par erreur, merci de le detruire et d'en avertir immediatement l'expediteur par e-mail.
Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. Les communications sur Internet n'etant pas securisees, l'expediteur informe qu'il ne peut accepter aucune responsabilite quant au contenu de ce message. This mail message and attachments (the "message") are solely intended for the addresses. It is confidential in nature.
If you receive this message in error, please delete it and immediately notify the sender by e-mail.
Any use other than its intended purpose, dissemination or disclosure, either whole or partial, is prohibited except if formal approval is granted. As communication on the Internet is not secure, the sender does not accept responsibility for the content of this message.

#2 lore raw

Thank you for your response.

Quoted 24 lines

Hi Clement,

Quoted 3 lines · On 5/9/23 6:15 AM, [email protected] wrote:

Hi,

I am trying to interface a dynamic dbus client to the IWD dbus interface

for simple commands such as GetOrderedNetworks() or Scan().

Quoted 1 line

The thing is that the object path of those methods starts with

"/net/connman/iwd/" followed by the phy (I only have one interface so I guess it will be 0) and then a number.

Quoted 1 line

As I want to be dynamic I try to restart iwd to try to observe a specific

pattern in the last number of this object path. I have observe that this number is incremented by one at each restart of the iwd service.

Quoted 3 lines

But I saw this number jumping (by 5 sometimes).

So I was wondering If I want to call the Scan method, how can I get the

correct number for the object path dynamically ?

The last number is actually the interface index, but the path itself isn't something you need to worry about deriving yourself. Instead you can use the org.freedesktop.DBus.ObjectManager interface and GetManagedObjects() method. This returns all the object paths and interfaces for IWD.

Quoted 4 lines

If your working with Python you can check out IWD's test framework as a guide:
https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/autotests/ut
il/iwd.py#n1143

I am working with C and glib and haven't found this interface. I use 1.26 version.
https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/autotests/util/iwd.py?h=1.26#n1034
There is the same call at GetManagedObjects() in 1.26 but I cannot find an equivalent method in C.

But :
By calling Introspect() on interface org.freedesktop.DBus.Introspectable() (object iwd/connman/iwd) I have found that it replies me with an XML that have the "under nodes" at the end of it So by iterating on it I will be able to get all the managed object from iwd.
Is this the only solution using C ?

Clément

Quoted 8 lines

Thanks,
James

Quoted 4 lines

Thanks

Clément

#3 lore raw

Hi Clement,

Quoted 32 lines · On 5/9/23 7:16 AM, [email protected] wrote:

Thank you for your response.

Quoted 24 lines

Hi Clement,

Quoted 3 lines · On 5/9/23 6:15 AM, [email protected] wrote:

Hi,

I am trying to interface a dynamic dbus client to the IWD dbus interface

for simple commands such as GetOrderedNetworks() or Scan().

Quoted 1 line

The thing is that the object path of those methods starts with

"/net/connman/iwd/" followed by the phy (I only have one interface so I guess it will be 0) and then a number.

Quoted 1 line

As I want to be dynamic I try to restart iwd to try to observe a specific

pattern in the last number of this object path. I have observe that this number is incremented by one at each restart of the iwd service.

Quoted 3 lines

But I saw this number jumping (by 5 sometimes).

So I was wondering If I want to call the Scan method, how can I get the

correct number for the object path dynamically ?

The last number is actually the interface index, but the path itself isn't something you need to worry about deriving yourself. Instead you can use the org.freedesktop.DBus.ObjectManager interface and GetManagedObjects() method. This returns all the object paths and interfaces for IWD.

Quoted 4 lines

If your working with Python you can check out IWD's test framework as a guide:
https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/autotests/ut
il/iwd.py#n1143

Quoted 8 lines

I am working with C and glib and haven't found this interface. I use 1.26 version.
https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/autotests/util/iwd.py?h=1.26#n1034
There is the same call at GetManagedObjects() in 1.26 but I cannot find an equivalent method in C.

But :
By calling Introspect() on interface org.freedesktop.DBus.Introspectable() (object iwd/connman/iwd) I have found that it replies me with an XML that have the "under nodes" at the end of it So by iterating on it I will be able to get all the managed object from iwd.
Is this the only solution using C ?

You shouldn't need to call Introspect(). You can just get the object manager interface under the root path '/' and that should have the GetManagedObjects() method. We do this in iwctl using ELL, but it should be somewhat similar to GLib:

https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/client/dbus-proxy.c#n770

Thanks,
James

Quoted 11 lines

Clément

Quoted 8 lines

Thanks,
James

Quoted 4 lines

Thanks

Clément

#4 lore raw

Thank you !

Quoted 59 lines

Hi Clement,

Quoted 30 lines · On 5/9/23 7:16 AM, [email protected] wrote:

Thank you for your response.

Quoted 27 lines

Hi Clement,

Quoted 4 lines · On 5/9/23 6:15 AM, [email protected] wrote:

Hi,

I am trying to interface a dynamic dbus client to the IWD dbus interface

for simple commands such as GetOrderedNetworks() or Scan().

Quoted 1 line

The thing is that the object path of those methods starts with

"/net/connman/iwd/" followed by the phy (I only have one interface so I guess it will be 0) and then a number.

Quoted 2 lines

As I want to be dynamic I try to restart iwd to try to observe a specific

pattern in the last number of this object path. I have observe that this number is incremented by one at each restart of the iwd service.

Quoted 4 lines

But I saw this number jumping (by 5 sometimes).

So I was wondering If I want to call the Scan method, how can I get the

correct number for the object path dynamically ?

The last number is actually the interface index, but the path itself isn't something you need to worry about deriving yourself. Instead you can use the org.freedesktop.DBus.ObjectManager interface and GetManagedObjects() method. This returns all the object paths and interfaces for IWD.

Quoted 8 lines
Quoted 6 lines

If your working with Python you can check out IWD's test framework as a
guide:
https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/autotest
s/ut
il/iwd.py#n1143

I am working with C and glib and haven't found this interface. I use 1.26

version.

Quoted 7 lines

https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/autotests
/util/iwd.py?h=1.26#n1034 There is the same call at GetManagedObjects() in 1.26 but I cannot find an equivalent method in C.

But :
By calling Introspect() on interface org.freedesktop.DBus.Introspectable() (object iwd/connman/iwd) I have

found that it replies me with an XML that have the "under nodes" at the end of it So by iterating on it I will be able to get all the managed object from iwd.

Quoted 1 line

Is this the only solution using C ?

You shouldn't need to call Introspect(). You can just get the object manager interface under the root path '/' and that should have the GetManagedObjects() method. We do this in iwctl using ELL, but it should be somewhat similar to GLib:

Quoted 16 lines

https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/client/dbus-
proxy.c#n770

Thanks,
James

Quoted 11 lines

Clément

Quoted 8 lines

Thanks,
James

Quoted 4 lines

Thanks

Clément

Clément