diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2020-07-02 11:35:14 +0200 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2020-07-02 11:52:25 +0200 |
| commit | c6c4e39b012d544c1f1ed816686c8ae1599da793 (patch) | |
| tree | 094d5e07c1d135d0ee67d99e051fd6a9a367a6a4 /examples/python/dbus/is-wwan-default.py | |
| parent | 7368e45ff5b3b8b328d55408bcd403e4d6c564d0 (diff) | |
| parent | acd7b014c72673f5b0c0b91309e27028886da167 (diff) | |
Merge remote-tracking branch 'salsa/debian/master' into ubuntu/master
Diffstat (limited to 'examples/python/dbus/is-wwan-default.py')
| -rwxr-xr-x | examples/python/dbus/is-wwan-default.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/python/dbus/is-wwan-default.py b/examples/python/dbus/is-wwan-default.py index d6e2b12e..38dc1735 100755 --- a/examples/python/dbus/is-wwan-default.py +++ b/examples/python/dbus/is-wwan-default.py @@ -30,8 +30,9 @@ proxy = bus.get_object(NM_SERVICE_NAME, "/org/freedesktop/NetworkManager") manager = dbus.Interface(proxy, NM_MANAGER_IFACE) props = dbus.Interface(proxy, DBUS_PROPS_IFACE) + def found_connection_type(ctype): - if ctype == '': + if ctype == "": print("No active connection") elif ctype in ["gsm", "cdma", "bluetooth"]: print("WWAN is default") @@ -39,6 +40,7 @@ def found_connection_type(ctype): print("WWAN is not default") sys.exit(0) + # Shortcut #1, for NM 1.0 try: ctype = props.Get(NM_MANAGER_IFACE, "PrimaryConnectionType") @@ -50,7 +52,7 @@ except KeyError: try: primary = props.Get(NM_MANAGER_IFACE, "PrimaryConnection") if not primary: - found_connection_type('') + found_connection_type("") primary_proxy = bus.get_object(NM_SERVICE_NAME, primary) primary_props = dbus.Interface(primary_proxy, DBUS_PROPS_IFACE) ctype = primary_props.Get(NM_ACTIVE_CONNECTION_INTERFACE, "Type") @@ -83,4 +85,3 @@ if default_is_wwan: print("WWAN is default") else: print("WWAN is not default") - |