[PATCH] broadband-modem-qmi: implement power-cycle reset functionality

Aleksander Morgado aleksander at aleksander.es
Wed Nov 11 10:43:03 PST 2015


On Wed, Nov 11, 2015 at 7:40 PM, Dan Williams <dcbw at redhat.com> wrote:
> ---
>  src/mm-broadband-modem-qmi.c | 49 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
>
> diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c
> index 49b3e14..1b516c6 100644
> --- a/src/mm-broadband-modem-qmi.c
> +++ b/src/mm-broadband-modem-qmi.c
> @@ -2847,6 +2847,53 @@ create_sim (MMIfaceModem *self,
>  }
>

Looks good, go on and merge it.

>  /*****************************************************************************/
> +/* Reset (Modem interface) */
> +
> +static gboolean
> +modem_reset_finish (MMIfaceModem *self,
> +                    GAsyncResult *res,
> +                    GError **error)
> +{
> +    return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
> +}
> +
> +
> +static void
> +modem_reset_power_cycle_ready (MMBroadbandModemQmi *self,
> +                               GAsyncResult *res,
> +                               GSimpleAsyncResult *simple)
> +{
> +    GError *error = NULL;
> +
> +    if (!power_cycle_finish (self, res, &error))
> +        g_simple_async_result_take_error (simple, error);
> +    else
> +        g_simple_async_result_set_op_res_gboolean (simple, TRUE);
> +
> +    g_simple_async_result_complete (simple);
> +    g_object_unref (simple);
> +}
> +
> +
> +static void
> +modem_reset (MMIfaceModem *self,
> +             GAsyncReadyCallback callback,
> +             gpointer user_data)
> +{
> +    GSimpleAsyncResult *result;
> +
> +    result = g_simple_async_result_new (G_OBJECT (self),
> +                                        callback,
> +                                        user_data,
> +                                        modem_reset);
> +
> +    /* Power cycle the modem */
> +    power_cycle (MM_BROADBAND_MODEM_QMI (self),
> +                 (GAsyncReadyCallback)modem_reset_power_cycle_ready,
> +                 result);
> +}
> +
> +/*****************************************************************************/
>  /* Factory reset (Modem interface) */
>
>  static gboolean
> @@ -10939,6 +10986,8 @@ iface_modem_init (MMIfaceModem *iface)
>      iface->create_bearer_finish = modem_create_bearer_finish;
>
>      /* Other actions */
> +    iface->reset = modem_reset;
> +    iface->reset_finish = modem_reset_finish;
>      iface->factory_reset = modem_factory_reset;
>      iface->factory_reset_finish = modem_factory_reset_finish;
>  }
> --
> 2.1.0
>
>
> _______________________________________________
> ModemManager-devel mailing list
> ModemManager-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/modemmanager-devel



-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list