开发者

Simulate Network Presence in dbus

开发者 https://www.devze.com 2022-12-25 18:29 出处:网络
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

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 t开发者_开发百科o connect. Pidgin, Empathy and other software are not able to detect the network.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号