[PATCH 2/2] bearer-mbim: parse replies on failure
Bjørn Mork
bjorn at mork.no
Thu Dec 19 03:55:51 PST 2013
Some messages provide an additional NwError cause code from
the network in case of failure. This means that we need to
parse the reply even if the status indicates failure, to be
able to return the exact failure cause.
Signed-off-by: Bjørn Mork <bjorn at mork.no>
---
src/mm-bearer-mbim.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c
index 3446ed3..1b77c65 100644
--- a/src/mm-bearer-mbim.c
+++ b/src/mm-bearer-mbim.c
@@ -429,7 +429,8 @@ connect_set_ready (MbimDevice *device,
response = mbim_device_command_finish (device, res, &error);
if (response &&
- mbim_message_command_done_get_result (response, &error) &&
+ (mbim_message_command_done_get_result (response, &error) ||
+ error->code == MBIM_STATUS_ERROR_FAILURE) &&
mbim_message_connect_response_parse (
response,
&session_id,
@@ -440,6 +441,7 @@ connect_set_ready (MbimDevice *device,
&nw_error,
&error)) {
if (nw_error) {
+ g_error_free (error);
error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error);
mm_dbg ("NwError: '%s' (%u)", error->message, nw_error);
} else {
@@ -524,7 +526,8 @@ packet_service_set_ready (MbimDevice *device,
response = mbim_device_command_finish (device, res, &error);
if (response &&
- mbim_message_command_done_get_result (response, &error) &&
+ (mbim_message_command_done_get_result (response, &error) ||
+ error->code == MBIM_STATUS_ERROR_FAILURE) &&
mbim_message_packet_service_response_parse (
response,
&nw_error,
@@ -534,6 +537,7 @@ packet_service_set_ready (MbimDevice *device,
&downlink_speed,
&error)) {
if (nw_error) {
+ g_error_free (error);
error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error);
mm_dbg ("NwError: '%s' (%u)", error->message, nw_error);
} else {
@@ -904,7 +908,8 @@ disconnect_set_ready (MbimDevice *device,
response = mbim_device_command_finish (device, res, &error);
if (response &&
- mbim_message_command_done_get_result (response, &error) &&
+ (mbim_message_command_done_get_result (response, &error) ||
+ error->code == MBIM_STATUS_ERROR_FAILURE) &&
mbim_message_connect_response_parse (
response,
&session_id,
@@ -915,6 +920,7 @@ disconnect_set_ready (MbimDevice *device,
&nw_error,
&error)) {
if (nw_error) {
+ g_error_free (error);
error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error);
mm_dbg ("NwError: '%s' (%u)", error->message, nw_error);
} else
--
1.7.10.4
More information about the ModemManager-devel
mailing list