Due to an influx of spam, we have had to impose restrictions on new accounts. Please see this wiki page for instructions on how to get full permissions. Sorry for the inconvenience.
ModemManager allows connection before modem fully enabled
CREG indicates modem is registered and valid MCC/MNC; mm-broadband-modem.c::registration_status_check_ready() calls mm-iface-modem-3gpp.c::mm_iface_modem_3gpp_update_ps_registration_state()
mm-iface-modem-3gpp.c::update_registration_state() has this code:
if (modem_state < MM_MODEM_STATE_ENABLING) { mm_dbg ("Modem %s: 3GPP Registration state change ignored as modem isn't enabled", g_dbus_object_get_object_path (G_DBUS_OBJECT (self))); return; }
which came from Ben Chan's recent commit "iface-modem-3gpp: ignore initial registration check result when appropriate", which was an attempt to handle this case, but only for state < ENABLING. Unfortunately here, our state is ENABLING so this check doesn't trigger.
Could we adjust that < ENABLING check to be < ENABLED? We already have a schedule_initial_registration_checks() call for ENABLING_STEP_LAST.
Tested with today's git version of both mm and nm with patch applied:
--- a/src/mm-iface-modem-3gpp.c
+++ b/src/mm-iface-modem-3gpp.c
@@ -1342,7 +1342,7 @@ update_registration_state (MMIfaceModem3gpp *self,
g_object_get (self,
MM_IFACE_MODEM_STATE, &modem_state,
NULL);
if (modem_state < MM_MODEM_STATE_ENABLING) {
if (modem_state < MM_MODEM_STATE_ENABLED) { mm_dbg ("Modem %s: 3GPP Registration state change ignored as modem isn't enabled", g_dbus_object_get_object_path (G_DBUS_OBJECT (self))); return;
Does not even unlock modem, but given that I do not see above mm_dbg line in the log, it is probably not related to the proposed change. Debug log provided just for completeness, I will retest with latest development snapshots.
Attachment 139588, "Complete journal with debug enabled for ModemManager and NetworkManager and patch applied": xxx
The problem in the latest logs appears to be a double-flash on enable, which could only occur if there is a race where two enable processes occur in parallel:
Apr 01 02:01:54 simear ModemManager[304]: <info> Simple connect started...
Apr 01 02:01:54 simear ModemManager[304]: <debug> PIN: 8888
Apr 01 02:01:54 simear ModemManager[304]: <debug> Operator ID: unspecified
Apr 01 02:01:54 simear ModemManager[304]: <debug> Allowed roaming: yes
Apr 01 02:01:54 simear ModemManager[304]: <debug> APN: op.mediaresearch
Apr 01 02:01:54 simear ModemManager[304]: <debug> IP family: ipv4
Apr 01 02:01:54 simear ModemManager[304]: <debug> Allowed authentication: unspecified
Apr 01 02:01:54 simear ModemManager[304]: <debug> User: unspecified
Apr 01 02:01:54 simear ModemManager[304]: <debug> Password: unspecified
Apr 01 02:01:54 simear ModemManager[304]: <debug> Number: unspecified
Apr 01 02:01:54 simear ModemManager[304]: <info> Simple connect state (3/8): Enable
Apr 01 02:01:54 simear ModemManager[304]: <info> Modem /org/freedesktop/ModemManager1/Modem/0: state changed (disabled -> enabling)
Apr 01 02:01:54 simear ModemManager[304]: <debug> (ttyUSB2) opening serial port...
Apr 01 02:01:54 simear ModemManager[304]: <debug> (ttyUSB2): setting up baudrate: 57600
Apr 01 02:01:54 simear ModemManager[304]: <debug> (ttyUSB2): port attributes not fully set
Apr 01 02:01:54 simear ModemManager[304]: <debug> (ttyUSB2) device open count is 1 (open)
Apr 01 02:01:54 simear ModemManager[304]: <debug> Flashing primary AT port before enabling...
Apr 01 02:01:54 simear ModemManager[304]: <debug> (ttyUSB2): port attributes not fully set
Apr 01 02:01:54 simear ModemManager[304]: <debug> (ttyUSB2) device open count is 2 (open)
Apr 01 02:01:54 simear ModemManager[304]: <debug> Flashing primary AT port before enabling...
Apr 01 02:01:54 simear NetworkManager[320]: <warn> [1522540914.6677] modem-broadband[ttyUSB2]: failed to connect modem: Primary port flashing failed: Modem is already being flashed.
Apr 01 02:01:54 simear ModemManager[304]: <info> Modem /org/freedesktop/ModemManager1/Modem/0: state changed (enabling -> disabled)
Apr 01 02:01:54 simear NetworkManager[320]: <debug> [1522540914.6680] modem-broadband[ttyUSB2]: unmapped error detected: 'Primary port flashing failed: Modem is already being flashed.'
As Dan said, this issue seems to be a race condition on the enabling phase. Looks like if two Enable() operations are queued one after the other, it may happen that both are run and the port flashing step fails. I was thinking in fix the actual race condition, but maybe the good fix is to allow multiple Enable() operations in parallel (i.e. just have the first one run and all the other ones scheduled a the same time wait for the result of the first one). Will try to prepare a fix in the following weeks.