From: Yegor Yefremov <[email protected]>

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)
---
 examples/network-scan-python/network-scan-python | 4 ++++
 1 file changed, 4 insertions(+)

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' %
-- 
2.17.0

_______________________________________________
ModemManager-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Reply via email to