[RFC, PATCH] only send when the AT-Command interpreter is ready
pHilipp Zabel
philipp.zabel at gmail.com
Thu Mar 29 16:40:11 CEST 2007
Harald,
could you comment on this? Not sure if this is the right way, but
gsmd still breaks if "AT-Command interpreter ready" is the first
string it gets about 300ms after opening the tty.
On 2/17/07, Philipp Zabel <philipp.zabel at gmail.com> wrote:
> This patch adds an "interpreter_ready" variable to the struct gsmd and
> makes sure commands are only sent once the interpreter is actually
> ready. This is needed for platforms where the interpreter is not yet
> ready when gsmd is started. For plaforms where the interpreter is ready
> to accept commands before gsmd is started, gsmd->interpreter_ready could
> be set to 1 in the vendor plugin initialization.
>
> Index: gsm/include/gsmd/gsmd.h
> ===================================================================
> --- gsm.orig/include/gsmd/gsmd.h 2007-02-17 13:48:24.000000000 +0100
> +++ gsm/include/gsmd/gsmd.h 2007-02-17 13:48:31.000000000 +0100
> @@ -57,6 +57,7 @@
>
> struct gsmd {
> unsigned int flags;
> + int interpreter_ready; /* AT-Command interpreter ready? */
> struct gsmd_fd gfd_uart;
> struct gsmd_fd gfd_sock;
> struct llparser llp;
> Index: gsm/src/gsmd/atcmd.c
> ===================================================================
> --- gsm.orig/src/gsmd/atcmd.c 2007-02-17 13:49:33.000000000 +0100
> +++ gsm/src/gsmd/atcmd.c 2007-02-17 13:52:23.000000000 +0100
> @@ -178,6 +178,7 @@
> DEBUGP("buf=`%s'(%d)\n", buf, len);
>
> if (!strcmp(buf, "AT-Command Interpreter ready")) {
> + g->interpreter_ready = 1;
> gsmd_initsettings(g);
> return 0;
> }
> @@ -357,7 +358,7 @@
> }
>
> /* write pending commands to UART */
> - if (what & GSMD_FD_WRITE) {
> + if ((what & GSMD_FD_WRITE) && g->interpreter_ready) {
> struct gsmd_atcmd *pos, *pos2;
> llist_for_each_entry_safe(pos, pos2, &g->pending_atcmds, list) {
> len = strlen(pos->buf);
> Index: gsm/src/gsmd/gsmd.c
> ===================================================================
> --- gsm.orig/src/gsmd/gsmd.c 2007-02-17 13:49:37.000000000 +0100
> +++ gsm/src/gsmd/gsmd.c 2007-02-17 13:51:00.000000000 +0100
> @@ -282,7 +282,8 @@
>
> gsmd_vendor_plugin_find(&g);
>
> - gsmd_initsettings(&g);
> + if (g.interpreter_ready)
> + gsmd_initsettings(&g);
>
> while (1) {
> int ret = gsmd_select_main();
>
>
>
More information about the gsmd-devel
mailing list