aboutsummaryrefslogtreecommitdiff
path: root/examples/network-scan-python
diff options
context:
space:
mode:
authorYegor Yefremov <yegorslists@googlemail.com>2021-02-13 17:19:13 +0100
committerAleksander Morgado <aleksander@aleksander.es>2021-02-14 23:35:54 +0100
commit3a32409000ad584ec67b0ddd43b312a37ea5a369 (patch)
tree73e0765d6d283b4e916ea3aa7d39f4737ac720be /examples/network-scan-python
parentc7d0defddeb03a372fb885eab3480cc56f10115b (diff)
examples: network-scan: enable modem before the network scan
Otherwise we get the following exception: Traceback (most recent call last): File "/root/network-scan-python", line 57, in <module> networks = modem3gpp.scan_sync() gi.repository.GLib.Error: mm_core_error_quark: GDBus.Error:org.freedesktop.ModemManager1.Error.Core.WrongState: Cannot scan networks: not enabled yet (8)
Diffstat (limited to 'examples/network-scan-python')
-rwxr-xr-xexamples/network-scan-python/network-scan-python4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/network-scan-python/network-scan-python b/examples/network-scan-python/network-scan-python
index db12242a..12ee02f7 100755
--- a/examples/network-scan-python/network-scan-python
+++ b/examples/network-scan-python/network-scan-python
@@ -19,6 +19,7 @@
#
import sys
+import time
import gi
gi.require_version('ModemManager', '1.0')
@@ -43,6 +44,9 @@ if __name__ == "__main__":
# Iterate modems and scan network with each one by one
for obj in manager.get_objects():
+ modem = obj.get_modem()
+ modem.enable()
+ time.sleep(1)
modem3gpp = obj.get_modem_3gpp()
if not modem3gpp:
sys.stderr.write('%s: skipping unusable modem...\n' %