From 00361c2946aef3975e302d5a5957ae239da21de8 Mon Sep 17 00:00:00 2001 From: laforge Date: Thu, 16 Aug 2007 04:16:26 +0000 Subject: From: Andrzej Zaborowski Date: Wed, 11 Jul 2007 16:03:16 +0200 Subject: [PATCH] Multiline commands support. Miscellaneous bugs. This adds support for commands like +CMGS and +CMGW that span mroe than one line and the lines can't be sent to modem as separate commands because every next line has to wait for a "> " prompt from modem before writing (otherwise beginnings of the lines get eaten). This patch also corrects a number of miscellaneous glitches that I have hit. I can split them each out if needed, but they are all quite obvious. The cms_error variable is introduced because there are CME and possibly other errors with the same codes, which resulted in that when I was sending a message and got error 42 ("congestion") on sending, openmoko-dialer asked for PIN because CMS event 42 happens to be PIN inquiry. The change in libgsmd-tool fixes the issue described by Philipp Zabel on the list, with usock locking up. git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2709 99fdad57-331a-0410-800a-d7fa5415bdb3 --- include/gsmd/gsmd.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/gsmd/gsmd.h b/include/gsmd/gsmd.h index 0ce753b..4362999 100644 --- a/include/gsmd/gsmd.h +++ b/include/gsmd/gsmd.h @@ -27,6 +27,7 @@ struct gsmd_atcmd { u_int32_t buflen; u_int16_t id; u_int8_t flags; + char *cur; char buf[]; }; @@ -36,6 +37,8 @@ enum llparse_state { LLPARSE_STATE_IDLE_LF, /* LF before response (V1) */ LLPARSE_STATE_RESULT, /* within result payload */ LLPARSE_STATE_RESULT_CR, /* CR after result */ + LLPARSE_STATE_PROMPT, /* within a "> " prompt */ + LLPARSE_STATE_PROMPT_SPC, /* a complete "> " prompt */ LLPARSE_STATE_ERROR, /* something went wrong */ /* ... idle again */ }; @@ -52,6 +55,7 @@ struct llparser { unsigned int flags; void *ctx; int (*cb)(const char *buf, int len, void *ctx); + int (*prompt_cb)(void *ctx); char *cur; char buf[LLPARSE_BUF_SIZE]; }; @@ -92,7 +96,8 @@ struct gsmd_user { extern int gsmdlog_init(const char *path); /* write a message to the daemons' logfile */ -void __gsmd_log(int level, const char *file, int line, const char *function, const char *message, ...); +void __gsmd_log(int level, const char *file, int line, const char *function, const char *message, ...) + __attribute__ ((__format__ (__printf__, 5, 6))); /* macro for logging including filename and line number */ #define gsmd_log(level, format, args ...) \ __gsmd_log(level, __FILE__, __LINE__, __FUNCTION__, format, ## args) -- cgit v1.2.3