QMI WDS event reports make Quectel EG25-G modem crash when suspending
Description
QMI modems send QMI WDS reports to notify about data traffic to the host. When using actively mobile data on the PinePhone, these QMI WDS event reports are very common. However, when such a report is received when we're also suspending, the report may not be processed completely. This causes the Quectel EG25-G modem to crash as seen in the logs below.
I noticed that there's preliminary support for this use case in !148 (merged), but maybe we also need systemd sleep/resume hooks to delay the sleeping in order to make sure we fully process the QMI reports?
[3869]: <debug> [1622269044.098296] [modem0/bearer1] got QMI WDS event report
[3869]: <info> [1622269044.507893] [sleep-monitor] system is about to suspend
[3869]: <debug> [1622269044.508208] [sleep-monitor] dropping systemd sleep inhibitor
[3869]: <debug> [1622269830.180942] [modem0/ttyUSB0/qcdm] unexpected port hangup!
[3869]: <debug> [1622269830.181315] [modem0/ttyUSB0/qcdm] forced to close port
[3869]: <debug> [1622269830.181417] [modem0/ttyUSB0/qcdm] device open count is 0 (close)
[3869]: <debug> [1622269830.181541] [modem0/ttyUSB0/qcdm] closing serial port...
[3869]: <debug> [1622269830.181882] [modem0/ttyUSB0/qcdm] serial port closed
[3869]: <info> [1622269830.205109] [base-manager] port ttyUSB0 released by device '/sys/devices/platform/soc/1c1b000.usb/usb2/2-1'
[3869]: <info> [1622269830.223217] [sleep-monitor] system is resuming
[3869]: <debug> [1622269830.231220] [sleep-monitor] taking systemd sleep inhibitor
[3869]: <debug> [1622269830.255132] syncing modem state (quick resuming)
[3869]: <info> [1622269830.263482] [modem0] resume synchronization state (1/4): modem interface sync
[3869]: <debug> [1622269830.270529] [modem0] start checking for SIM swap in slot 0
[3869]: <debug> [1622269830.276020] [modem0] checking if SIM was swapped...
[3869]: <debug> [1622269830.282698] [modem0/sim0] loading SIM identifier...
See https://gitlab.com/postmarketOS/pmaports/-/merge_requests/2187#note_587566199
What's happening?
The QMI WDS event reports are received, but not fully processed when we are currently suspending at the same time.
What's supposed to happen?
The QMI WDS event reports are processed before the device may sleep
Environment
- pmOS edge
- MM 1.16.4 + quick suspend/resume patches
- musl
- elogind suspend/resume hooks