Bug 84992 - mbim: Sierra Wireless EM7305 doesn't work after suspend/resume
Summary: mbim: Sierra Wireless EM7305 doesn't work after suspend/resume
Status: RESOLVED MOVED
Alias: None
Product: ModemManager
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: ModemManager bug user
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-14 12:15 UTC by Aleksander Morgado
Modified: 2018-06-10 09:02 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Successful connection attempt after a full reboot (111.10 KB, text/plain)
2014-10-14 12:21 UTC, Aleksander Morgado
Details
Connection error after resuming from suspend (111.08 KB, text/plain)
2014-10-14 12:22 UTC, Aleksander Morgado
Details
NetworkManager log - connect failure after sleep (875.67 KB, text/plain)
2015-03-13 17:38 UTC, Gergely Dömsödi
Details
ModemManager log - connect failure after sleep (157.90 KB, text/plain)
2015-03-13 17:39 UTC, Gergely Dömsödi
Details
Output of "lsusb -v -d 1199:9041" on Fujitsu S936 (10.08 KB, text/plain)
2017-01-24 08:30 UTC, Adrian Perez de Castro
Details
mbim-proxy log (suspend -> wakeup) from EM7305 (96.00 KB, text/plain)
2017-04-21 20:48 UTC, russianneuromancer
Details
ModemManager (suspend -> wakeup) from EM7305 (207.79 KB, text/x-log)
2017-04-21 20:49 UTC, russianneuromancer
Details
ModemManager 1.6.8, patched, suspend->resume cycle (67.46 KB, text/x-log)
2017-10-12 23:47 UTC, russianneuromancer
Details
ModemManagerHook.service (426 bytes, text/plain)
2017-10-12 23:50 UTC, russianneuromancer
Details

Description Aleksander Morgado 2014-10-14 12:15:13 UTC
Originally reported at:
  https://bugzilla.gnome.org/show_bug.cgi?id=726613
Please refer to the original bug report if more details are needed.

After resuming from a suspend, the MBIM-managed Sierra Wireless EM7305 doesn't seem to properly allow connections if ModemManager had an open MBIM session during the suspension. After resuming, a connection attempt will make the device connected, but not working properly.

   [1404835174.470611] (wwp0s20u6c2i12): port now connected
   [1404835174.470684] Connected bearer '/org/freedesktop/ModemManager1/Bearer/0'
   [1404835174.471132] Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> connected)
   [1404835174.471737] Simple connect state (8/8): All done
(now something happens, and it seems we get a Disconnection via DBus?)
   [1404835181.411298] Disconnecting bearer '/org/freedesktop/ModemManager1/Bearer/0'
   [1404835181.412289] Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connected -> disconnecting)
   [1404835181.412634] Launching disconnection on data port (net/wwp0s20u6c2i12)

Would be good to get a set of ModemManager *and* NetworkManager debug logs of the same run.
Comment 1 Aleksander Morgado 2014-10-14 12:21:55 UTC
Created attachment 107821 [details]
Successful connection attempt after a full reboot

Log from the original reporter.
Comment 2 Aleksander Morgado 2014-10-14 12:22:33 UTC
Created attachment 107822 [details]
Connection error after resuming from suspend

Log from the original reporter.
Comment 3 Aleksander Morgado 2014-10-14 13:57:44 UTC
An additional report which is showing the same issue, but hibernating instead of suspending:

https://bugzilla.gnome.org/show_bug.cgi?id=725377
http://lists.freedesktop.org/archives/modemmanager-devel/2014-February/000893.html
Comment 4 Aleksander Morgado 2014-10-14 14:00:32 UTC
(In reply to Aleksander Morgado from comment #3)
> An additional report which is showing the same issue, but hibernating
> instead of suspending:
> 
> https://bugzilla.gnome.org/show_bug.cgi?id=725377
> http://lists.freedesktop.org/archives/modemmanager-devel/2014-February/
> 000893.html

This is unrelated sorry; the NotOpened error is actually tracked in bug 84994.
Comment 5 Gergely Dömsödi 2015-03-13 17:37:40 UTC
I reproduced the error situation (boot, connect, disconnect, sleep, connect) on my current f22, and saved ModemManager and NetworkManager logs as requested in the original bugreport.

Relevant software versions: 
NetworkManager 1.0.0
ModemManager 1.4.4
kernel 4.0.0

Attaching the logs.
Comment 6 Gergely Dömsödi 2015-03-13 17:38:23 UTC
Created attachment 114288 [details]
NetworkManager log - connect failure after sleep
Comment 7 Gergely Dömsödi 2015-03-13 17:39:00 UTC
Created attachment 114289 [details]
ModemManager log - connect failure after sleep
Comment 8 marius 2015-11-02 18:48:35 UTC
Is this information useful for this issue?: http://www.0xf8.org/2015/07/dell-wireless-5809e-support-in-linux-a-followup/

Or something else in downstream bug report: https://bugs.launchpad.net/bugs/1326954
Comment 9 Gergely Dömsödi 2015-11-20 12:37:28 UTC
With the aforementioned udev rules file, the situation got much better. However, it is not perfect. In some occasions (about 20~30% of resumes), the modem is still unusable, and when this happens, only a reboot can help to get it usable again.
Comment 10 Adrian Perez de Castro 2017-01-24 08:29:38 UTC
I also have this issue, with a Fujitsu S936 laptop which includes an EM7305.
After adding the udev rules in the post at 0xf8.org (modifying them to fit
use the USB identifier that shows in my laptop, 1199:9041), the “mbim-proxy” 
program seems to hang in some kind of loop, chewing 80% of CPU time according
to “top”. Here are the details of my configuration:

- Arch Linux
- ModemManager 1.6.4
- NetworkManager 1.4.4
- libmbim 1.14.0
- Kernel 4.9.5

I will be posting the output from “lsusb -v -d 1199:9041” as an attachment.
Comment 11 Adrian Perez de Castro 2017-01-24 08:30:45 UTC
Created attachment 129120 [details]
Output of "lsusb -v -d 1199:9041" on Fujitsu S936
Comment 12 Aleksander Morgado 2017-01-24 09:48:48 UTC
(In reply to Adrian Perez de Castro from comment #10)
> I also have this issue, with a Fujitsu S936 laptop which includes an EM7305.
> After adding the udev rules in the post at 0xf8.org (modifying them to fit
> use the USB identifier that shows in my laptop, 1199:9041), the “mbim-proxy” 
> program seems to hang in some kind of loop, chewing 80% of CPU time according
> to “top”. Here are the details of my configuration:
> 
> - Arch Linux
> - ModemManager 1.6.4
> - NetworkManager 1.4.4
> - libmbim 1.14.0
> - Kernel 4.9.5
> 
> I will be posting the output from “lsusb -v -d 1199:9041” as an attachment.

I believe you misread what the rules in the blogpost are doing :) I think the rules try to force the device into QMI mode, instead of the MBIM mode that would be picked up by default. This was a better choice for the Dell modem at that time because there wasn't support for running QMI commands over MBIM, and the Dell modem really required the FCC Auth command; but that is no longer the case, as MM already handles QMI over MBIM automatically as well as the FCC auth command for the Dell device.

Anyway, in your case it seems the rules didn't work as expected because you're still in MBIM mode, which is the one I would anyway suggest. I believe you can remove all the udev rules, as the kernel (or usb_modeswitch, it depends) should choose the MBIM configuration as preferred automatically.

That said, could you gather MM and mbim-proxy debug logs? I'd like to check whether the issue is exactly the same one:

$> sudo systemctl stop ModemManager
$> sudo killall -9 mbim-proxy
$> sudo /usr/libexec/mbim-proxy --verbose > /tmp/mbim-proxy.log 2>&1 &
$> sudo /usr/sbin/ModemManager --debug > /tmp/mm.log 2>&1 &
(and retry reproducing the issue)
Comment 13 russianneuromancer 2017-04-21 20:47:53 UTC
I have same issue on Dell Venue 8 Pro 5855 tablet with Dell Wireless 5809e (Sierra Wireless AirPrime EM7305; default SWI9X15C_05.05.58.00 firmware).

Please look into attached logs:
4:26 mbim-proxy and ModemManager proxy is started, then tablet was suspended
4:27 wakeup from suspended, connection is not established
4:28 second attempt to connect, also unsuccessful. 

mbim-proxy and ModemManager termination and following restart allowed me to successfully establish connection again.

If my issue is different and I need to fill separate bugreport - please let me know.
Comment 14 russianneuromancer 2017-04-21 20:48:34 UTC
Created attachment 130974 [details]
mbim-proxy log (suspend -> wakeup) from EM7305
Comment 15 russianneuromancer 2017-04-21 20:49:04 UTC
Created attachment 130975 [details]
ModemManager (suspend -> wakeup) from EM7305
Comment 16 russianneuromancer 2017-04-21 21:27:41 UTC
And in case it could help someone, this workaround systemd unit helps me. With this unit connection could be established after suspend.

/etc/systemd/system/ModemManagerHook.service:

[Unit]
Description=ModemManager sleep hook
Before=sleep.target
StopWhenUnneeded=yes

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=-/bin/systemctl stop ModemManager
ExecStop=-/bin/systemctl start ModemManager

[Install]
WantedBy=sleep.target
Comment 17 Aleksander Morgado 2017-04-21 21:42:57 UTC
(In reply to russianneuromancer from comment #16)
> And in case it could help someone, this workaround systemd unit helps me.
> With this unit connection could be established after suspend.

Did you compile ModemManager with 'systemd' suspend/resume support? Ideally, MM should detect the suspend/resume events and reprobe the devices from scratch.
Comment 18 Aleksander Morgado 2017-04-21 21:44:38 UTC
(In reply to Aleksander Morgado from comment #17)
> (In reply to russianneuromancer from comment #16)
> > And in case it could help someone, this workaround systemd unit helps me.
> > With this unit connection could be established after suspend.
> 
> Did you compile ModemManager with 'systemd' suspend/resume support? Ideally,
> MM should detect the suspend/resume events and reprobe the devices from
> scratch.

Nevermind, I see the suspend/resume is in place in MM so the bug is still applicable there; I'll analyze the logs and let you know what I find.
Comment 19 russianneuromancer 2017-04-22 07:13:31 UTC
I wonder if the fact that I use "suspend freeze" mode instead of default "suspend" mode makes a difference?
https://www.freedesktop.org/software/systemd/man/sleep.conf.d.html

I have to do so because modern hardware implement S0i3 instead of S3, so default mode will just won't work (tablets and laptops without S3 support will just poweroff or reboot on attempt to go into S3).

> I'll analyze the logs and let you know what I find.

Ok. Just to let you know, I find first unit not reliable enough, so I edited it a little bit:
Removed "StopWhenUnneeded=yes" and "RemainAfterExit=yes".
Replaced "=-/bin/systemctl" with "=/bin/systemctl".
Comment 20 russianneuromancer 2017-08-31 20:04:04 UTC
Hi

Any news?
Comment 21 Aleksander Morgado 2017-09-01 06:08:21 UTC
(In reply to russianneuromancer from comment #20)
> Hi
> 
> Any news?

Yes, see: https://lists.freedesktop.org/archives/modemmanager-devel/2017-August/005668.html

Could you apply the patch in a custom build and retry, to see if it fixes your issue?
Comment 22 russianneuromancer 2017-10-12 18:55:31 UTC
> Could you apply the patch in a custom build and retry, to see if it fixes your issue?

Hello!

Thank you for looking into this issue! :)

I tried to build version 1.6.8, but build failed: 
https://launchpad.net/~russianneuromancer/+archive/ubuntu/drivers/+build/13571525 

It is supposed to work with version 1.6.8 or I need master? (In latter case I have no idea how to build modemmanager package.)
Comment 23 Aleksander Morgado 2017-10-12 22:03:52 UTC
If you want to apply it on a 1.6.x version, use this patch instead:
https://cgit.freedesktop.org/ModemManager/ModemManager/commit/?h=mm-1-6&id=196b8d619ad16d625ab0cc520854c2a044c0e4eb
Comment 24 russianneuromancer 2017-10-12 23:10:35 UTC
Thanks you once again :)

Yes, with this patch build was successful. I will test it next week and will let you know.
Comment 25 russianneuromancer 2017-10-12 23:47:56 UTC
Created attachment 134821 [details]
ModemManager 1.6.8, patched, suspend->resume cycle

I was able to test it kind of ahead of time, and unfortunately this doesn't help. Log attached.
Comment 26 russianneuromancer 2017-10-12 23:50:28 UTC
Created attachment 134822 [details]
ModemManagerHook.service

I also need to mention that workaround from Commentary 16 later was modified to not only restart ModemManager, but also detach modem before suspend, and reattach it after suspend. 

systemd unit is attached.
Comment 27 Daniel Rowe 2018-01-02 05:05:16 UTC
I am also seeing this issue on Fedora 27 with  Toshiba laptop.

I was having this issues: https://bugs.freedesktop.org/show_bug.cgi?id=100879 but this was fix in Fedora 27.

Now it work just fine till suspend.

I have tried the systemd unit and the modem at least shows with this but it wont connect.
Comment 28 russianneuromancer 2018-04-16 07:33:05 UTC
In addition to Dell Venue 8 Pro 5855 tablet with Dell Wireless 5809e (Comment 13) I find same issue reproducible on Dell Wireless 5810e (Telit LN930 with 1620 firmware) with patch from Comment 23.

I also find that detach/attach modem via systemd unit is sufficient, ModemManager restart seems like not necessary.

Aleksander, please let us know if any additional logs or testing is required.
Comment 29 GitLab Migration User 2018-06-10 09:02:52 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/30.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.