Re: Creating adhoc wireless Network

2009-07-15 Thread nexus
> On Mon, 2009-07-13 at 04:37 -0400, ne...@aflb.com wrote:
>> OK rewritting all the stuff into my little class, I got another issue
>> now :)
>>
>> I'm using The Delete Call from NetworkManagerSettings.Connection
>> Interface.
>>
>> All is going like a charm EXCEPT : I got still the entry in NM but it
>> does'nt exist anymore on the system.
>> Maybe a refresh is missing somewhere.
>>
>> So, the pont is, how to tell to nm-applet to refresh the list of
>> connection that exists ?
>
> What version of nm-applet again?  If you're using 0.7.0, you'll want to
> make sure you have commit
>
> f9142e838c764fbe70a5ec9f18894bbb78e0dbe4
>
> (bgo #557590)
>
> Dan


Dan,

Name: NetworkManager-gnome Relocations: (not relocatable)
Version : 0.7.0.r1053   Vendor: SUSE LINUX
Products GmbH, Nuernberg, Germany
Release : 11.7  Build Date: jeu. 26 févr. 2009
16:30:41 CET
Install Date: ven. 03 juil. 2009 12:16:10 CEST  Build Host: albeniz
Group   : System/GUI/GNOME  Source RPM:
NetworkManager-gnome-0.7.0.r1053-11.7.src.rpm
Size: 2343233  License: GPL v2 or later
Signature   : RSA/8, jeu. 26 févr. 2009 16:30:56 CET, Key ID e3a5c360307e3d54
Packager: http://bugs.opensuse.org
URL : http://www.gnome.org/projects/NetworkManager/
Summary : GNOME applications for use with NetworkManager
Description :
This package contains GNOME utilities and applications for use with
NetworkManager, including a panel applet for wireless networks.


The latest entry in changelog is :

* ven. févr. 20 2009 tam...@novell.com
- Yet some more DBus permission fixes (bnc #478080).

There's no bgo #557590.

Is there a workaround ? I see that if I disable the wireless and next
enable it, all the "non-existent" entries are flushed.

Thanks


>
>> Thanks
>>
>>
>> > On Tue, 2009-07-07 at 03:54 -0400, ne...@aflb.com wrote:
>> >> > On Mon, 2009-07-06 at 11:18 -0400, ne...@aflb.com wrote:
>> >> >> Hi Dan,
>> >> >>
>> >> >> I'm playing with the script you provide me but I have a problem :
>> >> >>
>> >> >> File "Create_Wireless.py", line 135, in 
>> >> >> if props['DeviceType'] == 2:   # wifi
>> >> >> KeyError: 'DeviceType'
>> >> >>
>> >> >> if I execute step by steps :
>> >> >>
>> >> >> >>> print nm_iface.GetDevices()
>> >> >> dbus.Array([dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_24_81_56_2e_52'),
>> >> >> dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')],
>> >> >> signature=dbus.Signature('o'))
>> >> >> >>> dev_proxy =
>> >> >> sys_bus.get_object('org.freedesktop.NetworkManager','/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')
>> >> >> >>> print dev_proxy
>> >> >> > 0xb7a5811c>
>> >> :1.7
>> >> >> /org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a at 0xb7a5a80c>
>> >> >> >>> dev_props_iface = dbus.Interface(dev_proxy,
>> >> >> 'org.freedesktop.DBus.Properties')
>> >> >> >>> print dev_props_iface
>> >> >> > >> >> 0xb7a5811c> :1.7
>> /org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a
>> >> at
>> >> >> 0xb7a5a80c> implementing 'org.freedesktop.DBus.Properties' at
>> >> >> 0xb7a5a9ac>
>> >> >> >>> print
>> >> >> dev_props_iface.GetAll('org.freedesktop.NetworkManager.Device')
>> >> >> dbus.Dictionary({}, signature=dbus.Signature('sv'))
>> >> >>
>> >> >> It seems empty ! What's wrong ?
>> >> >
>> >> > What version of dbus-glib do you have?  What does 'nm-tool' print
>> out
>> >> > when you run it?
>> >> >
>> >> > Dan
>> >> >
>> >>
>> >> Version provided by SLED11
>> >>
>> >> dbus-1-glib-0.76-34.3
>> >
>> > Ok, that's not quite new enough, anything < 0.77 has a bug with GetAll
>> > that causes properties to not be found.  The commit in question is:
>> >
>> > d1b80d803a0268bd4b3dd5b9a9522230461f2947
>> >
>> > Author: Dan Williams   2008-06-05 17:57:53
>> > Committer: Colin Walters   2008-06-05 17:57:53
>> > Follows: dbus-glib_0.76
>> > Precedes: dbus-glib_0.78
>> >
>> > Bug 16114 [patch] wincaps-to-uscore property names for GetAll()
>> >
>> >* dbus/dbus-gobject.c: We need to uscore property names
>> >so that we actually find the right properties.
>> >
>> >
>> > but, the good news is that you could do:
>> >
>> > dbus_props_iface.Get('org.freedesktop.NetworkManager.Device',
>> '> > name>')
>> >
>> > and get the properties you care about individually instead of all of
>> > them at once.  Somewhat less efficient, but it'll work.
>> >
>> > Dan
>> >
>> >> dbus-1-1.2.10-3.9.1
>> >> dbus-1-python-0.83.0-22.10
>> >>
>> >> nm-tool print the two interfaces with parameters :
>> >>
>> >> NetworkManager Tool
>> >>
>> >> State: connected
>> >>
>> >> - Device: eth0
>> >> 
>> >>   Type:  Wired
>> >>   Driver:tg3
>> >>   State: connected
>> >>   Default:   yes
>> >>   HW Address:00:24:81:56:2E:52
>> >>
>> >>   Capabilities:
>> >> Supported:   yes
>> >> Carrier Detec

Re: Creating adhoc wireless Network

2009-07-13 Thread Dan Williams
On Mon, 2009-07-13 at 04:37 -0400, ne...@aflb.com wrote:
> OK rewritting all the stuff into my little class, I got another issue now :)
> 
> I'm using The Delete Call from NetworkManagerSettings.Connection Interface.
> 
> All is going like a charm EXCEPT : I got still the entry in NM but it
> does'nt exist anymore on the system.
> Maybe a refresh is missing somewhere.
> 
> So, the pont is, how to tell to nm-applet to refresh the list of
> connection that exists ?

What version of nm-applet again?  If you're using 0.7.0, you'll want to
make sure you have commit

f9142e838c764fbe70a5ec9f18894bbb78e0dbe4

(bgo #557590)

Dan


> Thanks
> 
> 
> > On Tue, 2009-07-07 at 03:54 -0400, ne...@aflb.com wrote:
> >> > On Mon, 2009-07-06 at 11:18 -0400, ne...@aflb.com wrote:
> >> >> Hi Dan,
> >> >>
> >> >> I'm playing with the script you provide me but I have a problem :
> >> >>
> >> >> File "Create_Wireless.py", line 135, in 
> >> >> if props['DeviceType'] == 2:   # wifi
> >> >> KeyError: 'DeviceType'
> >> >>
> >> >> if I execute step by steps :
> >> >>
> >> >> >>> print nm_iface.GetDevices()
> >> >> dbus.Array([dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_24_81_56_2e_52'),
> >> >> dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')],
> >> >> signature=dbus.Signature('o'))
> >> >> >>> dev_proxy =
> >> >> sys_bus.get_object('org.freedesktop.NetworkManager','/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')
> >> >> >>> print dev_proxy
> >> >> 
> >> :1.7
> >> >> /org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a at 0xb7a5a80c>
> >> >> >>> dev_props_iface = dbus.Interface(dev_proxy,
> >> >> 'org.freedesktop.DBus.Properties')
> >> >> >>> print dev_props_iface
> >> >>  >> >> 0xb7a5811c> :1.7 /org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a
> >> at
> >> >> 0xb7a5a80c> implementing 'org.freedesktop.DBus.Properties' at
> >> >> 0xb7a5a9ac>
> >> >> >>> print
> >> >> dev_props_iface.GetAll('org.freedesktop.NetworkManager.Device')
> >> >> dbus.Dictionary({}, signature=dbus.Signature('sv'))
> >> >>
> >> >> It seems empty ! What's wrong ?
> >> >
> >> > What version of dbus-glib do you have?  What does 'nm-tool' print out
> >> > when you run it?
> >> >
> >> > Dan
> >> >
> >>
> >> Version provided by SLED11
> >>
> >> dbus-1-glib-0.76-34.3
> >
> > Ok, that's not quite new enough, anything < 0.77 has a bug with GetAll
> > that causes properties to not be found.  The commit in question is:
> >
> > d1b80d803a0268bd4b3dd5b9a9522230461f2947
> >
> > Author: Dan Williams   2008-06-05 17:57:53
> > Committer: Colin Walters   2008-06-05 17:57:53
> > Follows: dbus-glib_0.76
> > Precedes: dbus-glib_0.78
> >
> > Bug 16114 [patch] wincaps-to-uscore property names for GetAll()
> >
> > * dbus/dbus-gobject.c: We need to uscore property names
> > so that we actually find the right properties.
> >
> >
> > but, the good news is that you could do:
> >
> > dbus_props_iface.Get('org.freedesktop.NetworkManager.Device', ' > name>')
> >
> > and get the properties you care about individually instead of all of
> > them at once.  Somewhat less efficient, but it'll work.
> >
> > Dan
> >
> >> dbus-1-1.2.10-3.9.1
> >> dbus-1-python-0.83.0-22.10
> >>
> >> nm-tool print the two interfaces with parameters :
> >>
> >> NetworkManager Tool
> >>
> >> State: connected
> >>
> >> - Device: eth0
> >> 
> >>   Type:  Wired
> >>   Driver:tg3
> >>   State: connected
> >>   Default:   yes
> >>   HW Address:00:24:81:56:2E:52
> >>
> >>   Capabilities:
> >> Supported:   yes
> >> Carrier Detect:  yes
> >> Speed:   100 Mb/s
> >>
> >>   Wired Settings
> >>
> >>   IPv4 Settings:
> >> Address: 10.82.109.86
> >> Prefix:  24 (255.255.255.0)
> >> Gateway: 10.82.109.254
> >>
> >> DNS: 10.82.161.3
> >> DNS: 10.68.161.3
> >>
> >>
> >> - Device: eth1
> >> 
> >>   Type:  802.11 WiFi
> >>   Driver:iwlagn
> >>   State: connected
> >>   Default:   no
> >>   HW Address:00:22:FA:46:76:9A
> >>
> >>   Capabilities:
> >> Supported:   yes
> >>
> >>   Wireless Settings
> >> WEP Encryption:  yes
> >> WPA Encryption:  yes
> >> WPA2 Encryption: yes
> >>
> >>   Wireless Access Points(* = Current AP)
> >> TESTIPSL:Infra, 00:03:2F:1D:61:BF, Freq 2437 MHz, Rate 54
> >> Mb/s, Strength 79 WEP
> >> *iSync:  Ad-Hoc, D6:08:0C:12:06:49, Freq 2412 MHz, Rate 0
> >> Mb/s, Strength 0
> >>
> >>   IPv4 Settings:
> >> Address: 10.42.44.1
> >> Prefix:  24 (255.255.255.0)
> >> Gateway: 0.0.0.0
> >>
> >>
> >> >> Thanks
> >> >>
> >> >>
> >> >> > On Wed, 2009-07-01 at 12:28 -0400, Dan Williams wrote:
> >> >> >> On Wed, 2009-07-01 at 11:26 -0400, ne...@aflb.com wrote:
> >> >> >

Re: Creating adhoc wireless Network

2009-07-13 Thread nexus
OK rewritting all the stuff into my little class, I got another issue now :)

I'm using The Delete Call from NetworkManagerSettings.Connection Interface.

All is going like a charm EXCEPT : I got still the entry in NM but it
does'nt exist anymore on the system.
Maybe a refresh is missing somewhere.

So, the pont is, how to tell to nm-applet to refresh the list of
connection that exists ?

Thanks


> On Tue, 2009-07-07 at 03:54 -0400, ne...@aflb.com wrote:
>> > On Mon, 2009-07-06 at 11:18 -0400, ne...@aflb.com wrote:
>> >> Hi Dan,
>> >>
>> >> I'm playing with the script you provide me but I have a problem :
>> >>
>> >> File "Create_Wireless.py", line 135, in 
>> >> if props['DeviceType'] == 2:   # wifi
>> >> KeyError: 'DeviceType'
>> >>
>> >> if I execute step by steps :
>> >>
>> >> >>> print nm_iface.GetDevices()
>> >> dbus.Array([dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_24_81_56_2e_52'),
>> >> dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')],
>> >> signature=dbus.Signature('o'))
>> >> >>> dev_proxy =
>> >> sys_bus.get_object('org.freedesktop.NetworkManager','/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')
>> >> >>> print dev_proxy
>> >> 
>> :1.7
>> >> /org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a at 0xb7a5a80c>
>> >> >>> dev_props_iface = dbus.Interface(dev_proxy,
>> >> 'org.freedesktop.DBus.Properties')
>> >> >>> print dev_props_iface
>> >> > >> 0xb7a5811c> :1.7 /org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a
>> at
>> >> 0xb7a5a80c> implementing 'org.freedesktop.DBus.Properties' at
>> >> 0xb7a5a9ac>
>> >> >>> print
>> >> dev_props_iface.GetAll('org.freedesktop.NetworkManager.Device')
>> >> dbus.Dictionary({}, signature=dbus.Signature('sv'))
>> >>
>> >> It seems empty ! What's wrong ?
>> >
>> > What version of dbus-glib do you have?  What does 'nm-tool' print out
>> > when you run it?
>> >
>> > Dan
>> >
>>
>> Version provided by SLED11
>>
>> dbus-1-glib-0.76-34.3
>
> Ok, that's not quite new enough, anything < 0.77 has a bug with GetAll
> that causes properties to not be found.  The commit in question is:
>
> d1b80d803a0268bd4b3dd5b9a9522230461f2947
>
> Author: Dan Williams   2008-06-05 17:57:53
> Committer: Colin Walters   2008-06-05 17:57:53
> Follows: dbus-glib_0.76
> Precedes: dbus-glib_0.78
>
> Bug 16114 [patch] wincaps-to-uscore property names for GetAll()
>
>   * dbus/dbus-gobject.c: We need to uscore property names
>   so that we actually find the right properties.
>
>
> but, the good news is that you could do:
>
> dbus_props_iface.Get('org.freedesktop.NetworkManager.Device', ' name>')
>
> and get the properties you care about individually instead of all of
> them at once.  Somewhat less efficient, but it'll work.
>
> Dan
>
>> dbus-1-1.2.10-3.9.1
>> dbus-1-python-0.83.0-22.10
>>
>> nm-tool print the two interfaces with parameters :
>>
>> NetworkManager Tool
>>
>> State: connected
>>
>> - Device: eth0
>> 
>>   Type:  Wired
>>   Driver:tg3
>>   State: connected
>>   Default:   yes
>>   HW Address:00:24:81:56:2E:52
>>
>>   Capabilities:
>> Supported:   yes
>> Carrier Detect:  yes
>> Speed:   100 Mb/s
>>
>>   Wired Settings
>>
>>   IPv4 Settings:
>> Address: 10.82.109.86
>> Prefix:  24 (255.255.255.0)
>> Gateway: 10.82.109.254
>>
>> DNS: 10.82.161.3
>> DNS: 10.68.161.3
>>
>>
>> - Device: eth1
>> 
>>   Type:  802.11 WiFi
>>   Driver:iwlagn
>>   State: connected
>>   Default:   no
>>   HW Address:00:22:FA:46:76:9A
>>
>>   Capabilities:
>> Supported:   yes
>>
>>   Wireless Settings
>> WEP Encryption:  yes
>> WPA Encryption:  yes
>> WPA2 Encryption: yes
>>
>>   Wireless Access Points(* = Current AP)
>> TESTIPSL:Infra, 00:03:2F:1D:61:BF, Freq 2437 MHz, Rate 54
>> Mb/s, Strength 79 WEP
>> *iSync:  Ad-Hoc, D6:08:0C:12:06:49, Freq 2412 MHz, Rate 0
>> Mb/s, Strength 0
>>
>>   IPv4 Settings:
>> Address: 10.42.44.1
>> Prefix:  24 (255.255.255.0)
>> Gateway: 0.0.0.0
>>
>>
>> >> Thanks
>> >>
>> >>
>> >> > On Wed, 2009-07-01 at 12:28 -0400, Dan Williams wrote:
>> >> >> On Wed, 2009-07-01 at 11:26 -0400, ne...@aflb.com wrote:
>> >> >> > Thanks for this quick answer.
>> >> >> >
>> >> >> > That's what I though. Adding a new connection isnot easy to
>> do...
>> >> >> >
>> >> >> > when you say "programmatically ask the system settings service
>> to
>> >> >> create it"
>> >> >> >
>> >> >> > What do you mean ? Doing the same stuff as nm-applet but
>> hardcoded
>> >> ?
>> >> >>
>> >> >> Same way nm-connection-editor asks the system settings service to
>> >> create
>> >> >> a new connection when the user hits "Apply": you call the
>> >> >> AddConnection() method on 

Re: Creating adhoc wireless Network

2009-07-07 Thread Dan Williams
On Tue, 2009-07-07 at 03:54 -0400, ne...@aflb.com wrote:
> > On Mon, 2009-07-06 at 11:18 -0400, ne...@aflb.com wrote:
> >> Hi Dan,
> >>
> >> I'm playing with the script you provide me but I have a problem :
> >>
> >> File "Create_Wireless.py", line 135, in 
> >> if props['DeviceType'] == 2:   # wifi
> >> KeyError: 'DeviceType'
> >>
> >> if I execute step by steps :
> >>
> >> >>> print nm_iface.GetDevices()
> >> dbus.Array([dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_24_81_56_2e_52'),
> >> dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')],
> >> signature=dbus.Signature('o'))
> >> >>> dev_proxy =
> >> sys_bus.get_object('org.freedesktop.NetworkManager','/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')
> >> >>> print dev_proxy
> >>  :1.7
> >> /org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a at 0xb7a5a80c>
> >> >>> dev_props_iface = dbus.Interface(dev_proxy,
> >> 'org.freedesktop.DBus.Properties')
> >> >>> print dev_props_iface
> >>  >> 0xb7a5811c> :1.7 /org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a at
> >> 0xb7a5a80c> implementing 'org.freedesktop.DBus.Properties' at
> >> 0xb7a5a9ac>
> >> >>> print
> >> dev_props_iface.GetAll('org.freedesktop.NetworkManager.Device')
> >> dbus.Dictionary({}, signature=dbus.Signature('sv'))
> >>
> >> It seems empty ! What's wrong ?
> >
> > What version of dbus-glib do you have?  What does 'nm-tool' print out
> > when you run it?
> >
> > Dan
> >
> 
> Version provided by SLED11
> 
> dbus-1-glib-0.76-34.3

Ok, that's not quite new enough, anything < 0.77 has a bug with GetAll
that causes properties to not be found.  The commit in question is:

d1b80d803a0268bd4b3dd5b9a9522230461f2947

Author: Dan Williams   2008-06-05 17:57:53
Committer: Colin Walters   2008-06-05 17:57:53
Follows: dbus-glib_0.76
Precedes: dbus-glib_0.78

Bug 16114 [patch] wincaps-to-uscore property names for GetAll()

* dbus/dbus-gobject.c: We need to uscore property names
so that we actually find the right properties.


but, the good news is that you could do:

dbus_props_iface.Get('org.freedesktop.NetworkManager.Device', '')

and get the properties you care about individually instead of all of
them at once.  Somewhat less efficient, but it'll work.

Dan

> dbus-1-1.2.10-3.9.1
> dbus-1-python-0.83.0-22.10
> 
> nm-tool print the two interfaces with parameters :
> 
> NetworkManager Tool
> 
> State: connected
> 
> - Device: eth0
> 
>   Type:  Wired
>   Driver:tg3
>   State: connected
>   Default:   yes
>   HW Address:00:24:81:56:2E:52
> 
>   Capabilities:
> Supported:   yes
> Carrier Detect:  yes
> Speed:   100 Mb/s
> 
>   Wired Settings
> 
>   IPv4 Settings:
> Address: 10.82.109.86
> Prefix:  24 (255.255.255.0)
> Gateway: 10.82.109.254
> 
> DNS: 10.82.161.3
> DNS: 10.68.161.3
> 
> 
> - Device: eth1
> 
>   Type:  802.11 WiFi
>   Driver:iwlagn
>   State: connected
>   Default:   no
>   HW Address:00:22:FA:46:76:9A
> 
>   Capabilities:
> Supported:   yes
> 
>   Wireless Settings
> WEP Encryption:  yes
> WPA Encryption:  yes
> WPA2 Encryption: yes
> 
>   Wireless Access Points(* = Current AP)
> TESTIPSL:Infra, 00:03:2F:1D:61:BF, Freq 2437 MHz, Rate 54
> Mb/s, Strength 79 WEP
> *iSync:  Ad-Hoc, D6:08:0C:12:06:49, Freq 2412 MHz, Rate 0
> Mb/s, Strength 0
> 
>   IPv4 Settings:
> Address: 10.42.44.1
> Prefix:  24 (255.255.255.0)
> Gateway: 0.0.0.0
> 
> 
> >> Thanks
> >>
> >>
> >> > On Wed, 2009-07-01 at 12:28 -0400, Dan Williams wrote:
> >> >> On Wed, 2009-07-01 at 11:26 -0400, ne...@aflb.com wrote:
> >> >> > Thanks for this quick answer.
> >> >> >
> >> >> > That's what I though. Adding a new connection isnot easy to do...
> >> >> >
> >> >> > when you say "programmatically ask the system settings service to
> >> >> create it"
> >> >> >
> >> >> > What do you mean ? Doing the same stuff as nm-applet but hardcoded
> >> ?
> >> >>
> >> >> Same way nm-connection-editor asks the system settings service to
> >> create
> >> >> a new connection when the user hits "Apply": you call the
> >> >> AddConnection() method on the
> >> >> org.freedesktop.NetworkManagerSettings.System interface with the
> >> >> connection details you want to set.
> >> >>
> >> >> Unfortunately we didn't define that method to return the object path
> >> of
> >> >> the newly created connection in 0.7 (will probably be fixed in 0.8),
> >> so
> >> >> you have to wait for the NewConnection signal that the
> >> >> system-settings-service emits, look for the UUID of the connection
> >> you
> >> >> just created to get the object path, and then tell NM to activate
> >> that
> >> >> connection.
> >> >>
> >

Re: Creating adhoc wireless Network

2009-07-07 Thread nexus
> On Mon, 2009-07-06 at 11:18 -0400, ne...@aflb.com wrote:
>> Hi Dan,
>>
>> I'm playing with the script you provide me but I have a problem :
>>
>> File "Create_Wireless.py", line 135, in 
>> if props['DeviceType'] == 2:   # wifi
>> KeyError: 'DeviceType'
>>
>> if I execute step by steps :
>>
>> >>> print nm_iface.GetDevices()
>> dbus.Array([dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_24_81_56_2e_52'),
>> dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')],
>> signature=dbus.Signature('o'))
>> >>> dev_proxy =
>> sys_bus.get_object('org.freedesktop.NetworkManager','/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')
>> >>> print dev_proxy
>>  :1.7
>> /org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a at 0xb7a5a80c>
>> >>> dev_props_iface = dbus.Interface(dev_proxy,
>> 'org.freedesktop.DBus.Properties')
>> >>> print dev_props_iface
>> > 0xb7a5811c> :1.7 /org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a at
>> 0xb7a5a80c> implementing 'org.freedesktop.DBus.Properties' at
>> 0xb7a5a9ac>
>> >>> print
>> dev_props_iface.GetAll('org.freedesktop.NetworkManager.Device')
>> dbus.Dictionary({}, signature=dbus.Signature('sv'))
>>
>> It seems empty ! What's wrong ?
>
> What version of dbus-glib do you have?  What does 'nm-tool' print out
> when you run it?
>
> Dan
>

Version provided by SLED11

dbus-1-glib-0.76-34.3
dbus-1-1.2.10-3.9.1
dbus-1-python-0.83.0-22.10

nm-tool print the two interfaces with parameters :

NetworkManager Tool

State: connected

- Device: eth0

  Type:  Wired
  Driver:tg3
  State: connected
  Default:   yes
  HW Address:00:24:81:56:2E:52

  Capabilities:
Supported:   yes
Carrier Detect:  yes
Speed:   100 Mb/s

  Wired Settings

  IPv4 Settings:
Address: 10.82.109.86
Prefix:  24 (255.255.255.0)
Gateway: 10.82.109.254

DNS: 10.82.161.3
DNS: 10.68.161.3


- Device: eth1

  Type:  802.11 WiFi
  Driver:iwlagn
  State: connected
  Default:   no
  HW Address:00:22:FA:46:76:9A

  Capabilities:
Supported:   yes

  Wireless Settings
WEP Encryption:  yes
WPA Encryption:  yes
WPA2 Encryption: yes

  Wireless Access Points(* = Current AP)
TESTIPSL:Infra, 00:03:2F:1D:61:BF, Freq 2437 MHz, Rate 54
Mb/s, Strength 79 WEP
*iSync:  Ad-Hoc, D6:08:0C:12:06:49, Freq 2412 MHz, Rate 0
Mb/s, Strength 0

  IPv4 Settings:
Address: 10.42.44.1
Prefix:  24 (255.255.255.0)
Gateway: 0.0.0.0


>> Thanks
>>
>>
>> > On Wed, 2009-07-01 at 12:28 -0400, Dan Williams wrote:
>> >> On Wed, 2009-07-01 at 11:26 -0400, ne...@aflb.com wrote:
>> >> > Thanks for this quick answer.
>> >> >
>> >> > That's what I though. Adding a new connection isnot easy to do...
>> >> >
>> >> > when you say "programmatically ask the system settings service to
>> >> create it"
>> >> >
>> >> > What do you mean ? Doing the same stuff as nm-applet but hardcoded
>> ?
>> >>
>> >> Same way nm-connection-editor asks the system settings service to
>> create
>> >> a new connection when the user hits "Apply": you call the
>> >> AddConnection() method on the
>> >> org.freedesktop.NetworkManagerSettings.System interface with the
>> >> connection details you want to set.
>> >>
>> >> Unfortunately we didn't define that method to return the object path
>> of
>> >> the newly created connection in 0.7 (will probably be fixed in 0.8),
>> so
>> >> you have to wait for the NewConnection signal that the
>> >> system-settings-service emits, look for the UUID of the connection
>> you
>> >> just created to get the object path, and then tell NM to activate
>> that
>> >> connection.
>> >>
>> >> It's pretty straightforward actually, once you know what needs to be
>> >> done.  If PolicyKit throws up a dialog, use
>> polkit-gnome-authorization
>> >> to allow the user to always have the
>> >> org.freedesktop.network-manager-settings.system.modify permission and
>> >> the user won't ever get asked.
>> >
>> > Check out the attached script.  It will create a WEP-enabled adhoc
>> > connection if that connection (identified by UUID) doesn't already
>> > exist, and then direct NetworkManager to activate that connection.
>> The
>> > script is somewhat longer than it needs to be, simply because I made
>> it
>> > more readable, added comments so you can figure out what's going on,
>> and
>> > put some reasonable error checking in.
>> >
>> > Dan
>> > 
>> >
>> > #!/bin/env python
>> > # -*- Mode: Python; tab-width: 4; indent-tabs-mode: nil;
>> c-basic-offset: 4
>> > -*-
>> > #
>> > # Copyright (C) 2009 Red Hat, Inc.
>> > #
>> > # This program is free software; you can redistribute it and/or modify
>> > # it under the terms of the GNU General Public License as publishe

Re: Creating adhoc wireless Network

2009-07-06 Thread Dan Williams
On Mon, 2009-07-06 at 11:18 -0400, ne...@aflb.com wrote:
> Hi Dan,
> 
> I'm playing with the script you provide me but I have a problem :
> 
> File "Create_Wireless.py", line 135, in 
> if props['DeviceType'] == 2:   # wifi
> KeyError: 'DeviceType'
> 
> if I execute step by steps :
> 
> >>> print nm_iface.GetDevices()
> dbus.Array([dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_24_81_56_2e_52'),
> dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')],
> signature=dbus.Signature('o'))
> >>> dev_proxy =
> sys_bus.get_object('org.freedesktop.NetworkManager','/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')
> >>> print dev_proxy
>  :1.7
> /org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a at 0xb7a5a80c>
> >>> dev_props_iface = dbus.Interface(dev_proxy,
> 'org.freedesktop.DBus.Properties')
> >>> print dev_props_iface
>  0xb7a5811c> :1.7 /org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a at
> 0xb7a5a80c> implementing 'org.freedesktop.DBus.Properties' at 0xb7a5a9ac>
> >>> print dev_props_iface.GetAll('org.freedesktop.NetworkManager.Device')
> dbus.Dictionary({}, signature=dbus.Signature('sv'))
> 
> It seems empty ! What's wrong ?

What version of dbus-glib do you have?  What does 'nm-tool' print out
when you run it?

Dan

> Thanks
> 
> 
> > On Wed, 2009-07-01 at 12:28 -0400, Dan Williams wrote:
> >> On Wed, 2009-07-01 at 11:26 -0400, ne...@aflb.com wrote:
> >> > Thanks for this quick answer.
> >> >
> >> > That's what I though. Adding a new connection isnot easy to do...
> >> >
> >> > when you say "programmatically ask the system settings service to
> >> create it"
> >> >
> >> > What do you mean ? Doing the same stuff as nm-applet but hardcoded ?
> >>
> >> Same way nm-connection-editor asks the system settings service to create
> >> a new connection when the user hits "Apply": you call the
> >> AddConnection() method on the
> >> org.freedesktop.NetworkManagerSettings.System interface with the
> >> connection details you want to set.
> >>
> >> Unfortunately we didn't define that method to return the object path of
> >> the newly created connection in 0.7 (will probably be fixed in 0.8), so
> >> you have to wait for the NewConnection signal that the
> >> system-settings-service emits, look for the UUID of the connection you
> >> just created to get the object path, and then tell NM to activate that
> >> connection.
> >>
> >> It's pretty straightforward actually, once you know what needs to be
> >> done.  If PolicyKit throws up a dialog, use polkit-gnome-authorization
> >> to allow the user to always have the
> >> org.freedesktop.network-manager-settings.system.modify permission and
> >> the user won't ever get asked.
> >
> > Check out the attached script.  It will create a WEP-enabled adhoc
> > connection if that connection (identified by UUID) doesn't already
> > exist, and then direct NetworkManager to activate that connection.  The
> > script is somewhat longer than it needs to be, simply because I made it
> > more readable, added comments so you can figure out what's going on, and
> > put some reasonable error checking in.
> >
> > Dan
> > 
> >
> > #!/bin/env python
> > # -*- Mode: Python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4
> > -*-
> > #
> > # Copyright (C) 2009 Red Hat, Inc.
> > #
> > # This program is free software; you can redistribute it and/or modify
> > # it under the terms of the GNU General Public License as published by
> > # the Free Software Foundation; either version 2 of the License, or
> > # (at your option) any later version.
> > #
> > # This program is distributed in the hope that it will be useful,
> > # but WITHOUT ANY WARRANTY; without even the implied warranty of
> > # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > # GNU General Public License for more details.
> > #
> > # You should have received a copy of the GNU General Public License along
> > # with this program; if not, write to the Free Software Foundation, Inc.,
> > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> > #
> >
> > import dbus
> > import glib
> > import sys
> > import posix
> > import time
> >
> > uuid = "cabfaf9e-4043-4afb-8506-0e6f4a225636"
> >
> > s_con = { 'id':  'My AdHoc',
> >   'uuid':uuid,
> >   'type':'802-11-wireless',
> >   'autoconnect': False,
> >   'name':'connection' }
> >
> > s_wifi = { 'ssid': dbus.ByteArray("foobar"),
> >'mode': 'adhoc',
> >'security': '802-11-wireless-security',
> >'name': '802-11-wireless' }
> >
> > s_wsec = { 'key-mgmt': 'none',
> >'wep-key0': '0123456789abcdef0123456789',
> >'name': '802-11-wireless-security' }
> >
> > s_ip4 = { 'method': 'link-local',
> >   'name':   'ipv4' }
> >
> > con = { 'connection': s_con,
> > '802-11-wireless': s_wifi,
> > '802-11-wireless-security': s_wsec,
> > 'ipv4': s_ip4 }
> >
> > # init dbus
> > sys_

Re: Creating adhoc wireless Network

2009-07-06 Thread nexus
Hi Dan,

I'm playing with the script you provide me but I have a problem :

File "Create_Wireless.py", line 135, in 
if props['DeviceType'] == 2:   # wifi
KeyError: 'DeviceType'

if I execute step by steps :

>>> print nm_iface.GetDevices()
dbus.Array([dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_24_81_56_2e_52'),
dbus.ObjectPath('/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')],
signature=dbus.Signature('o'))
>>> dev_proxy =
sys_bus.get_object('org.freedesktop.NetworkManager','/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a')
>>> print dev_proxy
 :1.7
/org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a at 0xb7a5a80c>
>>> dev_props_iface = dbus.Interface(dev_proxy,
'org.freedesktop.DBus.Properties')
>>> print dev_props_iface
 :1.7 /org/freedesktop/Hal/devices/net_00_22_fa_46_76_9a at
0xb7a5a80c> implementing 'org.freedesktop.DBus.Properties' at 0xb7a5a9ac>
>>> print dev_props_iface.GetAll('org.freedesktop.NetworkManager.Device')
dbus.Dictionary({}, signature=dbus.Signature('sv'))

It seems empty ! What's wrong ?

Thanks


> On Wed, 2009-07-01 at 12:28 -0400, Dan Williams wrote:
>> On Wed, 2009-07-01 at 11:26 -0400, ne...@aflb.com wrote:
>> > Thanks for this quick answer.
>> >
>> > That's what I though. Adding a new connection isnot easy to do...
>> >
>> > when you say "programmatically ask the system settings service to
>> create it"
>> >
>> > What do you mean ? Doing the same stuff as nm-applet but hardcoded ?
>>
>> Same way nm-connection-editor asks the system settings service to create
>> a new connection when the user hits "Apply": you call the
>> AddConnection() method on the
>> org.freedesktop.NetworkManagerSettings.System interface with the
>> connection details you want to set.
>>
>> Unfortunately we didn't define that method to return the object path of
>> the newly created connection in 0.7 (will probably be fixed in 0.8), so
>> you have to wait for the NewConnection signal that the
>> system-settings-service emits, look for the UUID of the connection you
>> just created to get the object path, and then tell NM to activate that
>> connection.
>>
>> It's pretty straightforward actually, once you know what needs to be
>> done.  If PolicyKit throws up a dialog, use polkit-gnome-authorization
>> to allow the user to always have the
>> org.freedesktop.network-manager-settings.system.modify permission and
>> the user won't ever get asked.
>
> Check out the attached script.  It will create a WEP-enabled adhoc
> connection if that connection (identified by UUID) doesn't already
> exist, and then direct NetworkManager to activate that connection.  The
> script is somewhat longer than it needs to be, simply because I made it
> more readable, added comments so you can figure out what's going on, and
> put some reasonable error checking in.
>
> Dan
> 
>
> #!/bin/env python
> # -*- Mode: Python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4
> -*-
> #
> # Copyright (C) 2009 Red Hat, Inc.
> #
> # This program is free software; you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> # the Free Software Foundation; either version 2 of the License, or
> # (at your option) any later version.
> #
> # This program is distributed in the hope that it will be useful,
> # but WITHOUT ANY WARRANTY; without even the implied warranty of
> # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> # GNU General Public License for more details.
> #
> # You should have received a copy of the GNU General Public License along
> # with this program; if not, write to the Free Software Foundation, Inc.,
> # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> #
>
> import dbus
> import glib
> import sys
> import posix
> import time
>
> uuid = "cabfaf9e-4043-4afb-8506-0e6f4a225636"
>
> s_con = { 'id':  'My AdHoc',
>   'uuid':uuid,
>   'type':'802-11-wireless',
>   'autoconnect': False,
>   'name':'connection' }
>
> s_wifi = { 'ssid': dbus.ByteArray("foobar"),
>'mode': 'adhoc',
>'security': '802-11-wireless-security',
>'name': '802-11-wireless' }
>
> s_wsec = { 'key-mgmt': 'none',
>'wep-key0': '0123456789abcdef0123456789',
>'name': '802-11-wireless-security' }
>
> s_ip4 = { 'method': 'link-local',
>   'name':   'ipv4' }
>
> con = { 'connection': s_con,
> '802-11-wireless': s_wifi,
> '802-11-wireless-security': s_wsec,
> 'ipv4': s_ip4 }
>
> # init dbus
> sys_bus = dbus.SystemBus()
> ses_bus = dbus.SessionBus()
>
> ss_proxy =
> sys_bus.get_object('org.freedesktop.NetworkManagerSystemSettings',
>   '/org/freedesktop/NetworkManagerSettings')
> ss_iface = dbus.Interface(ss_proxy,
> 'org.freedesktop.NetworkManagerSettings')
> ss_sys_iface = dbus.Interface(ss_proxy,
> 'org.freedesktop.NetworkManagerSettings.System')
>
> nm_proxy = sys_bus.get_ob

Re: Creating adhoc wireless Network

2009-07-01 Thread Dan Williams
On Wed, 2009-07-01 at 12:28 -0400, Dan Williams wrote:
> On Wed, 2009-07-01 at 11:26 -0400, ne...@aflb.com wrote:
> > Thanks for this quick answer.
> > 
> > That's what I though. Adding a new connection isnot easy to do...
> > 
> > when you say "programmatically ask the system settings service to create it"
> > 
> > What do you mean ? Doing the same stuff as nm-applet but hardcoded ?
> 
> Same way nm-connection-editor asks the system settings service to create
> a new connection when the user hits "Apply": you call the
> AddConnection() method on the
> org.freedesktop.NetworkManagerSettings.System interface with the
> connection details you want to set.
> 
> Unfortunately we didn't define that method to return the object path of
> the newly created connection in 0.7 (will probably be fixed in 0.8), so
> you have to wait for the NewConnection signal that the
> system-settings-service emits, look for the UUID of the connection you
> just created to get the object path, and then tell NM to activate that
> connection.
> 
> It's pretty straightforward actually, once you know what needs to be
> done.  If PolicyKit throws up a dialog, use polkit-gnome-authorization
> to allow the user to always have the
> org.freedesktop.network-manager-settings.system.modify permission and
> the user won't ever get asked.

Check out the attached script.  It will create a WEP-enabled adhoc
connection if that connection (identified by UUID) doesn't already
exist, and then direct NetworkManager to activate that connection.  The
script is somewhat longer than it needs to be, simply because I made it
more readable, added comments so you can figure out what's going on, and
put some reasonable error checking in.

Dan


#!/bin/env python
# -*- Mode: Python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
#
# Copyright (C) 2009 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

import dbus
import glib
import sys
import posix
import time

uuid = "cabfaf9e-4043-4afb-8506-0e6f4a225636"

s_con = { 'id':  'My AdHoc',
  'uuid':uuid,
  'type':'802-11-wireless',
  'autoconnect': False,
  'name':'connection' }

s_wifi = { 'ssid': dbus.ByteArray("foobar"),
   'mode': 'adhoc', 
   'security': '802-11-wireless-security',
   'name': '802-11-wireless' }

s_wsec = { 'key-mgmt': 'none',
   'wep-key0': '0123456789abcdef0123456789',
   'name': '802-11-wireless-security' }

s_ip4 = { 'method': 'link-local',
  'name':   'ipv4' }

con = { 'connection': s_con,
'802-11-wireless': s_wifi,
'802-11-wireless-security': s_wsec,
'ipv4': s_ip4 }

# init dbus
sys_bus = dbus.SystemBus()
ses_bus = dbus.SessionBus()

ss_proxy = sys_bus.get_object('org.freedesktop.NetworkManagerSystemSettings',
  '/org/freedesktop/NetworkManagerSettings')
ss_iface = dbus.Interface(ss_proxy, 'org.freedesktop.NetworkManagerSettings')
ss_sys_iface = dbus.Interface(ss_proxy, 
'org.freedesktop.NetworkManagerSettings.System')

nm_proxy = sys_bus.get_object('org.freedesktop.NetworkManager',
  '/org/freedesktop/NetworkManager')
nm_iface = dbus.Interface(nm_proxy, 'org.freedesktop.NetworkManager')

pk_proxy = ses_bus.get_object('org.freedesktop.PolicyKit.AuthenticationAgent', 
'/')
pk_iface = dbus.Interface(pk_proxy, 
'org.freedesktop.PolicyKit.AuthenticationAgent')

def find_connection(requested_uuid):
for c in ss_iface.ListConnections():
# get the details of the connection
c_proxy = 
sys_bus.get_object('org.freedesktop.NetworkManagerSystemSettings', c)
c_iface = dbus.Interface(c_proxy, 
'org.freedesktop.NetworkManagerSettings.Connection')
settings = c_iface.GetSettings()
if settings['connection']['uuid'] == requested_uuid:
# found our connection
return c
return None

def try_add(connection):
try:
# Ask the system settings service to create the connection
ss_sys_iface.AddConnection(connection)
return None
except Exception, e:
parts = str(e).split(' ')
if 
parts[0].find('org.freedesktop.NetworkManagerSettings.System.NotPrivileged') < 
0:
# not a permission denied, give up and exit
p

Re: Creating adhoc wireless Network

2009-07-01 Thread Dan Williams
On Wed, 2009-07-01 at 11:26 -0400, ne...@aflb.com wrote:
> Thanks for this quick answer.
> 
> That's what I though. Adding a new connection isnot easy to do...
> 
> when you say "programmatically ask the system settings service to create it"
> 
> What do you mean ? Doing the same stuff as nm-applet but hardcoded ?

Same way nm-connection-editor asks the system settings service to create
a new connection when the user hits "Apply": you call the
AddConnection() method on the
org.freedesktop.NetworkManagerSettings.System interface with the
connection details you want to set.

Unfortunately we didn't define that method to return the object path of
the newly created connection in 0.7 (will probably be fixed in 0.8), so
you have to wait for the NewConnection signal that the
system-settings-service emits, look for the UUID of the connection you
just created to get the object path, and then tell NM to activate that
connection.

It's pretty straightforward actually, once you know what needs to be
done.  If PolicyKit throws up a dialog, use polkit-gnome-authorization
to allow the user to always have the
org.freedesktop.network-manager-settings.system.modify permission and
the user won't ever get asked.

> I think I have something... ugly but it works..
> 
> Create the adhoc with nm-editor -no enc key-, dump the gconf settings with
> gconftool2, cleaning the result.
> 
> On the other box : tweak the uuid and key number of the previously dumped
> gconf settings according to the still created network in gconf.
> 
> Use dbus to list connections, next list connections settings to find the
> one you just added. You have the objpath.
> 
> Find your wireless device with GetDevices method
> 
> Use ActivateConnection with special objpath at the objpath:/ ans
> NetworkManagerUserSettings as service_name.
> 
> Keep the return, it's the ActiveConnection objpath
> 
> My Connection Appear ! yeepee
> 
> Use the same way to DeactivateConnection and why not Delete the profile.

Yeah, that's really, really convoluted and you don't need to go through
that sort of trouble.

Dan

> 
> So The ugly part is to create the new wireless adhoc connection by dumping
> gconf and reload it on other boxes. It could be nice to create it directly
> by dbus command.
> 
> Thanks btw for your help
> 
> 
> > On Wed, 2009-07-01 at 05:27 -0400, ne...@aflb.com wrote:
> >> Hi there,
> >>
> >> I try to create a new adhoc wireless connection using DBUS.
> >>
> >> It's pretty hard coz I don't find any documentantion. I've only the
> >> d-feet
> >> utility to see the method and object path to use.
> >>
> >> I would like to create a third party apps (python / bash but not c) to :
> >>
> >> *-create a new adhoc connection with provided essid, wep encryption and
> >> key (no matter if the key is stored in plain text in gconf for example)
> >> *-activate this connection
> >> *-deactivate this connection
> >> *-delete this connection (the only part I've successfully tested !!)
> >>
> >> Is there someone who can help me with this ?
> >
> > http://projects.gnome.org/NetworkManager/developers/spec.html
> >
> > Any network device setup needs a Connection associated with it, which
> > contains all the settings for the device, including wifi, IP, DNS.
> > Those connections are provided by settings services, of which there are
> > two: user and system.  These settings services store all the Connections
> > somewhere (gconf, kconfig, flat files, etc) and provide them to
> > NetworkManager and other programs that want network information.
> >
> > So, to do an adhoc network, you'd first make sure that its Connection is
> > provided by a settings service (ie, that the connection has already been
> > set up), and then you tell NM to activate that connection (see the
> > ActiveConnection call on the org.freedesktop.NetworkManager dbus
> > interface).
> >
> > To get the Connection provided by a settings service, you either set it
> > up through the connection editor, or programmatically ask the system
> > settings service to create it.  It's also possible to create it in the
> > user settings service, but that's a bit more obscure due to security
> > concerns with exposing user passwords and secrets.
> >
> >> (the main goal is to create an adhoc wireless network to provide a one
> >> shot tiny http server (woof) with my calendar.ics in order to subscribe
> >> and sync my iphone  with it. I don't want to use Gcal or anything else,
> >> I
> >> need point to point network)
> >
> > Yeah, that should work.  You either need to figure out the IP address of
> > the connection that got created (which NM can provide to you, each
> > connection you active creates an ActiveConnection object on the dbus
> > interface which implements the
> > org.freedesktop.NetworkManager.Connection.Active interface, then you get
> > the device from that object that you care about, then you ask the device
> > for its current IPv4 settings) or bind your server to 0.0.0.0.
> >
> >> (second goal is to be able to 

Re: Creating adhoc wireless Network

2009-07-01 Thread nexus
Thanks for this quick answer.

That's what I though. Adding a new connection isnot easy to do...

when you say "programmatically ask the system settings service to create it"

What do you mean ? Doing the same stuff as nm-applet but hardcoded ?

I think I have something... ugly but it works..

Create the adhoc with nm-editor -no enc key-, dump the gconf settings with
gconftool2, cleaning the result.

On the other box : tweak the uuid and key number of the previously dumped
gconf settings according to the still created network in gconf.

Use dbus to list connections, next list connections settings to find the
one you just added. You have the objpath.

Find your wireless device with GetDevices method

Use ActivateConnection with special objpath at the objpath:/ ans
NetworkManagerUserSettings as service_name.

Keep the return, it's the ActiveConnection objpath

My Connection Appear ! yeepee

Use the same way to DeactivateConnection and why not Delete the profile.


So The ugly part is to create the new wireless adhoc connection by dumping
gconf and reload it on other boxes. It could be nice to create it directly
by dbus command.

Thanks btw for your help


> On Wed, 2009-07-01 at 05:27 -0400, ne...@aflb.com wrote:
>> Hi there,
>>
>> I try to create a new adhoc wireless connection using DBUS.
>>
>> It's pretty hard coz I don't find any documentantion. I've only the
>> d-feet
>> utility to see the method and object path to use.
>>
>> I would like to create a third party apps (python / bash but not c) to :
>>
>> *-create a new adhoc connection with provided essid, wep encryption and
>> key (no matter if the key is stored in plain text in gconf for example)
>> *-activate this connection
>> *-deactivate this connection
>> *-delete this connection (the only part I've successfully tested !!)
>>
>> Is there someone who can help me with this ?
>
> http://projects.gnome.org/NetworkManager/developers/spec.html
>
> Any network device setup needs a Connection associated with it, which
> contains all the settings for the device, including wifi, IP, DNS.
> Those connections are provided by settings services, of which there are
> two: user and system.  These settings services store all the Connections
> somewhere (gconf, kconfig, flat files, etc) and provide them to
> NetworkManager and other programs that want network information.
>
> So, to do an adhoc network, you'd first make sure that its Connection is
> provided by a settings service (ie, that the connection has already been
> set up), and then you tell NM to activate that connection (see the
> ActiveConnection call on the org.freedesktop.NetworkManager dbus
> interface).
>
> To get the Connection provided by a settings service, you either set it
> up through the connection editor, or programmatically ask the system
> settings service to create it.  It's also possible to create it in the
> user settings service, but that's a bit more obscure due to security
> concerns with exposing user passwords and secrets.
>
>> (the main goal is to create an adhoc wireless network to provide a one
>> shot tiny http server (woof) with my calendar.ics in order to subscribe
>> and sync my iphone  with it. I don't want to use Gcal or anything else,
>> I
>> need point to point network)
>
> Yeah, that should work.  You either need to figure out the IP address of
> the connection that got created (which NM can provide to you, each
> connection you active creates an ActiveConnection object on the dbus
> interface which implements the
> org.freedesktop.NetworkManager.Connection.Active interface, then you get
> the device from that object that you care about, then you ask the device
> for its current IPv4 settings) or bind your server to 0.0.0.0.
>
>> (second goal is to be able to create a third apps to use hotspot with
>> spécific secrets I don't want to provide to some users).
>
> Be aware that we don't necessarily expect WPA adhoc mode to work that
> well with current kernel drivers, it's fairly untested but reported by
> some to work, and not to work by others.  You'll need a fairly recent
> wpa_supplicant installed (0.6.9 or later I think) to get adhoc to work
> reliably as well.
>
> Dan
>
>


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Creating adhoc wireless Network

2009-07-01 Thread Dan Williams
On Wed, 2009-07-01 at 05:27 -0400, ne...@aflb.com wrote:
> Hi there,
> 
> I try to create a new adhoc wireless connection using DBUS.
> 
> It's pretty hard coz I don't find any documentantion. I've only the d-feet
> utility to see the method and object path to use.
> 
> I would like to create a third party apps (python / bash but not c) to :
> 
> *-create a new adhoc connection with provided essid, wep encryption and
> key (no matter if the key is stored in plain text in gconf for example)
> *-activate this connection
> *-deactivate this connection
> *-delete this connection (the only part I've successfully tested !!)
> 
> Is there someone who can help me with this ?

http://projects.gnome.org/NetworkManager/developers/spec.html

Any network device setup needs a Connection associated with it, which
contains all the settings for the device, including wifi, IP, DNS.
Those connections are provided by settings services, of which there are
two: user and system.  These settings services store all the Connections
somewhere (gconf, kconfig, flat files, etc) and provide them to
NetworkManager and other programs that want network information.

So, to do an adhoc network, you'd first make sure that its Connection is
provided by a settings service (ie, that the connection has already been
set up), and then you tell NM to activate that connection (see the
ActiveConnection call on the org.freedesktop.NetworkManager dbus
interface).

To get the Connection provided by a settings service, you either set it
up through the connection editor, or programmatically ask the system
settings service to create it.  It's also possible to create it in the
user settings service, but that's a bit more obscure due to security
concerns with exposing user passwords and secrets.

> (the main goal is to create an adhoc wireless network to provide a one
> shot tiny http server (woof) with my calendar.ics in order to subscribe
> and sync my iphone  with it. I don't want to use Gcal or anything else, I
> need point to point network)

Yeah, that should work.  You either need to figure out the IP address of
the connection that got created (which NM can provide to you, each
connection you active creates an ActiveConnection object on the dbus
interface which implements the
org.freedesktop.NetworkManager.Connection.Active interface, then you get
the device from that object that you care about, then you ask the device
for its current IPv4 settings) or bind your server to 0.0.0.0. 

> (second goal is to be able to create a third apps to use hotspot with
> spécific secrets I don't want to provide to some users).

Be aware that we don't necessarily expect WPA adhoc mode to work that
well with current kernel drivers, it's fairly untested but reported by
some to work, and not to work by others.  You'll need a fairly recent
wpa_supplicant installed (0.6.9 or later I think) to get adhoc to work
reliably as well.

Dan

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Creating adhoc wireless Network

2009-07-01 Thread nexus
Hi there,

I try to create a new adhoc wireless connection using DBUS.

It's pretty hard coz I don't find any documentantion. I've only the d-feet
utility to see the method and object path to use.

I would like to create a third party apps (python / bash but not c) to :

*-create a new adhoc connection with provided essid, wep encryption and
key (no matter if the key is stored in plain text in gconf for example)
*-activate this connection
*-deactivate this connection
*-delete this connection (the only part I've successfully tested !!)

Is there someone who can help me with this ?

(the main goal is to create an adhoc wireless network to provide a one
shot tiny http server (woof) with my calendar.ics in order to subscribe
and sync my iphone  with it. I don't want to use Gcal or anything else, I
need point to point network)

(second goal is to be able to create a third apps to use hotspot with
spécific secrets I don't want to provide to some users).

Thanks

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Creating AdHoc wireless network

2009-01-08 Thread Dan Williams
On Mon, 2008-12-22 at 13:06 -0500, Robert Moskowitz wrote:
> Using NetworkManager 0.6.4 in Centos 5.2
> 
> Does it support AdHoc wireless network definitions?
> 
> If so, how?

Yes, you want the "Create new wireless network..." item in the applet
menu.

Dan


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Creating AdHoc wireless network

2008-12-22 Thread Robert Moskowitz

Using NetworkManager 0.6.4 in Centos 5.2

Does it support AdHoc wireless network definitions?

If so, how?


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list