From ad3e4cd6d9e7c032d449b27c26b185024ca2993b Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 8 Feb 2017 23:55:31 +0100 Subject: qmicli: by default close before exiting Otherwise the MBIM channel will be kept open and the next MBIM commands won't succeed. --- src/qmicli/qmicli.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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 -- cgit v1.1