Hi Daniel,

On Wed, Jan 02, 2013 at 04:32:43PM +0100, Daniel Wagner wrote:
> On 28.12.2012 20:22, Forest Bond wrote:
> > From: Forest Bond <[email protected]>
> > 
> > Previously, the CDMA device was created only after the CDMA
> > ConnectionManager interface was added.  This created a chicken-and-egg
> > problem because oFono would not add the CM interface until after the
> > modem was online, but we would not set the modem online until enabling
> > the device (which was not created yet).  As a result, CDMA modems would
> > only work if they were set online manually.
> 
> So what you are saying is that the comment in ready_to_create_device()
> is wrong,
> 
>       /*
>        * There are three different modem types which behave slightly
>        * different:
>        * - GSM modems will expose the SIM interface then the
>        *   CM interface.
>        * - CDMA modems will expose CM first and sometime later
>        *   a unique serial number.
>        *
>        * This functions tests if we have the necessary information gathered
>        * before we are able to create a device.
>        */

Correct, I have observed different behavior than what is documented here and
this is confirmed by looking at the code for the following ofono drivers:

* speedupcdma.c
* huawei.c
* nokiacdma.c

In each driver, the CDMA ConnectionManager is created in the respective
post_online function so we will not see it until we've set the modem online.

> > ---
> >   plugins/ofono.c |   13 +++++--------
> >   1 files changed, 5 insertions(+), 8 deletions(-)
> > 
> > diff --git a/plugins/ofono.c b/plugins/ofono.c
> > index 41954e4..fe69495 100644
> > --- a/plugins/ofono.c
> > +++ b/plugins/ofono.c
> > @@ -2031,9 +2031,6 @@ static void modem_update_interfaces(struct modem_data 
> > *modem,
> >     }
> >   
> >     if (api_added(old_ifaces, new_ifaces, OFONO_API_CDMA_CM) == TRUE) {
> > -           if (ready_to_create_device(modem) == TRUE)
> > -                   create_device(modem);
> > -
> >             if (modem->device != NULL)
> >                     cdma_cm_get_properties(modem);
> >     }
> > @@ -2126,11 +2123,8 @@ static gboolean modem_changed(DBusConnection *conn, 
> > DBusMessage *message,
> >   
> >             DBG("%s Serial %s", modem->path, modem->serial);
> >   
> > -           if (has_interface(modem->interfaces,
> > -                                    OFONO_API_CDMA_CM) == TRUE) {
> > -                   if (ready_to_create_device(modem) == TRUE)
> > -                           create_device(modem);
> > -           }
> > +           if (ready_to_create_device(modem) == TRUE)
> > +                   create_device(modem);
> >     }
> 
> At least this change is touching the GSM modem code path, which makes me not
> too happy, because that would be the wrong thing to do at this point.

I see your point.  I guess the problem is that for GSM devices we need to wait
for the SIM interface before creating the device and for CDMA devices we do not,
but right now we distinguish between them by whether or not the SIM interface
has been added.

Looking at the oFono source code, I believe we can assume that if the modem is
powered and does not have a SIM interface, it will not be added (and is
therefore not a GSM modem).  But I don't see anything in the docs that back this
up.

> >     return TRUE;
> > @@ -2214,6 +2208,9 @@ static void add_modem(const char *path, 
> > DBusMessageIter *prop)
> >     }
> >   
> >     modem_update_interfaces(modem, 0, modem->interfaces);
> > +
> > +   if (ready_to_create_device(modem) == TRUE)
> > +           create_device(modem);
> >   }
> 
> here the same

Yep.

Thanks,
Forest
-- 
Forest Bond
http://www.alittletooquiet.net
http://www.rapidrollout.com

Attachment: signature.asc
Description: Digital signature

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to