Re: Managing a connection using D-Bus API



On Fri, Jul 2, 2010 at 03:19, Ozan Çağlayan <ozan pardus org tr> wrote:
> Oops the problem was during the activation of a given connection not
> deactivation. For deactivation, we're doing exactly what you suggested.
>
> This is the code snippet I'm talking about. It'll give an error when
> mac_address is None.
>
>    def set_profile_state_up(nm_handle, profile):
>        for conn in nm_handle.connections:
>            if conn.settings.id == profile:
>                for device in nm_handle.devices:
>                    if device.hwaddress == conn.settings.mac_address:
>                        nm_handle.activate_connection(conn, device)
>
> We've also looked at nm-applet. Apparently it lists all the available
> connections for a specific type under all the specific device so I don't
> expect a solution to be available but you may have some good suggestions.
>
> Thanks.
>
>
> ---
> Ozan Çağlayan
> TUBITAK/UEKAE - Pardus Linux
> http://www.pardus.org.tr/eng
>

Ah I see the issue. One is that a connection doesn't need to have a
device associated with it, only a type. Also not all device types have
a mac address (cdma modems come to mind). If a connection doesn't have
a mac address it's good for all devices of the right type. There's
also a get_connections_by_id() so you don't need to loop.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]