cli: fail if requesting 3GPP actions and modem is not 3GPP

This commit is contained in:
Aleksander Morgado
2012-01-24 16:19:05 +01:00
parent a1b199d903
commit 31ce3e5ae1

View File

@@ -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 ();