diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-01-24 17:12:46 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:58 +0100 |
commit | ffa374c793ac360262e414cab16c40edd1859543 (patch) | |
tree | ee3a2d56d958560da59f660fc25cd1d1e8f89cb3 /cli/mmcli-modem-location.c | |
parent | c075363c2c3563d548f12598a30d1a255e8285cb (diff) |
cli: fail if requesting location actions and modem doesn't handle locations
Diffstat (limited to 'cli/mmcli-modem-location.c')
-rw-r--r-- | cli/mmcli-modem-location.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/mmcli-modem-location.c b/cli/mmcli-modem-location.c index 5dbe5c2a..73c9fa7f 100644 --- a/cli/mmcli-modem-location.c +++ b/cli/mmcli-modem-location.c @@ -117,6 +117,16 @@ context_free (Context *ctx) g_free (ctx); } +static void +ensure_modem_location (void) +{ + if (ctx->modem_location) + return; + + g_printerr ("error: modem has no location capabilities"); + exit (EXIT_FAILURE); +} + void mmcli_modem_location_shutdown (void) { @@ -219,6 +229,8 @@ get_modem_ready (GObject *source, ctx->object = mmcli_get_modem_finish (result, &ctx->manager); ctx->modem_location = mm_object_get_modem_location (ctx->object); + ensure_modem_location (); + /* Request to enable location gathering? */ if (enable_flag) { g_debug ("Asynchronously enabling location gathering..."); @@ -284,6 +296,8 @@ mmcli_modem_location_run_synchronous (GDBusConnection *connection) &ctx->manager); ctx->modem_location = mm_object_get_modem_location (ctx->object); + ensure_modem_location (); + /* Request to enable location gathering? */ if (enable_flag) { gboolean result; |