iface-[modem|modem3gpp]: operation lock in all operations that change state
This logic can be tested by queing different operations one after the other, e.g.: mmcli -m a -e & sleep 0.2 mmcli -m a --3gpp-set-initial-eps-bearer-settings="apn=internet,ip-type=ipv4v6,force=true" & sleep 0.2 mmcli -m a -d & sleep 0.2 mmcli -m a -e & sleep 0.2 mmcli -m a --set-power-state-low & sleep 0.2 mmcli -m a -e & This previous sequence produces MM logs as follows: <dbg> [1726567176.214906] [modem0] [operation 15] default - enable: scheduled <dbg> [1726567176.215108] [modem0] [operation 15] default - enable: lock acquired <dbg> [1726567176.436234] [modem0] [operation 16] default - set-initial-eps-bearer-settings: scheduled <dbg> [1726567176.554153] [modem0] [operation 15] default - enable: lock released <dbg> [1726567176.554492] [modem0] [operation 16] default - set-initial-eps-bearer-settings: lock acquired <dbg> [1726567176.619021] [modem0] [operation 17] default - disable: scheduled <dbg> [1726567176.840024] [modem0] [operation 18] default - enable: scheduled <dbg> [1726567177.037155] [modem0] [operation 19] default - set-power-state: scheduled <dbg> [1726567177.240225] [modem0] [operation 20] default - enable: scheduled <dbg> [1726567179.496397] [modem0] [operation 16] default - set-initial-eps-bearer-settings: lock released <dbg> [1726567179.496576] [modem0] [operation 17] default - disable: lock acquired <dbg> [1726567179.672141] [modem0] [operation 17] default - disable: lock released <dbg> [1726567179.672658] [modem0] [operation 18] default - enable: lock acquired <dbg> [1726567179.938481] [modem0] [operation 18] default - enable: lock released <dbg> [1726567179.940470] [modem0] [operation 19] default - set-power-state: lock acquired <dbg> [1726567182.147894] [modem0] [operation 19] default - set-power-state: lock released <dbg> [1726567182.148041] [modem0] [operation 20] default - enable: lock acquired <dbg> [1726567184.494469] [modem0] [operation 20] default - enable: lock released iface-modem-3gpp: operation lock in all operations that change state
This commit is contained in:
+28
-12
@@ -1221,6 +1221,7 @@ typedef struct {
|
||||
HandleSetInitialEpsBearerSettingsStep step;
|
||||
MmGdbusModem3gpp *skeleton;
|
||||
GDBusMethodInvocation *invocation;
|
||||
gssize operation_id;
|
||||
MMIfaceModem3gpp *self;
|
||||
GVariant *dictionary;
|
||||
MMBearerProperties *config;
|
||||
@@ -1231,6 +1232,9 @@ typedef struct {
|
||||
static void
|
||||
handle_set_initial_eps_bearer_settings_context_free (HandleSetInitialEpsBearerSettingsContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
|
||||
g_assert (!ctx->saved_error);
|
||||
g_clear_object (&ctx->config);
|
||||
g_variant_unref (ctx->dictionary);
|
||||
@@ -1417,7 +1421,8 @@ set_initial_eps_bearer_settings_auth_ready (MMBaseModem
|
||||
GVariant *old_dictionary;
|
||||
g_autoptr(MMBearerProperties) old_config = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_initial_eps_bearer_settings_context_free (ctx);
|
||||
return;
|
||||
@@ -1474,12 +1479,15 @@ handle_set_initial_eps_bearer_settings (MmGdbusModem3gpp *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->dictionary = g_variant_ref (dictionary);
|
||||
ctx->previous_power_state = MM_MODEM_POWER_STATE_UNKNOWN;
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)set_initial_eps_bearer_settings_auth_ready,
|
||||
ctx);
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-initial-eps-bearer-settings",
|
||||
(GAsyncReadyCallback)set_initial_eps_bearer_settings_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1796,6 +1804,7 @@ handle_set_packet_service_state (MmGdbusModem3gpp *skeleton,
|
||||
typedef struct {
|
||||
MmGdbusModem3gpp *skeleton;
|
||||
GDBusMethodInvocation *invocation;
|
||||
gssize operation_id;
|
||||
MMIfaceModem3gpp *self;
|
||||
GVariant *dictionary;
|
||||
MMNr5gRegistrationSettings *settings;
|
||||
@@ -1804,6 +1813,9 @@ typedef struct {
|
||||
static void
|
||||
handle_set_nr5g_registration_settings_context_free (HandleSetNr5gRegistrationSettingsContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
|
||||
g_clear_object (&ctx->settings);
|
||||
g_variant_unref (ctx->dictionary);
|
||||
g_object_unref (ctx->skeleton);
|
||||
@@ -1884,7 +1896,8 @@ set_nr5g_registration_settings_auth_ready (MMBaseModem
|
||||
MMModem3gppDrxCycle new_drx_cycle;
|
||||
MMModem3gppMicoMode new_mico_mode;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_nr5g_registration_settings_context_free (ctx);
|
||||
return;
|
||||
@@ -1957,12 +1970,15 @@ handle_set_nr5g_registration_settings (MmGdbusModem3gpp *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->dictionary = g_variant_ref (dictionary);
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)set_nr5g_registration_settings_auth_ready,
|
||||
ctx);
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-nr5g-registration-settings",
|
||||
(GAsyncReadyCallback)set_nr5g_registration_settings_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
+115
-58
@@ -2267,6 +2267,7 @@ mm_iface_modem_update_subsystem_state (MMIfaceModem *self,
|
||||
typedef struct {
|
||||
MmGdbusModem *skeleton;
|
||||
GDBusMethodInvocation *invocation;
|
||||
gssize operation_id;
|
||||
MMIfaceModem *self;
|
||||
gboolean enable;
|
||||
} HandleEnableContext;
|
||||
@@ -2274,6 +2275,9 @@ typedef struct {
|
||||
static void
|
||||
handle_enable_context_free (HandleEnableContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
|
||||
g_object_unref (ctx->skeleton);
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->self);
|
||||
@@ -2309,13 +2313,14 @@ enable_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_enable_auth_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
handle_enable_auth_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
HandleEnableContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_enable_context_free (ctx);
|
||||
return;
|
||||
@@ -2329,13 +2334,13 @@ handle_enable_auth_ready (MMBaseModem *self,
|
||||
if (ctx->enable) {
|
||||
mm_obj_info (self, "processing user request to enable modem...");
|
||||
mm_base_modem_enable (self,
|
||||
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
|
||||
MM_BASE_MODEM_OPERATION_LOCK_ALREADY_ACQUIRED,
|
||||
(GAsyncReadyCallback)enable_ready,
|
||||
ctx);
|
||||
} else {
|
||||
mm_obj_info (self, "processing user request to disable modem...");
|
||||
mm_base_modem_disable (self,
|
||||
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
|
||||
MM_BASE_MODEM_OPERATION_LOCK_ALREADY_ACQUIRED,
|
||||
(GAsyncReadyCallback)enable_ready,
|
||||
ctx);
|
||||
}
|
||||
@@ -2354,12 +2359,15 @@ handle_enable (MmGdbusModem *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->enable = enable;
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_enable_auth_ready,
|
||||
ctx);
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
enable ? "enable" : "disable",
|
||||
(GAsyncReadyCallback)handle_enable_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2368,6 +2376,7 @@ handle_enable (MmGdbusModem *skeleton,
|
||||
typedef struct {
|
||||
MmGdbusModem *skeleton;
|
||||
GDBusMethodInvocation *invocation;
|
||||
gssize operation_id;
|
||||
MMIfaceModem *self;
|
||||
MMModemPowerState power_state;
|
||||
gboolean disable_after_update;
|
||||
@@ -2377,6 +2386,9 @@ typedef struct {
|
||||
static void
|
||||
handle_set_power_state_context_free (HandleSetPowerStateContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
|
||||
g_assert (!ctx->saved_error);
|
||||
g_object_unref (ctx->skeleton);
|
||||
g_object_unref (ctx->invocation);
|
||||
@@ -2411,7 +2423,7 @@ disable_after_low (MMIfaceModem *self,
|
||||
{
|
||||
mm_obj_info (self, "automatically disable modem after low-power mode...");
|
||||
mm_base_modem_disable (MM_BASE_MODEM (self),
|
||||
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
|
||||
MM_BASE_MODEM_OPERATION_LOCK_ALREADY_ACQUIRED,
|
||||
(GAsyncReadyCallback)disable_after_low_ready,
|
||||
ctx);
|
||||
}
|
||||
@@ -2452,23 +2464,13 @@ handle_set_power_state_auth_ready (MMBaseModem *self,
|
||||
MMModemState modem_state;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_power_state_context_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Only 'off', 'low' or 'up' expected */
|
||||
if (ctx->power_state != MM_MODEM_POWER_STATE_LOW &&
|
||||
ctx->power_state != MM_MODEM_POWER_STATE_ON &&
|
||||
ctx->power_state != MM_MODEM_POWER_STATE_OFF) {
|
||||
mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
|
||||
"Unknown power state: '%s'",
|
||||
mm_modem_power_state_get_string (ctx->power_state));
|
||||
handle_set_power_state_context_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
modem_state = MM_MODEM_STATE_UNKNOWN;
|
||||
g_object_get (self,
|
||||
MM_IFACE_MODEM_STATE, &modem_state,
|
||||
@@ -2517,18 +2519,33 @@ handle_set_power_state (MmGdbusModem *skeleton,
|
||||
MMIfaceModem *self)
|
||||
{
|
||||
HandleSetPowerStateContext *ctx;
|
||||
g_autofree gchar *operation_name = NULL;
|
||||
|
||||
ctx = g_slice_new0 (HandleSetPowerStateContext);
|
||||
ctx->skeleton = g_object_ref (skeleton);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->power_state = (MMModemPowerState)power_state;
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_power_state_auth_ready,
|
||||
ctx);
|
||||
/* Only 'off', 'low' or 'up' expected */
|
||||
if (ctx->power_state != MM_MODEM_POWER_STATE_LOW &&
|
||||
ctx->power_state != MM_MODEM_POWER_STATE_ON &&
|
||||
ctx->power_state != MM_MODEM_POWER_STATE_OFF) {
|
||||
mm_dbus_method_invocation_return_error (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
|
||||
"Unknown power state: %u", ctx->power_state);
|
||||
handle_set_power_state_context_free (ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
operation_name = g_strdup_printf ("set-power-state-%s", mm_modem_power_state_get_string (ctx->power_state));
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
operation_name,
|
||||
(GAsyncReadyCallback)handle_set_power_state_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2537,12 +2554,16 @@ handle_set_power_state (MmGdbusModem *skeleton,
|
||||
typedef struct {
|
||||
MmGdbusModem *skeleton;
|
||||
GDBusMethodInvocation *invocation;
|
||||
gssize operation_id;
|
||||
MMIfaceModem *self;
|
||||
} HandleResetContext;
|
||||
|
||||
static void
|
||||
handle_reset_context_free (HandleResetContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
|
||||
g_object_unref (ctx->skeleton);
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->self);
|
||||
@@ -2574,7 +2595,8 @@ handle_reset_auth_ready (MMBaseModem *self,
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_reset_context_free (ctx);
|
||||
return;
|
||||
@@ -2605,12 +2627,15 @@ handle_reset (MmGdbusModem *skeleton,
|
||||
ctx->skeleton = g_object_ref (skeleton);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_reset_auth_ready,
|
||||
ctx);
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"reset",
|
||||
(GAsyncReadyCallback)handle_reset_auth_ready,
|
||||
ctx);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -2620,6 +2645,7 @@ handle_reset (MmGdbusModem *skeleton,
|
||||
typedef struct {
|
||||
MmGdbusModem *skeleton;
|
||||
GDBusMethodInvocation *invocation;
|
||||
gssize operation_id;
|
||||
MMIfaceModem *self;
|
||||
gchar *code;
|
||||
} HandleFactoryResetContext;
|
||||
@@ -2627,6 +2653,9 @@ typedef struct {
|
||||
static void
|
||||
handle_factory_reset_context_free (HandleFactoryResetContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
|
||||
g_object_unref (ctx->skeleton);
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->self);
|
||||
@@ -2659,7 +2688,8 @@ handle_factory_reset_auth_ready (MMBaseModem *self,
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_factory_reset_context_free (ctx);
|
||||
return;
|
||||
@@ -2693,12 +2723,15 @@ handle_factory_reset (MmGdbusModem *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->code = g_strdup (code);
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_factory_reset_auth_ready,
|
||||
ctx);
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"factory-reset",
|
||||
(GAsyncReadyCallback)handle_factory_reset_auth_ready,
|
||||
ctx);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -2714,6 +2747,7 @@ handle_factory_reset (MmGdbusModem *skeleton,
|
||||
typedef struct {
|
||||
MmGdbusModem *skeleton;
|
||||
GDBusMethodInvocation *invocation;
|
||||
gssize operation_id;
|
||||
MMIfaceModem *self;
|
||||
MMModemCapability capabilities;
|
||||
gchar *capabilities_str;
|
||||
@@ -2722,6 +2756,9 @@ typedef struct {
|
||||
static void
|
||||
handle_set_current_capabilities_context_free (HandleSetCurrentCapabilitiesContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
|
||||
g_free (ctx->capabilities_str);
|
||||
g_object_unref (ctx->skeleton);
|
||||
g_object_unref (ctx->invocation);
|
||||
@@ -2759,7 +2796,8 @@ handle_set_current_capabilities_auth_ready (MMBaseModem
|
||||
gboolean matched = FALSE;
|
||||
guint i;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_current_capabilities_context_free (ctx);
|
||||
return;
|
||||
@@ -2830,12 +2868,15 @@ handle_set_current_capabilities (MmGdbusModem *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->capabilities = capabilities;
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_current_capabilities_auth_ready,
|
||||
ctx);
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-current-capabilities",
|
||||
(GAsyncReadyCallback)handle_set_current_capabilities_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -3196,6 +3237,7 @@ mm_iface_modem_set_current_bands (MMIfaceModem *self,
|
||||
typedef struct {
|
||||
MmGdbusModem *skeleton;
|
||||
GDBusMethodInvocation *invocation;
|
||||
gssize operation_id;
|
||||
MMIfaceModem *self;
|
||||
GVariant *bands;
|
||||
gchar *bands_str;
|
||||
@@ -3204,6 +3246,9 @@ typedef struct {
|
||||
static void
|
||||
handle_set_current_bands_context_free (HandleSetCurrentBandsContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
|
||||
g_free (ctx->bands_str);
|
||||
g_variant_unref (ctx->bands);
|
||||
g_object_unref (ctx->skeleton);
|
||||
@@ -3240,7 +3285,8 @@ handle_set_current_bands_auth_ready (MMBaseModem *self,
|
||||
g_autoptr(GArray) bands_array = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_current_bands_context_free (ctx);
|
||||
return;
|
||||
@@ -3274,12 +3320,15 @@ handle_set_current_bands (MmGdbusModem *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->bands = g_variant_ref (bands_variant);
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_current_bands_auth_ready,
|
||||
ctx);
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-current-bands",
|
||||
(GAsyncReadyCallback)handle_set_current_bands_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -3591,6 +3640,7 @@ mm_iface_modem_set_current_modes (MMIfaceModem *self,
|
||||
typedef struct {
|
||||
MmGdbusModem *skeleton;
|
||||
GDBusMethodInvocation *invocation;
|
||||
gssize operation_id;
|
||||
MMIfaceModem *self;
|
||||
MMModemMode allowed;
|
||||
MMModemMode preferred;
|
||||
@@ -3601,6 +3651,9 @@ typedef struct {
|
||||
static void
|
||||
handle_set_current_modes_context_free (HandleSetCurrentModesContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
|
||||
g_free (ctx->preferred_str);
|
||||
g_free (ctx->allowed_str);
|
||||
g_object_unref (ctx->skeleton);
|
||||
@@ -3638,7 +3691,8 @@ handle_set_current_modes_auth_ready (MMBaseModem *self,
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_current_modes_context_free (ctx);
|
||||
return;
|
||||
@@ -3672,17 +3726,20 @@ handle_set_current_modes (MmGdbusModem *skeleton,
|
||||
ctx->skeleton = g_object_ref (skeleton);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->operation_id = -1;
|
||||
|
||||
g_variant_get (variant,
|
||||
"(uu)",
|
||||
&ctx->allowed,
|
||||
&ctx->preferred);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_current_modes_auth_ready,
|
||||
ctx);
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-current-modes",
|
||||
(GAsyncReadyCallback)handle_set_current_modes_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user