Skip to content

shared-qmi: ignore slot status indications until initial status is known

Stephan Gerhold requested to merge Stephan/ModemManager:ignore-slot-status into main

Recent ModemManager versions no longer work on the Samsung A5 (Qualcomm MSM8916) smartphone: MM ends up in an infinite loop trying to probe the modem over and over again.

Looking at the debug log it seems to be related to a "Slot Status" indication that comes in during probe time and causes MM to restart the probing process:

[/dev/wwan0qmi0] Sent generic request (translated)...
  << QMUX: service = "uim"
  << QMI: message = "Register Events" (0x002E)
  << TLV: translated = physical-slot-status
[/dev/wwan0qmi0] Received generic indication (translated)...
  << QMUX: service = "uim"
  << QMI: message = "Slot Status" (0x0048)
  << TLV: translated = { [0] = '[ physical_card_status = 'present', ...
[/dev/wwan0qmi0] Received generic response (translated)...
  << QMUX: service = "uim"
  << QMI: message = "Register Events" (0x002E)
  << TLV: translated = SUCCESS
[modem42] registered for slot status indications
[/dev/wwan0qmi0] Sent generic request (translated)...
  << QMUX: service = "uim"
  << QMI: message = "Get Slot Status" (0x0047)
[modem42] received slot status indication
[modem42] An active slot had a status change, will reprobe the modem
 <infinite loop>

The "Slot Status" indication (uim_slot_status_indication_cb) arrives immediately after starting to listen for the event, which is before ModemManager has actually loaded the initial slot status in uim_get_slot_status_ready. In this situation !slot_array_status_equal() will always cause the modem to reprobe, even though it is not necessary during the probe phase.

To fix this add a simple check to uim_slot_status_indication_cb() that ignores the indication if the initial slot status was not loaded yet.

Note that interestingly the "Get Slot Status" message that fills the initial priv->slots_status state is actually unsupported by this modem. With this fix the following log looks like:

[/dev/wwan0qmi0] Received generic response (translated)...
<< QMUX: service = "uim"
<< QMI:  message = "Get Slot Status" (0x0047)
<< TLV: translated = FAILURE: NotSupported
[modem0] slot status not supported by modem: register for refresh indications
 ...
[modem0] registered for all SIM refresh events
[modem0] SIM hot swap setup succeeded

And SIM hot swap is not actually working... But having ModemManager detect the modem at all again is already a welcome improvement. :)

I'm not entirely sure if this fix does not break something else so all feedback is welcome. :)

Merge request reports