Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 01/10] android: Initialize IPC with command and notification sockets
@ 2013-11-28 14:15 Szymon Janc
  2013-11-28 14:15 ` [PATCH 02/10] android: Remove socket parameter from ipc_send_rsp Szymon Janc
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Szymon Janc @ 2013-11-28 14:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

Pass sockets after succesfully connected to HAL. This will allow
to improve IPC helpers API.
---
 android/ipc.c  | 15 +++++++++++++++
 android/ipc.h  |  3 +++
 android/main.c |  5 +++++
 3 files changed, 23 insertions(+)

diff --git a/android/ipc.c b/android/ipc.c
index 25c36fd..028d4ad 100644
--- a/android/ipc.c
+++ b/android/ipc.c
@@ -36,6 +36,21 @@
 #include "ipc.h"
 #include "log.h"
 
+static int cmd_sk = -1;
+static int notif_sk = -1;
+
+void ipc_init(int command_sk, int notification_sk)
+{
+	cmd_sk = command_sk;
+	notif_sk = notification_sk;
+}
+
+void ipc_cleanup(void)
+{
+	cmd_sk = -1;
+	notif_sk = -1;
+}
+
 void ipc_send(int sk, uint8_t service_id, uint8_t opcode, uint16_t len,
 							void *param, int fd)
 {
diff --git a/android/ipc.h b/android/ipc.h
index ad4a2d2..5786d2d 100644
--- a/android/ipc.h
+++ b/android/ipc.h
@@ -21,6 +21,9 @@
  *
  */
 
+void ipc_init(int command_sk, int notification_sk);
+void ipc_cleanup(void);
+
 void ipc_send(int sk, uint8_t service_id, uint8_t opcode, uint16_t len,
 							void *param, int fd);
 void ipc_send_rsp(int sk, uint8_t service_id, uint8_t opcode, uint8_t status);
diff --git a/android/main.c b/android/main.c
index bfd2a87..4e6ad38 100644
--- a/android/main.c
+++ b/android/main.c
@@ -354,6 +354,9 @@ static gboolean notif_connect_cb(GIOChannel *io, GIOCondition cond,
 
 	g_io_add_watch(hal_cmd_io, cond, cmd_watch_cb, NULL);
 
+	ipc_init(g_io_channel_unix_get_fd(hal_cmd_io),
+				g_io_channel_unix_get_fd(hal_notif_io));
+
 	info("Successfully connected to HAL");
 
 	return FALSE;
@@ -494,6 +497,8 @@ static void cleanup_hal_connection(void)
 		g_io_channel_unref(hal_notif_io);
 		hal_notif_io = NULL;
 	}
+
+	ipc_cleanup();
 }
 
 static bool set_capabilities(void)
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-11-28 16:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-28 14:15 [PATCH 01/10] android: Initialize IPC with command and notification sockets Szymon Janc
2013-11-28 14:15 ` [PATCH 02/10] android: Remove socket parameter from ipc_send_rsp Szymon Janc
2013-11-28 14:15 ` [PATCH 03/10] android: Use ipc_send_rsp helper for replying success Szymon Janc
2013-11-28 14:15 ` [PATCH 04/10] android: Add IPC helper for sending notifications Szymon Janc
2013-11-28 14:15 ` [PATCH 05/10] android: Use ipc_send_notif " Szymon Janc
2013-11-28 14:15 ` [PATCH 06/10] android: Add ipc_send_rsp_full IPC helper Szymon Janc
2013-11-28 14:15 ` [PATCH 07/10] android/socket: Use " Szymon Janc
2013-11-28 14:15 ` [PATCH 08/10] android: Make ipc_send static Szymon Janc
2013-11-28 14:15 ` [PATCH 09/10] android/bluetooth: Remove not needed notification_sk checks Szymon Janc
2013-11-28 14:15 ` [PATCH 10/10] android: Don't pass notification socket on services register Szymon Janc
2013-11-28 16:06 ` [PATCH 01/10] android: Initialize IPC with command and notification sockets Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox