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);
|
response = mbim_device_command_finish (device, res, &error);
|
||||||
if (response &&
|
if (response &&
|
||||||
|
mbim_message_command_done_get_result (response, &error) &&
|
||||||
mbim_message_basic_connect_device_caps_query_response_parse (
|
mbim_message_basic_connect_device_caps_query_response_parse (
|
||||||
response,
|
response,
|
||||||
NULL, /* device_type */
|
NULL, /* device_type */
|
||||||
@@ -381,6 +382,7 @@ pin_query_ready (MbimDevice *device,
|
|||||||
|
|
||||||
response = mbim_device_command_finish (device, res, &error);
|
response = mbim_device_command_finish (device, res, &error);
|
||||||
if (response &&
|
if (response &&
|
||||||
|
mbim_message_command_done_get_result (response, &error) &&
|
||||||
mbim_message_basic_connect_pin_query_response_parse (
|
mbim_message_basic_connect_pin_query_response_parse (
|
||||||
response,
|
response,
|
||||||
&pin_type,
|
&pin_type,
|
||||||
@@ -459,6 +461,7 @@ pin_query_unlock_retries_ready (MbimDevice *device,
|
|||||||
|
|
||||||
response = mbim_device_command_finish (device, res, &error);
|
response = mbim_device_command_finish (device, res, &error);
|
||||||
if (response &&
|
if (response &&
|
||||||
|
mbim_message_command_done_get_result (response, &error) &&
|
||||||
mbim_message_basic_connect_pin_query_response_parse (
|
mbim_message_basic_connect_pin_query_response_parse (
|
||||||
response,
|
response,
|
||||||
&pin_type,
|
&pin_type,
|
||||||
@@ -549,6 +552,7 @@ radio_state_query_ready (MbimDevice *device,
|
|||||||
|
|
||||||
response = mbim_device_command_finish (device, res, &error);
|
response = mbim_device_command_finish (device, res, &error);
|
||||||
if (response &&
|
if (response &&
|
||||||
|
mbim_message_command_done_get_result (response, &error) &&
|
||||||
mbim_message_basic_connect_radio_state_query_response_parse (
|
mbim_message_basic_connect_radio_state_query_response_parse (
|
||||||
response,
|
response,
|
||||||
&hardware_radio_state,
|
&hardware_radio_state,
|
||||||
|
@@ -86,17 +86,23 @@ pin_set_enter_ready (MbimDevice *device,
|
|||||||
|
|
||||||
response = mbim_device_command_finish (device, res, &error);
|
response = mbim_device_command_finish (device, res, &error);
|
||||||
if (response &&
|
if (response &&
|
||||||
mbim_message_basic_connect_pin_set_response_parse (
|
!mbim_message_command_done_get_result (response, &error)) {
|
||||||
response,
|
/* Sending PIN failed, build a better error to report */
|
||||||
&pin_type,
|
if (mbim_message_basic_connect_pin_set_response_parse (
|
||||||
&pin_state,
|
response,
|
||||||
NULL,
|
&pin_type,
|
||||||
&error)) {
|
&pin_state,
|
||||||
/* Create the errors ourselves */
|
NULL,
|
||||||
if (pin_type == MBIM_PIN_TYPE_PIN1 && pin_state == MBIM_PIN_STATE_LOCKED)
|
NULL)) {
|
||||||
error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_INCORRECT_PASSWORD);
|
/* Create the errors ourselves */
|
||||||
else if (pin_type == MBIM_PIN_TYPE_PUK1 && pin_state == MBIM_PIN_STATE_LOCKED)
|
if (pin_type == MBIM_PIN_TYPE_PIN1 && pin_state == MBIM_PIN_STATE_LOCKED) {
|
||||||
error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_PUK);
|
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) {
|
||||||
|
g_error_free (error);
|
||||||
|
error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_PUK);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
@@ -172,18 +178,22 @@ puk_set_enter_ready (MbimDevice *device,
|
|||||||
|
|
||||||
response = mbim_device_command_finish (device, res, &error);
|
response = mbim_device_command_finish (device, res, &error);
|
||||||
if (response &&
|
if (response &&
|
||||||
mbim_message_basic_connect_pin_set_response_parse (
|
!mbim_message_command_done_get_result (response, &error)) {
|
||||||
response,
|
/* Sending PUK failed, build a better error to report */
|
||||||
&pin_type,
|
if (mbim_message_basic_connect_pin_set_response_parse (
|
||||||
&pin_state,
|
response,
|
||||||
&remaining_attempts,
|
&pin_type,
|
||||||
&error)) {
|
&pin_state,
|
||||||
/* Create the errors ourselves */
|
&remaining_attempts,
|
||||||
if (pin_type == MBIM_PIN_TYPE_PUK1 && pin_state == MBIM_PIN_STATE_LOCKED) {
|
NULL)) {
|
||||||
if (remaining_attempts == 0)
|
/* Create the errors ourselves */
|
||||||
error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG);
|
if (pin_type == MBIM_PIN_TYPE_PUK1 && pin_state == MBIM_PIN_STATE_LOCKED) {
|
||||||
else
|
g_error_free (error);
|
||||||
error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_INCORRECT_PASSWORD);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user