diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-26 13:00:07 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-26 13:00:07 +0200 |
commit | 28f13c09ecf6433385d9b7a8cff5be825d74c9c8 (patch) | |
tree | d3529febb689258b8535f1c02ec88a344b7d00b6 /cli/mmcli-modem-3gpp.c | |
parent | d10780dcf573749137710c376edf52086e2b4500 (diff) |
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.
Diffstat (limited to 'cli/mmcli-modem-3gpp.c')
-rw-r--r-- | cli/mmcli-modem-3gpp.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/cli/mmcli-modem-3gpp.c b/cli/mmcli-modem-3gpp.c index 7e141be5..75b8ee14 100644 --- a/cli/mmcli-modem-3gpp.c +++ b/cli/mmcli-modem-3gpp.c @@ -161,21 +161,33 @@ context_free (Context *ctx) static void ensure_modem_3gpp (void) { - if (ctx->modem_3gpp) - 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); + } + + if (!ctx->modem_3gpp) { + g_printerr ("error: modem has no 3GPP capabilities\n"); + exit (EXIT_FAILURE); + } - g_printerr ("error: modem has no 3GPP capabilities\n"); - exit (EXIT_FAILURE); + /* Success */ } static void ensure_modem_3gpp_ussd (void) { - if (ctx->modem_3gpp_ussd) - 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); + } + + if (!ctx->modem_3gpp_ussd) { + g_printerr ("error: modem has no USSD capabilities\n"); + exit (EXIT_FAILURE); + } - g_printerr ("error: modem has no USSD capabilities\n"); - exit (EXIT_FAILURE); + /* Success */ } void |