diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-01-24 17:11:18 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:58 +0100 |
commit | c075363c2c3563d548f12598a30d1a255e8285cb (patch) | |
tree | a13b6a8516fe2733b7de3c37eb44478c24b5c1a0 /cli/mmcli-modem-cdma.c | |
parent | 0527667500463cf858612b6e88b7d2f3e8e58d2e (diff) |
cli: fail if requesting CDMA actions and modem is not CDMA
Diffstat (limited to 'cli/mmcli-modem-cdma.c')
-rw-r--r-- | cli/mmcli-modem-cdma.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/mmcli-modem-cdma.c b/cli/mmcli-modem-cdma.c index 5726b46e..7ef5fce3 100644 --- a/cli/mmcli-modem-cdma.c +++ b/cli/mmcli-modem-cdma.c @@ -105,6 +105,16 @@ context_free (Context *ctx) g_free (ctx); } +static void +ensure_modem_cdma (void) +{ + if (ctx->modem_cdma) + return; + + g_printerr ("error: modem has no CDMA capabilities"); + exit (EXIT_FAILURE); +} + void mmcli_modem_cdma_shutdown (void) { @@ -146,6 +156,8 @@ get_modem_ready (GObject *source, ctx->object = mmcli_get_modem_finish (result, &ctx->manager); ctx->modem_cdma = mm_object_get_modem_cdma (ctx->object); + ensure_modem_cdma (); + /* Request to activate the modem? */ if (activate_str) { g_debug ("Asynchronously activating the modem..."); @@ -189,6 +201,8 @@ mmcli_modem_cdma_run_synchronous (GDBusConnection *connection) &ctx->manager); ctx->modem_cdma = mm_object_get_modem_cdma (ctx->object); + ensure_modem_cdma (); + /* Request to activate the modem? */ if (activate_str) { gboolean result; |