e22e929ddcf9c46da7a6d64b5e2f9a5dbca73756
[framework/telephony/tel-plugin-packetservice.git] / packaging / 0001-main-Create-modems-only-when-one-modem-is-added.patch
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
7
8 ---
9  src/main.c |   17 ++++++++++++++++-
10  1 file changed, 16 insertions(+), 1 deletion(-)
11
12 diff --git a/src/main.c b/src/main.c
13 index c07a1e1..5c4e27b 100644
14 --- a/src/main.c
15 +++ b/src/main.c
16 @@ -34,6 +34,18 @@ static gboolean on_load()
17         return TRUE;
18  }
19  
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)
22 +{
23 +       gpointer *master = user_data;
24 +
25 +       dbg("modem added event called");
26 +
27 +       _ps_master_create_modems(master);
28 +
29 +       return TCORE_HOOK_RETURN_CONTINUE;
30 +}
31 +
32  static gboolean on_init(TcorePlugin *p)
33  {
34         gpointer *master;
35 @@ -57,7 +69,10 @@ static gboolean on_init(TcorePlugin *p)
36         }
37  
38         master = _ps_master_create_master(conn, p);
39 -       rv = _ps_master_create_modems(master);
40 +
41 +       tcore_server_add_notification_hook(tcore_plugin_ref_server(p),
42 +                                               TNOTI_MODEM_ADDED,
43 +                                               __on_hook_modem_added, master);
44  
45         dbg("initialized PacketService plugin!");
46         return TRUE;
47 -- 
48 1.7.10.4
49