Parallel enables occurring (when SIM PIN enabled)

Colin Helliwell colin.helliwell at ln-systems.com
Wed Jul 19 12:22:45 UTC 2017


> On 19 July 2017 at 09:19 Aleksander Morgado <aleksander at aleksander.es> wrote:
> 
> On Wed, Jul 19, 2017 at 8:42 AM, Colin Helliwell
> 
> <colin.helliwell at ln-systems.com> wrote:
> 
> > But I wondered whether anything had been re-structured elsewhere which ought to address the problem anyway?
> 
> Don't think anything has been done in that regard, no.
> 

Ok I think I've modified my patch for the GTask mods, but would appreciate it if someone could take a look and see if I've got all the flow and tidy-up correct.

Patch attached, but patched source maybe easier to digest:

static void
enabling_wait_for_final_state_ready2 (MMIfaceModem *self,
                                     GAsyncResult *res,
                                     GTask *task)
{
    EnablingContext *ctx;
    GError *error = NULL;
    MMModemState state = MM_MODEM_STATE_UNKNOWN;

    ctx = g_task_get_task_data (task);

    ctx->previous_state = mm_iface_modem_wait_for_final_state_finish (self, res, &error);
    if (error) {
        g_task_return_error (task, error);
        g_object_unref (task);
        return;
    }

    g_object_get (self,
                  MM_IFACE_MODEM_STATE, &state,
                  NULL);

    if (state < MM_MODEM_STATE_ENABLED) {
        g_task_return_error (task,
                             g_error_new_literal (MM_CORE_ERROR,
                                                  MM_CORE_ERROR_FAILED,
                                                  "waited longer, still not enabled"));
        g_object_unref (task);
        return;
    }

    /* We're enabled now, go on */
    g_task_return_boolean (task, TRUE);
    g_object_unref (task);
    return;
}

static void
enabling_wait_for_final_state_ready (MMIfaceModem *self,
                                     GAsyncResult *res,
                                     GTask *task)
{
    EnablingContext *ctx;
    GError *error = NULL;
    MMModemState state = MM_MODEM_STATE_UNKNOWN;

    ctx = g_task_get_task_data (task);

    ctx->previous_state = mm_iface_modem_wait_for_final_state_finish (self, res, &error);
    if (error) {
        g_task_return_error (task, error);
        g_object_unref (task);
        return;
    }

    g_object_get (self,
                  MM_IFACE_MODEM_STATE, &state,
                  NULL);
    if (state == MM_MODEM_STATE_ENABLING) {
        /*g_message ("######## parallel enables!");*/

        mm_iface_modem_wait_for_final_state (MM_IFACE_MODEM (ctx->self),
                                             MM_MODEM_STATE_UNKNOWN, /* just any */
                                             (GAsyncReadyCallback)enabling_wait_for_final_state_ready2,
                                             task);
        return;
    }

    /* We're in a final state now, go on */

    mm_iface_modem_update_state (MM_IFACE_MODEM (ctx->self),
                                 MM_MODEM_STATE_ENABLING,
                                 MM_MODEM_STATE_CHANGE_REASON_USER_REQUESTED);

    ctx->step++;
    enabling_step (task);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 01-parallel-enable.patch
Type: application/octet-stream
Size: 2671 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20170719/7d13bb7b/attachment.obj>


More information about the ModemManager-devel mailing list