aboutsummaryrefslogtreecommitdiff
path: root/src/mm-serial-port.c
diff options
context:
space:
mode:
authorNathan Williams <njw@chromium.org>2011-11-23 16:16:20 -0500
committerJiří Klimeš <jklimes@redhat.com>2011-11-30 09:38:42 +0100
commitd5d9eec2b52363a7460aeec0c020b1c6a7af6b03 (patch)
treefef2e75e78250e8a17b7ec1cb3c9989424a0d43f /src/mm-serial-port.c
parent44194ac04d7926cb80de03fe95ce98bd64a1c6c6 (diff)
serial: report port-not-open in queueing commands via callback
Reporting errors instead of just returning permits routines like mm-generic-gsm.c:simple_get_status() to work again, as their callbacks get the error they are expecting. To make this work, adapt get_csq_done() to handle a NULL response when error is set, and make sure that multiple errors don't step on each other in the mm_callback_info_chain() sequence created by simple_get_status(). Change-Id: Ie3a72b1ce71b7f117e8b1f3da7a406c4d2da9e02
Diffstat (limited to 'src/mm-serial-port.c')
-rw-r--r--src/mm-serial-port.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c
index 29f99ef3..ab64dc80 100644
--- a/src/mm-serial-port.c
+++ b/src/mm-serial-port.c
@@ -1021,9 +1021,17 @@ internal_queue_command (MMSerialPort *self,
MMQueueData *info;
g_return_if_fail (MM_IS_SERIAL_PORT (self));
- g_return_if_fail (priv->open_count > 0);
g_return_if_fail (command != NULL);
+ if (priv->open_count == 0) {
+ GError *error = g_error_new_literal (MM_SERIAL_ERROR,
+ MM_SERIAL_ERROR_SEND_FAILED,
+ "Sending command failed: device is not enabled");
+ callback (self, NULL, error, user_data);
+ g_error_free (error);
+ return;
+ }
+
info = g_slice_new0 (MMQueueData);
if (take_command)
info->command = command;