diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-01-24 16:19:05 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:58 +0100 |
commit | 31ce3e5ae140ffd5a96f8b010d4a281dafb0d17e (patch) | |
tree | d1b04e066158db889ffb8e9f73cf0f869bd2b800 | |
parent | a1b199d90338c2756673ff1b3c46cacbb2a6e20c (diff) |
cli: fail if requesting 3GPP actions and modem is not 3GPP
-rw-r--r-- | cli/mmcli-modem-3gpp.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/mmcli-modem-3gpp.c b/cli/mmcli-modem-3gpp.c index 3fbb315b..ba0af5c3 100644 --- a/cli/mmcli-modem-3gpp.c +++ b/cli/mmcli-modem-3gpp.c @@ -122,6 +122,16 @@ context_free (Context *ctx) g_free (ctx); } +static void +ensure_modem_3gpp (void) +{ + if (ctx->modem_3gpp) + return; + + g_printerr ("error: modem has no 3GPP capabilities"); + exit (EXIT_FAILURE); +} + void mmcli_modem_3gpp_shutdown (void) { @@ -230,6 +240,8 @@ get_modem_ready (GObject *source, ctx->object = mmcli_get_modem_finish (result, &ctx->manager); ctx->modem_3gpp = mm_object_get_modem_3gpp (ctx->object); + ensure_modem_3gpp (); + /* Request to scan networks? */ if (scan_flag) { g_debug ("Asynchronously scanning for networks..."); @@ -283,6 +295,8 @@ mmcli_modem_3gpp_run_synchronous (GDBusConnection *connection) &ctx->manager); ctx->modem_3gpp = mm_object_get_modem_3gpp (ctx->object); + ensure_modem_3gpp (); + if (scan_flag) g_assert_not_reached (); |