aboutsummaryrefslogtreecommitdiff
path: root/src/mm-bearer-mbim.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mm-bearer-mbim.c')
-rw-r--r--src/mm-bearer-mbim.c166
1 files changed, 111 insertions, 55 deletions
diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c
index 2cfd1cf..ff5c6a0 100644
--- a/src/mm-bearer-mbim.c
+++ b/src/mm-bearer-mbim.c
@@ -139,6 +139,7 @@ connect_context_complete_and_free (ConnectContext *ctx)
mm_bearer_connect_result_unref (ctx->connect_result);
g_object_unref (ctx->data);
g_object_unref (ctx->cancellable);
+ g_object_unref (ctx->properties);
g_object_unref (ctx->device);
g_object_unref (ctx->self);
g_slice_free (ConnectContext, ctx);
@@ -398,12 +399,19 @@ ip_configuration_query_ready (MbimDevice *device,
ipv4_config,
ipv6_config);
+ if (ipv4_config)
+ g_object_unref (ipv4_config);
+ if (ipv6_config)
+ g_object_unref (ipv6_config);
mbim_ipv4_element_array_free (ipv4address);
mbim_ipv6_element_array_free (ipv6address);
g_free (ipv4dnsserver);
g_free (ipv6dnsserver);
}
+ if (response)
+ mbim_message_unref (response);
+
if (error) {
g_simple_async_result_take_error (ctx->result, error);
connect_context_complete_and_free (ctx);
@@ -429,27 +437,42 @@ 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_connect_response_parse (
- response,
- &session_id,
- &activation_state,
- NULL, /* voice_call_state */
- &ip_type,
- NULL, /* context_type */
- &nw_error,
- &error)) {
- if (nw_error)
- error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error);
- else {
- ctx->ip_type = ip_type;
- mm_dbg ("Session ID '%u': %s (IP type: %s)",
- session_id,
- mbim_activation_state_get_string (activation_state),
- mbim_context_ip_type_get_string (ip_type));
+ (mbim_message_command_done_get_result (response, &error) ||
+ error->code == MBIM_STATUS_ERROR_FAILURE)) {
+ GError *inner_error = NULL;
+
+ if (mbim_message_connect_response_parse (
+ response,
+ &session_id,
+ &activation_state,
+ NULL, /* voice_call_state */
+ &ip_type,
+ NULL, /* context_type */
+ &nw_error,
+ &inner_error)) {
+ if (nw_error) {
+ if (error)
+ g_error_free (error);
+ error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error);
+ } else {
+ ctx->ip_type = ip_type;
+ mm_dbg ("Session ID '%u': %s (IP type: %s)",
+ session_id,
+ mbim_activation_state_get_string (activation_state),
+ mbim_context_ip_type_get_string (ip_type));
+ }
+ } else {
+ /* Prefer the error from the result to the parsing error */
+ if (!error)
+ error = inner_error;
+ else
+ g_error_free (inner_error);
}
}
+ if (response)
+ mbim_message_unref (response);
+
if (error) {
g_simple_async_result_take_error (ctx->result, error);
connect_context_complete_and_free (ctx);
@@ -503,6 +526,9 @@ provisioned_contexts_query_ready (MbimDevice *device,
g_error_free (error);
}
+ if (response)
+ mbim_message_unref (response);
+
/* Keep on */
ctx->step++;
connect_context_step (ctx);
@@ -523,30 +549,45 @@ 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_packet_service_response_parse (
- response,
- &nw_error,
- &packet_service_state,
- &highest_available_data_class,
- &uplink_speed,
- &downlink_speed,
- &error)) {
- if (nw_error)
- error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error);
- else {
- gchar *str;
-
- str = mbim_data_class_build_string_from_mask (highest_available_data_class);
- mm_dbg ("Packet service update:");
- mm_dbg (" state: '%s'", mbim_packet_service_state_get_string (packet_service_state));
- mm_dbg (" data class: '%s'", str);
- mm_dbg (" uplink: '%" G_GUINT64_FORMAT "' bps", uplink_speed);
- mm_dbg (" downlink: '%" G_GUINT64_FORMAT "' bps", downlink_speed);
- g_free (str);
+ (mbim_message_command_done_get_result (response, &error) ||
+ error->code == MBIM_STATUS_ERROR_FAILURE)) {
+ GError *inner_error = NULL;
+
+ if (mbim_message_packet_service_response_parse (
+ response,
+ &nw_error,
+ &packet_service_state,
+ &highest_available_data_class,
+ &uplink_speed,
+ &downlink_speed,
+ &error)) {
+ if (nw_error) {
+ if (error)
+ g_error_free (error);
+ error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error);
+ } else {
+ gchar *str;
+
+ str = mbim_data_class_build_string_from_mask (highest_available_data_class);
+ mm_dbg ("Packet service update:");
+ mm_dbg (" state: '%s'", mbim_packet_service_state_get_string (packet_service_state));
+ mm_dbg (" data class: '%s'", str);
+ mm_dbg (" uplink: '%" G_GUINT64_FORMAT "' bps", uplink_speed);
+ mm_dbg (" downlink: '%" G_GUINT64_FORMAT "' bps", downlink_speed);
+ g_free (str);
+ }
+ } else {
+ /* Prefer the error from the result to the parsing error */
+ if (!error)
+ error = inner_error;
+ else
+ g_error_free (inner_error);
}
}
+ if (response)
+ mbim_message_unref (response);
+
if (error) {
/* Don't make NoDeviceSupport errors fatal; just try to keep on the
* connection sequence even with this error. */
@@ -902,24 +943,39 @@ 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_connect_response_parse (
- response,
- &session_id,
- &activation_state,
- NULL, /* voice_call_state */
- NULL, /* ip_type */
- NULL, /* context_type */
- &nw_error,
- &error)) {
- if (nw_error)
- error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error);
- else
- mm_dbg ("Session ID '%u': %s",
- session_id,
- mbim_activation_state_get_string (activation_state));
+ (mbim_message_command_done_get_result (response, &error) ||
+ error->code == MBIM_STATUS_ERROR_FAILURE)) {
+ GError *inner_error = NULL;
+
+ if (mbim_message_connect_response_parse (
+ response,
+ &session_id,
+ &activation_state,
+ NULL, /* voice_call_state */
+ NULL, /* ip_type */
+ NULL, /* context_type */
+ &nw_error,
+ &error)) {
+ if (nw_error) {
+ if (error)
+ g_error_free (error);
+ error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error);
+ } else
+ mm_dbg ("Session ID '%u': %s",
+ session_id,
+ mbim_activation_state_get_string (activation_state));
+ } else {
+ /* Prefer the error from the result to the parsing error */
+ if (!error)
+ error = inner_error;
+ else
+ g_error_free (inner_error);
+ }
}
+ if (response)
+ mbim_message_unref (response);
+
if (error) {
g_simple_async_result_take_error (ctx->result, error);
disconnect_context_complete_and_free (ctx);