Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: designated way for modems disappearing from bus during +CFUN=1
Date: Wed, 13 Jul 2016 12:09:31 -0500	[thread overview]
Message-ID: <578675CB.5020604@gmail.com> (raw)
In-Reply-To: <20160711173751.GD5250@nataraja>

[-- Attachment #1: Type: text/plain, Size: 3081 bytes --]

Hi Harald,

On 07/11/2016 12:37 PM, Harald Welte wrote:
> Dear all,
>
> I've been struggling for quite some time to find out what is the
> designated way in ofono to deal with modems that actually perform a
> cold/warm reset (and hence USB device stack reset) when you send them an
> AT+CFUN=1 message.

The best way to deal with this is not to have the modem reset :)  Does 
Sierra Wireless have any extensions to turn off this behavior?

>
> Examples for this are e.g. the Sierra Wireless SL808x series of modems,
> where this behavior is documented and expected.  But I'm sure there are
> others, at least I recall having seen this several times in the past.

Generally this isn't done by the modems.  Some will physically power off 
when you send them a CFUN=0.  Then you'd need to replug the USB cable.

>
> It is somewhat logical, as a +CFUN+1 is supposed to reset _all_ of the
> status in the modem, not just the protocol stack. So the fact that most
> modems don't disappear from the bus afterwards actually means that they
> are cheating.

No, it means they are sane.  Many modem manufacturers use a second 
parameter to CFUN, which tells the modem whether to reset or not.  E.g. 
CFUN=1,1 to cause a full reset.

>
> The actual behavior of ofono with such a modem is:
>
> * modem first appears as a /wavecom_X device
> * if you issue enable_modem via dbus, the modem goes thrugh CFUN=1
> * the modem disappears from USB, ofono destroys its structures
> * the client program (e.g. the one from tests/) simply hangs and fails
>    at timeout
> * the modem re-enumerates on the bus and ofono creates a new /wavecom_Y
>    device, where Y != the X before the modem restart.
>
> So for an application it is not possible to continue to talk to one
> modem via dbus accross modem resets.
>
> Not issuing a +CFUN=1 is also not really an option, as then you loose
> the ability to completely disable the modem.  +CFUN=4 can be used to
> force an IMSI detach and disable it from the network point of view, but
> the modem is still talking to the SIM card and will not re-read SIM
> card state if brought back online from +CFUN=4.

I know of no USB based device that provides a complete power down 
setting.  Some (like Ericsson) just jump off the USB bus when a CFUN=0 
is issued, but it doesn't really help, as you'd need to physically take 
the modem out and plug it back in.  Hence we just go back to CFUN=4 mode 
on disable for these devices.

Since most of these devices need to be pulled out in order to change the 
SIM card, it is generally not a problem.

>
> I'm sure this issue has been seen before, and somebody must have a
> solution for it - or at least some ideas on how to solve this in a ofono
> driver plugin.  I'm willing to spend some time on it, but my
> experience/exposure to the code base is limited.

This is just a limitation of USB devices.  If you want proper control of 
a modem power state, you might want to research devices with 
full-featured modems on board.

Regards,
-Denis

  parent reply	other threads:[~2016-07-13 17:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-11 17:37 designated way for modems disappearing from bus during +CFUN=1 Harald Welte
2016-07-12 13:02 ` Dragos Tatulea
2016-07-13 17:09 ` Denis Kenzior [this message]
2016-07-13 18:27   ` Harald Welte
2016-07-13 19:47     ` Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=578675CB.5020604@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox