cli: fail if requesting CDMA actions and modem is not CDMA
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user