diff options
| author | Sylvain Pineau <sylvain.pineau@canonical.com> | 2017-07-07 17:06:08 +0200 |
|---|---|---|
| committer | Sylvain Pineau <sylvain.pineau@canonical.com> | 2017-07-07 17:06:08 +0200 |
| commit | 93a17729921e399d883aa824dc8c96e944affe03 (patch) | |
| tree | ad3d60e81dd2005ff0d85142077cee94c295874d | |
| parent | 174dbf09287ffecc3ba139bb830dc2ac2821689d (diff) | |
network_device_info: Only do the check for Ethernet devices
| -rwxr-xr-x | bin/network_device_info | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/bin/network_device_info b/bin/network_device_info index 9aa4f90..da2f5a2 100755 --- a/bin/network_device_info +++ b/bin/network_device_info @@ -58,7 +58,7 @@ nm_devices = [] class UdevResult: def addDevice(self, device): - if device.interface: + if device.category == 'NETWORK': udev_devices.append(device) @@ -177,8 +177,8 @@ def get_nm_devices(): except KeyError: devtype = "Unknown" - # only return WiFi, Ethernet and Modem devices - if devtype in ("WiFi", "Ethernet", "Modem"): + # only return Ethernet devices + if devtype == "Ethernet": devices.append(NetworkingDevice(devtype, props, dev_proxy, bus)) return devices @@ -191,10 +191,6 @@ def match_counts(nm_devices, udev_devices, devtype): # now check that the count (by type) matches nm_type_devices = [dev for dev in nm_devices if dev.gettype() in devtype] udevtype = 'NETWORK' - if devtype == 'WiFi': - udevtype = 'WIRELESS' - elif devtype == 'Modem': - udevtype = 'WWAN' udev_type_devices = [ udev for udev in udev_devices @@ -261,11 +257,7 @@ def main(args): for nm_dev in nm_devices: print(nm_dev) - if not match_counts(nm_devices, udev_devices, "WiFi"): - return 1 - elif not match_counts(nm_devices, udev_devices, "Ethernet"): - return 1 - elif not match_counts(nm_devices, udev_devices, "Modem"): + if not match_counts(nm_devices, udev_devices, "Ethernet"): return 1 else: return 0 |
