iwd.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* Object path last number
@ 2023-05-09 13:15 clement.legoffic
  2023-05-09 13:57 ` James Prestwood
  0 siblings, 1 reply; 5+ messages in thread
From: clement.legoffic @ 2023-05-09 13:15 UTC (permalink / raw)
  To: iwd

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Object path last number
  2023-05-09 13:15 Object path last number clement.legoffic
@ 2023-05-09 13:57 ` James Prestwood
  2023-05-09 14:16   ` clement.legoffic
  0 siblings, 1 reply; 5+ messages in thread
From: James Prestwood @ 2023-05-09 13:57 UTC (permalink / raw)
  To: clement.legoffic, iwd

Hi Clement,

On 5/9/23 6:15 AM, clement.legoffic@kelio.com 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

> 
> 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.
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Object path last number
  2023-05-09 13:57 ` James Prestwood
@ 2023-05-09 14:16   ` clement.legoffic
  2023-05-09 14:25     ` James Prestwood
  0 siblings, 1 reply; 5+ messages in thread
From: clement.legoffic @ 2023-05-09 14:16 UTC (permalink / raw)
  To: James Prestwood, iwd


Thank you for your response.

>Hi Clement,
> 
> On 5/9/23 6:15 AM, clement.legoffic@kelio.com 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/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

> 
> Thanks,
> James
> 
> >
> > Thanks
> >
> > Clément

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Object path last number
  2023-05-09 14:16   ` clement.legoffic
@ 2023-05-09 14:25     ` James Prestwood
  2023-05-09 14:40       ` clement.legoffic
  0 siblings, 1 reply; 5+ messages in thread
From: James Prestwood @ 2023-05-09 14:25 UTC (permalink / raw)
  To: clement.legoffic, iwd

Hi Clement,

On 5/9/23 7:16 AM, clement.legoffic@kelio.com wrote:
> 
> Thank you for your response.
> 
>> Hi Clement,
>>
>> On 5/9/23 6:15 AM, clement.legoffic@kelio.com 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/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 ?

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
> 
> Clément
> 
>>
>> Thanks,
>> James
>>
>>>
>>> Thanks
>>>
>>> Clément

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Object path last number
  2023-05-09 14:25     ` James Prestwood
@ 2023-05-09 14:40       ` clement.legoffic
  0 siblings, 0 replies; 5+ messages in thread
From: clement.legoffic @ 2023-05-09 14:40 UTC (permalink / raw)
  To: James Prestwood, iwd

Thank you !

> Hi Clement,
> 
> On 5/9/23 7:16 AM, clement.legoffic@kelio.com wrote:
> >
> > Thank you for your response.
> >
> >> Hi Clement,
> >>
> >> On 5/9/23 6:15 AM, clement.legoffic@kelio.com 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/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.
> > 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
> >
> > Clément
> >
> >>
> >> Thanks,
> >> James
> >>
> >>>
> >>> Thanks
> >>>
> >>> Clément

Clément

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-09 14:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-09 13:15 Object path last number clement.legoffic
2023-05-09 13:57 ` James Prestwood
2023-05-09 14:16   ` clement.legoffic
2023-05-09 14:25     ` James Prestwood
2023-05-09 14:40       ` clement.legoffic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).