All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH v4 3/6] mbmmodem: add location-reporting driver implementation
Date: Wed, 23 Feb 2011 22:21:03 -0600	[thread overview]
Message-ID: <4D65DCAF.8070508@gmail.com> (raw)
In-Reply-To: <AANLkTin82oSxJrih9ZwidVSQCGvzoz7xNpdDEmud+FiQ@mail.gmail.com>

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

Hi Lucas,

On 02/23/2011 08:26 PM, Lucas De Marchi wrote:
> Hi Denis
> 
> On Wed, Feb 23, 2011 at 9:57 PM, Denis Kenzior <denkenz@gmail.com> wrote:
>> Hi Lucas,
>>
>>> +static int mbm_create_data_chat(struct ofono_location_reporting *lr)
>>> +{
>>> +     struct gps_data *gd = ofono_location_reporting_get_data(lr);
>>> +     struct ofono_modem *modem;
>>> +     const char *gps_dev;
>>> +     GAtSyntax *syntax;
>>> +     GIOChannel *channel;
>>> +     int fd;
>>> +
>>> +     modem = ofono_location_reporting_get_modem(lr);
>>> +     gps_dev = ofono_modem_get_string(modem, "GPSDevice");
>>> +
>>> +     channel = g_at_tty_open(gps_dev, NULL);
>>> +     if (channel == NULL)
>>> +             return -1;
>>> +
>>> +     syntax = g_at_syntax_new_gsm_permissive();
>>> +     gd->data_chat = g_at_chat_new(channel, syntax);
>>> +     fd = g_io_channel_unix_get_fd(channel);
>>> +
>>> +     g_at_syntax_unref(syntax);
>>> +     g_io_channel_unref(channel);
>>> +
>>> +     if (gd->data_chat == NULL)
>>> +             return -1;
>>> +
>>> +     return fd;
>>> +}
>>> +
>>
>> Why do you bother creating a GAtChat for the NMEA port?  It seems that a
>> GIOChannel or a simple fd would be enough.
> 
> This is because of this line:
> 
> +       if (g_at_chat_send(gd->data_chat, "AT*E2GPSNPD", NULL, NULL, NULL,
> +                                                               NULL) > 0) {
> 
> AT*E2GPSNPD is sent on the tty that will contain the nmea stream, not
> the control one.
> 

Then I'm confused how this even works.  The GAtChat is installing its
own IO watches on this channel and would be reading from the stream.
Wouldn't this cause you to have a race between the location reporting
client and ofono itself?

Maybe you should be sending the E2GPSNPD, unrefing the data_chat and
then sending the fd upwards?

>> Also, what happens if the channel is hupped by the modem?  Shouldn't we
>> have a watch in the core for that and set Enabled accordingly?
> 
> Humn... maybe. Though client should have called Release(). Otherwise,
> isn't the Release() method superfluous?
> 

Assuming the client is well behaved..

Also, what are we doing with the open socket if oFono is forcefully shut
down?  Shouldn't we shut it down as well?

Regards,
-Denis

  reply	other threads:[~2011-02-24  4:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-22 18:35 [PATCH v4 0/6] Add location-reporting atom Lucas De Marchi
2011-02-22 18:35 ` [PATCH v4 1/6] location-reporting: add public header Lucas De Marchi
2011-02-22 18:35 ` [PATCH v4 2/6] location-reporting: add atom implementation Lucas De Marchi
2011-02-22 18:35 ` [PATCH v4 3/6] mbmmodem: add location-reporting driver implementation Lucas De Marchi
2011-02-24  0:57   ` Denis Kenzior
2011-02-24  2:26     ` Lucas De Marchi
2011-02-24  4:21       ` Denis Kenzior [this message]
2011-02-22 18:35 ` [PATCH v4 4/6] mbm: add location-reporting atom Lucas De Marchi
2011-02-22 18:35 ` [PATCH v4 5/6] udev: add location-reporting device to mbm Lucas De Marchi
2011-02-22 18:35 ` [PATCH v4 6/6] location-reporting: add documentation Lucas De Marchi
2011-02-24  0:55 ` [PATCH v4 0/6] Add location-reporting atom 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=4D65DCAF.8070508@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 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.