Re: Get uuid of connection

2010-07-21 Thread Daniel Gnoutcheff
On 07/21/2010 11:41 AM, Arlen Nascimento wrote:
> Ok, i could add a connection, but it is a system connection.
> As far as i noted, in order to this connection I created be detected by
> the scripts i'm using, it has to be a user connection.
> How to create a user connection in the command line?

I'm afraid that is much more difficult to do.  The method of adding user
connections is dependent on which NetworkManager client is in use. Each
client choses its own method of storing config data and then exports
that over DBus for the daemon to use.  Most (all?) NM clients don't
support editing user connections over DBus, so you would need to edit
the config files directly.  For example, nm-applet stores its config
data in GConf under /system/networking/connections.  gconftool-2 may be
useful for editing that.


Also, current plans are that the next major version of NetworkManager
will drop support for user connections. (They are to be replaced with
beefed-up security controls for system connections: see
http://live.gnome.org/NetworkManager/RemovingUserSettings for more
details on that.) So if it's at all possible, I'd recommend trying to
get the scripts to work with system connections.

Have a good one,
Daniel

> 
> 
> s_con = { 'id': 'XXX', 'uuid': '5ef2d781-1197-44eb-8744-cd78b9c07315',
> 'type': '802-11-wireless', 'autoconnect': False, 'name': 'connection' }
> 
> s_wifi = { 'ssid': dbus.ByteArray("XXX"), 'mode': 'infrastructure',
> 'security': '802-11-wireless-security', 'name': '802-11-wireless' }
> 
> s_wsec = { 'key-mgmt': 'wpa-psk', 'wpa-key': 'xxx', 'name':
> '802-11-wireless-security' }
> 
> s_ip4 = { 'method': 'auto', 'name': 'ipv4' }
> 
> con = { 'connection': s_con, '802-11-wireless': s_wifi,
> '802-11-wireless-security': s_wsec, 'ipv4': s_ip4 }
> 
> 
> sys_bus = dbus.SystemBus()
> ses_bus = dbus.SessionBus()
> proxy =
> sys_bus.get_object("org.freedesktop.NetworkManagerSystemSettings",
> "/org/freedesktop/NetworkManagerSettings")
> iface = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")
> 
> try:
> iface.AddConnection(con)
> except Exception, e:
> print e
> 
> On Mon, Jul 19, 2010 at 7:03 PM, Daniel Gnoutcheff
> mailto:dan...@gnoutcheff.name>> wrote:
> 
> On 07/19/2010 09:27 AM, Arlen Nascimento wrote:
> > It is possible to do it by means of dbus commands or something?
> > examples?
> 
> Here's one:
> 
> http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/add-system-connection.py
> 
> dbus-send(1) probably could do the job as well, e.g. if you prefer to
> use shell scripts. These documents may be helpful as well:
> http://projects.gnome.org/NetworkManager/developers/spec-08.html
> http://projects.gnome.org/NetworkManager/developers/settings-spec-08.html
> 
> And to make the connection "run" without user intervention, you only
> need to ensure that the "autoconnect" flag is "true". In fact, that flag
> is "true" by default, so you won't really need to do anything.
> 
> Note that adding a system connection is a one-shot deal; you only need
> to do it once. So if you can afford to use a GUI tool just once, you'll
> probably find that nm-connection-editor is a much easier way to do it.
> (Just check "Available for all users", and it'll get installed as a
> system connection.)
> 
> Have a good one,
> Daniel
> 
> > On Mon, Jul 19, 2010 at 2:26 PM, Daenyth Blank  
> > >> wrote:
> >
> > On Mon, Jul 19, 2010 at 09:11, Arlen Nascimento
> >  
>  >> wrote:
> > > Ok, but the thing is: i need to setup and "run" a connection
> > without the
> > > user intervention
> > In that case you need to create a new connection with the options
> > you want.
> 
> 
> 
> 
> -- 
> Arlen Nascimento
> 

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


Re: Re-scanning for available devices/connections after failure

2010-07-21 Thread Daenyth Blank
On Thu, Jul 15, 2010 at 17:16, Dan Williams  wrote:
> And there were /dev/ttyUSBx ports for the device?  If you can get it
> into that state again, do this:
>
> 1) mv /usr/sbin/modem-manager /
> 2) killall -TERM modem-manager
> 3) /modem-manager --debug
>
> and see what MM says.  When you're done,
> mv /modem-manager /usr/sbin/modem-manager.
>
> Dan
>
>

Unfortunately if the situation occurs, we can't do that since they're
remotely deployed and the only way to access is by using the modem. It
almost never happens at our office where we can put them on a lan.
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Re-scanning for available devices/connections after failure

2010-07-21 Thread Dan Williams
On Thu, 2010-07-15 at 15:00 -0400, Daenyth Blank wrote:
> On Thu, Jul 15, 2010 at 16:45, Dan Williams  wrote:
> > For 3G devices this could be a number of things.  If the device simply
> > isn't seen by NM, that means that ModemManager didn't successfully probe
> > the device.  So we need to look for it there.
> This sounds like the case some of the time
> 
> > If this happens when the device disconnects, it could be that the
> > device's firmware is crashing and its dropping off the USB bus.  That's
> > odd and indicates firmware problems, some of which we can work around in
> > ModemManager.  Other times the device is just screwed and needs a
> > firmware update.  If the device isn't recognized at *boot* time, that
> > could indicate either kernel problems, device problems, or possibly udev
> > issues.
> Sometimes it's recognized and others it's not. Is it possible that the
> device is left in some half-set state or is hanging and that prevents
> it from being probed?
> 
> > When the device isn't found, lets get some 'dmesg' output from the
> > kernel to see if the device is actually getting loaded correctly.  Also
> > see if the device's ports are present in /dev/.
> I don't have the output to hand, but I do remember checking and
> finding that the kernel did see it and the sierra driver was loaded
> for it. lsusb also showed it as present.

And there were /dev/ttyUSBx ports for the device?  If you can get it
into that state again, do this:

1) mv /usr/sbin/modem-manager /
2) killall -TERM modem-manager
3) /modem-manager --debug

and see what MM says.  When you're done,
mv /modem-manager /usr/sbin/modem-manager.

Dan

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


Re: Get uuid of connection

2010-07-21 Thread Arlen Nascimento
Ok, i could add a connection, but it is a system connection.
As far as i noted, in order to this connection I created be detected by the
scripts i'm using, it has to be a user connection.
How to create a user connection in the command line?


s_con = { 'id': 'XXX', 'uuid': '5ef2d781-1197-44eb-8744-cd78b9c07315',
'type': '802-11-wireless', 'autoconnect': False, 'name': 'connection' }

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

s_wsec = { 'key-mgmt': 'wpa-psk', 'wpa-key': 'xxx', 'name':
'802-11-wireless-security' }

s_ip4 = { 'method': 'auto', 'name': 'ipv4' }

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


sys_bus = dbus.SystemBus()
ses_bus = dbus.SessionBus()
proxy = sys_bus.get_object("org.freedesktop.NetworkManagerSystemSettings",
"/org/freedesktop/NetworkManagerSettings")
iface = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")

try:
iface.AddConnection(con)
except Exception, e:
print e

On Mon, Jul 19, 2010 at 7:03 PM, Daniel Gnoutcheff
wrote:

> On 07/19/2010 09:27 AM, Arlen Nascimento wrote:
> > It is possible to do it by means of dbus commands or something?
> > examples?
>
> Here's one:
>
> http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/add-system-connection.py
>
> dbus-send(1) probably could do the job as well, e.g. if you prefer to
> use shell scripts. These documents may be helpful as well:
> http://projects.gnome.org/NetworkManager/developers/spec-08.html
> http://projects.gnome.org/NetworkManager/developers/settings-spec-08.html
>
> And to make the connection "run" without user intervention, you only
> need to ensure that the "autoconnect" flag is "true". In fact, that flag
> is "true" by default, so you won't really need to do anything.
>
> Note that adding a system connection is a one-shot deal; you only need
> to do it once. So if you can afford to use a GUI tool just once, you'll
> probably find that nm-connection-editor is a much easier way to do it.
> (Just check "Available for all users", and it'll get installed as a
> system connection.)
>
> Have a good one,
> Daniel
>
> > On Mon, Jul 19, 2010 at 2:26 PM, Daenyth Blank  > > wrote:
> >
> > On Mon, Jul 19, 2010 at 09:11, Arlen Nascimento
> > mailto:arlen.nascime...@gmail.com>>
> wrote:
> > > Ok, but the thing is: i need to setup and "run" a connection
> > without the
> > > user intervention
> > In that case you need to create a new connection with the options
> > you want.
>



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