1 From ddb37eaa4cb56a44fa2531e5ae828f3a84eaa49b Mon Sep 17 00:00:00 2001
2 From: Guillaume Zajac <guillaume.zajac@linux.intel.com>
3 Date: Wed, 10 Oct 2012 16:50:27 +0200
4 Subject: [PATCH 1/3] main: Create modems only when one modem is added
5 Content-Type: text/plain; charset="utf-8"
6 Content-Transfer-Encoding: 8bit
9 src/main.c | 17 ++++++++++++++++-
10 1 file changed, 16 insertions(+), 1 deletion(-)
12 diff --git a/src/main.c b/src/main.c
13 index c07a1e1..5c4e27b 100644
16 @@ -34,6 +34,18 @@ static gboolean on_load()
20 +static enum tcore_hook_return __on_hook_modem_added(Server *s, CoreObject *source,
21 + enum tcore_notification_command command, unsigned int data_len, void *data, void *user_data)
23 + gpointer *master = user_data;
25 + dbg("modem added event called");
27 + _ps_master_create_modems(master);
29 + return TCORE_HOOK_RETURN_CONTINUE;
32 static gboolean on_init(TcorePlugin *p)
35 @@ -57,7 +69,10 @@ static gboolean on_init(TcorePlugin *p)
38 master = _ps_master_create_master(conn, p);
39 - rv = _ps_master_create_modems(master);
41 + tcore_server_add_notification_hook(tcore_plugin_ref_server(p),
43 + __on_hook_modem_added, master);
45 dbg("initialized PacketService plugin!");