All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: SIM Insertion Notification
  2012-07-14 16:31 SIM Insertion Notification Ruptash, Brian
@ 2012-07-14 11:02 ` Denis Kenzior
  2012-07-15 12:42   ` Brian Ruptash
  0 siblings, 1 reply; 4+ messages in thread
From: Denis Kenzior @ 2012-07-14 11:02 UTC (permalink / raw)
  To: ofono

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

Hi Brian,

On 07/14/2012 11:31 AM, Ruptash, Brian wrote:
> I'm running ofono 1.7, with a Cinterion PH8-P plugin I wrote and will submit once I've fully tested it.  One problem I have is I never receive notification of SIM insertion, i.e. the Present propertyChanged.  Looking at the code it seems pretty obvious why, unless I'm (probably) missing something.
>
> All the plugins, including mine, do similar to the following:
>
>      static void ph8_pre_sim(struct ofono_modem *modem)
>      {
>          struct ph8_data *data = ofono_modem_get_data(modem);
>          struct ofono_sim *sim;
>
>          ofono_devinfo_create(modem, 0, "atmodem", data->app);
>          sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION_PH8,
>                      "atmodem", data->app);
>
>          if (sim&&  data->have_sim == TRUE)
>              ofono_sim_inserted_notify(sim, TRUE);
>      }
>
> The call to ofono_sim_create() probes the atmodem driver, which ends with:
>
>      g_idle_add(at_sim_register, sim);
>
> So the subsequent call to ofono_sim_inserted_notify() will fail, as at_sim_register() is called later when it is scheduled.
>
> The logs bear this out, so I'm at a loss to understand how anyone receives a SIM notification... What am I missing here?
>

Everything is working as it should, what exactly is the problem?  You 
can call ofono_sim_inserted_notify before the atom is registered, but 
that means the Present property will be 'True' when you perform the 
initial GetProperties call.

This is meant for devices which do not support SIM hot-swap (e.g. most 
USB devices and many earlier phones where the SIM is behind the battery).

Regards,
-Denis

^ permalink raw reply	[flat|nested] 4+ messages in thread

* SIM Insertion Notification
@ 2012-07-14 16:31 Ruptash, Brian
  2012-07-14 11:02 ` Denis Kenzior
  0 siblings, 1 reply; 4+ messages in thread
From: Ruptash, Brian @ 2012-07-14 16:31 UTC (permalink / raw)
  To: ofono

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

I'm running ofono 1.7, with a Cinterion PH8-P plugin I wrote and will submit once I've fully tested it.  One problem I have is I never receive notification of SIM insertion, i.e. the Present propertyChanged.  Looking at the code it seems pretty obvious why, unless I'm (probably) missing something.

All the plugins, including mine, do similar to the following:

    static void ph8_pre_sim(struct ofono_modem *modem)
    {
        struct ph8_data *data = ofono_modem_get_data(modem);
        struct ofono_sim *sim;

        ofono_devinfo_create(modem, 0, "atmodem", data->app);
        sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION_PH8,
                    "atmodem", data->app);

        if (sim && data->have_sim == TRUE)
            ofono_sim_inserted_notify(sim, TRUE);
    }

The call to ofono_sim_create() probes the atmodem driver, which ends with:

    g_idle_add(at_sim_register, sim);

So the subsequent call to ofono_sim_inserted_notify() will fail, as at_sim_register() is called later when it is scheduled.

The logs bear this out, so I'm at a loss to understand how anyone receives a SIM notification... What am I missing here?

-- Brian

CONFIDENTIALITY NOTICE: The information contained in this email message is intended only for use of the intended recipient. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately delete it from your system and notify the sender by replying to this email.  Thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: SIM Insertion Notification
  2012-07-14 11:02 ` Denis Kenzior
@ 2012-07-15 12:42   ` Brian Ruptash
  2012-07-15 16:01     ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Ruptash @ 2012-07-15 12:42 UTC (permalink / raw)
  To: ofono

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

> On 07/14/2012 11:31 AM, Ruptash, Brian wrote:
> > I'm running ofono 1.7, with a Cinterion PH8-P plugin I wrote and will
> submit once I've fully tested it.  One problem I have is I never receive
> notification of SIM insertion, i.e. the Present propertyChanged.  Looking
> at the code it seems pretty obvious why, unless I'm (probably) missing
> something.
> >
> > All the plugins, including mine, do similar to the following:
> >
> >      static void ph8_pre_sim(struct ofono_modem *modem)
> >      {
> >          struct ph8_data *data = ofono_modem_get_data(modem);
> >          struct ofono_sim *sim;
> >
> >          ofono_devinfo_create(modem, 0, "atmodem", data->app);
> >          sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION_PH8,
> >                      "atmodem", data->app);
> >
> >          if (sim&&  data->have_sim == TRUE)
> >              ofono_sim_inserted_notify(sim, TRUE);
> >      }
> >
> > The call to ofono_sim_create() probes the atmodem driver, which ends
> with:
> >
> >      g_idle_add(at_sim_register, sim);
> >
> > So the subsequent call to ofono_sim_inserted_notify() will fail, as
> at_sim_register() is called later when it is scheduled.
> >
> > The logs bear this out, so I'm at a loss to understand how anyone
> receives a SIM notification... What am I missing here?
> 
> Everything is working as it should, what exactly is the problem?  You
> can call ofono_sim_inserted_notify before the atom is registered, but
> that means the Present property will be 'True' when you perform the
> initial GetProperties call.
> 
> This is meant for devices which do not support SIM hot-swap (e.g. most
> USB devices and many earlier phones where the SIM is behind the battery).

Thanks for the clarification, Denis.  That's what started me looking at the
Present propertyChanged, as I'd thought all property changes would be
signalled without the need for a GetProperties first.

I'm using ofono-qt, and the only notifications I get are propertyChanged's
for CardIdentifier, PreferredLanguages, SubscriberIdentity,
MobileCountryCode and MobileNetworkCode.  I never get Present or any of the
other properties.

Turns out it's a problem with ofono-qt; it only does a GetProperties once
when instantiating the SimManager, which is most likely before the interface
is even available.  It never does it again, including when the SIM interface
becomes available or if the SIM validity changes which could indicate a SIM
swap.  I fixed this and all's working fine now, I'll forward my changes to
the ofono-qt maintainer.

Thanks again.

-- Brian



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SIM Insertion Notification
  2012-07-15 12:42   ` Brian Ruptash
@ 2012-07-15 16:01     ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2012-07-15 16:01 UTC (permalink / raw)
  To: ofono

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

Hi Brian,

> > > I'm running ofono 1.7, with a Cinterion PH8-P plugin I wrote and will
> > submit once I've fully tested it.  One problem I have is I never receive
> > notification of SIM insertion, i.e. the Present propertyChanged.  Looking
> > at the code it seems pretty obvious why, unless I'm (probably) missing
> > something.
> > >
> > > All the plugins, including mine, do similar to the following:
> > >
> > >      static void ph8_pre_sim(struct ofono_modem *modem)
> > >      {
> > >          struct ph8_data *data = ofono_modem_get_data(modem);
> > >          struct ofono_sim *sim;
> > >
> > >          ofono_devinfo_create(modem, 0, "atmodem", data->app);
> > >          sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION_PH8,
> > >                      "atmodem", data->app);
> > >
> > >          if (sim&&  data->have_sim == TRUE)
> > >              ofono_sim_inserted_notify(sim, TRUE);
> > >      }
> > >
> > > The call to ofono_sim_create() probes the atmodem driver, which ends
> > with:
> > >
> > >      g_idle_add(at_sim_register, sim);
> > >
> > > So the subsequent call to ofono_sim_inserted_notify() will fail, as
> > at_sim_register() is called later when it is scheduled.
> > >
> > > The logs bear this out, so I'm at a loss to understand how anyone
> > receives a SIM notification... What am I missing here?
> > 
> > Everything is working as it should, what exactly is the problem?  You
> > can call ofono_sim_inserted_notify before the atom is registered, but
> > that means the Present property will be 'True' when you perform the
> > initial GetProperties call.
> > 
> > This is meant for devices which do not support SIM hot-swap (e.g. most
> > USB devices and many earlier phones where the SIM is behind the battery).
> 
> Thanks for the clarification, Denis.  That's what started me looking at the
> Present propertyChanged, as I'd thought all property changes would be
> signalled without the need for a GetProperties first.
> 
> I'm using ofono-qt, and the only notifications I get are propertyChanged's
> for CardIdentifier, PreferredLanguages, SubscriberIdentity,
> MobileCountryCode and MobileNetworkCode.  I never get Present or any of the
> other properties.
> 
> Turns out it's a problem with ofono-qt; it only does a GetProperties once
> when instantiating the SimManager, which is most likely before the interface
> is even available.  It never does it again, including when the SIM interface
> becomes available or if the SIM validity changes which could indicate a SIM
> swap.  I fixed this and all's working fine now, I'll forward my changes to
> the ofono-qt maintainer.

coming to think about this, it is actually an issue with our API at this
moment. When you add a modem, we do send you the current properties with
it, but when just an interface gets added, we don't. We should give you
the current properties in one go as well.

The API is stable, so we can not fix this until the next major version,
but a switch to D-Bus ObjectManager would clearly make this a lot simple
for application developers. Something for oFono 2.x series.

Regards

Marcel



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-15 16:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-14 16:31 SIM Insertion Notification Ruptash, Brian
2012-07-14 11:02 ` Denis Kenzior
2012-07-15 12:42   ` Brian Ruptash
2012-07-15 16:01     ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.