summaryrefslogtreecommitdiffstats
path: root/gatchat/gatmux.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-10-19 18:49:07 +0200
committerMarcel Holtmann <marcel@holtmann.org>2010-10-19 18:50:52 +0200
commit0caafef6c94bf5eef34eb47bf5372e3cecb6e168 (patch)
treed4660e98b9c026ccbfe90d08aa3c2ec51c668f5c /gatchat/gatmux.c
parent255782f8c2ff64991b362fb0e0554bd2adb7069e (diff)
downloadofono-0caafef6c94bf5eef34eb47bf5372e3cecb6e168.tar.bz2
gatchat: Add support for skipping AT+CMUX speed parameter
Diffstat (limited to 'gatchat/gatmux.c')
-rw-r--r--gatchat/gatmux.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/gatchat/gatmux.c b/gatchat/gatmux.c
index 50b3dbee..fb912e63 100644
--- a/gatchat/gatmux.c
+++ b/gatchat/gatmux.c
@@ -807,16 +807,21 @@ static void mux_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
goto error;
/* Speed, pick highest */
- if (!g_at_result_iter_open_list(&iter))
- goto error;
+ if (g_at_result_iter_open_list(&iter)) {
+ if (!g_at_result_iter_next_range(&iter, &min, &max))
+ goto error;
- if (!g_at_result_iter_next_range(&iter, &min, &max))
- goto error;
+ if (!g_at_result_iter_close_list(&iter))
+ goto error;
- if (!g_at_result_iter_close_list(&iter))
- goto error;
+ speed = max;
+ } else {
+ if (!g_at_result_iter_skip_next(&iter))
+ goto error;
- speed = max;
+ /* not available/used */
+ speed = -1;
+ }
/* Frame size, pick defaults */
if (!g_at_result_iter_open_list(&iter))
@@ -844,7 +849,11 @@ static void mux_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
nmsd = g_memdup(msd, sizeof(struct mux_setup_data));
g_at_chat_ref(nmsd->chat);
- sprintf(buf, "AT+CMUX=%u,0,%u,%u", msd->mode, speed, msd->frame_size);
+ if (speed < 0)
+ sprintf(buf, "AT+CMUX=%u,0,,%u", msd->mode, msd->frame_size);
+ else
+ sprintf(buf, "AT+CMUX=%u,0,%u,%u", msd->mode, speed,
+ msd->frame_size);
if (g_at_chat_send(msd->chat, buf, none_prefix,
mux_setup_cb, nmsd, msd_free) > 0)