tags:

views:

88

answers:

2

Is there a way using Python to simulate the presence of an active network connection using dbus? If I call getstate() on the dbus, I'm able to get the current network state. I want to set the current state to 4 (Connection Present). This is because Network Manager is not able to connect using my modem and I use other tools to connect. Pidgin, Empathy and other software are not able to detect the network.

A: 

Your options are to write something that mocks NetworkManager's D-Bus interface, or to write a module for NetworkManager that supports the tools you use.

Ignacio Vazquez-Abrams
+1  A: 

I'm pretty sure that both Pidgin and Empathy assume you're online if you disable NM by right-clicking the Network Manager tray icon and untick Enable Networking. So you can do this when you're connecting via a non-NM mechanism. No code necessary!

(You could write an application which implements the same D-Bus interface as NetworkManager, sits on the system bus, and pretends to be online, and then when you want to use your network kill the real NetworkManager program and start your fake one, but that smells like overkill to me...)

wjt
Thanks, but just in case I want to set the Network State, is there an easy way to do it? Just to set the state to 4(Connected). Probably emit some signal or change a variable somewhere.
Evans
You can either hack NetworkManager, or write a fake one.
wjt