aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2022-09-12 12:29:49 +0000
committerAleksander Morgado <aleksandermj@chromium.org>2022-11-04 13:12:57 +0000
commitb82c89f45c5448c9fedf3f142d2b0e14400f4c86 (patch)
tree23382ecc276b441a99a2abff038b20e1ec1128c2 /src
parent03528fbff76d05c1e8d62da4ba4613232edc5df0 (diff)
iface-modem: improve logging of user request to reset modem
Diffstat (limited to 'src')
-rw-r--r--src/mm-iface-modem.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 680f97c1..b45a7f66 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -2350,9 +2350,9 @@ handle_set_power_state (MmGdbusModem *skeleton,
/*****************************************************************************/
typedef struct {
- MmGdbusModem *skeleton;
+ MmGdbusModem *skeleton;
GDBusMethodInvocation *invocation;
- MMIfaceModem *self;
+ MMIfaceModem *self;
} HandleResetContext;
static void
@@ -2361,27 +2361,30 @@ handle_reset_context_free (HandleResetContext *ctx)
g_object_unref (ctx->skeleton);
g_object_unref (ctx->invocation);
g_object_unref (ctx->self);
- g_free (ctx);
+ g_slice_free (HandleResetContext, ctx);
}
static void
-handle_reset_ready (MMIfaceModem *self,
- GAsyncResult *res,
+handle_reset_ready (MMIfaceModem *self,
+ GAsyncResult *res,
HandleResetContext *ctx)
{
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);
- else
+ } else {
+ mm_obj_info (self, "modem reset requested");
mm_gdbus_modem_complete_reset (ctx->skeleton, ctx->invocation);
+ }
handle_reset_context_free (ctx);
}
static void
-handle_reset_auth_ready (MMBaseModem *self,
- GAsyncResult *res,
+handle_reset_auth_ready (MMBaseModem *self,
+ GAsyncResult *res,
HandleResetContext *ctx)
{
GError *error = NULL;
@@ -2393,29 +2396,27 @@ handle_reset_auth_ready (MMBaseModem *self,
}
/* If reseting is not implemented, report an error */
- if (!MM_IFACE_MODEM_GET_INTERFACE (self)->reset ||
- !MM_IFACE_MODEM_GET_INTERFACE (self)->reset_finish) {
- g_dbus_method_invocation_return_error (ctx->invocation,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot reset the modem: operation not supported");
+ if (!MM_IFACE_MODEM_GET_INTERFACE (self)->reset || !MM_IFACE_MODEM_GET_INTERFACE (self)->reset_finish) {
+ g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
+ "Operation not supported");
handle_reset_context_free (ctx);
return;
}
+ mm_obj_info (self, "processing user request to reset modem...");
MM_IFACE_MODEM_GET_INTERFACE (self)->reset (MM_IFACE_MODEM (self),
(GAsyncReadyCallback)handle_reset_ready,
ctx);
}
static gboolean
-handle_reset (MmGdbusModem *skeleton,
+handle_reset (MmGdbusModem *skeleton,
GDBusMethodInvocation *invocation,
- MMIfaceModem *self)
+ MMIfaceModem *self)
{
HandleResetContext *ctx;
- ctx = g_new (HandleResetContext, 1);
+ ctx = g_slice_new0 (HandleResetContext);
ctx->skeleton = g_object_ref (skeleton);
ctx->invocation = g_object_ref (invocation);
ctx->self = g_object_ref (self);