[PATCH 2/2] examples: network-scan: enable modem before the network scan
Aleksander Morgado
aleksander at aleksander.es
Sun Feb 14 22:37:38 UTC 2021
On 13/2/21 17:19, yegorslists at googlemail.com wrote:
> From: Yegor Yefremov <yegorslists at googlemail.com>
>
> 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)
> ---
Merged, thanks
> 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' %
>
--
Aleksander
https://aleksander.es
More information about the ModemManager-devel
mailing list