From: Yang Gu <yang.gu@intel.com>
To: ofono@ofono.org
Subject: [PATCH 2/3] Support phonesim proactive command notification
Date: Tue, 13 Jul 2010 18:30:00 +0800 [thread overview]
Message-ID: <1279017001-23915-2-git-send-email-yang.gu@intel.com> (raw)
In-Reply-To: <1279017001-23915-1-git-send-email-yang.gu@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1592 bytes --]
---
drivers/atmodem/stk.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/drivers/atmodem/stk.c b/drivers/atmodem/stk.c
index 1283cca..3850f15 100644
--- a/drivers/atmodem/stk.c
+++ b/drivers/atmodem/stk.c
@@ -39,9 +39,11 @@
#include "atmodem.h"
#include "stk.h"
+#include "vendor.h"
struct stk_data {
GAtChat *chat;
+ unsigned int vendor;
};
static const char *csim_prefix[] = { "+CSIM:", NULL };
@@ -262,10 +264,32 @@ error:
CALLBACK_WITH_FAILURE(cb, data);
}
+static void phonesim_tcmd_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_stk *stk = user_data;
+ struct stk_data *data = ofono_stk_get_data(stk);
+ GAtResultIter iter;
+ int length;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "*TCMD:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &length))
+ return;
+
+ at_sim_fetch_command(data->chat, stk, length);
+}
+
static gboolean at_stk_register(gpointer user)
{
struct ofono_stk *stk = user;
+ struct stk_data *sd = ofono_stk_get_data(stk);
+ if (sd->vendor == OFONO_VENDOR_PHONESIM)
+ g_at_chat_register(sd->chat, "*TCMD", phonesim_tcmd_notify,
+ FALSE, stk, NULL);
ofono_stk_register(stk);
return FALSE;
@@ -278,6 +302,7 @@ static int at_stk_probe(struct ofono_stk *stk, unsigned int vendor, void *data)
sd = g_new0(struct stk_data, 1);
sd->chat = chat;
+ sd->vendor = vendor;
ofono_stk_set_data(stk, sd);
g_idle_add(at_stk_register, stk);
--
1.7.0.4
next prev parent reply other threads:[~2010-07-13 10:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-13 10:29 [PATCH 1/3] Make fetch command function as external Yang Gu
2010-07-13 10:30 ` Yang Gu [this message]
2010-07-13 14:56 ` [PATCH 2/3] Support phonesim proactive command notification Denis Kenzior
2010-07-13 10:30 ` [PATCH 3/3] Use specific vendor for phonesim stk Yang Gu
2010-07-13 14:56 ` Denis Kenzior
2010-07-13 14:55 ` [PATCH 1/3] Make fetch command function as external Denis Kenzior
-- strict thread matches above, loose matches on Subject: below --
2010-07-09 14:52 Yang Gu
2010-07-09 14:52 ` [PATCH 2/3] Support phonesim proactive command notification Yang Gu
2010-07-09 17:18 ` Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1279017001-23915-2-git-send-email-yang.gu@intel.com \
--to=yang.gu@intel.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.