aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-04-26 17:57:38 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-07-03 16:08:49 +0200
commit3185e9553c4552105ef89c2eb3d6e3a9f9e622e4 (patch)
treebcd37f1031ef6e90f39b5a0cf8abc16c6405452f
parent13c12cde7f0b3bf16b2bcfdc213d26a393a37635 (diff)
downloadexternal_libqmi-3185e9553c4552105ef89c2eb3d6e3a9f9e622e4.zip
external_libqmi-3185e9553c4552105ef89c2eb3d6e3a9f9e622e4.tar.gz
external_libqmi-3185e9553c4552105ef89c2eb3d6e3a9f9e622e4.tar.bz2
device: don't detect generic QMI errors, let the message parsers notify them
Message response parsers may want to get additional TLVs when specific QMI errors are reported.
-rw-r--r--src/qmi-device.c15
-rw-r--r--src/qmi-message-ctl.c12
-rw-r--r--src/qmi-message-dms.c4
3 files changed, 20 insertions, 11 deletions
diff --git a/src/qmi-device.c b/src/qmi-device.c
index ae7ca41..8395942 100644
--- a/src/qmi-device.c
+++ b/src/qmi-device.c
@@ -786,17 +786,10 @@ process_message (QmiDevice *self,
if (!tr)
g_debug ("[%s] No transaction matched in received message",
self->priv->path_display);
- else {
- /* Received message is a response in a transaction; handle QMI protocol
- * errors */
- if (!qmi_message_get_response_result (message, &error)) {
- transaction_complete_and_free (tr, NULL, error);
- g_error_free (error);
- } else {
- /* Report the reply message */
- transaction_complete_and_free (tr, message, NULL);
- }
- }
+ else
+ /* Report the reply message */
+ transaction_complete_and_free (tr, message, NULL);
+
return;
}
diff --git a/src/qmi-message-ctl.c b/src/qmi-message-ctl.c
index 35f8c34..b8a7038 100644
--- a/src/qmi-message-ctl.c
+++ b/src/qmi-message-ctl.c
@@ -158,6 +158,10 @@ qmi_message_ctl_version_info_reply_parse (QmiMessage *self,
g_assert (qmi_message_get_message_id (self) == QMI_CTL_MESSAGE_GET_VERSION_INFO);
+ /* Abort if we got a QMI error reported */
+ if (!qmi_message_get_response_result (self, error))
+ return NULL;
+
if (!qmi_message_tlv_get_varlen (self,
0x01,
&svcbuflen,
@@ -241,6 +245,10 @@ qmi_message_ctl_allocate_cid_reply_parse (QmiMessage *self,
g_assert (qmi_message_get_message_id (self) == QMI_CTL_MESSAGE_ALLOCATE_CLIENT_ID);
+ /* Abort if we got a QMI error reported */
+ if (!qmi_message_get_response_result (self, error))
+ return FALSE;
+
if (!qmi_message_tlv_get (self, 0x01, sizeof (id), &id, error)) {
g_prefix_error (error, "Couldn't get TLV: ");
return FALSE;
@@ -295,6 +303,10 @@ qmi_message_ctl_release_cid_reply_parse (QmiMessage *self,
g_assert (qmi_message_get_message_id (self) == QMI_CTL_MESSAGE_RELEASE_CLIENT_ID);
+ /* Abort if we got a QMI error reported */
+ if (!qmi_message_get_response_result (self, error))
+ return FALSE;
+
if (!qmi_message_tlv_get (self, 0x01, sizeof (id), &id, error)) {
g_prefix_error (error, "Couldn't get TLV: ");
return FALSE;
diff --git a/src/qmi-message-dms.c b/src/qmi-message-dms.c
index 04050b9..54e5eb3 100644
--- a/src/qmi-message-dms.c
+++ b/src/qmi-message-dms.c
@@ -152,6 +152,10 @@ qmi_message_dms_get_ids_reply_parse (QmiMessage *self,
g_assert (qmi_message_get_message_id (self) == QMI_DMS_MESSAGE_GET_IDS);
+ /* Abort if we got a QMI error reported */
+ if (!qmi_message_get_response_result (self, error))
+ return NULL;
+
got_esn = qmi_message_tlv_get_string (self,
QMI_DMS_TLV_GET_IDS_ESN,
NULL);