port-serial-at: raw commands always run next

We use the raw commands exclusively when we're sending SMS data to the
device. Until this change, all raw commands were added at the tail of
the queue of pending commands, and that meant that if any unrelated AT
command was interleaved between e.g. our AT+CGMS and the actual SMS
data sent, the operation would have failed.

With this fix, we're making sure that all raw commands are added at
the head of the queue, so we're making sure that the next command
picked after e.g. CGMS is actually the raw SMS data to be sent.

We would be avoiding issues like this one, where an outgoing voice
call attempt gets in the way before we send the SMS data:

  [1556246081.786284] (ttyACM2): --> 'AT+CMGS=70<CR>'
  [1556246081.814861] (ttyACM2): <-- '<CR><LF>> '
  [1556246081.819382] (ttyACM2): --> 'ATD1234567890;<CR>'
  [1556246081.839685] (ttyACM2): <-- '<CR><LF>> '
  [1556246081.840123] Couldn't start call : 'Couldn't start the call: Unhandled response '> ''
  [1556246081.856254] (ttyACM2): --> '0001000D810..............
  [1556246081.922470] (ttyACM2): <-- '<CR><LF>+CME ERROR: 4<CR><LF>'
This commit is contained in:
Aleksander Morgado
2019-06-03 03:50:22 +00:00
committed by Dan Williams
parent 8092e301fc
commit 72bdb1b365
2 changed files with 12 additions and 3 deletions
+11 -2
View File
@@ -1,3 +1,4 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
@@ -914,7 +915,11 @@ store_ready (MMBaseModem *modem,
ctx = g_task_get_task_data (task);
/* Send the actual message data */
/* Send the actual message data.
* We send the data as 'raw' data because we do NOT want it to
* be treated as an AT command (i.e. we don't want it prefixed
* with AT+ and suffixed with <CR><LF>), plus, we want it to be
* sent right away (not queued after other AT commands). */
mm_base_modem_at_command_raw (ctx->modem,
ctx->msg_data,
10,
@@ -1131,7 +1136,11 @@ send_generic_ready (MMBaseModem *modem,
ctx = g_task_get_task_data (task);
/* Send the actual message data */
/* Send the actual message data.
* We send the data as 'raw' data because we do NOT want it to
* be treated as an AT command (i.e. we don't want it prefixed
* with AT+ and suffixed with <CR><LF>), plus, we want it to be
* sent right away (not queued after other AT commands). */
mm_base_modem_at_command_raw (ctx->modem,
ctx->msg_data,
10,
+1 -1
View File
@@ -427,7 +427,7 @@ mm_port_serial_at_command (MMPortSerialAt *self,
buf,
timeout_seconds,
allow_cached,
FALSE, /* always queued last */
is_raw, /* raw commands always run next, never queued last */
cancellable,
(GAsyncReadyCallback)serial_command_ready,
simple);