Skip to content

mbim-proxy NOT_OPENED error re-open fixes

Maciej S. Szmigiero requested to merge (removed):mbim-proxy-not-opened-fix into main

This MR contains two fixes for mbim-proxy re-opening of the device after receiving a MBIM_PROTOCOL_ERROR_NOT_OPENED. It fixes re-detection of some MBIM modems after a suspend/resume cycle.


The first fix is to set open_status to OPEN_STATUS_CLOSED in mbim_device_close_force (). Otherwise mbim_device_open() -> device_open_context_step (DEVICE_OPEN_CONTEXT_STEP_FIRST) will refuse re-opening as it will think the device is already open.


The second fix (workaround) is to not unblock SIGNAL_ERROR immediately on caps_query MBIM_PROTOCOL_ERROR_NOT_OPENED. When caps_query operation returns MBIM_PROTOCOL_ERROR_NOT_OPENED the device gets re-opened by this operation completion callback. This re-open attempt also re-uses the same MbimDevice.

However, since commit fbcacbb8 we receive the relevant SIGNAL_ERROR only after the operation completion callback has already run and started the re-open attempt.

This will prevent this re-open attempt from succeeding, since the code will think that this SIGNAL_ERROR refers to the re-open attempt rather than the original caps_query operation.

The proper fix here would be to not reuse the same MbimDevice in internal_device_open_caps_query_ready () for the re-opening attempt but rather drop the current MbimDevice and create a new one.

Since this requires some careful code rework this commit at least works the issue around by deferring unblocking of the SIGNAL_ERROR handler in this case until opening of the device is complete. This way we at least have this issue mitigated for now - as it is affecting multiple users.


Closes: #43 (closed)

Merge request reports