From 6024142facf549f90a5aafb3782434ef19398947 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Thu, 11 Apr 2013 20:03:39 +0200 Subject: [PATCH] sim-mbim: these modems don't allow to enable/disable/change PIN if locked --- src/mm-sim-mbim.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/mm-sim-mbim.c b/src/mm-sim-mbim.c index ab41a163..12dbe8b0 100644 --- a/src/mm-sim-mbim.c +++ b/src/mm-sim-mbim.c @@ -272,9 +272,16 @@ pin_set_enable_ready (MbimDevice *device, mbim_message_unref (response); } - if (error) + if (error) { + if (g_error_matches (error, MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_PIN_REQUIRED)) { + g_error_free (error); + error = g_error_new (MM_CORE_ERROR, + MM_CORE_ERROR_WRONG_STATE, + "Need to be unlocked to allow enabling/disabling PIN"); + } + g_simple_async_result_take_error (simple, error); - else + } else g_simple_async_result_set_op_res_gboolean (simple, TRUE); g_simple_async_result_complete (simple); g_object_unref (simple); @@ -345,9 +352,16 @@ pin_set_change_ready (MbimDevice *device, mbim_message_unref (response); } - if (error) + if (error) { + if (g_error_matches (error, MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_PIN_REQUIRED)) { + g_error_free (error); + error = g_error_new (MM_CORE_ERROR, + MM_CORE_ERROR_WRONG_STATE, + "Need to be unlocked to allow changing PIN"); + } + g_simple_async_result_take_error (simple, error); - else + } else g_simple_async_result_set_op_res_gboolean (simple, TRUE); g_simple_async_result_complete (simple); g_object_unref (simple);