aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-01-24 17:12:46 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:58 +0100
commitffa374c793ac360262e414cab16c40edd1859543 (patch)
treeee3a2d56d958560da59f660fc25cd1d1e8f89cb3
parentc075363c2c3563d548f12598a30d1a255e8285cb (diff)
cli: fail if requesting location actions and modem doesn't handle locations
-rw-r--r--cli/mmcli-modem-location.c14
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;