Is it necessary to disable modem before powering it down?
aleksander at aleksander.es
Thu Feb 20 01:21:11 PST 2014
On Thu, Feb 20, 2014 at 1:58 AM, Dan Williams <dcbw at redhat.com> wrote:
> On Wed, 2014-02-19 at 16:54 -0800, Thieu Le wrote:
>> In this particular case, the command AT%DPDNACT=0 took longer than 10s,
>> which is too long when the user suspends the system.
>> Thanks, I'll take a look at the internal states and see if we can reset it
>> without going through a full disable.
> We could either do a quick fix or a better fix.
> quick fix: add a "will power down next" flag to the disable codepaths,
> which you would then check and just not call %DPDNACT if we were in fact
> about to power down next.
> better fix: what I described earlier; split out any of the cleanup logic
> so that it could be called from both disable and power-down, and then
> allow power-down without first doing disable.
The %DPDNACT=0 tells the modem to get disconnected; and it probably is
wise to wait to get it properly disconnected; even if it's going to
get powered down afterwards (thinking in the network here). It's
actually the same case with putting the device in low-power mode; it
is not only to save battery switching off RF, as when running the
low-power mode command the modem will also run the IMSI Detach
procedure with the network (e.g. telling the network that it is going
offline). I know some MM users that explicitly require a proper IMSI
Detach for this reason. Just shutting down the device will keep the
registration details in the network and the network is then
responsible of tracking if the device is online or not...
I don't think we should allow power-down without first passing through
disable... that would complicate unnecessarily the whole logic that we
can handle. E.g. a modem would actually be 'enabled' but in low-power
mode, which is a bit misleading... Instead, I'd suggest to make use of
the "OFF" power state for this case. I have a branch which I didn't
merge yet (may do it today), which allows passing the OFF state to a
modem (e.g. passing OFFLINE state to a QMI mode, or CPOF=1 to a
Wavecom one). After setting a modem in OFF state, the only thing that
can be done with the device is actually cutting the power completely.
The OFF state is like the low-power mode in the sense that it also
performs a clean IMSI detach, but also makes sure that all data is
properly stored in persistent memory and also disconnects the SIM
card. If you're going to shutdown a device completely, therefore, we
could pass the OFF power state; and maybe then (didn't implement this
yet) instruct ModemManager to forget about that modem completely (e.g.
marking it as invalid and removing all the ports and such). Being such
a specific case, where we know that we're going to power off the
device, we could allow this from whatever state the modem is, and just
let it shutdown cleanly... what do you think?
More information about the ModemManager-devel