diff options
author | Koen Kooi <koen@openembedded.org> | 2009-02-02 21:50:14 +0100 |
---|---|---|
committer | Koen Kooi <koen@openembedded.org> | 2009-02-02 21:50:14 +0100 |
commit | 927decaa31e3409eeb47df293eac72aeed03092e (patch) | |
tree | f76ce6721dd4a9227dbba9a8645ad48a5de4073f /packages/networkmanager/netm-cli-0.2 | |
parent | 05b19d12d5a32d1ab7708660e9dcede2b2bf1dc8 (diff) |
networkmanager: merge with mamona
Diffstat (limited to 'packages/networkmanager/netm-cli-0.2')
-rw-r--r-- | packages/networkmanager/netm-cli-0.2/scan_support.patch | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/packages/networkmanager/netm-cli-0.2/scan_support.patch b/packages/networkmanager/netm-cli-0.2/scan_support.patch new file mode 100644 index 0000000000..efa3cd89b4 --- /dev/null +++ b/packages/networkmanager/netm-cli-0.2/scan_support.patch @@ -0,0 +1,69 @@ +diff --git a/netm-cli/netm-cli b/netm-cli/netm-cli +index 46c3fa6..0a53036 100755 +--- a/netm-cli/netm-cli ++++ b/netm-cli/netm-cli +@@ -29,6 +29,7 @@ __version__ = "0.2" + import dbus + import gobject + import os ++import sys + from dbus.mainloop.glib import DBusGMainLoop + from ConfigParser import ConfigParser + from optparse import OptionParser, OptionGroup +@@ -499,6 +500,14 @@ class NMCLI: + self._we_cipher, self._hexkey, + self._wpa_version, self._key_mgmt) + ++ def scan(self): ++ """Scan the network and update the NM device struct.""" ++ for devname in self.devices: ++ device = self.devices[devname] ++ if device['type'] == DEVICE_TYPE_802_11_WIRELESS: ++ devobj = self.bus.get_object(NM_DBUS_SERVICE, device['path']) ++ devobj.performScan() ++ + def sleep(self): + """Tell NetworkManager to go into offline mode mode.""" + self.nm.sleep(ignore_reply=True) +@@ -782,7 +791,33 @@ def main(): + nm = NMCLI(device, essid, hexkey, contype, wep_alg, wpa_pairwise, + options.verbose) + ++ loop = gobject.MainLoop() ++ + # Main actions ++ if options.networks: ++ print "Performing scan...", ++ sys.stdout.flush() ++ devices = [nm.devices[dev]['path'] for dev in nm.devices if ++ nm.devices[dev]['type'] == DEVICE_TYPE_802_11_WIRELESS] ++ ++ def scan_performed(device): ++ """Scan helper.""" ++ if device in devices: ++ devices.remove(device) ++ if not devices: ++ loop.quit() ++ ++ nm.bus.add_signal_receiver( ++ handler_function=scan_performed, signal_name="ScanPerformed", ++ path=NM_DBUS_PATH, dbus_interface=NM_DBUS_INTERFACE) ++ nm.scan() ++ loop.run() ++ nm.bus.remove_signal_receiver( ++ handler_or_match=scan_performed, signal_name="ScanPerformed", ++ path=NM_DBUS_PATH, dbus_interface=NM_DBUS_INTERFACE) ++ print "OK" ++ sys.stdout.flush() ++ nm.update_devices() + if options.monitor: + nm.set_signals() + if options.nmstatus: +@@ -811,7 +846,6 @@ def main(): + config.save() + + if options.monitor: +- loop = gobject.MainLoop() + loop.run() + + # Run the program |