gsm: return success if unlocked but doesn't allow subsequent CPIN commands

If the modem for some reason returns ERROR for a +CPIN when it's
unlocked, and subsequent PIN post-unlock pin checks return READY,
just treat the modem as unlocked don't return the +CPIN error.
This commit is contained in:
Dan Williams
2011-04-18 17:38:39 -05:00
parent 5dadfa4c21
commit fca4d3aa37

View File

@@ -1958,8 +1958,17 @@ pin_puk_recheck_done (MMModem *modem, GError *error, gpointer user_data)
/* If we have a saved error from sending PIN/PUK, return that to callers */ /* If we have a saved error from sending PIN/PUK, return that to callers */
saved_error = mm_callback_info_get_data (info, SAVED_ERROR_TAG); saved_error = mm_callback_info_get_data (info, SAVED_ERROR_TAG);
if (saved_error) { if (saved_error) {
g_clear_error (&info->error); if (info->modem && !mm_modem_base_get_unlock_required (MM_MODEM_BASE (info->modem))) {
info->error = saved_error; /* Original unlock failed but the modem is actually unlocked, so
* return success. Sometimes happens if the modem doesn't allow
* CPIN="xxxx" when it's already unlocked and returns an error.
* Do nothing.
*/
} else {
/* Unlock failed after recheck, return original error */
g_clear_error (&info->error);
info->error = g_error_copy (saved_error);
}
} }
mm_callback_info_schedule (info); mm_callback_info_schedule (info);
@@ -1984,7 +1993,8 @@ send_puk_done (MMAtSerialPort *port,
* when we're done rechecking CPIN status. * when we're done rechecking CPIN status.
*/ */
mm_callback_info_set_data (info, SAVED_ERROR_TAG, mm_callback_info_set_data (info, SAVED_ERROR_TAG,
g_error_copy (error), NULL); g_error_copy (error),
(GDestroyNotify) g_error_free);
} }
} }
@@ -2047,7 +2057,8 @@ send_pin_done (MMAtSerialPort *port,
* when we're done rechecking CPIN status. * when we're done rechecking CPIN status.
*/ */
mm_callback_info_set_data (info, SAVED_ERROR_TAG, mm_callback_info_set_data (info, SAVED_ERROR_TAG,
g_error_copy (error), NULL); g_error_copy (error),
(GDestroyNotify) g_error_free);
} }
} }