Hey,
> I'm trying to use ModemManager (in conjunction with NetworkManager) to manage > a Quectel EC25 mini-pcie module (which is actually USB) using QMI. More > specifically, I need it to play-nice with suspend-to-ram, and minimise the > frequency at which it wakes up the host. > I've managed to get the modem persisting across a suspend/resume, and is able > to keep a TCP connection open during suspend and wakeup the host when the TCP > connection receives data (ala smartphone push-notifications). MM supported > this without any special configuration or patches - very nice :) > Is it that you're building MM without suspend/resume support? That's the only way the TCP connection alive through suspend/resume would work, when MM doesn't know the system is suspend/resuming. If you're doing that, well, you should know that a lot of things may happen in the modem while the host is suspended, and you cannot rely on the state known by MM about the modem once the system is resumed, as that state may likely be wrong. The suspend/resume support in MM is done to allow MM refresh from scratch all the modem state upon resume, without needing to know what happened to the modem... but this may not be what you want. So in short, there is no perfect solution for this yet, your email goes actually quite in line with Dylan's "Faster resume probing" email thread: https://lists.freedesktop.org/archives/modemmanager-devel/2021-January/008340.html > However one issue I'm running into is premature wakeups due to unsolicited > messages (as these cause activity on the USB interface, causing a USB wakeup > and thus a host wakeup). > Inspecting the MM debug logs, I noticed there were 3 main culprits: > - Packet statistics These are actually polled, and we should allow disabling them, see https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/287 > - Signal strength indications > - Dormancy status indications > > I've done a few very nasty hacks which completely prevent these indications > from being enabled, and things _appear_ to be working - it's happily sleeping > for 30+ mins. These two are indeed indications, and I believe these could be disabled via QMI, as you're probably doing. There are quite some other indications that may happen, you're just looking at the 2 most common ones really. If you want a solution to ignore all you would need to extend that list of indications a bit more I think (e.g. serving system indications...) > So my questions: > - Are the aforementioned indications critical to the functioning of MM? None of the indications are critical, unless the user applications on top require to know about them. E.g. a serving system indication reporting the modem is unregistered may be critical, yes, but a signal quality update from 70% to 75% may not be critical at all or it could be very critical if there are apps behaving differently based on the signal quality updates. > - Does MM have a mode where most unsolicited messages are turned off (e.g. > utilising polling instead)? The only mode where all unsolicited messages are turned off and ignored is when MM doesn't have a modem object for the modem in use. If you build your MM with suspend/resume support (and you're using systemd) then you'll get that modem by default. But you'll also lose the open TCP connections in that case, as the modem will be completely disconnected. Not the same issue, but there are even modems that will crash if those indications sent by the modem while the host is suspended aren't read by the host as the internal buffers in the USB layer of the modem would get full and the modem doesn't know how to react.... see https://gitlab.freedesktop.org/mobile-broadband/libmbim/-/merge_requests/31/diffs?commit_id=5d5fc08b0704513c4c6d8f3e18d07476e53757a9 This kind of issues should be solved in a generic manner by ModemManager at some point. > - Am I going about things the wrong way - perhaps I'm using MM in a manner > it's not intended? > Well, your usecase is not the default, although it's a valid one. Unfortunately it's not a use case that we've actively considered. There are hacks that can be done to accommodate those features you need, but there is no generic way to do that cleanly (yet). -- Aleksander https://aleksander.es _______________________________________________ ModemManager-devel mailing list ModemManager-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel