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: Quectel EC25 & AT&T connection Catch-22

2024-04-22 Thread Enrico Mioso
On Fri, Apr 19, 2024 at 04:39:46PM +, Bruce Johnson wrote:
> I have a question about using both QMI and the serial interface with 
> ModemManager.
> 
> I had little difficulty getting ModemManager's SimpleModem to connect to 
> T-Mobile (USA) using a Quectel EG25-G, but we found that modem wasn't 
> compatible with AT&T and/or a private APN used by one of our customers. We 
> were advised to use the Quectel EC25, and after engaging both Quectel and 
> AT&T, we were told that we need to insert the APN into the modem using an AT 
> command, AT+CGDCONT=1,"IPV4V6","mcm.com.attz". I had to tweak the kernel 
> config and the ModemManager build.
> 
> Mods:
> 
>   *   I built ModemManager 1.18.4 with --with-at-command-via-dbus.
>   *   In the kernel config, I added USB Serial Converter support -> USB 
> driver for GSM and CDMA modems.
> 
> After I did this, the /dev/ttyUSB[1-4] files showed up, and I was able to 
> issue AT commands using ModemManager, but while the modem would sort-of 
> connect with SimpleModem's connect method -- I am getting a Bearer, and mmcli 
> shows "connected" -- I receive no IP address information from the carrier. 
> Port wwan0 is showing up as "ignored". (mmcli output below)
> 
> The Quectel docs also said to patch the kernel a certain way to allow use of 
> serial and the QMI_WWAN driver, but wwan0 is still ignored.
> 
> Does anyone have any suggestions?
> 
> Thanks!
> 
> --
> Bruce Johnson
> Chantilly, Virginia
> USA

I will stand corrected in case - but...
I don't think you need AT commands via d-bus to do this, but giving the APN via 
QMI somehow, depending on the object or method you use to connect.
That said, you probably won't need qmi_wwan_q or whatever - the stock qmi_wwan 
driver from kernel, and "option" for serial should suffice.

For some reason you have wwan0 (gnored) in your output which doesn't sound 
right. I would try to look at it/fix it first.

Enrico



> 
> 
>   
>   General  | path: /org/freedesktop/ModemManager1/Modem/0
>|device id: 
>   
>   Hardware | manufacturer: Quectel
>|model: EC25
>|firmware revision: EC25AFFAR07A14M4G
>|supported: gsm-umts, lte
>|  current: gsm-umts, lte
>| equipment id: 359401089771197
>   
>   System   |   device: 
> /sys/devices/pci:00/:00:15.0/usb1/1-4
>|  drivers: option, qmi_wwan
>|   plugin: quectel
>| primary port: ttyUSB3
>|ports: ttyUSB2 (gps), ttyUSB3 (at), ttyUSB4 (at), 
> wwan0 (ignored)
>   
>   Status   |   unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (3), 
> sim-puk2 (10)
>|state: connected
>|  power state: on
>|  access tech: lte
>|   signal quality: 60% (recent)
>   
>   Modes|supported: allowed: 2g, 3g, 4g; preferred: none
>|  current: allowed: 2g, 3g, 4g; preferred: none
>   
>   IP   |supported: ipv4, ipv6, ipv4v6
>   
>   3GPP | imei: 3594010
>|  operator id: 310410
>|operator name: AT&T
>| registration: home
>   
>   3GPP EPS | ue mode of operation: csps-2
>   
>   SIM  | primary sim path: /org/freedesktop/ModemManager1/SIM/0
>   
>   Bearer   |paths: /org/freedesktop/ModemManager1/Bearer/0
> 
> 


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:
<<   length

Quectel EC25 & AT&T connection Catch-22

2024-04-22 Thread Bruce Johnson
I have a question about using both QMI and the serial interface with 
ModemManager.

I had little difficulty getting ModemManager's SimpleModem to connect to 
T-Mobile (USA) using a Quectel EG25-G, but we found that modem wasn't 
compatible with AT&T and/or a private APN used by one of our customers. We were 
advised to use the Quectel EC25, and after engaging both Quectel and AT&T, we 
were told that we need to insert the APN into the modem using an AT command, 
AT+CGDCONT=1,"IPV4V6","mcm.com.attz". I had to tweak the kernel config and the 
ModemManager build.

Mods:

  *   I built ModemManager 1.18.4 with --with-at-command-via-dbus.
  *   In the kernel config, I added USB Serial Converter support -> USB driver 
for GSM and CDMA modems.

After I did this, the /dev/ttyUSB[1-4] files showed up, and I was able to issue 
AT commands using ModemManager, but while the modem would sort-of connect with 
SimpleModem's connect method -- I am getting a Bearer, and mmcli shows 
"connected" -- I receive no IP address information from the carrier. Port wwan0 
is showing up as "ignored". (mmcli output below)

The Quectel docs also said to patch the kernel a certain way to allow use of 
serial and the QMI_WWAN driver, but wwan0 is still ignored.

Does anyone have any suggestions?

Thanks!

--
Bruce Johnson
Chantilly, Virginia
USA


  
  General  | path: /org/freedesktop/ModemManager1/Modem/0
   |device id: 
  
  Hardware | manufacturer: Quectel
   |model: EC25
   |firmware revision: EC25AFFAR07A14M4G
   |supported: gsm-umts, lte
   |  current: gsm-umts, lte
   | equipment id: 359401089771197
  
  System   |   device: /sys/devices/pci:00/:00:15.0/usb1/1-4
   |  drivers: option, qmi_wwan
   |   plugin: quectel
   | primary port: ttyUSB3
   |ports: ttyUSB2 (gps), ttyUSB3 (at), ttyUSB4 (at), 
wwan0 (ignored)
  
  Status   |   unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (3), 
sim-puk2 (10)
   |state: connected
   |  power state: on
   |  access tech: lte
   |   signal quality: 60% (recent)
  
  Modes|supported: allowed: 2g, 3g, 4g; preferred: none
   |  current: allowed: 2g, 3g, 4g; preferred: none
  
  IP   |supported: ipv4, ipv6, ipv4v6
  
  3GPP | imei: 3594010
   |  operator id: 310410
   |operator name: AT&T
   | registration: home
  
  3GPP EPS | ue mode of operation: csps-2
  
  SIM  | primary sim path: /org/freedesktop/ModemManager1/SIM/0
  
  Bearer   |paths: /org/freedesktop/ModemManager1/Bearer/0