Re: Shutdown/hibernate/sleep events


Le jeudi 08 septembre 2011 à 12:49 -0500, Dan Williams a écrit :
> On Thu, 2011-09-01 at 17:31 +0800, Daniel Yek wrote:
> > On Thu, 2011-09-01 at 10:15 +0200, Jean Parpaillon wrote:
> > > I'm currently developing a solution leveraging wake on wireless feature
> > > on some new 3g modems. For this to work, SIM card must not be disabled
> > > when computer go to sleep. 
> > > Can someone point me the code which is responsible for handling SIM
> > > deactivation and sleep events ? It is in ModemManager ? NetworkManager ?
> > > linux driver itself ?
> > 
> > I won't start with ModemManager, NetworkManager, or the driver.
> > 
> > I will start with ACPI code and trace from there.
> > 
> > ACPI does Power Management and 
> > implements the policy of sleeping states.
> > 
> > Not sure if the policy is extended up to ModemManager.
> > 
> > I don't know any more than this (without "doing the work",)
> > so just take this as one other suggestion that you can look into.
> At the moment, here's what' happens with NM/MM.  When NM gets the signal
> to go to sleep, it disconnect active connections.  ModemManager
> currently knows nothing about sleep/wake, it depends on the driver or
> kernel stack to indicate to MM that the modem has been powered down
> (usually indicated by a USB bus disconnect of the modem device and
> associated serial ports).

Ok, thank you very much for your explanation.
It seems that USB power on sleep mode can be controlled through sysfs,
(when drivers handle this): see

In my case, an Ericsson modem, the driver seems ok.

> When you say "SIM card disabled" what specifically do you mean?  Do you
> mean the modem should be left in powered-up mode and potentially
> registered with the network?  

Yes, exactly. The module may be registered to the network to be able to
receive a special message and wakeup.

> Normally the SIM card doesn't have much to
> do with this at all, it's that the modem isn't powered down (CFUN=0) and
> is allowed to stay registered.
> But as Daniel wrote, you first have to ensure that the kernel's USB
> stack allows the modem to remain powered and doesn't turn off the USB
> controller during suspend.
> So at this point it's more about the kernel drivers and USB stack than
> it is about userspace.  Once you've verified that the kernel provides
> the behavior you expect, then we can investigate what mechanisms the
> modem provides to userspace clients for this; ie does it keep the serial
> ports open across suspend/resume and thus on resume when the MM process
> is unfrozen, there's data to be read on the serial port?  

Yes, serial port must remain opened.

> Or is the
> serial port closed and we need to re-open it and read data?  That sort
> of thing.

If I understand well, I should provide a mechanism to tell
NetworkManager not shutting down certain interfaces when sleeping.
Furthermore, we could be able to provide a pre-sleep dispatch script in
order to prepare the modem to wake up the computer.

The specific AT commands to prepare the modem for waking up must be in a
separate script/hook/plugin as some of them are under NDA,
unfortunately. But I think that a proper architecture to handle wake on
wireless in a generic way could be useful, for the case of other devices
of this type.

Best regards,
> Dan

Jean Parpaillon
R&D Engineer
+33 6 30 10 92 86
xmpp: jean parpaillon gmail com

Attachment: signature.asc
Description: This is a digitally signed message part

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]