broadband-modem-mbim,sim-mbim: consider MBIM result errors
This commit is contained in:
@@ -120,6 +120,7 @@ device_caps_query_ready (MbimDevice *device,
|
||||
|
||||
response = mbim_device_command_finish (device, res, &error);
|
||||
if (response &&
|
||||
mbim_message_command_done_get_result (response, &error) &&
|
||||
mbim_message_basic_connect_device_caps_query_response_parse (
|
||||
response,
|
||||
NULL, /* device_type */
|
||||
@@ -381,6 +382,7 @@ pin_query_ready (MbimDevice *device,
|
||||
|
||||
response = mbim_device_command_finish (device, res, &error);
|
||||
if (response &&
|
||||
mbim_message_command_done_get_result (response, &error) &&
|
||||
mbim_message_basic_connect_pin_query_response_parse (
|
||||
response,
|
||||
&pin_type,
|
||||
@@ -459,6 +461,7 @@ pin_query_unlock_retries_ready (MbimDevice *device,
|
||||
|
||||
response = mbim_device_command_finish (device, res, &error);
|
||||
if (response &&
|
||||
mbim_message_command_done_get_result (response, &error) &&
|
||||
mbim_message_basic_connect_pin_query_response_parse (
|
||||
response,
|
||||
&pin_type,
|
||||
@@ -549,6 +552,7 @@ radio_state_query_ready (MbimDevice *device,
|
||||
|
||||
response = mbim_device_command_finish (device, res, &error);
|
||||
if (response &&
|
||||
mbim_message_command_done_get_result (response, &error) &&
|
||||
mbim_message_basic_connect_radio_state_query_response_parse (
|
||||
response,
|
||||
&hardware_radio_state,
|
||||
|
@@ -86,18 +86,24 @@ pin_set_enter_ready (MbimDevice *device,
|
||||
|
||||
response = mbim_device_command_finish (device, res, &error);
|
||||
if (response &&
|
||||
mbim_message_basic_connect_pin_set_response_parse (
|
||||
!mbim_message_command_done_get_result (response, &error)) {
|
||||
/* Sending PIN failed, build a better error to report */
|
||||
if (mbim_message_basic_connect_pin_set_response_parse (
|
||||
response,
|
||||
&pin_type,
|
||||
&pin_state,
|
||||
NULL,
|
||||
&error)) {
|
||||
NULL)) {
|
||||
/* Create the errors ourselves */
|
||||
if (pin_type == MBIM_PIN_TYPE_PIN1 && pin_state == MBIM_PIN_STATE_LOCKED)
|
||||
if (pin_type == MBIM_PIN_TYPE_PIN1 && pin_state == MBIM_PIN_STATE_LOCKED) {
|
||||
g_error_free (error);
|
||||
error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_INCORRECT_PASSWORD);
|
||||
else if (pin_type == MBIM_PIN_TYPE_PUK1 && pin_state == MBIM_PIN_STATE_LOCKED)
|
||||
} else if (pin_type == MBIM_PIN_TYPE_PUK1 && pin_state == MBIM_PIN_STATE_LOCKED) {
|
||||
g_error_free (error);
|
||||
error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_PUK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (error)
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
@@ -172,20 +178,24 @@ puk_set_enter_ready (MbimDevice *device,
|
||||
|
||||
response = mbim_device_command_finish (device, res, &error);
|
||||
if (response &&
|
||||
mbim_message_basic_connect_pin_set_response_parse (
|
||||
!mbim_message_command_done_get_result (response, &error)) {
|
||||
/* Sending PUK failed, build a better error to report */
|
||||
if (mbim_message_basic_connect_pin_set_response_parse (
|
||||
response,
|
||||
&pin_type,
|
||||
&pin_state,
|
||||
&remaining_attempts,
|
||||
&error)) {
|
||||
NULL)) {
|
||||
/* Create the errors ourselves */
|
||||
if (pin_type == MBIM_PIN_TYPE_PUK1 && pin_state == MBIM_PIN_STATE_LOCKED) {
|
||||
g_error_free (error);
|
||||
if (remaining_attempts == 0)
|
||||
error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG);
|
||||
else
|
||||
error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_INCORRECT_PASSWORD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (error)
|
||||
g_simple_async_result_take_error (simple, error);
|
||||
|
Reference in New Issue
Block a user