From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 2/2] atmodem: add serial line debugging to gatchat
Date: Wed, 05 Aug 2009 17:09:12 -0500 [thread overview]
Message-ID: <200908051709.12869.denkenz@gmail.com> (raw)
In-Reply-To: <20090805173313.450a0e20@mycelium.queued.net>
[-- Attachment #1: Type: text/plain, Size: 2312 bytes --]
Hi Andres,
> drivers/atmodem/atmodem.c | 13 ++++++++++++-
> gatchat/gatchat.c | 33 ++++++++++++++++++++++++++++++---
> gatchat/gatchat.h | 7 +++++--
> include/log.h | 5 +++++
> src/log.c | 39 +++++++++++++++++++++++++++++++++------
> src/main.c | 1 +
> 6 files changed, 86 insertions(+), 12 deletions(-)
Send two separate patches, one for gatchat related functionality. One for the
ofono integration.
> +static void g_at_chat_debug_log(GAtChat *chat, gboolean is_read,
> + char *str, gsize len)
I suggest you use const char *str here
> +{
> + char type = is_read ? '<' : '>';
> + char *tmp;
> +
> + if (!chat->debugf || !len)
> + return;
> +
> + if (len > 1024) {
> + /* let's keep it to a reasonable length.. */
> + chat->debugf("%c (ignoring string of length %d)\n", type, len);
27.007 specifies a max command result length of 2048, Section 5.1:
"the total number of characters, including line terminators, in the
information text shall not exceed 2048 characters."
> + return;
> + }
> +
> + str[len] = '\0'; /* XXX: is it safe to overwrite this byte? */
Probably not
> + tmp = g_strescape(str, "\"");
> + chat->debugf("%c %s\n", type, tmp);
> + g_free(tmp);
> +}
> +
> -GAtChat *g_at_chat_new(GIOChannel *channel, int flags)
> +GAtChat *g_at_chat_new(GIOChannel *channel, int flags, GAtDebugFunc
Lets make the debug function settable / gettable. I.e. something like:
g_at_chat_set_debug_info(GAtChat *chat, GAtDebugFunc *debugf, void *debugdata)
g_at_chat_get_debug_func(GAtChat *chat)
g_at_chat_get_debug_data(GAtChat *chat)
> GAtChat *g_at_chat_ref(GAtChat *chat)
> diff --git a/gatchat/gatchat.h b/gatchat/gatchat.h
> index 969f6f4..4353e08 100644
> --- a/gatchat/gatchat.h
> +++ b/gatchat/gatchat.h
> @@ -36,6 +36,8 @@ typedef void (*GAtResultFunc)(gboolean success, GAtResult
> *result, gpointer user_data);
> typedef void (*GAtNotifyFunc)(GAtResult *result, gpointer user_data);
> typedef void (*GAtDisconnectFunc)(gpointer user_data);
> +typedef void (*GAtDebugFunc)(const char *format, ...)
> + __attribute__((format(printf, 1, 2)));
>
make the signature a simple void (*foo)(const char *str, void *data);
Regards,
-Denis
next prev parent reply other threads:[~2009-08-05 22:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-05 21:33 [PATCH 2/2] atmodem: add serial line debugging to gatchat Andres Salomon
2009-08-05 22:09 ` Denis Kenzior [this message]
2009-08-06 5:21 ` Andres Salomon
2009-08-06 22:08 ` 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=200908051709.12869.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.