Disconnect failed after SIM card hot switch during disable modem progress
Description:
- Plugin in SIM card and make sure modem connected.
- Plugin out SIM card then ModemManager will do the disable modem progress.
- Disable modem failed because bearer disconnect with error "SimNotInserted" response.
LOG:
2022-05-24T17:35:13.834676Z DEBUG ModemManager[14825]: <debug> [modem0] SIM hot swap detected
2022-05-24T17:35:13.835199Z DEBUG ModemManager[14825]: <debug> [modem0/bearer1] disconnecting...
2022-05-24T17:35:13.835632Z DEBUG ModemManager[14825]: [/dev/wwan0mbim0] Sent message (translated)...#012<<<<<< Header:#012<<<<<< length = 112#012<<<<<< type = command (0x00000003)#012<<<<<< transaction = 15874#012<<<<<< Fragment header:#012<<<<<< total = 1#012<<<<<< current = 0#012<<<<<< Contents:#012<<<<<< service = 'basic-connect' (a289cc33-bcbb-8b4f-b6b0-133ec2aae6df)#012<<<<<< cid = 'connect' (0x0000000c)#012<<<<<< type = 'set' (0x00000001)#012<<<<<< Fields:#012<<<<<< SessionId = '0'#012<<<<<< ActivationCommand = 'deactivate'#012
2022-05-24T17:35:13.837697Z DEBUG ModemManager[14825]: [/dev/wwan0mbim0] Received message (translated)...#012>>>>>> Header:#012>>>>>> length = 96#012>>>>>> type = command-done (0x80000003)#012>>>>>> transaction = 15874#012>>>>>> Fragment header:#012>>>>>> total = 1#012>>>>>> current = 0#012>>>>>> Contents:#012>>>>>> status error = 'SimNotInserted' (0x00000003)#012>>>>>> service = 'basic-connect' (a289cc33-bcbb-8b4f-b6b0-133ec2aae6df)#012>>>>>> cid = 'connect' (0x0000000c)
2022-05-24T17:35:13.837749Z DEBUG ModemManager[14825]: <debug> [modem0/bearer1] couldn't disconnect: SimNotInserted
2022-05-24T17:35:13.837818Z ERR ModemManager[14825]: <error> [modem0] failed to disable after SIM switch event: SimNotInserted
...
2022-05-24T17:35:13.963818Z DEBUG ModemManager[14825]: [/dev/wwan0mbim0] Received message (translated)...#012>>>>>> Header:#012>>>>>> length = 92#012>>>>>> type = indicate-status (0x80000007)#012>>>>>> transaction = 0#012>>>>>> Fragment header:#012>>>>>> total = 1#012>>>>>> current = 0#012>>>>>> Contents:#012>>>>>> service = 'basic-connect' (a289cc33-bcbb-8b4f-b6b0-133ec2aae6df)#012>>>>>> cid = 'connect' (0x0000000c)#012>>>>>> Fields:#012>>>>>> SessionId = '0'#012>>>>>> ActivationState = 'deactivated'#012>>>>>> VoiceCallState = 'none'#012>>>>>> IpType = 'default'#012>>>>>> ContextType = '00000000-0000-0000-0000-000000000000'#012>>>>>> NwError = '1000959'#012>>>>>> MediaPreference = 'unknown'#012>>>>>> AccessString = '{#012>>>>>> tlv type = wchar-str (0x000a)#012>>>>>> tlv data = #012>>>>>> tlv string = #012>>>>>> }'#012>>>>>> UnnamedIes = '[ #012>>>>>> ]'
Is that right to modify the function disconnect_set_ready to ignore the status error 'SimNotInserted'? Hope to get your guidance and advice.
static void
disconnect_set_ready (MbimDevice *device,
GAsyncResult *res,
GTask *task)
{
......
if (g_error_matches (error, MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_CONTEXT_NOT_ACTIVATED)) {
if (parsed_result)
mm_obj_dbg (self, "context not activated: session ID '%u' already disconnected", session_id);
else
mm_obj_dbg (self, "context not activated: already disconnected");
g_clear_error (&error);
g_clear_error (&inner_error);
/* success */
goto out;
}
//Add ignore "SimNotInserted" error here
if (g_error_matches (error, MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_SIM_NOT_INSERTED)) {
g_clear_error (&error);[Redrix-sim-unplug-error-net.log](/uploads/6a1aded9147d51c5f80a3c462ba0e796/Redrix-sim-unplug-error-net.log)
g_clear_error (&inner_error);
/* success */
goto out;
}
if (g_error_matches (error, MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_FAILURE) && parsed_result && nw_error != 0) {
g_assert (!inner_error);
g_error_free (error);
error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error, self);
/* error out with nw_error error */
goto out;
}
......
}