static gboolean first_interface_missing_timeout_cb (MMDevice *device) { try_next_usbif (device); /* Reload the timeout, just in case we end up not having the next interface to probe... * which is anyway very unlikely as we got it by looking at the real probe list, but anyway... */ return TRUE; }
static void huawei_custom_init_step (HuaweiCustomInitContext *ctx) { FirstInterfaceContext *fi_ctx; /* If cancelled, end */ if (g_cancellable_is_cancelled (ctx->cancellable)) { mm_dbg ("(Huawei) no need to keep on running custom init in (%s)", mm_port_get_device (MM_PORT (ctx->port))); g_simple_async_result_set_error (ctx->result, MM_CORE_ERROR, MM_CORE_ERROR_CANCELLED, "Custom initialization cancelled"); huawei_custom_init_context_complete_and_free (ctx); return; } if (!ctx->curc_done) { if (ctx->curc_retries == 0) { /* All retries consumed, probably not an AT port */ mm_port_probe_set_result_at (ctx->probe, FALSE); g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); /* Try with next */ try_next_usbif (mm_port_probe_peek_device (ctx->probe)); huawei_custom_init_context_complete_and_free (ctx); return; } ctx->curc_retries--; /* Turn off unsolicited messages on secondary ports until needed */ mm_at_serial_port_queue_command ( ctx->port, "AT^CURC=0", 3, FALSE, /* raw */ ctx->cancellable, (MMAtSerialResponseFn)curc_ready, ctx); return; } /* Try to get a port map from the modem */ if (!ctx->getportmode_done) { if (ctx->getportmode_retries == 0) { g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); huawei_custom_init_context_complete_and_free (ctx); return; } ctx->getportmode_retries--; mm_at_serial_port_queue_command ( ctx->port, "AT^GETPORTMODE", 3, FALSE, /* raw */ ctx->cancellable, (MMAtSerialResponseFn)getportmode_ready, ctx); return; } /* All done it seems */ fi_ctx = g_object_get_data (G_OBJECT (mm_port_probe_peek_device (ctx->probe)), TAG_FIRST_INTERFACE_CONTEXT); g_assert (fi_ctx != NULL); fi_ctx->custom_init_run = TRUE; g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); huawei_custom_init_context_complete_and_free (ctx); }
static void huawei_custom_init_step (HuaweiCustomInitContext *ctx) { FirstInterfaceContext *fi_ctx; GUdevDevice *port; /* If cancelled, end */ if (g_cancellable_is_cancelled (ctx->cancellable)) { mm_dbg ("(Huawei) no need to keep on running custom init in (%s)", mm_port_get_device (MM_PORT (ctx->port))); g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); huawei_custom_init_context_complete_and_free (ctx); return; } if (!ctx->curc_done) { if (ctx->curc_retries == 0) { /* All retries consumed, probably not an AT port */ mm_port_probe_set_result_at (ctx->probe, FALSE); g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); /* Try with next */ try_next_usbif (mm_port_probe_peek_device (ctx->probe)); huawei_custom_init_context_complete_and_free (ctx); return; } ctx->curc_retries--; /* Turn off unsolicited messages on secondary ports until needed */ mm_port_serial_at_command ( ctx->port, "AT^CURC=0", 3, FALSE, /* raw */ FALSE, /* allow_cached */ ctx->cancellable, (GAsyncReadyCallback)curc_ready, ctx); return; } /* Try to get a port map from the modem */ port = mm_port_probe_peek_port (ctx->probe); if (!ctx->getportmode_done && !g_udev_device_get_property_as_boolean (port, "ID_MM_HUAWEI_DISABLE_GETPORTMODE")) { if (ctx->getportmode_retries == 0) { g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); huawei_custom_init_context_complete_and_free (ctx); return; } ctx->getportmode_retries--; mm_port_serial_at_command ( ctx->port, "AT^GETPORTMODE", 3, FALSE, /* raw */ FALSE, /* allow_cached */ ctx->cancellable, (GAsyncReadyCallback)getportmode_ready, ctx); return; } /* All done it seems */ fi_ctx = g_object_get_data (G_OBJECT (mm_port_probe_peek_device (ctx->probe)), TAG_FIRST_INTERFACE_CONTEXT); g_assert (fi_ctx != NULL); fi_ctx->custom_init_run = TRUE; g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); huawei_custom_init_context_complete_and_free (ctx); }