All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH V2 2/4] voicecall: add ATD support for HFP emulator
Date: Wed, 25 May 2011 06:16:22 -0500	[thread overview]
Message-ID: <4DDCE506.1040406@gmail.com> (raw)
In-Reply-To: <1305884461-4476-3-git-send-email-frederic.danis@linux.intel.com>

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

Hi Frédéric,

<snip>

> +static void emulator_dial_callback(const struct ofono_error *error, void *data)
> +{
> +	struct ofono_voicecall *vc = data;
> +	const char *number = NULL;
> +	gboolean need_to_emit;
> +	struct voicecall *v;
> +
> +	v = dial_handle_result(vc, error, number, &need_to_emit);
> +
> +	if (v == NULL) {
> +		struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
> +
> +		if (is_emergency_number(vc, number) == TRUE)
> +			__ofono_modem_dec_emergency_mode(modem);
> +	}
> +
> +	if (need_to_emit)
> +		voicecalls_emit_call_added(vc, v);
> +}
> +
> +static void emulator_dial(struct ofono_emulator *em, struct ofono_voicecall *vc,
> +				const char *number)
> +{
> +	struct ofono_error result;
> +	int err;
> +
> +	result.error = 0;
> +
> +	if (number == NULL || number[0] == '\0') {
> +		result.type = OFONO_ERROR_TYPE_FAILURE;
> +		goto send;
> +	}
> +
> +	err = voicecall_dial(vc, number, OFONO_CLIR_OPTION_DEFAULT,
> +					emulator_dial_callback, vc);
> +	switch (err) {
> +	case 0:
> +		result.type = OFONO_ERROR_TYPE_NO_ERROR;
> +		break;
> +

Actually you can't do this.  There are bizarre circumstances where the
dial callback will be called synchronously, so even though all
conditions in voicecall_dial are satisfied and it returns 0, the modem
driver still fails to dispatch the ATD.  In which case you will
erroneously return OK.

e.g.:

voicecall_dial ->
	at_modem_dial ->
		emulator_dial_callback
voicecall_dial

you have to be also careful of the timing of the ofono_voicecall_notify
events and the ATD callback.  You should not report cind until you have
sent the final response to the ATD.

Regards,
-Denis

  reply	other threads:[~2011-05-25 11:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-20  9:40 [PATCH V2 0/4] Add dial support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-05-20  9:40 ` [PATCH V2 1/4] voicecall: create generic dial function =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-05-25 10:59   ` Denis Kenzior
2011-05-20  9:40 ` [PATCH V2 2/4] voicecall: add ATD support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-05-25 11:16   ` Denis Kenzior [this message]
2011-05-20  9:41 ` [PATCH V2 3/4] voicecall: save last dialed number =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-05-25 11:19   ` Denis Kenzior
2011-05-20  9:41 ` [PATCH V2 4/4] voicecall: add +BLDN support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis

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=4DDCE506.1040406@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.