aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mm-base-manager.c1
-rw-r--r--src/mm-base-modem.c26
-rw-r--r--src/mm-base-modem.h16
-rw-r--r--src/mm-device.c5
-rw-r--r--src/mm-iface-modem.c6
5 files changed, 36 insertions, 18 deletions
diff --git a/src/mm-base-manager.c b/src/mm-base-manager.c
index 449b74df..6e7542b5 100644
--- a/src/mm-base-manager.c
+++ b/src/mm-base-manager.c
@@ -963,6 +963,7 @@ foreach_disable (gpointer key,
mm_base_modem_disable (modem,
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
+ MM_BASE_MODEM_OPERATION_PRIORITY_OVERRIDE,
(GAsyncReadyCallback)shutdown_disable_ready,
ctx);
}
diff --git a/src/mm-base-modem.c b/src/mm-base-modem.c
index 6348af33..b6023039 100644
--- a/src/mm-base-modem.c
+++ b/src/mm-base-modem.c
@@ -808,11 +808,12 @@ lock_before_state_operation_ready (MMBaseModem *self,
}
static void
-state_operation (MMBaseModem *self,
- StateOperationType operation_type,
- MMBaseModemOperationLock operation_lock,
- GAsyncReadyCallback callback,
- gpointer user_data)
+state_operation (MMBaseModem *self,
+ StateOperationType operation_type,
+ MMBaseModemOperationLock operation_lock,
+ MMBaseModemOperationPriority operation_priority,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GTask *task;
StateOperationContext *ctx;
@@ -871,7 +872,7 @@ state_operation (MMBaseModem *self,
g_assert (operation_lock == MM_BASE_MODEM_OPERATION_LOCK_REQUIRED);
mm_base_modem_operation_lock (self,
- MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
+ operation_priority,
operation_description,
(GAsyncReadyCallback) lock_before_state_operation_ready,
task);
@@ -898,6 +899,7 @@ mm_base_modem_sync (MMBaseModem *self,
state_operation (self,
STATE_OPERATION_TYPE_SYNC,
operation_lock,
+ MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
callback,
user_data);
}
@@ -915,14 +917,16 @@ mm_base_modem_disable_finish (MMBaseModem *self,
}
void
-mm_base_modem_disable (MMBaseModem *self,
- MMBaseModemOperationLock operation_lock,
- GAsyncReadyCallback callback,
- gpointer user_data)
+mm_base_modem_disable (MMBaseModem *self,
+ MMBaseModemOperationLock operation_lock,
+ MMBaseModemOperationPriority operation_priority,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
state_operation (self,
STATE_OPERATION_TYPE_DISABLE,
operation_lock,
+ operation_priority,
callback,
user_data);
}
@@ -946,6 +950,7 @@ mm_base_modem_enable (MMBaseModem *self,
state_operation (self,
STATE_OPERATION_TYPE_ENABLE,
operation_lock,
+ MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
callback,
user_data);
}
@@ -969,6 +974,7 @@ mm_base_modem_initialize (MMBaseModem *self,
state_operation (self,
STATE_OPERATION_TYPE_INITIALIZE,
operation_lock,
+ MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
callback,
user_data);
}
diff --git a/src/mm-base-modem.h b/src/mm-base-modem.h
index a02bdf4c..aab195ac 100644
--- a/src/mm-base-modem.h
+++ b/src/mm-base-modem.h
@@ -230,6 +230,7 @@ gboolean mm_base_modem_authorize_finish (MMBaseModem *self,
/* Operation lock support */
typedef enum { /*< underscore_name=mm_base_modem_operation_priority >*/
+ MM_BASE_MODEM_OPERATION_PRIORITY_UNKNOWN,
/* Default operations are scheduled at the end of the list of pending
* operations */
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
@@ -285,13 +286,14 @@ gboolean mm_base_modem_enable_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
-void mm_base_modem_disable (MMBaseModem *self,
- MMBaseModemOperationLock operation_lock,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean mm_base_modem_disable_finish (MMBaseModem *self,
- GAsyncResult *res,
- GError **error);
+void mm_base_modem_disable (MMBaseModem *self,
+ MMBaseModemOperationLock operation_lock,
+ MMBaseModemOperationPriority priority,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean mm_base_modem_disable_finish (MMBaseModem *self,
+ GAsyncResult *res,
+ GError **error);
#if defined WITH_SUSPEND_RESUME
void mm_base_modem_sync (MMBaseModem *self,
diff --git a/src/mm-device.c b/src/mm-device.c
index 40b2039c..62cba0fd 100644
--- a/src/mm-device.c
+++ b/src/mm-device.c
@@ -748,9 +748,12 @@ mm_device_inhibit (MMDevice *self,
g_assert (!self->priv->inhibited);
self->priv->inhibited = TRUE;
- /* Make sure modem is disabled while inhibited */
+ /* Make sure modem is disabled while inhibited. This operation requests
+ * an exclusive lock marked as override, so the modem object will not
+ * allow any additional lock request any more. */
mm_base_modem_disable (self->priv->modem,
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
+ MM_BASE_MODEM_OPERATION_PRIORITY_OVERRIDE,
(GAsyncReadyCallback)inhibit_disable_ready,
task);
}
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 5e98261e..ff285dee 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -343,9 +343,13 @@ mm_iface_modem_process_sim_event (MMIfaceModem *self)
if (MM_IFACE_MODEM_GET_IFACE (self)->cleanup_sim_hot_swap)
MM_IFACE_MODEM_GET_IFACE (self)->cleanup_sim_hot_swap (self);
+ /* Make sure modem is disabled before reprobing. This operation requests
+ * an exclusive lock marked as override, so the modem object will not
+ * allow any additional lock request any more. */
mm_base_modem_set_reprobe (MM_BASE_MODEM (self), TRUE);
mm_base_modem_disable (MM_BASE_MODEM (self),
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
+ MM_BASE_MODEM_OPERATION_PRIORITY_OVERRIDE,
(GAsyncReadyCallback) after_sim_event_disable_ready,
NULL);
}
@@ -2341,6 +2345,7 @@ handle_enable_auth_ready (MMBaseModem *self,
mm_obj_info (self, "processing user request to disable modem...");
mm_base_modem_disable (self,
MM_BASE_MODEM_OPERATION_LOCK_ALREADY_ACQUIRED,
+ MM_BASE_MODEM_OPERATION_PRIORITY_UNKNOWN,
(GAsyncReadyCallback)enable_ready,
ctx);
}
@@ -2424,6 +2429,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_ALREADY_ACQUIRED,
+ MM_BASE_MODEM_OPERATION_PRIORITY_UNKNOWN,
(GAsyncReadyCallback)disable_after_low_ready,
ctx);
}