From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 2/4][RFC] gatchat: Allow cancelling a running command.
Date: Thu, 29 Apr 2010 21:53:49 -0500 [thread overview]
Message-ID: <201004292153.49983.denkenz@gmail.com> (raw)
In-Reply-To: <1272540754-19028-1-git-send-email-andrew.zaborowski@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2290 bytes --]
Hi Andrew,
> Users need to be extra careful using the cancel functions because
> there's a potential race condition where an OK or ERROR for the command
> being cancelled arrives just the same moment the next command in the
> queue is being submitted, and is treated as a response to that command.
This is why this is just a really bad idea. The only one I think we should
cancel (and most vendors support reliably) is an ATD...
Are you sure your CSIM STATUS poll would actually time out or would the modem
return a +CME/+CMS error? In the end the modem does this polling itself...
> @@ -1040,18 +1041,20 @@ gboolean g_at_chat_cancel(GAtChat *chat, guint id)
> if (!l)
> return FALSE;
>
> - if (l == g_queue_peek_head(chat->command_queue) &&
> - chat->cmd_bytes_written > 0) {
> - struct at_command *c = l->data;
> + head = l->data == g_queue_peek_head(chat->command_queue);
>
> - /* We can't actually remove it since it is most likely
> - * already in progress, just null out the callback
> - * so it won't be called
> - */
> - c->callback = NULL;
> - } else {
> - at_command_destroy(l->data);
> - g_queue_remove(chat->command_queue, l->data);
> + at_command_destroy(l->data);
> + g_queue_remove(chat->command_queue, l->data);
> +
> + if (head) {
> + chat->cmd_bytes_written = 0;
> +
> + g_slist_foreach(chat->response_lines, (GFunc)g_free, NULL);
> + g_slist_free(chat->response_lines);
> + chat->response_lines = NULL;
> +
> + if (g_queue_get_length(chat->command_queue) > 0)
> + chat_wakeup_writer(chat);
Quoting V.250 5.6.1:
"Some action commands that require time to execute may be aborted while in
progress; these are explicitly noted in the description of the command.
Aborting of commands is accomplished by the transmission from the DTE to the
DCE of any character. A single character shall be sufficient to abort the
command in progress; however, characters transmitted during the first 125
milliseconds after transmission of the termination character shall be ignored
(to allow for the DTE to append additional control characters such as line
feed after the command line termination character)."
Sounds like your device's AT parser is 'not quite' compliant ;)
Regards,
-Denis
next prev parent reply other threads:[~2010-04-30 2:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-29 11:32 [PATCH 2/4][RFC] gatchat: Allow cancelling a running command Andrzej Zaborowski
2010-04-30 2:53 ` Denis Kenzior [this message]
2010-05-03 16:40 ` Andrzej Zaborowski
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=201004292153.49983.denkenz@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.