mmcli: abort certain operations if modem is unlocked
Do not try to perform feature/capability specific actions if we're still unlocked, as the modem didn't yet export the feature/capability specific interface. The only interfaces expected while modem is unlocked are the Modem and Simple interfaces, as well as the SIM interface in the SIM object, of course.
This commit is contained in:
@@ -120,11 +120,17 @@ context_free (Context *ctx)
|
||||
static void
|
||||
ensure_modem_messaging (void)
|
||||
{
|
||||
if (ctx->modem_messaging)
|
||||
return;
|
||||
if (mm_modem_get_unlock_required (mm_object_peek_modem (ctx->object)) != MM_MODEM_LOCK_NONE) {
|
||||
g_printerr ("error: modem not unlocked yet\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
g_printerr ("error: modem has no messaging capabilities\n");
|
||||
exit (EXIT_FAILURE);
|
||||
if (!ctx->modem_messaging) {
|
||||
g_printerr ("error: modem has no messaging capabilities\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Success */
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user