summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-07-15 15:44:23 -0500
committerDenis Kenzior <denkenz@gmail.com>2009-07-15 15:51:33 -0500
commit86864c819c0b9ef7bd98c97224ac7732f280b3be (patch)
treeae044665135e94fcb07178ef36166b63aa001f77
parenta90d89e8c165fe61c364157349443eb68bb098fe (diff)
downloadofono-86864c819c0b9ef7bd98c97224ac7732f280b3be.tar.bz2
Add extra_pdu_crlf quirk
-rw-r--r--gatchat/gatchat.c10
-rw-r--r--gatchat/gatchat.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c
index 3c21e068..616f843a 100644
--- a/gatchat/gatchat.c
+++ b/gatchat/gatchat.c
@@ -675,7 +675,15 @@ static void new_bytes(GAtChat *p)
len -= p->read_so_far;
wrap -= p->read_so_far;
- have_pdu(p);
+ /* Some modems like the TI Calypso send a CMT style
+ * notification with an extra CRLF thrown in
+ */
+ if ((p->flags & G_AT_CHAT_FLAG_EXTRA_PDU_CRLF) &&
+ p->read_so_far == 2) {
+ p->state = PARSER_STATE_PDU;
+ ring_buffer_drain(p->buf, p->read_so_far);
+ } else
+ have_pdu(p);
p->read_so_far = 0;
} else if (p->state == PARSER_STATE_INITIAL_CR) {
diff --git a/gatchat/gatchat.h b/gatchat/gatchat.h
index ff0994b1..969f6f46 100644
--- a/gatchat/gatchat.h
+++ b/gatchat/gatchat.h
@@ -39,6 +39,7 @@ typedef void (*GAtDisconnectFunc)(gpointer user_data);
enum _GAtChatFlags {
G_AT_CHAT_FLAG_NO_LEADING_CRLF = 1, /* Some emulators are broken */
+ G_AT_CHAT_FLAG_EXTRA_PDU_CRLF = 2,
};
typedef enum _GAtChatFlags GAtChatFlags;