From 90bf3b4473da30d8b89c8ecfabcce42c0e4fe484 Mon Sep 17 00:00:00 2001 From: laforge Date: Fri, 17 Aug 2007 08:30:42 +0000 Subject: From: Andrzej Zaborowski Date: Fri, 27 Jul 2007 14:29:44 +0200 Subject: [PATCH] Multiline unsolicited responses parsing. +CMT, +CBM and +CDS responses two lines long in PDU mode and the parser has problem with them. As it was mentioned earlier there's no way for the parser to know if a new line is part of the most recent command response or unsolicited response, or a completely new unsolicited response, without looking at the contents of the first line. My idea is that the parser for the particular response decides if the response is too short, and returns -EAGAIN in which case the AT parser will append the following line to the response and resubmit it to the response parser. The disadvantage is that the generic parser gets one more special case to remember about, but it works quite well, hopefully there are no more cases where we will need to modify the parser. (We may need to use a separate multiline buffer (like the current mlbuf variable) to account for situations when a multiline unsolicited response comes in the middle of receiving a different response, which is also possible. Also, mlbuf should probably be moved into the parser state struct instead of being a global). This patch also moves initialisation of SMS options to after we are registered to the network, so that we don't get errors from the modem. Perhaps we want to have a dynamic list of callbacks to call on succesfull registration. Among other changes also prevents setting dev_state.on if the radio powering-on fails. --- include/gsmd/event.h | 8 +++++ include/gsmd/sms.h | 1 + src/gsmd/atcmd.c | 26 +++++++++++++++++ src/gsmd/sms_cb.c | 73 ++++++++++++++++++++++++------------------------ src/gsmd/unsolicited.c | 8 +++++ src/gsmd/usock.c | 21 ++++++++++++-- src/util/event.c | 10 +++---- 7 files changed, 103 insertions(+), 44 deletions(-) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2722 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/util/event.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/util') diff --git a/src/util/event.c b/src/util/event.c index 209d34b..f98c7da 100644 --- a/src/util/event.c +++ b/src/util/event.c @@ -60,19 +60,19 @@ static int netreg_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxda printf("EVENT: Netreg "); switch (aux->u.netreg.state) { - case 0: + case GSMD_NETREG_UNREG: printf("not searching for network "); break; - case 1: + case GSMD_NETREG_REG_HOME: printf("registered (home network) "); break; - case 2: + case GSMD_NETREG_UNREG_BUSY: printf("searching for network "); break; - case 3: + case GSMD_NETREG_DENIED: printf("registration denied "); break; - case 5: + case GSMD_NETREG_REG_ROAMING: printf("registered (roaming) "); break; } -- cgit v1.2.3