diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2020-07-02 12:20:27 +0200 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2020-07-02 12:20:27 +0200 |
| commit | 486e0bef719d78ee55d2166b0bfb4fa684c09854 (patch) | |
| tree | aead4c1cc30eb61a2d9dec70f7c8339904506fad /examples/python/dbus/is-wwan-default.py | |
| parent | 39143df7aed46e83f8c68ea9ad6d24cfdf5a1dd8 (diff) | |
| parent | 10ae7d8cd706062742d0cdb1803d49909aef9e06 (diff) | |
Merge branch 'upstream/latest' of https://salsa.debian.org/utopia-team/network-manager into upstream/latest
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") - |