aboutsummaryrefslogtreecommitdiff
path: root/src/mm-port-serial.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-05-16 18:12:01 +0200
committerDan Williams <dcbw@redhat.com>2019-06-03 03:50:22 +0000
commit8092e301fc55c84a5523a8cb3f75461b53ac2e9a (patch)
treef1f6d0f7070791d1bc65bd299925bc48ef07128c /src/mm-port-serial.c
parentc78ba5ea0ad37dcff4c2a5ca3b7bca21526eba08 (diff)
port-serial: allow deciding whether the command is queued last or run next
By default all the commands we were sending through the serial port were added at the tail of the pending queue, but we may want to queue them at the head in very specific cases (e.g. while sending an SMS).
Diffstat (limited to 'src/mm-port-serial.c')
-rw-r--r--src/mm-port-serial.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mm-port-serial.c b/src/mm-port-serial.c
index d739313b..4067979c 100644
--- a/src/mm-port-serial.c
+++ b/src/mm-port-serial.c
@@ -163,6 +163,7 @@ mm_port_serial_command (MMPortSerial *self,
GByteArray *command,
guint32 timeout_seconds,
gboolean allow_cached,
+ gboolean run_next,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -203,7 +204,12 @@ mm_port_serial_command (MMPortSerial *self,
if (!allow_cached)
port_serial_set_cached_reply (self, ctx->command, NULL);
- g_queue_push_tail (self->priv->queue, ctx);
+ /* If requested to run next, push to the head of the queue so that it really is
+ * the next one sent */
+ if (run_next)
+ g_queue_push_head (self->priv->queue, ctx);
+ else
+ g_queue_push_tail (self->priv->queue, ctx);
if (g_queue_get_length (self->priv->queue) == 1)
port_serial_schedule_queue_process (self, 0);