Fix Quectel EM05-G and other LTE modems not working after resume
Some LTE modems, namely the Quectel EM05-G found in a Fujitsu Lifebook E5412 laptop, quit working after suspending because the USB connection hangs. Another modem that displays similar behavior is the Huawei ME906s found in Thinkpads.
The modems are no longer detected by ModemManager after resuming from suspend, nor by NetworkManager. Possibly other modems are affected too, if yours works after rebooting but stops working after suspending the system it could be fixed with this method.
The fix is quite simple, the modem's USB connection needs to be reset after waking up from suspend, and this can be done with usbutils
and systemd.
Install the usbutils
package, then use lsusb
to find the modem's VID/PID. In my case the output is:
Bus 003 Device 002: ID 2c7c:030d Quectel EM05-G
It means that my VID is 2c7c
and the PID is 030d
.
Next, suspend the computer and wake it up after a few minutes (it looks like very quick resumes can leave the modem working). It should no longer be recognized by ModemManager, but still be visible in lsusb
.
Execute sudo usbreset VID:PID
, in my case it is sudo usbreset 2c7c:030d
. The modem's USB connection should be reset and it should be enumerated again (check with dmesg
). After a few seconds, it should also be detected by GNOME or ModemManager.
If everything worked out, you can create a systemd unit file to execute the command automatically on wakeup.
Create a /etc/systemd/system/fix-wwan.service
file, and paste the following contents, making sure to replace VID:PID by your own VID and PID:
[Unit] Description=Fix WWAN LTE modem hanging after suspend After=suspend.target [Service] User=root Type=oneshot ExecStart=/usr/bin/usbreset VID:PID TimeoutSec=0 StandardOutput=syslog [Install] WantedBy=multi-user.target sleep.target
After saving the new file, you can enable the unit with sudo systemctl enable fix-wwan.service
and you can also test it with sudo systemctl start fix-wwan.service
(as it is a oneshot unit, it will be started automatically and stopped immediately when it is done).
This should fix the issue permanently.