iface-modem: improve logging of user request to reset modem
This commit is contained in:
@@ -2350,9 +2350,9 @@ handle_set_power_state (MmGdbusModem *skeleton,
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
MmGdbusModem *skeleton;
|
MmGdbusModem *skeleton;
|
||||||
GDBusMethodInvocation *invocation;
|
GDBusMethodInvocation *invocation;
|
||||||
MMIfaceModem *self;
|
MMIfaceModem *self;
|
||||||
} HandleResetContext;
|
} HandleResetContext;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2361,27 +2361,30 @@ handle_reset_context_free (HandleResetContext *ctx)
|
|||||||
g_object_unref (ctx->skeleton);
|
g_object_unref (ctx->skeleton);
|
||||||
g_object_unref (ctx->invocation);
|
g_object_unref (ctx->invocation);
|
||||||
g_object_unref (ctx->self);
|
g_object_unref (ctx->self);
|
||||||
g_free (ctx);
|
g_slice_free (HandleResetContext, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_reset_ready (MMIfaceModem *self,
|
handle_reset_ready (MMIfaceModem *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
HandleResetContext *ctx)
|
HandleResetContext *ctx)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->reset_finish (self, res, &error))
|
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->reset_finish (self, res, &error)) {
|
||||||
|
mm_obj_warn (self, "failed requesting modem reset: %s", error->message);
|
||||||
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||||
else
|
} else {
|
||||||
|
mm_obj_info (self, "modem reset requested");
|
||||||
mm_gdbus_modem_complete_reset (ctx->skeleton, ctx->invocation);
|
mm_gdbus_modem_complete_reset (ctx->skeleton, ctx->invocation);
|
||||||
|
}
|
||||||
|
|
||||||
handle_reset_context_free (ctx);
|
handle_reset_context_free (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_reset_auth_ready (MMBaseModem *self,
|
handle_reset_auth_ready (MMBaseModem *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
HandleResetContext *ctx)
|
HandleResetContext *ctx)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@@ -2393,29 +2396,27 @@ handle_reset_auth_ready (MMBaseModem *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If reseting is not implemented, report an error */
|
/* If reseting is not implemented, report an error */
|
||||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->reset ||
|
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->reset || !MM_IFACE_MODEM_GET_INTERFACE (self)->reset_finish) {
|
||||||
!MM_IFACE_MODEM_GET_INTERFACE (self)->reset_finish) {
|
g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
|
||||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
"Operation not supported");
|
||||||
MM_CORE_ERROR,
|
|
||||||
MM_CORE_ERROR_UNSUPPORTED,
|
|
||||||
"Cannot reset the modem: operation not supported");
|
|
||||||
handle_reset_context_free (ctx);
|
handle_reset_context_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mm_obj_info (self, "processing user request to reset modem...");
|
||||||
MM_IFACE_MODEM_GET_INTERFACE (self)->reset (MM_IFACE_MODEM (self),
|
MM_IFACE_MODEM_GET_INTERFACE (self)->reset (MM_IFACE_MODEM (self),
|
||||||
(GAsyncReadyCallback)handle_reset_ready,
|
(GAsyncReadyCallback)handle_reset_ready,
|
||||||
ctx);
|
ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
handle_reset (MmGdbusModem *skeleton,
|
handle_reset (MmGdbusModem *skeleton,
|
||||||
GDBusMethodInvocation *invocation,
|
GDBusMethodInvocation *invocation,
|
||||||
MMIfaceModem *self)
|
MMIfaceModem *self)
|
||||||
{
|
{
|
||||||
HandleResetContext *ctx;
|
HandleResetContext *ctx;
|
||||||
|
|
||||||
ctx = g_new (HandleResetContext, 1);
|
ctx = g_slice_new0 (HandleResetContext);
|
||||||
ctx->skeleton = g_object_ref (skeleton);
|
ctx->skeleton = g_object_ref (skeleton);
|
||||||
ctx->invocation = g_object_ref (invocation);
|
ctx->invocation = g_object_ref (invocation);
|
||||||
ctx->self = g_object_ref (self);
|
ctx->self = g_object_ref (self);
|
||||||
|
Reference in New Issue
Block a user