summaryrefslogtreecommitdiffstats
path: root/isys/isys.py
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2008-08-25 16:44:11 -1000
committerDavid Cantrell <dcantrell@redhat.com>2008-08-25 16:44:11 -1000
commit1c2f59f0d1f9876d4fb15ff69812cf8d55f25461 (patch)
tree69c71d9528e3b6a322b4843dc0a4473105bd9558 /isys/isys.py
parentbf30dd85aac92dce3f0d398aa320ebf88a76be6d (diff)
downloadanaconda-1c2f59f0d1f9876d4fb15ff69812cf8d55f25461.tar.gz
anaconda-1c2f59f0d1f9876d4fb15ff69812cf8d55f25461.tar.xz
anaconda-1c2f59f0d1f9876d4fb15ff69812cf8d55f25461.zip
Rewrite isys.isWireless() to use D-Bus and NetworkManager
Removed the wireless.c and wireless.h code from isys, since isWireless() in isys.py communicates with NetworkManager now.
Diffstat (limited to 'isys/isys.py')
-rwxr-xr-xisys/isys.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/isys/isys.py b/isys/isys.py
index bbfeec951..c3d56f30d 100755
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -923,7 +923,35 @@ def getMacAddress(dev):
# @param dev The network device to check.
# @return True if dev is a wireless network device, False otherwise.
def isWireless(dev):
- return _isys.isWireless(dev)
+ if dev == '' or dev is None:
+ return False
+
+ bus = dbus.SystemBus()
+ nm = bus.get_object(NM_SERVICE, NM_MANAGER_PATH)
+ devlist = nm.get_dbus_method("GetDevices")()
+
+ for path in devlist:
+ device = bus.get_object(NM_SERVICE, path)
+ device_props_iface = dbus.Interface(device, DBUS_PROPS_IFACE)
+
+ device_interface = device_props_iface.Get(NM_MANAGER_IFACE, "Interface")
+ if str(device_interface) != dev:
+ continue
+
+ device_type = int(device_props_iface.Get(NM_MANAGER_IFACE, "DeviceType"))
+
+ # from include/NetworkManager.h in the NM source code
+ # 0 == NM_DEVICE_TYPE_UNKNOWN
+ # 1 == NM_DEVICE_TYPE_ETHERNET
+ # 2 == NM_DEVICE_TYPE_WIFI
+ # 3 == NM_DEVICE_TYPE_GSM
+ # 4 == NM_DEVICE_TYPE_CDMA
+ if device_type == 2:
+ return True
+ else:
+ return False
+
+ return False
## Get the IP address for a network device.
# @param dev The network device to check.