Re: SIM PIN Unlock Error in MM 1.22.0

2024-04-22 Thread Amol Lad
Thanks Aleksander!

The fix works.

Amol

From: Aleksander Morgado 
Sent: Monday, April 22, 2024 2:35 PM
To: Amol Lad 
Cc: ModemManager (development) 
Subject: Re: SIM PIN Unlock Error in MM 1.22.0

Hey Amol,

>
> We are getting following error when trying to send pin to the SIM card. The 
> problem is not observed in MM 1.20.4. However, please note that the SIM card 
> does unlocks after the below command even though error is reported.
>
> # mmcli -i 0 --pin=1234
> error: couldn't send PIN code to the SIM: 
> 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Failed: Couldn't get 
> interface skeleton'
>
> Now, after looking through the code, following change is causing this issue. 
> This change was not present in 1.20.4
> 
> mm-broadband-modem-mbim.c:
> if ((self->priv->enabled_cache.last_ready_state != 
> MBIM_SUBSCRIBER_READY_STATE_DEVICE_LOCKED &&
>  ready_state == MBIM_SUBSCRIBER_READY_STATE_DEVICE_LOCKED) ||
> (self->priv->enabled_cache.last_ready_state == 
> MBIM_SUBSCRIBER_READY_STATE_DEVICE_LOCKED &&
>  ready_state != MBIM_SUBSCRIBER_READY_STATE_DEVICE_LOCKED)) {
> mm_obj_dbg (self, "Lock state change detected");
> active_sim_event = TRUE;
> }
>
> self->priv->enabled_cache.last_ready_state = ready_state;
>
> if (active_sim_event) {
> mm_iface_modem_process_sim_event (MM_IFACE_MODEM (self));
> }
> 
> What is happening is when SIM PIN lock state changes then 
> mm_iface_modem_process_sim_event () is called which eventually calls 
> mm_base_modem_set_reprobe(). The reprobe, "unexports" the current modem 
> instance (modem 0) and recreates a new modem instance (1). As a result, the 
> above mmcli command is reporting error. I'm not sure why this should happen 
> for SIM Lock state change.

I think this has been fixed in MM git main branch; is there any chance
you could test with that? See
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/commit/19fd9c634b8f2876694d18a77a3b686a0c08bf34

--
Aleksander


Re: SIM PIN Unlock Error in MM 1.22.0

2024-04-22 Thread Aleksander Morgado
Hey Amol,

>
> We are getting following error when trying to send pin to the SIM card. The 
> problem is not observed in MM 1.20.4. However, please note that the SIM card 
> does unlocks after the below command even though error is reported.
>
> # mmcli -i 0 --pin=1234
> error: couldn't send PIN code to the SIM: 
> 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Failed: Couldn't get 
> interface skeleton'
>
> Now, after looking through the code, following change is causing this issue. 
> This change was not present in 1.20.4
> 
> mm-broadband-modem-mbim.c:
> if ((self->priv->enabled_cache.last_ready_state != 
> MBIM_SUBSCRIBER_READY_STATE_DEVICE_LOCKED &&
>  ready_state == MBIM_SUBSCRIBER_READY_STATE_DEVICE_LOCKED) ||
> (self->priv->enabled_cache.last_ready_state == 
> MBIM_SUBSCRIBER_READY_STATE_DEVICE_LOCKED &&
>  ready_state != MBIM_SUBSCRIBER_READY_STATE_DEVICE_LOCKED)) {
> mm_obj_dbg (self, "Lock state change detected");
> active_sim_event = TRUE;
> }
>
> self->priv->enabled_cache.last_ready_state = ready_state;
>
> if (active_sim_event) {
> mm_iface_modem_process_sim_event (MM_IFACE_MODEM (self));
> }
> 
> What is happening is when SIM PIN lock state changes then 
> mm_iface_modem_process_sim_event () is called which eventually calls 
> mm_base_modem_set_reprobe(). The reprobe, "unexports" the current modem 
> instance (modem 0) and recreates a new modem instance (1). As a result, the 
> above mmcli command is reporting error. I'm not sure why this should happen 
> for SIM Lock state change.

I think this has been fixed in MM git main branch; is there any chance
you could test with that? See
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/commit/19fd9c634b8f2876694d18a77a3b686a0c08bf34

-- 
Aleksander


SIM PIN Unlock Error in MM 1.22.0

2024-04-22 Thread Amol Lad
Hi,

We are getting following error when trying to send pin to the SIM card. The 
problem is not observed in MM 1.20.4. However, please note that the SIM card 
does unlocks after the below command even though error is reported.

# mmcli -i 0 --pin=1234
error: couldn't send PIN code to the SIM: 
'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Failed: Couldn't get 
interface skeleton'

Now, after looking through the code, following change is causing this issue. 
This change was not present in 1.20.4

mm-broadband-modem-mbim.c:
if ((self->priv->enabled_cache.last_ready_state != 
MBIM_SUBSCRIBER_READY_STATE_DEVICE_LOCKED &&
 ready_state == MBIM_SUBSCRIBER_READY_STATE_DEVICE_LOCKED) ||
(self->priv->enabled_cache.last_ready_state == 
MBIM_SUBSCRIBER_READY_STATE_DEVICE_LOCKED &&
 ready_state != MBIM_SUBSCRIBER_READY_STATE_DEVICE_LOCKED)) {
mm_obj_dbg (self, "Lock state change detected");
active_sim_event = TRUE;
}

self->priv->enabled_cache.last_ready_state = ready_state;

if (active_sim_event) {
mm_iface_modem_process_sim_event (MM_IFACE_MODEM (self));
}

What is happening is when SIM PIN lock state changes then 
mm_iface_modem_process_sim_event () is called which eventually calls 
mm_base_modem_set_reprobe(). The reprobe, "unexports" the current modem 
instance (modem 0) and recreates a new modem instance (1). As a result, the 
above mmcli command is reporting error. I'm not sure why this should happen for 
SIM Lock state change.

The logs are below.  As you can see at timestamp 1713774618.140486, the modem 
is unexported and then it's all cleanup and creation of new modem instance.

Please advise.

 [1713774617.896807] [modem0/sim0] sending PIN...
 [1713774617.896908] [/dev/cdc-wdm0] sent message...
<< RAW:
<<   length = 80
<<   data   = 03:00:00:00:50:00:00:00:17:00:00:00...

 [1713774617.897063] [/dev/cdc-wdm0] sent message (translated)...
<< Header:
<<   length  = 80
<<   type= command (0x0003)
<<   transaction = 23
<< Fragment header:
<<   total   = 1
<<   current = 0
<< Contents:
<<   service = 'basic-connect' (a289cc33-bcbb-8b4f-b6b0-133ec2aae6df)
<<   cid = 'pin' (0x0004)
<<   type= 'set' (0x0001)
<< Fields:
<<   PinType = 'pin1'
<<   PinOperation = 'enter'
<<   Pin = '1234'
<<   NewPin = '(NULL)'

 [1713774618.139714] [/dev/cdc-wdm0] received message...
>> RAW:
>>   length = 144
>>   data   = 07:00:00:80:90:00:00:00:00:00:00:00...

 [1713774618.139908] [/dev/cdc-wdm0] received message (translated)...
>> Header:
>>   length  = 144
>>   type= indicate-status (0x8007)
>>   transaction = 0
>> Fragment header:
>>   total   = 1
>>   current = 0
>> Contents:
>>   service = 'basic-connect' (a289cc33-bcbb-8b4f-b6b0-133ec2aae6df)
>>   cid = 'subscriber-ready-status' (0x0002)
>> Fields:
>>   ReadyState = 'not-initialized'
>>   SubscriberId = '###'
>>   SimIccId = '###'
>>   ReadyInfo = 'none'
>>   TelephoneNumbersCount = '0'
>>   TelephoneNumbers = '###'

 [1713774618.139979] [modem0] received notification (service 
'basic-connect', command 'subscriber-ready-status')
 [1713774618.140012] [modem0] processed subscriber ready status 
notification
 [1713774618.140033] [modem0] Lock state change detected
 [1713774618.140052] [modem0] Processing SIM event
 [1713774618.140486] [device 
/sys/devices/platform/soc/soc:internal-regs/f10f.usb3/usb3/3-1] unexported 
modem from path '/org/freedesktop/ModemManager1/Modem/0'
 [1713774618.140532] [modem0] supported notifications: signal (no), 
registration (no), sms (no), connect (no), subscriber (no), packet (no), pco 
(no), ussd (no), lte attach info (no), provisioned contexts (no), 
slot_info_status (no)
 [1713774618.140585] [cdc-wdm0/mbim] Releasing client for service 'uim'...
 [1713774618.140623] [/dev/cdc-wdm0] releasing 'uim' client with flags 
'release-cid'...
 [1713774618.140657] [/dev/cdc-wdm0] unregistered 'uim' client with ID '2'
 [1713774618.140769] [/dev/cdc-wdm0] sent message...
<< RAW:
<<   length = 17
<<   data   = 01:10:00:00:00:00:00:07:23:00:05:00...

 [1713774618.140910] [/dev/cdc-wdm0] sent generic request (translated)...
<< QMUX:
<<   length  = 16
<<   flags   = 0x00
<<   service = "ctl"
<<   client  = 0
<< QMI:
<<   flags   = "none"
<<   transaction = 7
<<   tlv_length  = 5
<<   message = "Release CID" (0x0023)
<< TLV:
<<   type   = "Release Info" (0x01)
<<   length = 2
<<   value  = 0B:02
<<   translated = [ service = 'uim' cid = '2' ]

 [1713774618.140994] [/dev/cdc-wdm0] sent message...
<< RAW:
<<   length = 65
<<   data   = 03:00:00:00:41:00:00:00:15:00:00:00...

 [1713774618.141233] [/dev/cdc-wdm0] sent message (translated)...
<< Header:
<<