aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-02-08 23:55:31 +0100
committerAleksander Morgado <aleksander@aleksander.es>2017-02-09 10:20:27 +0100
commitad3e4cd6d9e7c032d449b27c26b185024ca2993b (patch)
tree2c651cd63fb3b350773f2895b9487c466822f164
parentd29bfb5a22339d883e5f7448371c3bbb71610945 (diff)
downloadexternal_libqmi-ad3e4cd6d9e7c032d449b27c26b185024ca2993b.zip
external_libqmi-ad3e4cd6d9e7c032d449b27c26b185024ca2993b.tar.gz
external_libqmi-ad3e4cd6d9e7c032d449b27c26b185024ca2993b.tar.bz2
qmicli: by default close before exiting
Otherwise the MBIM channel will be kept open and the next MBIM commands won't succeed.
-rw-r--r--src/qmicli/qmicli.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/qmicli/qmicli.c b/src/qmicli/qmicli.c
index e119a96..289873c 100644
--- a/src/qmicli/qmicli.c
+++ b/src/qmicli/qmicli.c
@@ -261,6 +261,21 @@ generic_options_enabled (void)
/* Running asynchronously */
static void
+close_ready (QmiDevice *dev,
+ GAsyncResult *res)
+{
+ GError *error = NULL;
+
+ if (!qmi_device_close_finish (dev, res, &error)) {
+ g_printerr ("error: couldn't close: %s\n", error->message);
+ g_error_free (error);
+ } else
+ g_debug ("Closed");
+
+ g_main_loop_quit (loop);
+}
+
+static void
release_client_ready (QmiDevice *dev,
GAsyncResult *res)
{
@@ -272,7 +287,7 @@ release_client_ready (QmiDevice *dev,
} else
g_debug ("Client released");
- g_main_loop_quit (loop);
+ qmi_device_close_async (dev, 10, NULL, (GAsyncReadyCallback) close_ready, NULL);
}
void