diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-01-22 19:01:08 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-01-29 10:37:53 +0100 |
commit | b6190674bd57fa760c601d760a29caf4d8373918 (patch) | |
tree | d04cd0332caaf129c351d7d23066c717d5d717a6 | |
parent | c0543fff0d95ae40e0d4eed75ab4ca564b9c21b3 (diff) | |
download | external_libqmi-b6190674bd57fa760c601d760a29caf4d8373918.zip external_libqmi-b6190674bd57fa760c601d760a29caf4d8373918.tar.gz external_libqmi-b6190674bd57fa760c601d760a29caf4d8373918.tar.bz2 |
qmicli: allow skipping CID release after successful operation
E.g. if the command requested will end up power cycling the device and
therefore not even supporting the cid release operation, as in the
"HP Change Device Mode" command.
[22 ene 2017, 18:42:23] [Debug] [/dev/cdc-wdm1] sent generic request (translated)...
<<<<<< QMUX:
<<<<<< length = 16
<<<<<< flags = 0x00
<<<<<< service = "ctl"
<<<<<< client = 0
<<<<<< QMI:
<<<<<< flags = "none"
<<<<<< transaction = 2
<<<<<< tlv_length = 5
<<<<<< message = "Release CID" (0x0023)
<<<<<< TLV:
<<<<<< type = "Release Info" (0x01)
<<<<<< length = 2
<<<<<< value = 02:02
<<<<<< translated = [ service = 'dms' cid = '2' ]
[22 ene 2017, 18:42:23] [Debug] [/dev/cdc-wdm1] sending message as MBIM...
error: couldn't release client: MBIM error: Transaction timed out
-rw-r--r-- | src/qmicli/qmicli-dms.c | 21 | ||||
-rw-r--r-- | src/qmicli/qmicli-nas.c | 2 | ||||
-rw-r--r-- | src/qmicli/qmicli-pbm.c | 2 | ||||
-rw-r--r-- | src/qmicli/qmicli-pdc.c | 2 | ||||
-rw-r--r-- | src/qmicli/qmicli-uim.c | 2 | ||||
-rw-r--r-- | src/qmicli/qmicli-voice.c | 2 | ||||
-rw-r--r-- | src/qmicli/qmicli-wda.c | 2 | ||||
-rw-r--r-- | src/qmicli/qmicli-wds.c | 2 | ||||
-rw-r--r-- | src/qmicli/qmicli-wms.c | 2 | ||||
-rw-r--r-- | src/qmicli/qmicli.c | 17 | ||||
-rw-r--r-- | src/qmicli/qmicli.h | 3 |
11 files changed, 39 insertions, 18 deletions
diff --git a/src/qmicli/qmicli-dms.c b/src/qmicli/qmicli-dms.c index 062a83a..cb4f780 100644 --- a/src/qmicli/qmicli-dms.c +++ b/src/qmicli/qmicli-dms.c @@ -404,7 +404,17 @@ operation_shutdown (gboolean operation_status) { /* Cleanup context and finish async operation */ context_free (ctx); - qmicli_async_operation_done (operation_status); + qmicli_async_operation_done (operation_status, FALSE); +} + +static void +operation_shutdown_skip_cid_release (gboolean operation_status) +{ + /* Cleanup context and finish async operation. Explicitly ask not to release + * the client CID. This is so that the qmicli operation doesn't fail after + * this step, e.g. if the device just reboots after the action. */ + context_free (ctx); + qmicli_async_operation_done (operation_status, TRUE); } static void @@ -3392,8 +3402,15 @@ hp_change_device_mode_ready (QmiClientDms *client, return; } + g_print ("[%s] Successfully changed HP device mode\n", + qmi_device_get_path_display (ctx->device)); + qmi_message_dms_hp_change_device_mode_output_unref (output); - operation_shutdown (TRUE); + + /* Changing the mode will end up power cycling the device right away, so + * just ignore any error from now on and don't even try to release the + * client CID */ + operation_shutdown_skip_cid_release (TRUE); } static void diff --git a/src/qmicli/qmicli-nas.c b/src/qmicli/qmicli-nas.c index 73125ac..b056bea 100644 --- a/src/qmicli/qmicli-nas.c +++ b/src/qmicli/qmicli-nas.c @@ -203,7 +203,7 @@ operation_shutdown (gboolean operation_status) { /* Cleanup context and finish async operation */ context_free (ctx); - qmicli_async_operation_done (operation_status); + qmicli_async_operation_done (operation_status, FALSE); } static gboolean diff --git a/src/qmicli/qmicli-pbm.c b/src/qmicli/qmicli-pbm.c index 66fd1fb..3b4379d 100644 --- a/src/qmicli/qmicli-pbm.c +++ b/src/qmicli/qmicli-pbm.c @@ -110,7 +110,7 @@ operation_shutdown (gboolean operation_status) { /* Cleanup context and finish async operation */ context_free (ctx); - qmicli_async_operation_done (operation_status); + qmicli_async_operation_done (operation_status, FALSE); } static void diff --git a/src/qmicli/qmicli-pdc.c b/src/qmicli/qmicli-pdc.c index a7b137d..879ec04 100644 --- a/src/qmicli/qmicli-pdc.c +++ b/src/qmicli/qmicli-pdc.c @@ -228,7 +228,7 @@ operation_shutdown (gboolean operation_status) /* Cleanup context and finish async operation */ context_free (ctx); ctx = NULL; - qmicli_async_operation_done (operation_status); + qmicli_async_operation_done (operation_status, FALSE); } /******************************************************************************/ diff --git a/src/qmicli/qmicli-uim.c b/src/qmicli/qmicli-uim.c index 453b46d..a54b082 100644 --- a/src/qmicli/qmicli-uim.c +++ b/src/qmicli/qmicli-uim.c @@ -159,7 +159,7 @@ operation_shutdown (gboolean operation_status) { /* Cleanup context and finish async operation */ context_free (ctx); - qmicli_async_operation_done (operation_status); + qmicli_async_operation_done (operation_status, FALSE); } static QmiMessageUimSetPinProtectionInput * diff --git a/src/qmicli/qmicli-voice.c b/src/qmicli/qmicli-voice.c index 3c60901..53a7fff 100644 --- a/src/qmicli/qmicli-voice.c +++ b/src/qmicli/qmicli-voice.c @@ -117,7 +117,7 @@ operation_shutdown (gboolean operation_status) { /* Cleanup context and finish async operation */ context_free (ctx); - qmicli_async_operation_done (operation_status); + qmicli_async_operation_done (operation_status, FALSE); } static void diff --git a/src/qmicli/qmicli-wda.c b/src/qmicli/qmicli-wda.c index b88b16e..7db5d87 100644 --- a/src/qmicli/qmicli-wda.c +++ b/src/qmicli/qmicli-wda.c @@ -123,7 +123,7 @@ operation_shutdown (gboolean operation_status) { /* Cleanup context and finish async operation */ context_free (ctx); - qmicli_async_operation_done (operation_status); + qmicli_async_operation_done (operation_status, FALSE); } static gboolean diff --git a/src/qmicli/qmicli-wds.c b/src/qmicli/qmicli-wds.c index 5973b11..9ba1063 100644 --- a/src/qmicli/qmicli-wds.c +++ b/src/qmicli/qmicli-wds.c @@ -222,7 +222,7 @@ operation_shutdown (gboolean operation_status) { /* Cleanup context and finish async operation */ context_free (ctx); - qmicli_async_operation_done (operation_status); + qmicli_async_operation_done (operation_status, FALSE); } static void diff --git a/src/qmicli/qmicli-wms.c b/src/qmicli/qmicli-wms.c index 4599905..48c30a8 100644 --- a/src/qmicli/qmicli-wms.c +++ b/src/qmicli/qmicli-wms.c @@ -117,7 +117,7 @@ operation_shutdown (gboolean operation_status) { /* Cleanup context and finish async operation */ context_free (ctx); - qmicli_async_operation_done (operation_status); + qmicli_async_operation_done (operation_status, FALSE); } static void diff --git a/src/qmicli/qmicli.c b/src/qmicli/qmicli.c index 00b4aad..630fd9c 100644 --- a/src/qmicli/qmicli.c +++ b/src/qmicli/qmicli.c @@ -266,7 +266,8 @@ release_client_ready (QmiDevice *dev, } void -qmicli_async_operation_done (gboolean reported_operation_status) +qmicli_async_operation_done (gboolean reported_operation_status, + gboolean skip_cid_release) { QmiDeviceReleaseClientFlags flags = QMI_DEVICE_RELEASE_CLIENT_FLAGS_NONE; @@ -282,7 +283,9 @@ qmicli_async_operation_done (gboolean reported_operation_status) return; } - if (!client_no_release_cid_flag) + if (skip_cid_release) + g_debug ("Skipped CID release"); + else if (!client_no_release_cid_flag) flags |= QMI_DEVICE_RELEASE_CLIENT_FLAGS_RELEASE_CID; else g_print ("[%s] Client ID not released:\n" @@ -398,7 +401,7 @@ set_instance_id_ready (QmiDevice *dev, link_id); /* We're done now */ - qmicli_async_operation_done (TRUE); + qmicli_async_operation_done (TRUE, FALSE); } static void @@ -467,7 +470,7 @@ get_service_version_info_ready (QmiDevice *dev, g_array_unref (services); /* We're done now */ - qmicli_async_operation_done (TRUE); + qmicli_async_operation_done (TRUE, FALSE); } static void @@ -499,7 +502,7 @@ device_set_expected_data_format_cb (QmiDevice *dev) qmi_device_expected_data_format_get_string (expected)); /* We're done now */ - qmicli_async_operation_done (!error); + qmicli_async_operation_done (!error, FALSE); g_object_unref (dev); return FALSE; @@ -526,7 +529,7 @@ device_get_expected_data_format_cb (QmiDevice *dev) g_print ("%s\n", qmi_device_expected_data_format_get_string (expected)); /* We're done now */ - qmicli_async_operation_done (!error); + qmicli_async_operation_done (!error, FALSE); g_object_unref (dev); return FALSE; @@ -551,7 +554,7 @@ device_get_wwan_iface_cb (QmiDevice *dev) g_print ("%s\n", wwan_iface); /* We're done now */ - qmicli_async_operation_done (!!wwan_iface); + qmicli_async_operation_done (!!wwan_iface, FALSE); g_object_unref (dev); return FALSE; diff --git a/src/qmicli/qmicli.h b/src/qmicli/qmicli.h index 7672490..5ebd988 100644 --- a/src/qmicli/qmicli.h +++ b/src/qmicli/qmicli.h @@ -24,7 +24,8 @@ #define __QMICLI_H__ /* Common */ -void qmicli_async_operation_done (gboolean operation_status); +void qmicli_async_operation_done (gboolean reported_operation_status, + gboolean skip_cid_release); /* DMS group */ GOptionGroup *qmicli_dms_get_option_group (void); |