diff options
Diffstat (limited to 'packages')
40 files changed, 1119 insertions, 281 deletions
diff --git a/packages/file/file-native_4.21.bb b/packages/file/file-native_4.21.bb index 59535dd518..734891d18d 100644 --- a/packages/file/file-native_4.21.bb +++ b/packages/file/file-native_4.21.bb @@ -1,6 +1,6 @@ require file_${PV}.bb inherit native -DEPENDS = "" +DEPENDS = "zlib-native" PR = "r0" SRC_URI += "file://native-fix.diff;patch=1" diff --git a/packages/libmikey/.mtn2git_empty b/packages/gnash/.mtn2git_empty index e69de29bb2..e69de29bb2 100644 --- a/packages/libmikey/.mtn2git_empty +++ b/packages/gnash/.mtn2git_empty diff --git a/packages/gnash/gnash_0.8.0.bb b/packages/gnash/gnash_0.8.0.bb new file mode 100644 index 0000000000..197cea06b6 --- /dev/null +++ b/packages/gnash/gnash_0.8.0.bb @@ -0,0 +1,79 @@ +DESCRIPTION = "Gnash is a GNU Flash movie player that supports many SWF v7 features" + +LICENSE = "GPL-2" +HOMEPAGE = "http://www.gnu.org/software/gnash" + +DEPENDS = "gtk+ cairo libxml2 libmad libsdl-mixer zlib boost jpeg pango curl" + +SRC_URI = "ftp://ftp.gnu.org/pub/gnu/gnash/${PV}/gnash-${PV}.tar.bz2" + + +EXTRA_OECONF = "--enable-gui=gtk \ + --enable-renderer=cairo \ + --enable-media=none \ + --disable-klash \ + --enable-z \ + --enable-jpeg \ + --disable-glext \ + --enable-Xft \ + --enable-expat \ + --enable-mad \ + --enable-cairo \ + --disable-plugin \ + --disable-cygnal \ + --with-boost-incl=${STAGING_INCDIR} \ + --with-boost-lib=${STAGING_LIBDIR} \ + --with-libxml-incl=${STAGING_INCDIR}/libxml2 \ + --with-libxml-lib=${STAGING_LIBDIR} \ + --with-glib-incl=${STAGING_INCDIR}/glib-2.0 \ +# --with-glib-lib=${STAGING_LIBDIR} \ + --with-gtk2-incl=${STAGING_INCDIR}/gtk-2.0 \ + --with-pango-incl=${STAGING_INCDIR}/pango-1.0 \ +# --with-pango-lib=${STAGING_LIBDIR} \ + --with-sdl-incl=${STAGING_INCDIR}/SDL \ + --with-atk-incl=${STAGING_INCDIR}/atk-1.0 \ + --with-Xft-incl=${STAGING_INCDIR}/X11 \ + --with-expat-incl=${STAGING_INCDIR} \ + --with-mad-incl=${STAGING_INCDIR} \ + --with-cairo-incl=${STAGING_INCDIR}/cairo \ + --with-curl-incl=${STAGING_INCDIR} \ + --with-curl-lib=${STAGING_LIBDIR} \ + " + +inherit autotools pkgconfig + +LDFLAGS += " -L${STAGING_LIBDIR} -lcurl -lboost_date_time -lboost_filesystem -lboost_iostreams -lboost_signals -lboost_thread-mt " +CFLAGS += " -I${STAGING_INCDIR} -I${STAGING_LIBDIR}/gtk-2.0/include/ " + +do_configure_append() { + for i in `find . -name Makefile` ; do + sed -i s:I/usr/include:I${STAGING_INCDIR}:g $i + done +} + + +PARALLEL_MAKE = "" + +do_compile() { + oe_runmake 'CC=${CC}' 'LD=${LD}' 'CFLAGS=${CFLAGS}' \ + 'ZLIB_INCLUDE=${STAGING_INCDIR}' \ + 'ZLIB_LIBS=${STAGING_LIBDIR}' \ + 'PNG_INCLUDE=${STAGING_INCDIR}' \ + 'PNG_LIBS=${STAGING_LIBDIR}' +} + + +PACKAGES =+ " libgnashamf libgnashbackend libgnashbase libgnashgeo libgnashgui libgnashplayer libgnashserver " + +FILES_libgnashamf = "${libdir}/libgnashamf-${PV}.so" +FILES_libgnashbackend = "${libdir}/libgnashbackend-${PV}.so" +FILES_libgnashbase = "${libdir}/libgnashbase-${PV}.so" +FILES_libgnashgeo = "${libdir}/libgnashgeo-${PV}.so" +FILES_libgnashgui = "${libdir}/libgnashgui-${PV}.so" +FILES_libgnashplayer = "${libdir}/libgnashplayer-${PV}.so" +FILES_libgnashserver = "${libdir}/libgnashserver-${PV}.so" + +do_stage() { + autotools_stage_all +} + diff --git a/packages/gsm/files/alive-start-if-interpreter-ready.patch b/packages/gsm/files/alive-start-if-interpreter-ready.patch deleted file mode 100644 index 20104d2e3f..0000000000 --- a/packages/gsm/files/alive-start-if-interpreter-ready.patch +++ /dev/null @@ -1,39 +0,0 @@ -Index: gsm/src/gsmd/atcmd.c -=================================================================== ---- gsm.orig/src/gsmd/atcmd.c 2007-06-03 13:24:44.000000000 +0200 -+++ gsm/src/gsmd/atcmd.c 2007-06-03 13:24:46.000000000 +0200 -@@ -185,6 +185,7 @@ - !strcmp(buf, "AT-Command Interpreter ready")) { - g->interpreter_ready = 1; - gsmd_initsettings(g); -+ gmsd_alive_start(g); - return 0; - } - -Index: gsm/src/gsmd/gsmd.c -=================================================================== ---- gsm.orig/src/gsmd/gsmd.c 2007-06-03 13:22:02.000000000 +0200 -+++ gsm/src/gsmd/gsmd.c 2007-06-03 13:22:56.000000000 +0200 -@@ -128,7 +128,7 @@ - gsmd_timer_register(tmr); - } - --static int gmsd_alive_start(struct gsmd *gsmd) -+int gmsd_alive_start(struct gsmd *gsmd) - { - struct timeval tv; - -@@ -478,10 +478,11 @@ - /* select a vendor plugin */ - gsmd_vendor_plugin_find(&g); - -- if (g.interpreter_ready) -+ if (g.interpreter_ready) { - gsmd_initsettings(&g); - -- gmsd_alive_start(&g); -+ gmsd_alive_start(&g); -+ } - - gsmd_opname_init(&g); - diff --git a/packages/gsm/files/libgsmd-tool-fix.patch b/packages/gsm/files/libgsmd-tool-fix.patch new file mode 100644 index 0000000000..8938f5a682 --- /dev/null +++ b/packages/gsm/files/libgsmd-tool-fix.patch @@ -0,0 +1,19 @@ +Index: gsm/src/util/atcmd.c +=================================================================== +--- gsm.orig/src/util/atcmd.c 2007-07-31 11:44:32.000000000 +0200 ++++ gsm/src/util/atcmd.c 2007-07-31 11:46:44.000000000 +0200 +@@ -91,9 +91,11 @@ + continue; + } + printf("STR=`%s'\n", buf); ++ ++ /* this is a synchronous call for a passthrough ++ * command */ ++ lgsm_passthrough(lgsmh, buf, rbuf, &rlen); ++ printf("RSTR=`%s'\n", rbuf); + } +- /* this is a synchronous call for a passthrough command */ +- lgsm_passthrough(lgsmh, buf, rbuf, &rlen); +- printf("RSTR=`%s'\n", rbuf); + } + } diff --git a/packages/gsm/files/mlbuf-in-gsmd-struct.patch b/packages/gsm/files/mlbuf-in-gsmd-struct.patch new file mode 100644 index 0000000000..d46eae8bb3 --- /dev/null +++ b/packages/gsm/files/mlbuf-in-gsmd-struct.patch @@ -0,0 +1,102 @@ +Index: gsm/include/gsmd/gsmd.h +=================================================================== +--- gsm.orig/include/gsmd/gsmd.h 2007-07-31 14:07:47.000000000 +0200 ++++ gsm/include/gsmd/gsmd.h 2007-07-31 14:09:02.000000000 +0200 +@@ -74,6 +74,8 @@ + struct gsmd_device_state dev_state; + + struct llist_head operators; /* cached list of operator names */ ++ unsigned int mlbuf_len; ++ unsigned char *mlbuf; /* ml_parse buffer */ + }; + + struct gsmd_user { +Index: gsm/src/gsmd/atcmd.c +=================================================================== +--- gsm.orig/src/gsmd/atcmd.c 2007-07-31 14:06:49.000000000 +0200 ++++ gsm/src/gsmd/atcmd.c 2007-07-31 14:12:33.000000000 +0200 +@@ -175,9 +175,7 @@ + { + struct gsmd *g = ctx; + struct gsmd_atcmd *cmd = NULL; +- static char mlbuf[MLPARSE_BUF_SIZE]; + int rc = 0, final = 0; +- int mlbuf_len; + + DEBUGP("buf=`%s'(%d)\n", buf, len); + +@@ -273,15 +271,15 @@ + + /* it might be a multiline response, so if there's a previous + response, send out mlbuf and start afresh with an empty buffer */ +- if (mlbuf[0] != 0) { ++ if (g->mlbuf[0] != 0) { + if (!cmd->cb) { + gsmd_log(GSMD_NOTICE, "command without cb!!!\n"); + } else { + DEBUGP("Calling cmd->cb()\n"); +- cmd->resp = mlbuf; ++ cmd->resp = g->mlbuf; + rc = cmd->cb(cmd, cmd->ctx, cmd->resp); + DEBUGP("Clearing mlbuf\n"); +- mlbuf[0] = 0; ++ g->mlbuf[0] = 0; + } + } + +@@ -334,16 +332,16 @@ + /* we reach here, if we are at an information response that needs to be + * passed on */ + +- if (mlbuf[0] == 0) { ++ if (g->mlbuf[0] == 0) { + DEBUGP("Filling mlbuf\n"); +- strncat(mlbuf, buf, sizeof(mlbuf)-1); ++ strncat(g->mlbuf, buf, MLPARSE_BUF_SIZE-1); + } else { + DEBUGP("Appending buf to mlbuf\n"); +- mlbuf_len = strlen(mlbuf); +- if (mlbuf_len+1 < sizeof(mlbuf)) { +- mlbuf[mlbuf_len] = '\n'; +- mlbuf[mlbuf_len+1] = '\0'; +- strncat(mlbuf, buf, sizeof(mlbuf)-mlbuf_len-2); ++ g->mlbuf_len = strlen(g->mlbuf); ++ if (g->mlbuf_len+1 < MLPARSE_BUF_SIZE) { ++ g->mlbuf[g->mlbuf_len] = '\n'; ++ g->mlbuf[g->mlbuf_len+1] = '\0'; ++ strncat(g->mlbuf, buf, MLPARSE_BUF_SIZE-g->mlbuf_len-2); + } else { + DEBUGP("response too big for mlbuf!!!\n"); + return -EFBIG; +@@ -365,13 +363,13 @@ + } else { + DEBUGP("Calling final cmd->cb()\n"); + /* send final result code if there is no information response in mlbuf */ +- if (mlbuf[0] == 0) ++ if (g->mlbuf[0] == 0) + cmd->resp = buf; + else +- cmd->resp = mlbuf; ++ cmd->resp = g->mlbuf; + rc = cmd->cb(cmd, cmd->ctx, cmd->resp); + DEBUGP("Clearing mlbuf\n"); +- mlbuf[0] = 0; ++ g->mlbuf[0] = 0; + } + + /* remove from list of currently executing cmds */ +Index: gsm/src/gsmd/gsmd.c +=================================================================== +--- gsm.orig/src/gsmd/gsmd.c 2007-07-31 14:06:47.000000000 +0200 ++++ gsm/src/gsmd/gsmd.c 2007-07-31 14:06:50.000000000 +0200 +@@ -300,6 +300,10 @@ + { + INIT_LLIST_HEAD(&g->users); + ++ g->mlbuf = talloc_array(gsmd_tallocs, unsigned char, MLPARSE_BUF_SIZE); ++ if (!g->mlbuf) ++ return -ENOMEM; ++ + return 0; + } + diff --git a/packages/gsm/files/sms-hacks.patch b/packages/gsm/files/sms-hacks.patch new file mode 100644 index 0000000000..ba248449af --- /dev/null +++ b/packages/gsm/files/sms-hacks.patch @@ -0,0 +1,820 @@ +From 3e5832569d3b29a90b29b5d5ac0ffad4765bcff3 Mon Sep 17 00:00:00 2001 +From: Andrzej Zaborowski <balrog@zabor.org> +Date: Fri, 6 Jul 2007 06:55:12 +0200 +Subject: [PATCH] SMS hacks 2 + +--- + include/gsmd/gsmd.h | 8 ++- + include/gsmd/usock.h | 35 ++++++++- + include/gsmd/vendorplugin.h | 2 +- + include/libgsmd/sms.h | 2 +- + src/gsmd/atcmd.c | 130 +++++++++++++++++++------------- + src/gsmd/sms_cb.c | 19 ++++- + src/gsmd/usock.c | 175 +++++++++++++++++++++++++++++++++++++----- + src/gsmd/vendor_ti.c | 2 +- + src/libgsmd/libgsmd_sms.c | 26 +++++-- + 11 files changed, 320 insertions(+), 91 deletions(-) + +Index: gsm/include/gsmd/gsmd.h +=================================================================== +--- gsm.orig/include/gsmd/gsmd.h 2007-07-31 14:09:02.000000000 +0200 ++++ gsm/include/gsmd/gsmd.h 2007-07-31 14:23:32.000000000 +0200 +@@ -27,6 +27,7 @@ + u_int32_t buflen; + u_int16_t id; + u_int8_t flags; ++ char *cur; + char buf[]; + }; + +@@ -36,6 +37,8 @@ + 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 @@ + 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]; + }; +@@ -59,6 +63,7 @@ + struct gsmd; + + #define GSMD_FLAG_V0 0x0001 /* V0 responses to be expected from TA */ ++#define GSMD_FLAG_SMS_FMT 0x0002 /* Use TEXT rather than PDU mode */ + + struct gsmd { + unsigned int flags; +@@ -94,7 +99,8 @@ + + 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) +Index: gsm/include/gsmd/usock.h +=================================================================== +--- gsm.orig/include/gsmd/usock.h 2007-07-31 13:58:37.000000000 +0200 ++++ gsm/include/gsmd/usock.h 2007-07-31 14:23:32.000000000 +0200 +@@ -139,7 +139,7 @@ + /* for SMS-SUBMIT, SMS-DELIVER */ + enum gsmd_sms_tp_udhi { + GSMD_SMS_TP_UDHI_NO_HEADER = (0<<6), +- GSMD_SMS_TP_UDHI_WTIH_HEADER = (1<<6), ++ GSMD_SMS_TP_UDHI_WITH_HEADER = (1<<6), + }; + + /* SMS delflg from 3GPP TS 07.05, Clause 3.5.4 */ +@@ -160,6 +160,34 @@ + GSMD_PHONEBOOK_GET_SUPPORT = 6, + }; + ++/* Type-of-Address, Numbering Plan Identification field */ ++enum gsmd_toa_npi { ++ GSMD_TOA_NPI_UNKNOWN = 0x0, ++ GSMD_TOA_NPI_ISDN = 0x1, ++ GSMD_TOA_NPI_DATA = 0x3, ++ GSMD_TOA_NPI_TELEX = 0x4, ++ GSMD_TOA_NPI_NATIONAL = 0x8, ++ GSMD_TOA_NPI_PRIVATE = 0x9, ++ GSMD_TOA_NPI_ERMES = 0xa, ++ GSMD_TOA_NPI_RESERVED = 0xf, ++}; ++ ++/* Type-of-Address, Type-of-Number field */ ++enum gsmd_toa_ton { ++ GSMD_TOA_TON_UNKNOWN = (0<<4), ++ GSMD_TOA_TON_INTERNATIONAL = (1<<4), ++ GSMD_TOA_TON_NATIONAL = (2<<4), ++ GSMD_TOA_TON_NETWORK = (3<<4), ++ GSMD_TOA_TON_SUBSCRIBER = (4<<4), ++ GSMD_TOA_TON_ALPHANUMERIC = (5<<4), ++ GSMD_TOA_TON_ABBREVIATED = (6<<4), ++}; ++ ++/* Type-of-Address, bit 7 always 1 */ ++enum gsmd_toa_reserved { ++ GSMD_TOA_RESERVED = (1<<7), ++}; ++ + /* Length from 3GPP TS 04.08, Clause 10.5.4.7 */ + + #define GSMD_ADDR_MAXLEN 32 +@@ -269,6 +297,11 @@ + char user_data[140]; + } __attribute__ ((packed)); + ++struct gsmd_sms_send { ++ struct gsmd_addr addr; ++ struct gsmd_sms payload; ++}; ++ + /* Refer to GSM 07.07 subclause 8.12 */ + struct gsmd_phonebook_readrg { + u_int8_t index1; +Index: gsm/include/gsmd/vendorplugin.h +=================================================================== +--- gsm.orig/include/gsmd/vendorplugin.h 2007-07-31 13:58:38.000000000 +0200 ++++ gsm/include/gsmd/vendorplugin.h 2007-07-31 14:23:32.000000000 +0200 +@@ -12,7 +12,7 @@ + struct gsmd_vendor_plugin { + struct llist_head list; + unsigned char *name; +- unsigned char *ext_chars; ++ char *ext_chars; + unsigned int num_unsolicit; + const struct gsmd_unsolicit *unsolicit; + int (*detect)(struct gsmd *g); +Index: gsm/include/libgsmd/sms.h +=================================================================== +--- gsm.orig/include/libgsmd/sms.h 2007-07-31 13:58:38.000000000 +0200 ++++ gsm/include/libgsmd/sms.h 2007-07-31 14:23:32.000000000 +0200 +@@ -83,7 +83,7 @@ + extern int lgsmd_sms_send(struct lgsm_handle *lh, const struct lgsm_sms *sms); + + /* Write Message to Memory */ +-extern int lgsmd_sms_write(struct lgsm_handle *lh, ++extern int lgsmd_sms_write(struct lgsm_handle *lh, + const struct lgsm_sms_write *sms_write); + + /* Packing of 7-bit characters, refer to GSM 03.38 subclause 6.1.2.1.1 */ +Index: gsm/src/gsmd/atcmd.c +=================================================================== +--- gsm.orig/src/gsmd/atcmd.c 2007-07-31 14:13:00.000000000 +0200 ++++ gsm/src/gsmd/atcmd.c 2007-07-31 14:23:32.000000000 +0200 +@@ -82,9 +82,12 @@ + + switch (llp->state) { + case LLPARSE_STATE_IDLE: ++ case LLPARSE_STATE_PROMPT_SPC: + if (llp->flags & LGSM_ATCMD_F_EXTENDED) { + if (byte == '\r') + llp->state = LLPARSE_STATE_IDLE_CR; ++ else if (byte == '>') ++ llp->state = LLPARSE_STATE_PROMPT; + else { + #ifdef STRICT + llp->state = LLPARSE_STATE_ERROR; +@@ -108,6 +111,8 @@ + /* can we really go directly into result_cr ? */ + if (byte == '\r') + llp->state = LLPARSE_STATE_RESULT_CR; ++ else if (byte == '>') ++ llp->state = LLPARSE_STATE_PROMPT; + else { + llp->state = LLPARSE_STATE_RESULT; + ret = llparse_append(llp, byte); +@@ -127,6 +132,16 @@ + memset(llp->buf, 0, LLPARSE_BUF_SIZE); + } + break; ++ case LLPARSE_STATE_PROMPT: ++ if (byte == ' ') ++ llp->state = LLPARSE_STATE_PROMPT_SPC; ++ else { ++ /* this was not a real "> " prompt */ ++ llparse_append(llp, '>'); ++ ret = llparse_append(llp, byte); ++ llp->state = LLPARSE_STATE_RESULT; ++ } ++ break; + case LLPARSE_STATE_ERROR: + break; + } +@@ -147,6 +162,10 @@ + /* FIXME: what to do with return value ? */ + llp->cb(llp->buf, llp->cur - llp->buf, llp->ctx); + } ++ ++ /* if a full SMS-style prompt was received, poke the select */ ++ if (llp->state == LLPARSE_STATE_PROMPT_SPC) ++ llp->prompt_cb(llp->ctx); + } + + return 0; +@@ -175,7 +194,7 @@ + { + struct gsmd *g = ctx; + struct gsmd_atcmd *cmd = NULL; +- int rc = 0, final = 0; ++ int rc = 0; + + DEBUGP("buf=`%s'(%d)\n", buf, len); + +@@ -229,7 +248,6 @@ + DEBUGP("error number %lu\n", err_nr); + if (cmd) + cmd->ret = err_nr; +- final = 1; + goto final_cb; + } + if (!strncmp(buf+1, "CMS ERROR", 9)) { +@@ -239,7 +257,6 @@ + DEBUGP("error number %lu\n", err_nr); + if (cmd) + cmd->ret = err_nr; +- final = 1; + goto final_cb; + } + +@@ -271,7 +288,7 @@ + + /* it might be a multiline response, so if there's a previous + response, send out mlbuf and start afresh with an empty buffer */ +- if (g->mlbuf[0] != 0) { ++ if (g->mlbuf_len) { + if (!cmd->cb) { + gsmd_log(GSMD_NOTICE, "command without cb!!!\n"); + } else { +@@ -279,8 +296,8 @@ + cmd->resp = g->mlbuf; + rc = cmd->cb(cmd, cmd->ctx, cmd->resp); + DEBUGP("Clearing mlbuf\n"); +- g->mlbuf[0] = 0; + } ++ g->mlbuf_len = 0; + } + + /* the current buf will be appended to mlbuf below */ +@@ -299,7 +316,6 @@ + DEBUGP("unspecified error\n"); + if (cmd) + cmd->ret = 4; +- final = 1; + goto final_cb; + } + +@@ -308,7 +324,6 @@ + /* Part of Case 'C' */ + if (cmd) + cmd->ret = 0; +- final = 1; + goto final_cb; + } + +@@ -317,14 +332,12 @@ + if (!strncmp(buf, "NO CARRIER", 11) || + ((g->flags & GSMD_FLAG_V0) && buf[0] == '3')) { + /* Part of Case 'D' */ +- final = 1; + goto final_cb; + } + + if (!strncmp(buf, "BUSY", 4) || + ((g->flags & GSMD_FLAG_V0) && buf[0] == '7')) { + /* Part of Case 'D' */ +- final = 1; + goto final_cb; + } + } +@@ -332,21 +345,13 @@ + /* we reach here, if we are at an information response that needs to be + * passed on */ + +- if (g->mlbuf[0] == 0) { +- DEBUGP("Filling mlbuf\n"); +- strncat(g->mlbuf, buf, MLPARSE_BUF_SIZE-1); +- } else { +- DEBUGP("Appending buf to mlbuf\n"); +- g->mlbuf_len = strlen(g->mlbuf); +- if (g->mlbuf_len+1 < MLPARSE_BUF_SIZE) { +- g->mlbuf[g->mlbuf_len] = '\n'; +- g->mlbuf[g->mlbuf_len+1] = '\0'; +- strncat(g->mlbuf, buf, MLPARSE_BUF_SIZE-g->mlbuf_len-2); +- } else { +- DEBUGP("response too big for mlbuf!!!\n"); +- return -EFBIG; +- } +- } ++ if (g->mlbuf_len) ++ g->mlbuf[g->mlbuf_len ++] = '\n'; ++ DEBUGP("Appending buf to mlbuf\n"); ++ if (len > MLPARSE_BUF_SIZE - g->mlbuf_len) ++ len = MLPARSE_BUF_SIZE - g->mlbuf_len; ++ memcpy(g->mlbuf + g->mlbuf_len, buf, len); ++ g->mlbuf_len += len; + return 0; + + final_cb: +@@ -363,13 +368,16 @@ + } else { + DEBUGP("Calling final cmd->cb()\n"); + /* send final result code if there is no information response in mlbuf */ +- if (g->mlbuf[0] == 0) +- cmd->resp = buf; +- else ++ if (g->mlbuf_len) { + cmd->resp = g->mlbuf; ++ g->mlbuf[g->mlbuf_len] = 0; ++ gsmd_log(GSMD_NOTICE, ++ "the text discarded is %s\n", buf); ++ } else ++ cmd->resp = buf; + rc = cmd->cb(cmd, cmd->ctx, cmd->resp); + DEBUGP("Clearing mlbuf\n"); +- g->mlbuf[0] = 0; ++ g->mlbuf_len = 0; + } + + /* remove from list of currently executing cmds */ +@@ -382,7 +390,15 @@ + g->gfd_uart.when |= GSMD_FD_WRITE; + + return rc; +-} ++} ++ ++/* called when the modem asked for a new line of a multiline atcmd */ ++static int atcmd_prompt(void *data) ++{ ++ struct gsmd *g = data; ++ ++ g->gfd_uart.when |= GSMD_FD_WRITE; ++} + + /* callback to be called if [virtual] UART has some data for us */ + static int atcmd_select_cb(int fd, unsigned int what, void *data) +@@ -390,6 +406,7 @@ + int len, rc; + static char rxbuf[1024]; + struct gsmd *g = data; ++ char *cr; + + if (what & GSMD_FD_READ) { + memset(rxbuf, 0, sizeof(rxbuf)); +@@ -413,8 +430,12 @@ + 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); +- rc = write(fd, pos->buf, strlen(pos->buf)); ++ cr = strchr(pos->cur, '\n'); ++ if (cr) ++ len = cr - pos->cur; ++ else ++ len = pos->buflen; ++ rc = write(fd, pos->cur, len); + if (rc == 0) { + gsmd_log(GSMD_ERROR, "write returns 0, aborting\n"); + break; +@@ -423,27 +444,32 @@ + fd, rc); + return rc; + } +- if (rc < len) { +- gsmd_log(GSMD_FATAL, "short write!!! FIXME!\n"); +- exit(3); +- } ++ if (cr && rc == len) ++ rc ++; /* Skip the \n */ ++ pos->buflen -= rc; ++ pos->cur += rc; + write(fd, "\r", 1); +- /* success: remove from global list of to-be-sent atcmds */ +- llist_del(&pos->list); +- /* append to global list of executing atcmds */ +- llist_add_tail(&pos->list, &g->busy_atcmds); ++ ++ if (!pos->buflen) { ++ /* success: remove from global list of ++ * to-be-sent atcmds */ ++ llist_del(&pos->list); ++ /* append to global list of executing atcmds */ ++ llist_add_tail(&pos->list, &g->busy_atcmds); + + /* we only send one cmd at the moment */ +- g->gfd_uart.when &= ~GSMD_FD_WRITE; + break; ++ } else { ++ /* The write was short or the atcmd has more ++ * lines to send after a "> ". */ ++ if (!(rc < len)) ++ break; ++ } + } +- } + +-#if 0 +- if (llist_empty(&g->pending_atcmds)) ++ /* Either pending_atcmds is empty or a command has to wait */ + g->gfd_uart.when &= ~GSMD_FD_WRITE; +-#endif +- ++ } + + return 0; + } +@@ -454,10 +480,10 @@ + { + int buflen = strlen(cmd); + struct gsmd_atcmd *atcmd; +- ++ + if (rlen > buflen) + buflen = rlen; +- ++ + atcmd = talloc_size(__atcmd_ctx, sizeof(*atcmd)+ buflen); + if (!atcmd) + return NULL; +@@ -468,6 +494,7 @@ + atcmd->ret = -255; + atcmd->buflen = buflen; + atcmd->buf[buflen-1] = '\0'; ++ atcmd->cur = atcmd->buf; + atcmd->cb = cb; + atcmd->resp = NULL; + strncpy(atcmd->buf, cmd, buflen-1); +@@ -480,8 +507,9 @@ + { + DEBUGP("submitting command `%s'\n", cmd->buf); + ++ if (llist_empty(&g->pending_atcmds)) ++ g->gfd_uart.when |= GSMD_FD_WRITE; + llist_add_tail(&cmd->list, &g->pending_atcmds); +- g->gfd_uart.when |= GSMD_FD_WRITE; + + return 0; + } +@@ -517,9 +545,9 @@ + g->llp.cur = g->llp.buf; + g->llp.len = sizeof(g->llp.buf); + g->llp.cb = &ml_parse; ++ g->llp.prompt_cb = &atcmd_prompt; + g->llp.ctx = g; + g->llp.flags = LGSM_ATCMD_F_EXTENDED; + + return gsmd_register_fd(&g->gfd_uart); +-} +- ++} +Index: gsm/src/gsmd/sms_cb.c +=================================================================== +--- gsm.orig/src/gsmd/sms_cb.c 2007-07-31 13:58:37.000000000 +0200 ++++ gsm/src/gsmd/sms_cb.c 2007-07-31 14:23:32.000000000 +0200 +@@ -91,9 +91,6 @@ + if (!ucmd) + return -ENOMEM; + +- +- +- + ucmd->hdr.version = GSMD_PROTO_VERSION; + ucmd->hdr.msg_type = GSMD_MSG_SMS; + ucmd->hdr.msg_subtype = GSMD_SMS_GETMSG_STORAGE; +@@ -188,14 +185,26 @@ + int sms_cb_init(struct gsmd *gsmd) + { + struct gsmd_atcmd *atcmd; ++ char buffer[10]; |
