iface-modem: improve logging of user request to run AT command
This commit is contained in:
@@ -999,7 +999,7 @@ handle_command_context_free (HandleCommandContext *ctx)
|
|||||||
g_object_unref (ctx->invocation);
|
g_object_unref (ctx->invocation);
|
||||||
g_object_unref (ctx->self);
|
g_object_unref (ctx->self);
|
||||||
g_free (ctx->cmd);
|
g_free (ctx->cmd);
|
||||||
g_free (ctx);
|
g_slice_free (HandleCommandContext, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1010,13 +1010,14 @@ command_ready (MMIfaceModem *self,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
const gchar *result;
|
const gchar *result;
|
||||||
|
|
||||||
result = MM_IFACE_MODEM_GET_INTERFACE (self)->command_finish (self,
|
result = MM_IFACE_MODEM_GET_INTERFACE (self)->command_finish (self, res, &error);
|
||||||
res,
|
if (error) {
|
||||||
&error);
|
mm_obj_dbg (self, "failed running AT command '%s': %s", ctx->cmd, error->message);
|
||||||
if (error)
|
|
||||||
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||||
else
|
} else {
|
||||||
|
mm_obj_dbg (self, "AT command '%s' run: %s", ctx->cmd, result);
|
||||||
mm_gdbus_modem_complete_command (ctx->skeleton, ctx->invocation, result);
|
mm_gdbus_modem_complete_command (ctx->skeleton, ctx->invocation, result);
|
||||||
|
}
|
||||||
|
|
||||||
handle_command_context_free (ctx);
|
handle_command_context_free (ctx);
|
||||||
}
|
}
|
||||||
@@ -1037,28 +1038,22 @@ handle_command_auth_ready (MMBaseModem *self,
|
|||||||
#if ! defined WITH_AT_COMMAND_VIA_DBUS
|
#if ! defined WITH_AT_COMMAND_VIA_DBUS
|
||||||
/* If we are not in Debug mode, report an error */
|
/* If we are not in Debug mode, report an error */
|
||||||
if (!mm_context_get_debug ()) {
|
if (!mm_context_get_debug ()) {
|
||||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
g_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNAUTHORIZED,
|
||||||
MM_CORE_ERROR,
|
"Operation only allowed in debug mode");
|
||||||
MM_CORE_ERROR_UNAUTHORIZED,
|
|
||||||
"Cannot send AT command to modem: "
|
|
||||||
"operation only allowed in debug mode");
|
|
||||||
handle_command_context_free (ctx);
|
handle_command_context_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If command is not implemented, report an error */
|
/* If command is not implemented, report an error */
|
||||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->command ||
|
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->command || !MM_IFACE_MODEM_GET_INTERFACE (self)->command_finish) {
|
||||||
!MM_IFACE_MODEM_GET_INTERFACE (self)->command_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 send AT command to modem: "
|
|
||||||
"operation not supported");
|
|
||||||
handle_command_context_free (ctx);
|
handle_command_context_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mm_obj_dbg (self, "processing user request to run AT command '%s'...", ctx->cmd);
|
||||||
MM_IFACE_MODEM_GET_INTERFACE (self)->command (ctx->self,
|
MM_IFACE_MODEM_GET_INTERFACE (self)->command (ctx->self,
|
||||||
ctx->cmd,
|
ctx->cmd,
|
||||||
ctx->timeout,
|
ctx->timeout,
|
||||||
@@ -1075,7 +1070,7 @@ handle_command (MmGdbusModem *skeleton,
|
|||||||
{
|
{
|
||||||
HandleCommandContext *ctx;
|
HandleCommandContext *ctx;
|
||||||
|
|
||||||
ctx = g_new (HandleCommandContext, 1);
|
ctx = g_slice_new0 (HandleCommandContext);
|
||||||
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