RE: Ublox TOBY-L210 needs two retries to connect

2017-05-11 Thread Penalva, Salvador
Hi,

Thank you for opening the bug and tracking it. Right now, I have not enough 
time to do the changes and test it. I'm sorry. It's gonna take much of my time 
to understand how to do the changes and apply them correctly.  And we don't 
need it to work right now if without SIM of with a retry is still working.

Probably you have too many other important things to do before solving this, 
but if you find time to solve the bug sometime I will be glad to help you to 
test it if you need it.

Thank you,

Salvador. 

-Original Message-
From: Aleksander Morgado [mailto:aleksan...@aleksander.es] 
Sent: martes, 09 de mayo de 2017 23:16
To: Penalva, Salvador
Cc: ModemManager (development)
Subject: Re: Ublox TOBY-L210 needs two retries to connect

Hey Salvador,

>
> I did these changes but it didn't work. I added a debug message to determine 
> when the wait_function was being called. The first attempt of connection that 
> fails, never calls that function, so I think that the timeout is not being 
> applied.  However the second attempt, the one that connects is calling the 
> function.
>
> Here you go the changes I applied, in case I did something wrong.
>

Yes, I realize now that just subclassing that step isn't enough, as that step 
is a wait time *after* the modem has reported us it's unlocked. In our case, we 
need to wait time before even checking if the modem is unlocked. What we  
probably need is to subclass is the
send_pin() method in the MMBaseSim object. This means we need to create a new 
MMSimTelit object with MMBaseSim as parent object, and then subclass the 
send_pin() method only to add a
g_timeout_add_seconds(5,...) call.

Would you be up to doing this? An example of plugin subclasing the
send_pin() in the MMBaseSim object is the "mbm" plugin, where we have a 
MMSimMbm that subclasses send_pin() and send_puk(). Both those should be 
subclassed in our case as well.

I opened a bug in bugzilla to track it:
https://bugs.freedesktop.org/show_bug.cgi?id=100980

Cheers!

--
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


RE: Ublox TOBY-L210 needs two retries to connect

2017-05-05 Thread Penalva, Salvador
Hey,

I don't mind testing these changes, but I may need a little further guidance to 
do the changes. The files mm-broadband-modem-pantech.c and 
mm-broadband-modem-ublox.c are quite different...

I have copied in the ublox file the whole block of after_sim_unlock (the three 
fucntions). However the pantech file call these functions inside the function " 
iface_modem_init " that is really different to the same function in the ublox 
program. 

Is it enough just coping the lines 

iface->modem_after_sim_unlock = modem_after_sim_unlock;
iface->modem_after_sim_unlock_finish = modem_after_sim_unlock_finish;

at the end of the modem_init function in the ublox plugin? 

Thank you,

Salvador.
 
-Original Message-
From: Aleksander Morgado [mailto:aleksan...@aleksander.es] 
Sent: viernes, 05 de mayo de 2017 11:46
To: Penalva, Salvador
Cc: ModemManager (development)
Subject: Re: Ublox TOBY-L210 needs two retries to connect

Hey,

On Fri, May 5, 2017 at 11:18 AM, Penalva, Salvador <salvador.pena...@digi.com> 
wrote:
> I'm testing Ublox TOBY-L210 with MM-master branch and a SIM with PIN Lock. I 
> can connect it but only after issuing the simple-connect command twice. The 
> first time I receive an message saying that the SIM is locked.
> With an unlocked SIM the connection is establish at the first attempt.
>
> These is the simple connect procedure:
>
> root@ccimx6ulsbc:~# mmcli -m 0 
> --simple-connect="apn=ac.vodafone.es,pin=8770,number=*99#"
> ModemManager[917]:   Simple connect started...
> ModemManager[917]:   Simple connect state (1/8): Unlock check
> error: couldn't connect the modem: 
> 'GDBus.Error:org.freedesktop.ModemManager1.Error.MobileEquipment.SimPin: 
> Device is locked: 'sim-pin''

We're sending the PIN correctly, but the modem is still replying that SIM-PIN 
is needed if we query it right away after sending the PIN:

 [1493975621.397922] [../../git/src/mm-port-serial-at.c:459]
debug_log(): (ttyACM0): --> 'AT+CPIN="8770"'
 [1493975621.484268] [../../git/src/mm-port-serial-at.c:459]
debug_log(): (ttyACM0): <-- 'OK'
 [1493975621.485273] [../../git/src/mm-broadband-modem.c:1339]
modem_load_unlock_required(): checking if unlock required...
 [1493975621.485618] [../../git/src/mm-port-serial.c:1250]
mm_port_serial_open(): (ttyACM0) device open count is 2 (open)  
[1493975621.486500] [../../git/src/mm-port-serial.c:1307]
_close_internal(): (ttyACM0) device open count is 1 (close)  
[1493975621.486979] [../../git/src/mm-port-serial-at.c:459]
debug_log(): (ttyACM0): --> 'AT+CPIN?'
 [1493975621.513303] [../../git/src/mm-port-serial-at.c:459]
debug_log(): (ttyACM0): <-- '+CPIN: SIM PIN'
 [1493975621.515441] [../../git/src/mm-port-serial-at.c:459]
debug_log(): (ttyACM0): <-- 'OK'
 [1493975621.517437] [../../git/src/mm-port-serial.c:1307]
_close_internal(): (ttyACM0) device open count is 0 (close)  
[1493975621.517703] [../../git/src/mm-port-serial.c:1323]
_close_internal(): (ttyACM0) closing serial port...
 [1493975621.523061] [../../git/src/mm-port-serial.c:1371]
_close_internal(): (ttyACM0) serial port closed

This means we would need to introduce an arbitrary timeout after sending 
SIM-PIN before we re-check whether it is required or not.

Could you add a custom "after_sim_unlock" step to the u-blox plugin which just 
does a timeout of some seconds? You can basically copy & paste the 
"after_sim_unlock" step from e.g. the Pantech plugin 
(mm-broadband-modem-pantech.c), which has a 5s timeout.

--
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


RE: QMI modems with MM-master branch error

2017-05-05 Thread Penalva, Salvador
I thought that too,

 but this modem still worked with the commit before the last changes I 
mentioned in the email before. Why is the connection attempt cancelled then an 
in the second retry working again?

Thanks,

Salvador

-Original Message-
From: Aleksander Morgado [mailto:aleksan...@aleksander.es] 
Sent: viernes, 05 de mayo de 2017 14:52
To: Penalva, Salvador
Cc: ModemManager (development); Ben Chan
Subject: Re: QMI modems with MM-master branch error

On Fri, May 5, 2017 at 1:36 PM, Penalva, Salvador <salvador.pena...@digi.com> 
wrote:
> ModemManager[918]:   Modem 
> /org/freedesktop/ModemManager1/Modem/0: state changed (searching -> 
> registered)
> ModemManager[918]:   Simple connect state (6/8): Bearer
> ModemManager[918]:   Simple connect state (7/8): Connect
> ModemManager[918]:   Modem 
> /org/freedesktop/ModemManager1/Modem/0: state changed (registered -> 
> connecting)
> ModemManager[918]: [/dev/cdc-wdm0] Allocating new client ID...
> ModemManager[918]: [/dev/cdc-wdm0] Registered 'wds' (version 1.36) client 
> with ID '11'
> ModemManager[918]:   Modem 
> /org/freedesktop/ModemManager1/Modem/0: 3GPP Registration state 
> changed (home -> idle)
> ModemManager[918]:   Modem 
> /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> 
> disconnecting)
> ModemManager[918]:   Error disconnecting bearer 
> '/org/freedesktop/ModemManager1/Bearer/0': 'Couldn't disconnect QMI bearer: 
> this bearer is not connected'. Will assume disconnected anyway.
> error: couldn't connect the modem: 
> 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Cancelled: Connection 
> setup operation has been cancelled'
> ModemManager[918]:   Modem 
> /org/freedesktop/ModemManager1/Modem/0: state changed (disconnecting 
> -> enabled)

This issue seems unrelated to the original bug; it looks like the modem 
registration is going away (home->idle) just in the middle of a connection 
attempt, so the connection attempt is cancelled.


--
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


RE: QMI modems with MM-master branch error

2017-05-05 Thread Penalva, Salvador
Hi again,

Quectel EC25 works perfectly now, but TelitLE910 is still failing the first 
attempt of connection.  The second attempt succeeded. Maybe is needed a timeout 
or something?

I send you the logs:

root@ccimx6ulsbc:~# mmcli -m 0 --simple-connect="apn=ac.vodafone.es,pin=8770"
ModemManager[918]:   Simple connect started...
ModemManager[918]:   Simple connect state (1/8): Unlock check
ModemManager[918]:   Simple connect state (2/8): Wait to get fully 
initialized
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (locked -> initializing)
ModemManager[918]:   couldn't load Operator identifier: 'Couldn't get 
home network: QMI protocol error (16): 'NotProvisioned''
ModemManager[918]:   couldn't load Operator name: 'Couldn't get home 
network: QMI protocol error (16): 'NotProvisioned''
ModemManager[918]:   couldn't load list of Own Numbers: 'Couldn't get 
MSISDN: QMI protocol error (16): 'NotProvisioned''
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (initializing -> disabled)
ModemManager[918]:   Simple connect state (3/8): Enable
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (disabled -> enabling)
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (enabling -> enabled)
ModemManager[918]:   Simple connect state (4/8): Wait to get fully enabled
ModemManager[918]:   Simple connect state (5/8): Register
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP 
Registration state changed (unknown -> searching)
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (enabled -> searching)
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP 
Registration state changed (searching -> idle)
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP 
Registration state changed (idle -> registering)
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP 
Registration state changed (registering -> home)
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (searching -> registered)
ModemManager[918]:   Simple connect state (6/8): Bearer
ModemManager[918]:   Simple connect state (7/8): Connect
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (registered -> connecting)
ModemManager[918]: [/dev/cdc-wdm0] Allocating new client ID...
ModemManager[918]: [/dev/cdc-wdm0] Registered 'wds' (version 1.36) client with 
ID '11'
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP 
Registration state changed (home -> idle)
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (connecting -> disconnecting)
ModemManager[918]:   Error disconnecting bearer 
'/org/freedesktop/ModemManager1/Bearer/0': 'Couldn't disconnect QMI bearer: 
this bearer is not connected'. Will assume disconnected anyway.
error: couldn't connect the modem: 
'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Cancelled: Connection 
setup operation has been cancelled'
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (disconnecting -> enabled)
root@ccimx6ulsbc:~# ModemManager[918]: [/dev/cdc-wdm0] No transaction matched 
in received message

root@ccimx6ulsbc:~# mmcli -m 0 
--simple-connect="apn=ac.vodafone.es,pin=8770"ModemManager[918]:   Modem 
/org/freedesktop/ModemManager1/Modem/0: 3GPP Registration state changed (idle 
-> registering)
ModemManager[918]:   Couldn't load Operator Name: 'Current operator 
description is still unknown'
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP 
Registration state changed (registering -> home)
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (enabled -> registered)

ModemManager[918]:   Simple connect started...
ModemManager[918]:   Simple connect state (4/8): Wait to get fully enabled
ModemManager[918]:   Simple connect state (5/8): Register
ModemManager[918]:   Simple connect state (6/8): Bearer
ModemManager[918]:   Simple connect state (7/8): Connect
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (registered -> connecting)
ModemManager[918]:   QMI IPv4 Settings:
ModemManager[918]:   Address: 77.210.242.158/30
ModemManager[918]:   Gateway: 77.210.242.157
ModemManager[918]:   DNS #1: 212.166.210.6
ModemManager[918]:   DNS #2: 212.73.32.67
ModemManager[918]:  MTU: 1430
ModemManager[918]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (connecting -> connected)
ModemManager[918]:   Simple connect state (8/8): All done
successfully connected the modem

Tell me if you need debug logs.

Thanks,

Salvador


-Original Message-
From: Aleksander Morgado [mailto:aleksan...@aleksander.es] 
Sent: viernes, 05 de mayo de 2017 11:40
To: Penalva, Salvador
Cc: Modem

Ublox TOBY-L210 needs two retries to connect

2017-05-05 Thread Penalva, Salvador
Hi,

I'm testing Ublox TOBY-L210 with MM-master branch and a SIM with PIN Lock. I 
can connect it but only after issuing the simple-connect command twice. The 
first time I receive an message saying that the SIM is locked.
With an unlocked SIM the connection is establish at the first attempt.

These is the simple connect procedure:

root@ccimx6ulsbc:~# mmcli -m 0 
--simple-connect="apn=ac.vodafone.es,pin=8770,number=*99#"
ModemManager[917]:   Simple connect started...
ModemManager[917]:   Simple connect state (1/8): Unlock check
error: couldn't connect the modem: 
'GDBus.Error:org.freedesktop.ModemManager1.Error.MobileEquipment.SimPin: Device 
is locked: 'sim-pin''


root@ccimx6ulsbc:~# mmcli -m 0 
--simple-connect="apn=ac.vodafone.es,pin=8770,number=*99#"
ModemManager[917]:   Simple connect started...
ModemManager[917]:   Simple connect state (1/8): Unlock check
ModemManager[917]:   Simple connect state (2/8): Wait to get fully 
initialized
ModemManager[917]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (locked -> initializing)
ModemManager[917]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (initializing -> disabled)
ModemManager[917]:   Simple connect state (3/8): Enable
ModemManager[917]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (disabled -> enabling)
ModemManager[917]:   Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP 
Registration state changed (unknown -> registering)
ModemManager[917]:   Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP 
Registration state changed (registering -> home)
ModemManager[917]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (enabling -> registered)
ModemManager[917]:   Simple connect state (4/8): Wait to get fully enabled
ModemManager[917]:   Simple connect state (5/8): Register
ModemManager[917]:   Simple connect state (6/8): Bearer
ModemManager[917]:   Simple connect state (7/8): Connect
ModemManager[917]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (registered -> connecting)
ModemManager[917]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (connecting -> connected)
ModemManager[917]:   Simple connect state (8/8): All done
successfully connected the modem

Thank you,

Salvador


Here you go the debug log:

  [1493975621.330048] [../../git/src/mm-iface-modem-simple.c:650] 
connect_auth_ready(): Simple connect started...
 [1493975621.330202] [../../git/src/mm-iface-modem-simple.c:660] 
connect_auth_ready():PIN: 8770
 [1493975621.330269] [../../git/src/mm-iface-modem-simple.c:662] 
connect_auth_ready():Operator ID: unspecified
 [1493975621.330327] [../../git/src/mm-iface-modem-simple.c:664] 
connect_auth_ready():Allowed roaming: yes
 [1493975621.330388] [../../git/src/mm-iface-modem-simple.c:666] 
connect_auth_ready():APN: ac.vodafone.es
 [1493975621.330444] [../../git/src/mm-iface-modem-simple.c:674] 
connect_auth_ready():IP family: unspecified
 [1493975621.330501] [../../git/src/mm-iface-modem-simple.c:682] 
connect_auth_ready():Allowed authentication: unspecified
 [1493975621.330556] [../../git/src/mm-iface-modem-simple.c:684] 
connect_auth_ready():User: unspecified
 [1493975621.330607] [../../git/src/mm-iface-modem-simple.c:686] 
connect_auth_ready():Password: unspecified
 [1493975621.330659] [../../git/src/mm-iface-modem-simple.c:688] 
connect_auth_ready():Number: *99#
  [1493975621.330701] [../../git/src/mm-iface-modem-simple.c:452] 
connection_step(): Simple connect state (1/8): Unlock check
 [1493975621.330838] [../../git/src/mm-broadband-modem.c:1339] 
modem_load_unlock_required(): checking if unlock required...
 [1493975621.330995] [../../git/src/mm-port-serial.c:1120] 
mm_port_serial_open(): (ttyACM0) opening serial port...
 [1493975621.332233] [../../git/src/mm-port-serial.c:421] 
real_config_fd(): (ttyACM0): setting up baudrate: 57600
 [1493975621.332607] [../../git/src/mm-port-serial.c:1250] 
mm_port_serial_open(): (ttyACM0) device open count is 1 (open)
 [1493975621.333028] [../../git/src/mm-port-serial-at.c:459] 
debug_log(): (ttyACM0): --> 'AT+CPIN?'
 [1493975621.358806] [../../git/src/mm-port-serial-at.c:459] 
debug_log(): (ttyACM0): <-- '+CPIN: SIM PIN'
 [1493975621.359550] [../../git/src/mm-port-serial-at.c:459] 
debug_log(): (ttyACM0): <-- 'OK'
 [1493975621.360058] [../../git/src/mm-port-serial.c:1307] 
_close_internal(): (ttyACM0) device open count is 0 (close)
 [1493975621.360170] [../../git/src/mm-port-serial.c:1323] 
_close_internal(): (ttyACM0) closing serial port...
 [1493975621.363881] [../../git/src/mm-port-serial.c:1371] 
_close_internal(): (ttyACM0) serial port closed
 [1493975621.364348] [../../git/src/mm-port-serial.c:1120] 
mm_port_serial_open(): (ttyACM0) opening serial port...
 [1493975621.365320] [../../git/src/mm-port-serial.c:421] 
real_config_fd(): (ttyACM0): setting up baudrate: 57600
 [1493975621.365672] [../../git/src/mm-port-serial.c:1250] 

QMI modems with MM-master branch error

2017-05-05 Thread Penalva, Salvador
Hi,

Hi have been trying to connect two different QMI modems: Telit LE910 and 
Quectel EC25 with ModemManager master branch and I get the following error 
messages:

ModemManager[937]:   Simple connect state (7/8): Connect
ModemManager[937]:   Modem /org/freedesktop/ModemManager1/Modem/0: state 
changed (registered -> connecting)
ModemManager[937]: [/dev/cdc-wdm0] Allocating new client ID...
ModemManager[937]: [/dev/cdc-wdm0] Registered 'wds' (version 1.67) client with 
ID '19'
ModemManager[937]: qmi_client_get_next_transaction_id: assertion 'QMI_IS_CLIENT 
(self)' failed
ModemManager[937]: qmi_client_get_cid: assertion 'QMI_IS_CLIENT (self)' failed
ModemManager[937]: qmi_client_peek_device: assertion 'QMI_IS_CLIENT (self)' 
failed
ModemManager[937]: qmi_device_command_full: assertion 'QMI_IS_DEVICE (self)' 
failed
error: couldn't connect the modem: 'Timeout was reached'

The thing is that with MM-1.6.4 stable release, both Modems work perfectly. 
Furthermore, I have bisect modem manager commits to try to determine where the 
problem can be, and I found that:

--Before commit  “telit: fix AT+SERVICE 3GPP2 access technology reporting”  
with SHA1 8c04cc036782dab0e80c1f2314baa3376eecad02  → it works

--with commit “port-mbim: port mm_port_mbim_{open,close} to use GTask” with 
SHA1 b65819e6ad66688c8d6633f910e1519a35d3571d → it doesn’t work anymore.

So probably the problem is in some of the commits between these two. 

Before connection, I also receive the following warnings. I don’t know if they 
are related

ModemManager[937]:   Modem: state changed (unknown -> locked)
ModemManager[937]:   couldn't load SIM identifier: 'Couldn't get UIM 
ICCID: QMI protocol error (94): 'NotSupported''
ModemManager[937]:   couldn't load IMSI: 'Couldn't get UIM IMSI: QMI 
protocol error (94): 'NotSupported''
ModemManager[937]:   couldn't load Operator identifier: 'Couldn't get 
home network: QMI protocol error (37): 'UimUninitialized''
ModemManager[937]:   couldn't load Operator name: 'Couldn't get home 
network: QMI protocol error (37): 'UimUninitialized''
ModemManager[937]:   couldn't load list of Own Numbers: 'Couldn't get 
MSISDN: QMI protocol error (37): 'UimUninitialized''


Thank you,

Salvador
---

Debug log of interesting parts:

 [1493912307.426718] [../../git/src/mm-sim-qmi.c:144] 
load_sim_identifier(): loading SIM identifier...
[/dev/cdc-wdm0] sent message...
<< RAW:
<<   length = 13
<<   data   = 01:0C:00:00:02:01:00:0A:00:3C:00:00:00
[/dev/cdc-wdm0] sent generic request (translated)...
<< QMUX:
<<   length  = 12
<<   flags   = 0x00
<<   service = "dms"
<<   client  = 1
<< QMI:
<<   flags   = "none"
<<   transaction = 10
<<   tlv_length  = 0
<<   message = "UIM Get ICCID" (0x003C)
[/dev/cdc-wdm0] received message...
<< RAW:
<<   length = 20
<<   data   = 01:13:00:80:02:01:02:0A:00:3C:00:07:00:02:04:00:01:00:5E:00
[/dev/cdc-wdm0] received generic response (translated)...
<< QMUX:
<<   length  = 19
<<   flags   = 0x80
<<   service = "dms"
<<   client  = 1
<< QMI:
<<   flags   = "response"
<<   transaction = 10
<<   tlv_length  = 7
<<   message = "UIM Get ICCID" (0x003C)
<< TLV:
<<   type   = "Result" (0x02)
<<   length = 4
<<   value  = 01:00:5E:00
<<   translated = FAILURE: NotSupported
 [1493912307.448140] [../../git/src/mm-sim-qmi.c:144] 
load_sim_identifier(): loading SIM identifier...
[/dev/cdc-wdm0] sent message...
<< RAW:
<<   length = 13
<<   data   = 01:0C:00:00:02:01:00:0B:00:3C:00:00:00
[/dev/cdc-wdm0] sent generic request (translated)...
<< QMUX:
<<   length  = 12
<<   flags   = 0x00
<<   service = "dms"
<<   client  = 1
<< QMI:
<<   flags   = "none"
<<   transaction = 11
<<   tlv_length  = 0
<<   message = "UIM Get ICCID" (0x003C)
[/dev/cdc-wdm0] received message...
<< RAW:
<<   length = 20
<<   data   = 01:13:00:80:02:01:02:0B:00:3C:00:07:00:02:04:00:01:00:5E:00
[/dev/cdc-wdm0] received generic response (translated)...
<< QMUX:
<<   length  = 19
<<   flags   = 0x80
<<   service = "dms"
<<   client  = 1
<< QMI:
<<   flags   = "response"
<<   transaction = 11
<<   tlv_length  = 7
<<   message = "UIM Get ICCID" (0x003C)
<< TLV:
<<   type   = "Result" (0x02)
<<   length = 4
<<   value  = 01:00:5E:00
<<   translated = FAILURE: NotSupported
  [1493912307.478785] [../../git/src/mm-base-sim.c:1387] 
load_sim_identifier_ready(): couldn't load SIM identifier: 'Couldn't get UIM 
ICCID: QMI protocol error (94): 'NotSupported''
 [1493912307.479175] [../../git/src/mm-sim-qmi.c:206] load_imsi(): 
loading IMSI...
[/dev/cdc-wdm0] sent message...
<< RAW:
<<   length = 13
<<   data   = 01:0C:00:00:02:01:00:0C:00:43:00:00:00
[/dev/cdc-wdm0] sent generic request (translated)...
<< QMUX:
<<   

RE: [PATCH] telit: lock/unlock CSIM operations by default

2017-03-17 Thread Penalva, Salvador
Thank you all,

You have all been really helpful and quick and the patch seems to do its job 
perfectly!

Salvador

-Original Message-
From: Aleksander Morgado [mailto:aleksan...@aleksander.es] 
Sent: jueves, 16 de marzo de 2017 22:35
To: Carlo Lobrano; Penalva, Salvador; Daniele Palmas
Cc: ModemManager (development); Aleksander Morgado
Subject: Re: [PATCH] telit: lock/unlock CSIM operations by default

On Wed, Mar 15, 2017 at 12:19 AM, Aleksander Morgado <aleksan...@aleksander.es> 
wrote:
> Wrap the AT+CSIM=XX commands between lock (CSIM=1) and unlock (CSIM=0) 
> operations.
>
> This seems to avoid the TTY lockup seen in several different Telit 
> modules.
>
> https://bugs.freedesktop.org/show_bug.cgi?id=100205
>
> Reported-by: Penalva, Salvador <salvador.pena...@digi.com>
> ---
>
> Hey Salvador, Carlo and Daniele,
>
> Can you guys review and test this patch? It looks like it solved the issue I 
> saw myself.
>
> The AT command reference for the Telit LE866 does say that the AT+CSIM 
> commands need to be enclosed within lock/unlock operations like these.
>

Pushed to git master and mm-1-6.

> ---
>  plugins/telit/mm-broadband-modem-telit.c | 60 
> 
>  1 file changed, 60 insertions(+)
>
> diff --git a/plugins/telit/mm-broadband-modem-telit.c 
> b/plugins/telit/mm-broadband-modem-telit.c
> index b1679ae4..8bc9d1e5 100644
> --- a/plugins/telit/mm-broadband-modem-telit.c
> +++ b/plugins/telit/mm-broadband-modem-telit.c
> @@ -452,6 +452,8 @@ modem_load_supported_bands (MMIfaceModem *self,  
> /*
> /
>  /* Load unlock retries (Modem interface) */
>
> +#define CSIM_LOCK_STR   "+CSIM=1"
> +#define CSIM_UNLOCK_STR "+CSIM=0"
>  #define CSIM_QUERY_PIN_RETRIES_STR  "+CSIM=10,002100"
>  #define CSIM_QUERY_PUK_RETRIES_STR  "+CSIM=10,002C000100"
>  #define CSIM_QUERY_PIN2_RETRIES_STR "+CSIM=10,0020008100"
> @@ -460,10 +462,12 @@ modem_load_supported_bands (MMIfaceModem *self,
>
>  typedef enum {
>  LOAD_UNLOCK_RETRIES_STEP_FIRST,
> +LOAD_UNLOCK_RETRIES_STEP_LOCK,
>  LOAD_UNLOCK_RETRIES_STEP_PIN,
>  LOAD_UNLOCK_RETRIES_STEP_PUK,
>  LOAD_UNLOCK_RETRIES_STEP_PIN2,
>  LOAD_UNLOCK_RETRIES_STEP_PUK2,
> +LOAD_UNLOCK_RETRIES_STEP_UNLOCK,
>  LOAD_UNLOCK_RETRIES_STEP_LAST
>  } LoadUnlockRetriesStep;
>
> @@ -500,6 +504,25 @@ modem_load_unlock_retries_finish (MMIfaceModem 
> *self,  }
>
>  static void
> +csim_unlock_ready (MMBaseModem  *self,
> +   GAsyncResult *res,
> +   LoadUnlockRetriesContext *ctx) {
> +const gchar *response;
> +GError  *error = NULL;
> +
> +/* Ignore errors */
> +response = mm_base_modem_at_command_finish (self, res, );
> +if (!response) {
> +mm_warn ("Couldn't unlock SIM card: %s", error->message);
> +g_error_free (error);
> +}
> +
> +ctx->step++;
> +load_unlock_retries_step (ctx);
> +}
> +
> +static void
>  csim_query_ready (MMBaseModem *self,
>GAsyncResult *res,
>LoadUnlockRetriesContext *ctx) @@ -542,6 +565,7 @@ 
> csim_query_ready (MMBaseModem *self,
>  mm_unlock_retries_set (ctx->retries, MM_MODEM_LOCK_SIM_PUK2, 
> unlock_retries);
>  break;
>  default:
> +g_assert_not_reached ();
>  break;
>  }
>
> @@ -551,12 +575,40 @@ next_step:
>  }
>
>  static void
> +csim_lock_ready (MMBaseModem  *self,
> + GAsyncResult *res,
> + LoadUnlockRetriesContext *ctx) {
> +const gchar *response;
> +GError  *error = NULL;
> +
> +response = mm_base_modem_at_command_finish (self, res, );
> +if (!response) {
> +g_prefix_error (, "Couldn't lock SIM card: ");
> +g_simple_async_result_take_error (ctx->result, error);
> +load_unlock_retries_context_complete_and_free (ctx);
> +return;
> +}
> +
> +ctx->step++;
> +load_unlock_retries_step (ctx);
> +}
> +
> +static void
>  load_unlock_retries_step (LoadUnlockRetriesContext *ctx)  {
>  switch (ctx->step) {
>  case LOAD_UNLOCK_RETRIES_STEP_FIRST:
>  /* Fall back on next step */
>  ctx->step++;
> +case LOAD_UNLOCK_RETRIES_STEP_LOCK:
> +mm_base_modem_at_command (MM_BASE_MODEM (ctx->self),
> +  CSIM_LOCK_STR,
> +  

RE: [PATCH] telit: lock/unlock CSIM operations by default

2017-03-15 Thread Penalva, Salvador
Hi all, 

I tried Aleksander Patch with an older version of telit HE910 FW and it works 
perfect. 

I just have one question, Is this CSIM command supported in all telit Modems? 
It wouldn't be good if by implementing this change on telit-plugin to fix this 
issue on telit HE910 and the other modems that can use this command, other 
modems  stop working.

Thank you,

Salvador

-Original Message-
From: Aleksander Morgado [mailto:aleksan...@aleksander.es] 
Sent: miércoles, 15 de marzo de 2017 10:28
To: Dan Williams
Cc: Carlo Lobrano; Penalva, Salvador; Daniele Palmas; ModemManager (development)
Subject: Re: [PATCH] telit: lock/unlock CSIM operations by default

On Wed, Mar 15, 2017 at 2:40 AM, Dan Williams <d...@redhat.com> wrote:
>>
>> Can you guys review and test this patch? It looks like it solved the 
>> issue I saw myself.
>>
>> The AT command reference for the Telit LE866 does say that the
>> AT+CSIM commands need to be enclosed within lock/unlock operations
>> like these.
>
> If the LOCK succeeds, then don't we need to UNLOCK if some 
> intermediate step fails?  It looks like we'll just leave it in locked 
> state if any step like say PIN or PIN2 calls 
> load_unlock_retries_context_complete_and_free().

But all the other intermediate steps never fail; i.e.
csim_query_ready() always goes to the next step, never completes the 
GSimpleAsyncResult. So effectively, if any intermediate AT command fails, we 
just go on to the next one, and after the last one we have the CSIM=0 to unlock.

--
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


RE: Telit HE910 not connecting with Modem Manager 1.6.4

2017-03-14 Thread Penalva, Salvador
Hi all,

We made some test applying Carlo’s patch and increasing the timeout of CSIM 
command as suggested, but when it does AT+CSIM=10,00210 after doing 
AT+CPIN=”pin” it gets stuck anyway (we even tried with a huge timeout but the 
driver timeout stops the execution before you can get any response). After this 
has happened you can even connect to the modem via microcom through the serial 
port but it doesn’t answer to any AT command.

In order to debug the problem, we removed from "mm-broadband-modem-telit.c" 
file the functions that used CSIM command ("MMUnlockRetrie and 
modem_load_unlock_retries"). These are the ones that ask the SIM how many 
retries of PIN and PUK it has. After disabling this functionality from the 
plugin, we were able to connect with a modem with an old FW without problem. 

I think it's quite clear that the problem is in that command and we also think 
that with a firmware update of the modem this doesn’t seem to happen anymore. 
We got this morning an update from telit and I will try it right now.  Anyway, 
it would be good a patch to this problems so that older versions of the FW of 
telit that used to work until now, could still work. Checking for which modems 
+CPINR works and use +CSIM on the rest as Aleksander suggested , could be a 
good solution. 

Thank you very much,

Salvador

-Original Message-
From: Aleksander Morgado [mailto:aleksan...@aleksander.es] 
Sent: martes, 14 de marzo de 2017 13:17
To: Carlo Lobrano
Cc: Reinhard Speyerer; Daniele Palmas; Penalva, Salvador; 
modemmanager-devel@lists.freedesktop.org
Subject: Re: Telit HE910 not connecting with Modem Manager 1.6.4

On Tue, Mar 14, 2017 at 10:30 AM, Carlo Lobrano <c.lobr...@gmail.com> wrote:
> Yes, +CPINR is not supported by all Telit modems (e.g. LE910 and LE910 
> V2), so I opted for the command with wider support. Changing the 
> timeout can be a solution and I'll made some tests.

We could always run +CPINR=? to look for support before using it, and otherwise 
fallback to +CSIM commands? If it's better to use +CPINR for any reason, why 
not do that?

--
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


RE: Telit HE910 not connecting with Modem Manager 1.6.4

2017-03-10 Thread Penalva, Salvador
Hi Aleksander,

Sorry for the delay but I was trying to debug a little more the logs to isolate 
the problem.

Answering to your question: We use SimpleConnect command inside a script but we 
don't use network Manager.

Finally, we got to the conclusion, that the problem could start when trying to 
unlock the SIM. We tested just unlocking the SIM card with the pin in both 
versions of ModemManager (1.4.12 and 1.6.4) and we think that the error could 
be in this step that seem to have changed between both versions of 
ModemManager. This part is just after sending the PIN to the SIM with CPIN in 
MM 1.6.4:

ModemManager[814]:  [1489145392.858937] 
[../../ModemManager-1.6.4/src/mm-port-serial.c:1288] mm_port_serial_open(): 
(ttyACM0) device open count is 1 (open)
ModemManager[814]:  [1489145392.859398] 
[../../ModemManager-1.6.4/src/mm-port-serial-at.c:459] debug_log(): (ttyACM0): 
--> 'AT+CSIM=10,002100'
ModemManager[814]:   [1489145396.334171] 
[../../ModemManager-1.6.4/plugins/telit/mm-broadband-modem-telit.c:342] 
csim_query_ready(): No respose for step 1: Serial command timed out
ModemManager[814]:  [1489145396.334617] 
[../../ModemManager-1.6.4/src/mm-port-serial.c:1288] mm_port_serial_open(): 
(ttyACM0) device open count is 2 (open)
ModemManager[814]:  [1489145396.334962] 
[../../ModemManager-1.6.4/src/mm-port-serial.c:1345] _close_internal(): 
(ttyACM0) device open count is 1 (close)
ModemManager[814]:  [1489145396.335307] 
[../../ModemManager-1.6.4/src/mm-port-serial-at.c:459] debug_log(): (ttyACM0): 
--> 'AT+CSIM=10,002C000100'
ModemManager[814]:   [1489145399.334315] 
[../../ModemManager-1.6.4/plugins/telit/mm-broadband-modem-telit.c:342] 
csim_query_ready(): No respose for step 2: Serial command timed out
ModemManager[814]:  [1489145399.334760] 
[../../ModemManager-1.6.4/src/mm-port-serial.c:1288] mm_port_serial_open(): 
(ttyACM0) device open count is 2 (open)
ModemManager[814]:  [1489145399.335107] 
[../../ModemManager-1.6.4/src/mm-port-serial.c:1345] _close_internal(): 
(ttyACM0) device open count is 1 (close)
ModemManager[814]:  [1489145399.335456] 
[../../ModemManager-1.6.4/src/mm-port-serial-at.c:459] debug_log(): (ttyACM0): 
--> 'AT+CSIM=10,0020008100'
ModemManager[814]:   [1489145402.811803] 
[../../ModemManager-1.6.4/plugins/telit/mm-broadband-modem-telit.c:342] 
csim_query_ready(): No respose for step 3: Sending command failed: 'Resource 
tempora'
ModemManager[814]:  [1489145402.812322] 
[../../ModemManager-1.6.4/src/mm-port-serial.c:1288] mm_port_serial_open(): 
(ttyACM0) device open count is 2 (open)
ModemManager[814]:  [1489145402.812684] 
[../../ModemManager-1.6.4/src/mm-port-serial.c:1345] _close_internal(): 
(ttyACM0) device open count is 1 (close)
ModemManager[814]:  [1489145402.813025] 
[../../ModemManager-1.6.4/src/mm-port-serial-at.c:459] debug_log(): (ttyACM0): 
--> 'AT+CSIM=10,002C008100'
ModemManager[814]:   [1489145406.273564] 
[../../ModemManager-1.6.4/plugins/telit/mm-broadband-modem-telit.c:342] 
csim_query_ready(): No respose for step 4: Sending command failed: 'Resource 
tempora'
ModemManager[814]:   [1489145406.273995] 
[../../ModemManager-1.6.4/src/mm-iface-modem.c:2960] 
load_unlock_retries_ready(): Couldn't load unlock retries: 'Could not get any 
of the SIM unlock retries'
ModemManager[814]:  [1489145406.274272] 
[../../ModemManager-1.6.4/src/mm-iface-modem.c:3110] 
update_lock_info_context_step(): SIM is ready, and no need for the after SIM 
unlock step...
ModemManager[814]:  [1489145406.274795] 
[../../ModemManager-1.6.4/src/mm-port-serial.c:1345] _close_internal(): 
(ttyACM0) device open count is 0 (close)
ModemManager[814]:  [1489145406.275051] 
[../../ModemManager-1.6.4/src/mm-port-serial.c:1361] _close_internal(): 
(ttyACM0) closing serial port...
ModemManager[814]:  [1489145411.274803] 
[../../ModemManager-1.6.4/src/mm-port-serial.c:1409] _close_internal(): 
(ttyACM0) serial port closed
ModemManager[814]:   [1489145411.277327] 
[../../ModemManager-1.6.4/src/mm-iface-modem.c:1431] 
__iface_modem_update_state_internal(): Modem 
/org/freedesktop/ModemManager1/Modem/0: state changed (loc)
ModemManager[814]:  [1489145411.282002] 
[../../ModemManager-1.6.4/src/mm-port-serial.c:1158] mm_port_serial_open(): 
(ttyACM0) opening serial port...

Looking over the documentation of HE910 
(http://www.telit.com/fileadmin/user_upload/products/Downloads/3G/Telit_3G_Modules_AT_Commands_Reference_Guide_r10.pdf
 , page 115) which explains the CSIM command, it says that you have to do first 
 AT+CSIM=1 to lock the interface and after executing the rest of commands for 
CSIM you have to do AT+CSIM=0 to unlock the device. The problem could be that 
with this Modem if you don't do the unlock after doing 
"'AT+CSIM=10,002100", the SIM could remain locked and thus  no able to 
connect later.

Next you have the logs of both tests (with ModemManager 1.4.12 and 1.6.4) with 
the same device and doing the same operation (mmcli -i 0 --pin="").

MM 1.6.4 (Not working case)