Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 08/10] android/socket: Strip extra log messages
From: Andrei Emeltchenko @ 2013-11-28 14:38 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1385649486-19978-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Remove debug messages when sending data, debug still exist for connection
establishment. Do not print error when connection hang up, print debug
instead.
---
 android/socket.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/android/socket.c b/android/socket.c
index 3f07dc6..45ff90e 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -488,11 +488,12 @@ static gboolean sock_stack_event_cb(GIOChannel *io, GIOCondition cond,
 	unsigned char buf[1024];
 	int len, sent;
 
-	DBG("rfsock: fd %d real_sock %d chan %u sock %d",
-		rfsock->fd, rfsock->real_sock, rfsock->channel,
-		g_io_channel_unix_get_fd(io));
+	if (cond & G_IO_HUP) {
+		DBG("Socket %d hang up", g_io_channel_unix_get_fd(io));
+		goto fail;
+	}
 
-	if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
+	if (cond & (G_IO_ERR | G_IO_NVAL)) {
 		error("Socket error: sock %d cond %d",
 					g_io_channel_unix_get_fd(io), cond);
 		goto fail;
@@ -505,16 +506,12 @@ static gboolean sock_stack_event_cb(GIOChannel *io, GIOCondition cond,
 		return TRUE;
 	}
 
-	DBG("read %d bytes write to %d", len, rfsock->real_sock);
-
 	sent = try_write_all(rfsock->real_sock, buf, len);
 	if (sent < 0) {
 		error("write(): %s", strerror(errno));
 		goto fail;
 	}
 
-	DBG("Written %d bytes", sent);
-
 	return TRUE;
 fail:
 	connections = g_list_remove(connections, rfsock);
@@ -530,11 +527,12 @@ static gboolean sock_rfcomm_event_cb(GIOChannel *io, GIOCondition cond,
 	unsigned char buf[1024];
 	int len, sent;
 
-	DBG("rfsock: fd %d real_sock %d chan %u sock %d",
-		rfsock->fd, rfsock->real_sock, rfsock->channel,
-		g_io_channel_unix_get_fd(io));
+	if (cond & G_IO_HUP) {
+		DBG("Socket %d hang up", g_io_channel_unix_get_fd(io));
+		goto fail;
+	}
 
-	if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
+	if (cond & (G_IO_ERR | G_IO_NVAL)) {
 		error("Socket error: sock %d cond %d",
 					g_io_channel_unix_get_fd(io), cond);
 		goto fail;
@@ -547,16 +545,12 @@ static gboolean sock_rfcomm_event_cb(GIOChannel *io, GIOCondition cond,
 		return TRUE;
 	}
 
-	DBG("read %d bytes, write to fd %d", len, rfsock->fd);
-
 	sent = try_write_all(rfsock->fd, buf, len);
 	if (sent < 0) {
 		error("write(): %s", strerror(errno));
 		goto fail;
 	}
 
-	DBG("Written %d bytes", sent);
-
 	return TRUE;
 fail:
 	connections = g_list_remove(connections, rfsock);
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 07/10] android/hidhost: Shutdown ctrl_io channel if intr_io fails
From: Andrei Emeltchenko @ 2013-11-28 14:38 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1385649486-19978-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

This fix possible memory leak.
---
 android/hidhost.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/android/hidhost.c b/android/hidhost.c
index d50c5b8..1f5aa5d 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -1219,8 +1219,12 @@ bool bt_hid_register(int sk, const bdaddr_t *addr)
 				BT_IO_OPT_INVALID);
 	if (!intr_io) {
 		error("Failed to listen on intr channel: %s", err->message);
-		g_io_channel_unref(ctrl_io);
 		g_error_free(err);
+
+		g_io_channel_shutdown(ctrl_io, TRUE, NULL);
+		g_io_channel_unref(ctrl_io);
+		ctrl_io = NULL;
+
 		return false;
 	}
 
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 06/10] android/socket: Fix rfsock lists
From: Andrei Emeltchenko @ 2013-11-28 14:38 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1385649486-19978-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

This fixes several places where rfsock structure were not removed
from the list due to connection errors.
---
 android/socket.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/android/socket.c b/android/socket.c
index d55db54..3f07dc6 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -625,8 +625,6 @@ static void accept_cb(GIOChannel *io, GError *err, gpointer user_data)
 		return;
 	}
 
-	connections = g_list_append(connections, rfsock_acc);
-
 	DBG("rfsock: fd %d real_sock %d chan %u sock %d",
 		rfsock->fd, rfsock->real_sock, rfsock->channel,
 		sock_acc);
@@ -636,6 +634,8 @@ static void accept_cb(GIOChannel *io, GError *err, gpointer user_data)
 		return;
 	}
 
+	connections = g_list_append(connections, rfsock_acc);
+
 	/* Handle events from Android */
 	cond = G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL;
 	io_stack = g_io_channel_unix_new(rfsock_acc->fd);
@@ -700,7 +700,6 @@ static int handle_listen(void *buf)
 	}
 
 	rfsock->real_sock = g_io_channel_unix_get_fd(io);
-	servers = g_list_append(servers, rfsock);
 
 	/* TODO: Add server watch */
 	g_io_channel_set_close_on_unref(io, TRUE);
@@ -717,6 +716,8 @@ static int handle_listen(void *buf)
 
 	rfsock->service_handle = sdp_service_register(profile, cmd->name);
 
+	servers = g_list_append(servers, rfsock);
+
 	return hal_fd;
 }
 
@@ -787,6 +788,7 @@ static void connect_cb(GIOChannel *io, GError *err, gpointer user_data)
 
 	return;
 fail:
+	connections = g_list_remove(connections, rfsock);
 	cleanup_rfsock(rfsock);
 }
 
@@ -865,6 +867,7 @@ static void sdp_search_cb(sdp_list_t *recs, int err, gpointer data)
 
 	return;
 fail:
+	connections = g_list_remove(connections, rfsock);
 	cleanup_rfsock(rfsock);
 }
 
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 05/10] android/socket: Cleanup sockets on unregister
From: Andrei Emeltchenko @ 2013-11-28 14:38 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1385649486-19978-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

This cleans up rfsock structures closing all sockets and making general cleanup
for servers and for connections. This will be called form socket unregister.
---
 android/socket.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/android/socket.c b/android/socket.c
index 1fb154d..d55db54 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -943,7 +943,27 @@ bool bt_socket_register(int sk, const bdaddr_t *addr)
 	return true;
 }
 
+static void free_connection(gpointer data, gpointer user_data)
+{
+	struct rfcomm_sock *rfsock = data;
+
+	connections = g_list_remove(connections, rfsock);
+	cleanup_rfsock(rfsock);
+}
+
+static void free_server(gpointer data, gpointer user_data)
+{
+	struct rfcomm_sock *rfsock = data;
+
+	servers = g_list_remove(servers, rfsock);
+	cleanup_rfsock(rfsock);
+}
+
 void bt_socket_unregister(void)
 {
 	DBG("");
+
+	g_list_foreach(connections, free_connection, NULL);
+
+	g_list_foreach(servers, free_server, NULL);
 }
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 04/10] android/main: Free enabled string on exit
From: Andrei Emeltchenko @ 2013-11-28 14:38 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1385649486-19978-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

---
 android/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/android/main.c b/android/main.c
index 4dc3061..30792c5 100644
--- a/android/main.c
+++ b/android/main.c
@@ -566,6 +566,7 @@ int main(int argc, char *argv[])
 	__btd_log_init("*", 0);
 
 	if (!set_capabilities()) {
+		__btd_log_cleanup();
 		g_source_remove(signal);
 		return EXIT_FAILURE;
 	}
@@ -574,11 +575,13 @@ int main(int argc, char *argv[])
 							quit_eventloop, NULL);
 	if (bluetooth_start_timeout == 0) {
 		error("Failed to init startup timeout");
+		__btd_log_cleanup();
 		g_source_remove(signal);
 		return EXIT_FAILURE;
 	}
 
 	if (!bt_bluetooth_start(option_index, adapter_ready)) {
+		__btd_log_cleanup();
 		g_source_remove(bluetooth_start_timeout);
 		g_source_remove(signal);
 		return EXIT_FAILURE;
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 03/10] android/main: Remove signal source on exit
From: Andrei Emeltchenko @ 2013-11-28 14:37 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1385649486-19978-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Remove signal source on exit and move check capability function in order
to avoid extra check.
---
 android/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/android/main.c b/android/main.c
index dd5c622..4dc3061 100644
--- a/android/main.c
+++ b/android/main.c
@@ -565,18 +565,22 @@ int main(int argc, char *argv[])
 
 	__btd_log_init("*", 0);
 
-	if (!set_capabilities())
+	if (!set_capabilities()) {
+		g_source_remove(signal);
 		return EXIT_FAILURE;
+	}
 
 	bluetooth_start_timeout = g_timeout_add_seconds(STARTUP_GRACE_SECONDS,
 							quit_eventloop, NULL);
 	if (bluetooth_start_timeout == 0) {
 		error("Failed to init startup timeout");
+		g_source_remove(signal);
 		return EXIT_FAILURE;
 	}
 
 	if (!bt_bluetooth_start(option_index, adapter_ready)) {
 		g_source_remove(bluetooth_start_timeout);
+		g_source_remove(signal);
 		return EXIT_FAILURE;
 	}
 
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 02/10] android/main: Remove timeout source on exit
From: Andrei Emeltchenko @ 2013-11-28 14:37 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1385649486-19978-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

This fixes memory leak types of warnings from some tools.
---
 android/main.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/android/main.c b/android/main.c
index 830eef2..dd5c622 100644
--- a/android/main.c
+++ b/android/main.c
@@ -575,8 +575,10 @@ int main(int argc, char *argv[])
 		return EXIT_FAILURE;
 	}
 
-	if (!bt_bluetooth_start(option_index, adapter_ready))
+	if (!bt_bluetooth_start(option_index, adapter_ready)) {
+		g_source_remove(bluetooth_start_timeout);
 		return EXIT_FAILURE;
+	}
 
 	/* Use params: mtu = 0, flags = 0 */
 	start_sdp_server(0, 0);
@@ -589,6 +591,9 @@ int main(int argc, char *argv[])
 
 	g_source_remove(signal);
 
+	if (bluetooth_start_timeout > 0)
+		g_source_remove(bluetooth_start_timeout);
+
 	cleanup_hal_connection();
 	stop_sdp_server();
 	bt_bluetooth_cleanup();
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 01/10] android: Avoid memory leak warnings for event_loop
From: Andrei Emeltchenko @ 2013-11-28 14:37 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Move creation of event_loop closer to g_main_loop_run. This avoids
calling g_main_loop_unref too many times in initialization error paths.
This is safe since g_main_loop_quit eval to NOOP if parameter == NULL.
---
 android/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/android/main.c b/android/main.c
index bfd2a87..830eef2 100644
--- a/android/main.c
+++ b/android/main.c
@@ -559,7 +559,6 @@ int main(int argc, char *argv[])
 		exit(EXIT_SUCCESS);
 	}
 
-	event_loop = g_main_loop_new(NULL, FALSE);
 	signal = setup_signalfd();
 	if (!signal)
 		return EXIT_FAILURE;
@@ -584,6 +583,8 @@ int main(int argc, char *argv[])
 
 	DBG("Entering main loop");
 
+	event_loop = g_main_loop_new(NULL, FALSE);
+
 	g_main_loop_run(event_loop);
 
 	g_source_remove(signal);
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 10/10] android: Don't pass notification socket on services register
From: Szymon Janc @ 2013-11-28 14:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385648130-12808-1-git-send-email-szymon.janc@tieto.com>

It is no longer needed as proper socket is use by IPC helpers.
---
 android/a2dp.c      | 13 +------------
 android/a2dp.h      |  2 +-
 android/bluetooth.c | 16 +---------------
 android/bluetooth.h |  2 +-
 android/hidhost.c   | 12 +-----------
 android/hidhost.h   |  2 +-
 android/main.c      | 13 +++++--------
 android/pan.c       | 14 +-------------
 android/pan.h       |  2 +-
 android/socket.c    |  4 +---
 android/socket.h    |  2 +-
 11 files changed, 15 insertions(+), 67 deletions(-)

diff --git a/android/a2dp.c b/android/a2dp.c
index 92c359e..99aa14d 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -48,7 +48,6 @@
 #define L2CAP_PSM_AVDTP 0x19
 #define SVC_HINT_CAPTURING 0x08
 
-static int notification_sk = -1;
 static GIOChannel *server = NULL;
 static GSList *devices = NULL;
 static bdaddr_t adapter_addr;
@@ -350,16 +349,13 @@ static sdp_record_t *a2dp_record(void)
 	return record;
 }
 
-bool bt_a2dp_register(int sk, const bdaddr_t *addr)
+bool bt_a2dp_register(const bdaddr_t *addr)
 {
 	GError *err = NULL;
 	sdp_record_t *rec;
 
 	DBG("");
 
-	if (notification_sk >= 0)
-		return false;
-
 	bacpy(&adapter_addr, addr);
 
 	server = bt_io_listen(connect_cb, NULL, NULL, NULL, &err,
@@ -384,8 +380,6 @@ bool bt_a2dp_register(int sk, const bdaddr_t *addr)
 	}
 	record_id = rec->handle;
 
-	notification_sk = sk;
-
 	return true;
 }
 
@@ -400,14 +394,9 @@ void bt_a2dp_unregister(void)
 {
 	DBG("");
 
-	if (notification_sk < 0)
-		return;
-
 	g_slist_foreach(devices, a2dp_device_disconnected, NULL);
 	devices = NULL;
 
-	notification_sk = -1;
-
 	bt_adapter_remove_record(record_id);
 	record_id = 0;
 
diff --git a/android/a2dp.h b/android/a2dp.h
index 3531618..2a1eb3c 100644
--- a/android/a2dp.h
+++ b/android/a2dp.h
@@ -23,5 +23,5 @@
 
 void bt_a2dp_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len);
 
-bool bt_a2dp_register(int sk, const bdaddr_t *addr);
+bool bt_a2dp_register(const bdaddr_t *addr);
 void bt_a2dp_unregister(void);
diff --git a/android/bluetooth.c b/android/bluetooth.c
index fdafb81..8a1d444 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -60,8 +60,6 @@
 
 static uint16_t option_index = MGMT_INDEX_NONE;
 
-static int notification_sk = -1;
-
 #define BASELEN_REMOTE_DEV_PROP (sizeof(struct hal_ev_remote_device_props) \
 					+ sizeof(struct hal_property))
 /* This list contains addresses which are asked for records */
@@ -2267,24 +2265,12 @@ error:
 	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, opcode, status);
 }
 
-bool bt_bluetooth_register(int sk)
+void bt_bluetooth_register(void)
 {
 	DBG("");
-
-	if (notification_sk >= 0)
-		return false;
-
-	notification_sk = sk;
-
-	return true;
 }
 
 void bt_bluetooth_unregister(void)
 {
 	DBG("");
-
-	if (notification_sk < 0)
-		return;
-
-	notification_sk = -1;
 }
diff --git a/android/bluetooth.h b/android/bluetooth.h
index 44b8e9e..86872ee 100644
--- a/android/bluetooth.h
+++ b/android/bluetooth.h
@@ -31,7 +31,7 @@ void bt_bluetooth_cleanup(void);
 
 void bt_bluetooth_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len);
 
-bool bt_bluetooth_register(int sk);
+void bt_bluetooth_register(void);
 void bt_bluetooth_unregister(void);
 
 int bt_adapter_add_record(sdp_record_t *rec, uint8_t svc_hint);
diff --git a/android/hidhost.c b/android/hidhost.c
index 09c71f4..50ac50d 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -78,7 +78,6 @@
 
 static bdaddr_t adapter_addr;
 
-static int notification_sk = -1;
 static GIOChannel *ctrl_io = NULL;
 static GIOChannel *intr_io = NULL;
 static GSList *devices = NULL;
@@ -1190,15 +1189,12 @@ static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
 	}
 }
 
-bool bt_hid_register(int sk, const bdaddr_t *addr)
+bool bt_hid_register(const bdaddr_t *addr)
 {
 	GError *err = NULL;
 
 	DBG("");
 
-	if (notification_sk >= 0)
-		return false;
-
 	bacpy(&adapter_addr, addr);
 
 	ctrl_io = bt_io_listen(connect_cb, NULL, NULL, NULL, &err,
@@ -1224,8 +1220,6 @@ bool bt_hid_register(int sk, const bdaddr_t *addr)
 		return false;
 	}
 
-	notification_sk = sk;
-
 	return true;
 }
 
@@ -1241,12 +1235,8 @@ void bt_hid_unregister(void)
 {
 	DBG("");
 
-	if (notification_sk < 0)
-		return;
-
 	g_slist_foreach(devices, free_hid_devices, NULL);
 	devices = NULL;
-	notification_sk = -1;
 
 	if (ctrl_io) {
 		g_io_channel_shutdown(ctrl_io, TRUE, NULL);
diff --git a/android/hidhost.h b/android/hidhost.h
index 688086a..b5545fb 100644
--- a/android/hidhost.h
+++ b/android/hidhost.h
@@ -23,5 +23,5 @@
 
 void bt_hid_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len);
 
-bool bt_hid_register(int sk, const bdaddr_t *addr);
+bool bt_hid_register(const bdaddr_t *addr);
 void bt_hid_unregister(void);
diff --git a/android/main.c b/android/main.c
index 211503b..fb16503 100644
--- a/android/main.c
+++ b/android/main.c
@@ -77,34 +77,31 @@ static bool services[HAL_SERVICE_ID_MAX + 1] = { false };
 static void service_register(void *buf, uint16_t len)
 {
 	struct hal_cmd_register_module *m = buf;
-	int sk = g_io_channel_unix_get_fd(hal_notif_io);
 
 	if (m->service_id > HAL_SERVICE_ID_MAX || services[m->service_id])
 		goto failed;
 
 	switch (m->service_id) {
 	case HAL_SERVICE_ID_BLUETOOTH:
-		if (!bt_bluetooth_register(sk))
-			goto failed;
+		bt_bluetooth_register();
 
 		break;
 	case HAL_SERVICE_ID_SOCK:
-		if (!bt_socket_register(sk, &adapter_bdaddr))
-			goto failed;
+		bt_socket_register(&adapter_bdaddr);
 
 		break;
 	case HAL_SERVICE_ID_HIDHOST:
-		if (!bt_hid_register(sk, &adapter_bdaddr))
+		if (!bt_hid_register(&adapter_bdaddr))
 			goto failed;
 
 		break;
 	case HAL_SERVICE_ID_A2DP:
-		if (!bt_a2dp_register(sk, &adapter_bdaddr))
+		if (!bt_a2dp_register(&adapter_bdaddr))
 			goto failed;
 
 		break;
 	case HAL_SERVICE_ID_PAN:
-		if (!bt_pan_register(sk, &adapter_bdaddr))
+		if (!bt_pan_register(&adapter_bdaddr))
 			goto failed;
 
 		break;
diff --git a/android/pan.c b/android/pan.c
index 29f1007..ea15637 100644
--- a/android/pan.c
+++ b/android/pan.c
@@ -35,8 +35,6 @@
 #include "hal-msg.h"
 #include "ipc.h"
 
-static int notification_sk = -1;
-
 static uint8_t bt_pan_enable(struct hal_cmd_pan_enable *cmd, uint16_t len)
 {
 	DBG("Not Implemented");
@@ -91,24 +89,14 @@ void bt_pan_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
 	ipc_send_rsp(HAL_SERVICE_ID_PAN, opcode, status);
 }
 
-bool bt_pan_register(int sk, const bdaddr_t *addr)
+bool bt_pan_register(const bdaddr_t *addr)
 {
 	DBG("");
 
-	if (notification_sk >= 0)
-		return false;
-
-	notification_sk = sk;
-
 	return true;
 }
 
 void bt_pan_unregister(void)
 {
 	DBG("");
-
-	if (notification_sk < 0)
-		return;
-
-	notification_sk = -1;
 }
diff --git a/android/pan.h b/android/pan.h
index 2430378..dd18f68 100644
--- a/android/pan.h
+++ b/android/pan.h
@@ -23,5 +23,5 @@
 
 void bt_pan_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len);
 
-bool bt_pan_register(int sk, const bdaddr_t *addr);
+bool bt_pan_register(const bdaddr_t *addr);
 void bt_pan_unregister(void);
diff --git a/android/socket.c b/android/socket.c
index 6a5f4e8..4550dc8 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -934,13 +934,11 @@ void bt_sock_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
 	ipc_send_rsp(HAL_SERVICE_ID_SOCK, opcode, HAL_STATUS_FAILED);
 }
 
-bool bt_socket_register(int sk, const bdaddr_t *addr)
+void bt_socket_register(const bdaddr_t *addr)
 {
 	DBG("");
 
 	bacpy(&adapter_addr, addr);
-
-	return true;
 }
 
 void bt_socket_unregister(void)
diff --git a/android/socket.h b/android/socket.h
index ba56c9b..5150b89 100644
--- a/android/socket.h
+++ b/android/socket.h
@@ -30,5 +30,5 @@ struct hal_sock_connect_signal {
 
 void bt_sock_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len);
 
-bool bt_socket_register(int sk, const bdaddr_t *addr);
+void bt_socket_register(const bdaddr_t *addr);
 void bt_socket_unregister(void);
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 09/10] android/bluetooth: Remove not needed notification_sk checks
From: Szymon Janc @ 2013-11-28 14:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385648130-12808-1-git-send-email-szymon.janc@tieto.com>

This is now checked inside ipc_send_notif helper.
---
 android/bluetooth.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 68e26fa..fdafb81 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1185,9 +1185,7 @@ static void remove_uuid_complete(uint8_t status, uint16_t length,
 
 	mgmt_dev_class_changed_event(adapter.index, length, param, NULL);
 
-	/* send notification only if bluetooth service is registered */
-	if (notification_sk >= 0)
-		get_uuids();
+	get_uuids();
 }
 
 static void remove_uuid(uint16_t uuid)
@@ -1213,9 +1211,7 @@ static void add_uuid_complete(uint8_t status, uint16_t length,
 
 	mgmt_dev_class_changed_event(adapter.index, length, param, NULL);
 
-	/* send notification only if bluetooth service is registered */
-	if (notification_sk >= 0)
-		get_uuids();
+	get_uuids();
 }
 
 static void add_uuid(uint8_t svc_hint, uint16_t uuid)
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 08/10] android: Make ipc_send static
From: Szymon Janc @ 2013-11-28 14:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385648130-12808-1-git-send-email-szymon.janc@tieto.com>

It should not longer be used from outside of IPC code.
---
 android/ipc.c | 2 +-
 android/ipc.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/android/ipc.c b/android/ipc.c
index 83c2221..64b0db5 100644
--- a/android/ipc.c
+++ b/android/ipc.c
@@ -51,7 +51,7 @@ void ipc_cleanup(void)
 	notif_sk = -1;
 }
 
-void ipc_send(int sk, uint8_t service_id, uint8_t opcode, uint16_t len,
+static void ipc_send(int sk, uint8_t service_id, uint8_t opcode, uint16_t len,
 							void *param, int fd)
 {
 	struct msghdr msg;
diff --git a/android/ipc.h b/android/ipc.h
index ce0e0b1..f66c9e0 100644
--- a/android/ipc.h
+++ b/android/ipc.h
@@ -24,8 +24,6 @@
 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(uint8_t service_id, uint8_t opcode, uint8_t status);
 void ipc_send_rsp_full(uint8_t service_id, uint8_t opcode, uint16_t len,
 							void *param, int fd);
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 07/10] android/socket: Use ipc_send_rsp_full IPC helper
From: Szymon Janc @ 2013-11-28 14:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385648130-12808-1-git-send-email-szymon.janc@tieto.com>

Use command reply helper for sending reply with file descriptor.
---
 android/socket.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/android/socket.c b/android/socket.c
index c2212d9..6a5f4e8 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -909,7 +909,7 @@ void bt_sock_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
 		if (fd < 0)
 			break;
 
-		ipc_send(sk, HAL_SERVICE_ID_SOCK, opcode, 0, NULL, fd);
+		ipc_send_rsp_full(HAL_SERVICE_ID_SOCK, opcode, 0, NULL, fd);
 
 		if (close(fd) < 0)
 			error("close() fd %d failed: %s", fd, strerror(errno));
@@ -920,7 +920,7 @@ void bt_sock_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
 		if (fd < 0)
 			break;
 
-		ipc_send(sk, HAL_SERVICE_ID_SOCK, opcode, 0, NULL, fd);
+		ipc_send_rsp_full(HAL_SERVICE_ID_SOCK, opcode, 0, NULL, fd);
 
 		if (close(fd) < 0)
 			error("close() fd %d failed: %s", fd, strerror(errno));
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 06/10] android: Add ipc_send_rsp_full IPC helper
From: Szymon Janc @ 2013-11-28 14:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385648130-12808-1-git-send-email-szymon.janc@tieto.com>

This will be used to send non-empty reply using command socket.
---
 android/ipc.c | 6 ++++++
 android/ipc.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/android/ipc.c b/android/ipc.c
index d1a59d7..83c2221 100644
--- a/android/ipc.c
+++ b/android/ipc.c
@@ -110,6 +110,12 @@ void ipc_send_rsp(uint8_t service_id, uint8_t opcode, uint8_t status)
 	ipc_send(cmd_sk, service_id, HAL_OP_STATUS, sizeof(s), &s, -1);
 }
 
+void ipc_send_rsp_full(uint8_t service_id, uint8_t opcode, uint16_t len,
+							void *param, int fd)
+{
+	ipc_send(cmd_sk, service_id, opcode, len, param, fd);
+}
+
 void ipc_send_notif(uint8_t service_id, uint8_t opcode,  uint16_t len,
 								void *param)
 {
diff --git a/android/ipc.h b/android/ipc.h
index 1233bec..ce0e0b1 100644
--- a/android/ipc.h
+++ b/android/ipc.h
@@ -27,5 +27,7 @@ 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(uint8_t service_id, uint8_t opcode, uint8_t status);
+void ipc_send_rsp_full(uint8_t service_id, uint8_t opcode, uint16_t len,
+							void *param, int fd);
 void ipc_send_notif(uint8_t service_id, uint8_t opcode,  uint16_t len,
 								void *param);
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 05/10] android: Use ipc_send_notif for sending notifications
From: Szymon Janc @ 2013-11-28 14:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385648130-12808-1-git-send-email-szymon.janc@tieto.com>

---
 android/a2dp.c      |  4 ++--
 android/bluetooth.c | 63 ++++++++++++++++++++++++++---------------------------
 android/hidhost.c   | 20 ++++++++---------
 3 files changed, 43 insertions(+), 44 deletions(-)

diff --git a/android/a2dp.c b/android/a2dp.c
index 14f34ad..92c359e 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -112,8 +112,8 @@ static void bt_a2dp_notify_state(struct a2dp_device *dev, uint8_t state)
 	bdaddr2android(&dev->dst, ev.bdaddr);
 	ev.state = state;
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_A2DP,
-			HAL_EV_A2DP_CONN_STATE, sizeof(ev), &ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_A2DP, HAL_EV_A2DP_CONN_STATE, sizeof(ev),
+									&ev);
 
 	if (state != HAL_A2DP_STATE_DISCONNECTED)
 		return;
diff --git a/android/bluetooth.c b/android/bluetooth.c
index b5fd644..68e26fa 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -132,8 +132,8 @@ static void adapter_name_changed(const uint8_t *name)
 	ev->props[0].len = len;
 	memcpy(ev->props->val, name, len);
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
-			HAL_EV_ADAPTER_PROPS_CHANGED, sizeof(buf), ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_ADAPTER_PROPS_CHANGED,
+							sizeof(buf), ev);
 }
 
 static void adapter_set_name(const uint8_t *name)
@@ -173,8 +173,8 @@ static void powered_changed(void)
 
 	DBG("%u", ev.state);
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
-			HAL_EV_ADAPTER_STATE_CHANGED, sizeof(ev), &ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_ADAPTER_STATE_CHANGED,
+							sizeof(ev), &ev);
 }
 
 static uint8_t settings2scan_mode(void)
@@ -210,8 +210,8 @@ static void scan_mode_changed(void)
 
 	DBG("mode %u", *mode);
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
-			HAL_EV_ADAPTER_PROPS_CHANGED, sizeof(buf), buf, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_ADAPTER_PROPS_CHANGED,
+							sizeof(buf), buf);
 }
 
 static void adapter_class_changed(void)
@@ -226,8 +226,8 @@ static void adapter_class_changed(void)
 	ev->props[0].len = sizeof(uint32_t);
 	memcpy(ev->props->val, &adapter.dev_class, sizeof(uint32_t));
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
-			HAL_EV_ADAPTER_PROPS_CHANGED, sizeof(buf), buf, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_ADAPTER_PROPS_CHANGED,
+							sizeof(buf), buf);
 }
 
 static void settings_changed(uint32_t settings)
@@ -327,8 +327,8 @@ static void send_bond_state_change(const bdaddr_t *addr, uint8_t status,
 	ev.state = state;
 	bdaddr2android(addr, ev.bdaddr);
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
-			HAL_EV_BOND_STATE_CHANGED, sizeof(ev), &ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_BOND_STATE_CHANGED,
+							sizeof(ev), &ev);
 }
 
 static void cache_device_name(const bdaddr_t *addr, const char *name)
@@ -408,8 +408,8 @@ static void remote_uuids_callback(struct browse_req *req)
 	ev->props[0].len = sizeof(uint128_t) * g_slist_length(req->uuids);
 	fill_uuids(req->uuids, ev->props[0].val);
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
-				HAL_EV_REMOTE_DEVICE_PROPS, len, ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_REMOTE_DEVICE_PROPS,
+								len, ev);
 
 	g_free(ev);
 }
@@ -605,8 +605,8 @@ static void send_remote_device_name_prop(const bdaddr_t *bdaddr)
 	ev->props[0].len = strlen(name);
 	memcpy(&ev->props[0].val, name, strlen(name));
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
-			HAL_EV_REMOTE_DEVICE_PROPS, ev_len, ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_REMOTE_DEVICE_PROPS,
+								ev_len, ev);
 
 	g_free(ev);
 }
@@ -639,8 +639,8 @@ static void pin_code_request_callback(uint16_t index, uint16_t length,
 	memset(&hal_ev, 0, sizeof(hal_ev));
 	bdaddr2android(&ev->addr.bdaddr, hal_ev.bdaddr);
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH, HAL_EV_PIN_REQUEST,
-						sizeof(hal_ev), &hal_ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_PIN_REQUEST,
+						sizeof(hal_ev), &hal_ev);
 }
 
 static void send_ssp_request(const bdaddr_t *addr, uint8_t variant,
@@ -657,8 +657,8 @@ static void send_ssp_request(const bdaddr_t *addr, uint8_t variant,
 	ev.pairing_variant = variant;
 	ev.passkey = passkey;
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH, HAL_EV_SSP_REQUEST,
-							sizeof(ev), &ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_SSP_REQUEST,
+							sizeof(ev), &ev);
 }
 
 static void user_confirm_request_callback(uint16_t index, uint16_t length,
@@ -760,8 +760,8 @@ static void mgmt_discovering_event(uint16_t index, uint16_t length,
 		cp.state = HAL_DISCOVERY_STATE_STOPPED;
 	}
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
-			HAL_EV_DISCOVERY_STATE_CHANGED, sizeof(cp), &cp, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH,
+			HAL_EV_DISCOVERY_STATE_CHANGED, sizeof(cp), &cp);
 }
 
 static void confirm_device_name(const bdaddr_t *addr, uint8_t addr_type)
@@ -872,8 +872,7 @@ static void update_found_device(const bdaddr_t *bdaddr, uint8_t bdaddr_type,
 		(*num_prop)++;
 	}
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH, opcode, size, buf,
-									-1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, opcode, size, buf);
 
 	if (confirm) {
 		char addr[18];
@@ -943,8 +942,8 @@ static void mgmt_device_connected_event(uint16_t index, uint16_t length,
 	hal_ev.state = HAL_ACL_STATE_CONNECTED;
 	bdaddr2android(&ev->addr.bdaddr, hal_ev.bdaddr);
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
-			HAL_EV_ACL_STATE_CHANGED, sizeof(hal_ev), &hal_ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_ACL_STATE_CHANGED,
+						sizeof(hal_ev), &hal_ev);
 }
 
 static void mgmt_device_disconnected_event(uint16_t index, uint16_t length,
@@ -962,8 +961,8 @@ static void mgmt_device_disconnected_event(uint16_t index, uint16_t length,
 	hal_ev.state = HAL_ACL_STATE_DISCONNECTED;
 	bdaddr2android(&ev->addr.bdaddr, hal_ev.bdaddr);
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
-			HAL_EV_ACL_STATE_CHANGED, sizeof(hal_ev), &hal_ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_ACL_STATE_CHANGED,
+						sizeof(hal_ev), &hal_ev);
 }
 
 static uint8_t status_mgmt2hal(uint8_t mgmt)
@@ -1169,8 +1168,8 @@ static bool get_uuids(void)
 		p += sizeof(uint128_t);
 	}
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
-			HAL_EV_ADAPTER_PROPS_CHANGED, sizeof(buf), ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_ADAPTER_PROPS_CHANGED,
+							sizeof(buf), ev);
 
 	return true;
 }
@@ -1701,8 +1700,8 @@ static void get_address(void)
 	ev->props[0].len = sizeof(bdaddr_t);
 	bdaddr2android(&adapter.bdaddr, ev->props[0].val);
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
-			HAL_EV_ADAPTER_PROPS_CHANGED, sizeof(buf), buf, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_ADAPTER_PROPS_CHANGED,
+							sizeof(buf), buf);
 }
 
 static bool get_name(void)
@@ -1777,8 +1776,8 @@ static bool get_discoverable_timeout(void)
 	memcpy(&ev->props[0].val, &adapter.discoverable_timeout,
 							sizeof(uint32_t));
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_BLUETOOTH,
-			HAL_EV_ADAPTER_PROPS_CHANGED, sizeof(buf), ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_BLUETOOTH, HAL_EV_ADAPTER_PROPS_CHANGED,
+							sizeof(buf), ev);
 
 	return true;
 }
diff --git a/android/hidhost.c b/android/hidhost.c
index 80957e8..09c71f4 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -297,8 +297,8 @@ static void bt_hid_notify_state(struct hid_device *dev, uint8_t state)
 	bdaddr2android(&dev->dst, ev.bdaddr);
 	ev.state = state;
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_HIDHOST,
-			HAL_EV_HIDHOST_CONN_STATE, sizeof(ev), &ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_HIDHOST, HAL_EV_HIDHOST_CONN_STATE,
+							sizeof(ev), &ev);
 }
 
 static gboolean intr_watch_cb(GIOChannel *chan, GIOCondition cond,
@@ -356,8 +356,8 @@ static void bt_hid_notify_proto_mode(struct hid_device *dev, uint8_t *buf,
 		ev.mode = HAL_HIDHOST_UNSUPPORTED_PROTOCOL;
 	}
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_HIDHOST,
-			HAL_EV_HIDHOST_PROTO_MODE, sizeof(ev), &ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_HIDHOST, HAL_EV_HIDHOST_PROTO_MODE,
+							sizeof(ev), &ev);
 }
 
 static void bt_hid_notify_get_report(struct hid_device *dev, uint8_t *buf,
@@ -399,8 +399,8 @@ static void bt_hid_notify_get_report(struct hid_device *dev, uint8_t *buf,
 	}
 
 send:
-	ipc_send(notification_sk, HAL_SERVICE_ID_HIDHOST,
-				HAL_EV_HIDHOST_GET_REPORT, ev_len, ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_HIDHOST, HAL_EV_HIDHOST_GET_REPORT,
+								ev_len, ev);
 	g_free(ev);
 }
 
@@ -424,8 +424,8 @@ static void bt_hid_notify_virtual_unplug(struct hid_device *dev,
 		ev.status = HAL_HIDHOST_STATUS_OK;
 	}
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_HIDHOST,
-			HAL_EV_HIDHOST_VIRTUAL_UNPLUG, sizeof(ev), &ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_HIDHOST, HAL_EV_HIDHOST_VIRTUAL_UNPLUG,
+							sizeof(ev), &ev);
 
 }
 
@@ -509,8 +509,8 @@ static void bt_hid_set_info(struct hid_device *dev)
 	memset(ev.descr, 0, sizeof(ev.descr));
 	memcpy(ev.descr, dev->rd_data, ev.descr_len);
 
-	ipc_send(notification_sk, HAL_SERVICE_ID_HIDHOST, HAL_EV_HIDHOST_INFO,
-							sizeof(ev), &ev, -1);
+	ipc_send_notif(HAL_SERVICE_ID_HIDHOST, HAL_EV_HIDHOST_INFO, sizeof(ev),
+									&ev);
 }
 
 static int uhid_create(struct hid_device *dev)
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 04/10] android: Add IPC helper for sending notifications
From: Szymon Janc @ 2013-11-28 14:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385648130-12808-1-git-send-email-szymon.janc@tieto.com>

This will use notification socket passed on IPC init.
---
 android/ipc.c | 9 +++++++++
 android/ipc.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/android/ipc.c b/android/ipc.c
index 51734e3..d1a59d7 100644
--- a/android/ipc.c
+++ b/android/ipc.c
@@ -109,3 +109,12 @@ void ipc_send_rsp(uint8_t service_id, uint8_t opcode, uint8_t status)
 
 	ipc_send(cmd_sk, service_id, HAL_OP_STATUS, sizeof(s), &s, -1);
 }
+
+void ipc_send_notif(uint8_t service_id, uint8_t opcode,  uint16_t len,
+								void *param)
+{
+	if (notif_sk < 0)
+		return;
+
+	ipc_send(notif_sk, service_id, opcode, len, param, -1);
+}
diff --git a/android/ipc.h b/android/ipc.h
index 873f715..1233bec 100644
--- a/android/ipc.h
+++ b/android/ipc.h
@@ -27,3 +27,5 @@ 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(uint8_t service_id, uint8_t opcode, uint8_t status);
+void ipc_send_notif(uint8_t service_id, uint8_t opcode,  uint16_t len,
+								void *param);
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 03/10] android: Use ipc_send_rsp helper for replying success
From: Szymon Janc @ 2013-11-28 14:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385648130-12808-1-git-send-email-szymon.janc@tieto.com>

Where applicable use helper as this make code easier to understand.
---
 android/bluetooth.c | 2 +-
 android/main.c      | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 716c0eb..b5fd644 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -2263,7 +2263,7 @@ void bt_bluetooth_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
 		goto error;
 	}
 
-	ipc_send(sk, HAL_SERVICE_ID_BLUETOOTH, opcode, 0, NULL, -1);
+	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, opcode, HAL_STATUS_SUCCESS);
 	return;
 
 error:
diff --git a/android/main.c b/android/main.c
index 6fe0d1c..211503b 100644
--- a/android/main.c
+++ b/android/main.c
@@ -115,8 +115,8 @@ static void service_register(void *buf, uint16_t len)
 
 	services[m->service_id] = true;
 
-	ipc_send(g_io_channel_unix_get_fd(hal_cmd_io), HAL_SERVICE_ID_CORE,
-					HAL_OP_REGISTER_MODULE, 0, NULL, -1);
+	ipc_send_rsp(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
+							HAL_STATUS_SUCCESS);
 
 	info("Service ID=%u registered", m->service_id);
 	return;
@@ -157,8 +157,8 @@ static void service_unregister(void *buf, uint16_t len)
 
 	services[m->service_id] = false;
 
-	ipc_send(g_io_channel_unix_get_fd(hal_cmd_io), HAL_SERVICE_ID_CORE,
-					HAL_OP_UNREGISTER_MODULE, 0, NULL, -1);
+	ipc_send_rsp(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
+							HAL_STATUS_SUCCESS);
 
 	info("Service ID=%u unregistered", m->service_id);
 	return;
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 02/10] android: Remove socket parameter from ipc_send_rsp
From: Szymon Janc @ 2013-11-28 14:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385648130-12808-1-git-send-email-szymon.janc@tieto.com>

Use command socket provided to IPC on init.
---
 android/a2dp.c      |  2 +-
 android/bluetooth.c |  2 +-
 android/hidhost.c   |  2 +-
 android/ipc.c       |  6 +++---
 android/ipc.h       |  2 +-
 android/main.c      | 17 ++++++-----------
 android/pan.c       |  2 +-
 android/socket.c    |  2 +-
 8 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/android/a2dp.c b/android/a2dp.c
index 2251001..14f34ad 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -251,7 +251,7 @@ void bt_a2dp_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
 		break;
 	}
 
-	ipc_send_rsp(sk, HAL_SERVICE_ID_A2DP, opcode, status);
+	ipc_send_rsp(HAL_SERVICE_ID_A2DP, opcode, status);
 }
 
 static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
diff --git a/android/bluetooth.c b/android/bluetooth.c
index 0e45131..716c0eb 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -2269,7 +2269,7 @@ void bt_bluetooth_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
 error:
 	error("Error handling command 0x%02x status %u", opcode, status);
 
-	ipc_send_rsp(sk, HAL_SERVICE_ID_BLUETOOTH, opcode, status);
+	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, opcode, status);
 }
 
 bool bt_bluetooth_register(int sk)
diff --git a/android/hidhost.c b/android/hidhost.c
index d50c5b8..80957e8 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -1115,7 +1115,7 @@ void bt_hid_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
 		break;
 	}
 
-	ipc_send_rsp(sk, HAL_SERVICE_ID_HIDHOST, opcode, status);
+	ipc_send_rsp(HAL_SERVICE_ID_HIDHOST, opcode, status);
 }
 
 static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
diff --git a/android/ipc.c b/android/ipc.c
index 028d4ad..51734e3 100644
--- a/android/ipc.c
+++ b/android/ipc.c
@@ -96,16 +96,16 @@ void ipc_send(int sk, uint8_t service_id, uint8_t opcode, uint16_t len,
 	}
 }
 
-void ipc_send_rsp(int sk, uint8_t service_id, uint8_t opcode, uint8_t status)
+void ipc_send_rsp(uint8_t service_id, uint8_t opcode, uint8_t status)
 {
 	struct hal_status s;
 
 	if (status == HAL_STATUS_SUCCESS) {
-		ipc_send(sk, service_id, opcode, 0, NULL, -1);
+		ipc_send(cmd_sk, service_id, opcode, 0, NULL, -1);
 		return;
 	}
 
 	s.code = status;
 
-	ipc_send(sk, service_id, HAL_OP_STATUS, sizeof(s), &s, -1);
+	ipc_send(cmd_sk, service_id, HAL_OP_STATUS, sizeof(s), &s, -1);
 }
diff --git a/android/ipc.h b/android/ipc.h
index 5786d2d..873f715 100644
--- a/android/ipc.h
+++ b/android/ipc.h
@@ -26,4 +26,4 @@ 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);
+void ipc_send_rsp(uint8_t service_id, uint8_t opcode, uint8_t status);
diff --git a/android/main.c b/android/main.c
index 4e6ad38..6fe0d1c 100644
--- a/android/main.c
+++ b/android/main.c
@@ -121,9 +121,8 @@ static void service_register(void *buf, uint16_t len)
 	info("Service ID=%u registered", m->service_id);
 	return;
 failed:
-	ipc_send_rsp(g_io_channel_unix_get_fd(hal_cmd_io),
-				HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
-				HAL_STATUS_FAILED);
+	ipc_send_rsp(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
+							HAL_STATUS_FAILED);
 }
 
 static void service_unregister(void *buf, uint16_t len)
@@ -164,9 +163,8 @@ static void service_unregister(void *buf, uint16_t len)
 	info("Service ID=%u unregistered", m->service_id);
 	return;
 failed:
-	ipc_send_rsp(g_io_channel_unix_get_fd(hal_cmd_io),
-				HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
-				HAL_STATUS_FAILED);
+	ipc_send_rsp(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
+							HAL_STATUS_FAILED);
 }
 
 static void handle_service_core(uint8_t opcode, void *buf, uint16_t len)
@@ -179,9 +177,7 @@ static void handle_service_core(uint8_t opcode, void *buf, uint16_t len)
 		service_unregister(buf, len);
 		break;
 	default:
-		ipc_send_rsp(g_io_channel_unix_get_fd(hal_cmd_io),
-						HAL_SERVICE_ID_CORE, opcode,
-						HAL_STATUS_FAILED);
+		ipc_send_rsp(HAL_SERVICE_ID_CORE, opcode, HAL_STATUS_FAILED);
 		break;
 	}
 }
@@ -277,8 +273,7 @@ static gboolean cmd_watch_cb(GIOChannel *io, GIOCondition cond,
 		bt_pan_handle_cmd(fd, msg->opcode, msg->payload, msg->len);
 		break;
 	default:
-		ipc_send_rsp(fd, msg->service_id, msg->opcode,
-							HAL_STATUS_FAILED);
+		ipc_send_rsp(msg->service_id, msg->opcode, HAL_STATUS_FAILED);
 		break;
 	}
 
diff --git a/android/pan.c b/android/pan.c
index ada458a..29f1007 100644
--- a/android/pan.c
+++ b/android/pan.c
@@ -88,7 +88,7 @@ void bt_pan_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
 		break;
 	}
 
-	ipc_send_rsp(sk, HAL_SERVICE_ID_PAN, opcode, status);
+	ipc_send_rsp(HAL_SERVICE_ID_PAN, opcode, status);
 }
 
 bool bt_pan_register(int sk, const bdaddr_t *addr)
diff --git a/android/socket.c b/android/socket.c
index 1fb154d..c2212d9 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -931,7 +931,7 @@ void bt_sock_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
 		break;
 	}
 
-	ipc_send_rsp(sk, HAL_SERVICE_ID_SOCK, opcode, HAL_STATUS_FAILED);
+	ipc_send_rsp(HAL_SERVICE_ID_SOCK, opcode, HAL_STATUS_FAILED);
 }
 
 bool bt_socket_register(int sk, const bdaddr_t *addr)
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 01/10] android: Initialize IPC with command and notification sockets
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

* [PATCH 2/2] android/pics: Add PIXIT setup info to PICS files
From: Jakub Tyszkowski @ 2013-11-28 13:57 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1385647052-26572-1-git-send-email-jakub.tyszkowski@tieto.com>

Some profiles like DID, requires specific PIXIT setup to pass some tests
cases. Other profiles works well with defaults. Thus appropriate
information at the end of PICS file should be provided.

---
 android/pics-did.txt  | 11 +++++++++++
 android/pics-gap.txt  |  5 +++++
 android/pics-hid.txt  |  5 +++++
 android/pics-opp.txt  |  5 +++++
 android/pics-pan.txt  |  5 +++++
 android/pics-pbap.txt |  5 +++++
 6 files changed, 36 insertions(+)

diff --git a/android/pics-did.txt b/android/pics-did.txt
index 8f92bc1..e8c914a 100644
--- a/android/pics-did.txt
+++ b/android/pics-did.txt
@@ -29,3 +29,14 @@ TSPC_DID_1_5	True		Primary Record (M)
 TSPC_DID_1_6	True		Vendor ID Source (M)
 TSPC_ALL	False		Turns on all the test cases
 -------------------------------------------------------------------------------
+
+
+		Required PIXIT settings
+-------------------------------------------------------------------------------
+Parameter Name			Value
+-------------------------------------------------------------------------------
+TSPX_ClientExecutableURL	False
+TSPX_ServiceDescription		False
+TSPX_DocumentationURL		False
+-------------------------------------------------------------------------------
+Other should be set according to Tester's test environment.
diff --git a/android/pics-gap.txt b/android/pics-gap.txt
index e8ab2ab..cd274e8 100644
--- a/android/pics-gap.txt
+++ b/android/pics-gap.txt
@@ -707,3 +707,8 @@ TSPC_SM_1_2	False		Slave Role (Responder)
 TSPC_SM_2_4	False		OOB supported (O)
 TSPC_ALL	False		Turns on all
 -------------------------------------------------------------------------------
+
+
+-------------------------------------------------------------------------------
+No special PIXIT settings required. All should be set according to Tester's
+test environment.
diff --git a/android/pics-hid.txt b/android/pics-hid.txt
index b0b7d52..ba50626 100644
--- a/android/pics-hid.txt
+++ b/android/pics-hid.txt
@@ -283,3 +283,8 @@ TSPC_ALL	False		Enables all test cases when set to true.
 -------------------------------------------------------------------------------
 M.1: Mandatory IF (TSPC_HID_1_2) is supported.
 -------------------------------------------------------------------------------
+
+
+-------------------------------------------------------------------------------
+No special PIXIT settings required. All should be set according to Tester's
+test environment.
diff --git a/android/pics-opp.txt b/android/pics-opp.txt
index c0f2ad6..11e61ff 100644
--- a/android/pics-opp.txt
+++ b/android/pics-opp.txt
@@ -182,3 +182,8 @@ TSPC_ALL	False		Turn on all test cases.
 -------------------------------------------------------------------------------
 C.1: Optional if TSPC_OPP_1_2 is supported, otherwise excluded.
 -------------------------------------------------------------------------------
+
+
+-------------------------------------------------------------------------------
+No special PIXIT settings required. All should be set according to Tester's
+test environment.
diff --git a/android/pics-pan.txt b/android/pics-pan.txt
index 7576d2d..406b6a9 100644
--- a/android/pics-pan.txt
+++ b/android/pics-pan.txt
@@ -144,3 +144,8 @@ C.1: PAN User devices must support at least One of items (TSPC_PAN_4_2) or
 C.2: Mandatory to support if (TSPC_PAN_4_2) is supported.
 C.3: Mandatory to support if (TSPC_PAN_4_8) is supported.
 -------------------------------------------------------------------------------
+
+
+-------------------------------------------------------------------------------
+No special PIXIT settings required. All should be set according to Tester's
+test environment.
diff --git a/android/pics-pbap.txt b/android/pics-pbap.txt
index 7b2d7d2..2af5fd8 100644
--- a/android/pics-pbap.txt
+++ b/android/pics-pbap.txt
@@ -439,3 +439,8 @@ TSPC_ALL	False (*)	Turns on all the test cases
 -------------------------------------------------------------------------------
 C.1: Optional if TSPC_PBAP_26_4 (OBEX SRM) is supported, otherwise Excluded.
 -------------------------------------------------------------------------------
+
+
+-------------------------------------------------------------------------------
+No special PIXIT settings required. All should be set according to Tester's
+test environment.
-- 
1.8.4.1


^ permalink raw reply related

* [PATCH 1/2] android/pics: Add PTS PICS for PBAP
From: Jakub Tyszkowski @ 2013-11-28 13:57 UTC (permalink / raw)
  To: linux-bluetooth

PTS PICS for PBAP, targeting Android 4.4.

---
 android/Makefile.am   |   2 +-
 android/pics-pbap.txt | 441 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 442 insertions(+), 1 deletion(-)
 create mode 100644 android/pics-pbap.txt

diff --git a/android/Makefile.am b/android/Makefile.am
index 38aa00a..15ecf35 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -87,4 +87,4 @@ endif
 EXTRA_DIST += android/Android.mk android/hal-ipc-api.txt android/README \
 		android/pics-gap.txt android/pics-hid.txt \
 		android/pics-pan.txt android/pics-did.txt \
-		android/pics-opp.txt
+		android/pics-opp.txt android/pics-pbap.txt
diff --git a/android/pics-pbap.txt b/android/pics-pbap.txt
new file mode 100644
index 0000000..7b2d7d2
--- /dev/null
+++ b/android/pics-pbap.txt
@@ -0,0 +1,441 @@
+PBAP PICS for the PTS tool.
+
+* - different than PTS defaults
+# - not yet implemented/supported
+
+M - mandatory
+O - optional
+
+		Major Profile Version (X.Y)
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_0_1	False		Role: PBAP 1.0 (C.1)
+TSPC_PBAP_0_2	True (*)	Role: PBAP 1.1 (C.1)
+TSPC_PBAP_0_3	False		Role: Reserve
+TSPC_PBAP_0_4	False (*)	Role: PBAP 1.2 (C.1)
+-------------------------------------------------------------------------------
+C.1: Mandatory to support one and only one major profile version.
+-------------------------------------------------------------------------------
+
+
+		Roles
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_1_1	False		Role: PCE (C.1)
+TSPC_PBAP_1_2	True (*)	Role: PSE (C.1)
+-------------------------------------------------------------------------------
+C1: It is mandatory to support at least one of the defined roles.
+-------------------------------------------------------------------------------
+
+
+		Supported features (PCE)
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_2_1	False (*)	PCE: Phone Book Download (C.1)
+TSPC_PBAP_2_2	False (*)	PCE: Phone Book Browsing (C.1)
+TSPC_PBAP_2_3	False (*)	PCE: Session Management (M)
+TSPC_PBAP_2_4	False		PCE: Able to Request Size of the Phonebook (O)
+TSPC_PBAP_2_5	False		PCE: Database Identifier (C.2)
+TSPC_PBAP_2_6	False		PCE: Folder Version Counters (C.2)
+TSPC_PBAP_2_7	False		PCE: vCard Selecting (C.2)
+TSPC_PBAP_2_7a	False		PCE: Able to send vCardSelector (C.2)
+TSPC_PBAP_2_7b	False		PCE: Able to send vCardSelectorOperator (C.2)
+TSPC_PBAP_2_8	False (*)	PCE: Enhanced Missed Calls (C.4)
+TSPC_PBAP_2_8a	False (*)	PCE: Able to reset the missed Calls (C.2)
+TSPC_PBAP_2_9	False		PCE: X-BT-UCI vCard Field (C.2)
+TSPC_PBAP_2_9a	False		PCE: Able to request X-BT-UCI Field (C.2)
+TSPC_PBAP_2_10	False		PCE: X-BT-UID vCard Field (C.2)
+TSPC_PBAP_2_10a	False		PCE: Referencing Contacts (C.2)
+TSPC_PBAP_2_12	False		PCE: Contact Image Default Format (C.2)
+TSPC_PBAP_2_12a	False		PCE: Able to request Contact Images (C.2)
+TSPC_PBAP_2_13	False		PCE: Supported Phonebook Objects (C.3)
+TSPC_PBAP_2_13a	False (*)	PCE: Telecom/pb (C.3)
+TSPC_PBAP_2_13b	False		PCE: Telecom/ich (C.3)
+TSPC_PBAP_2_13c	False		PCE: Telecom/och (C.3)
+TSPC_PBAP_2_13d	False (*)	PCE: Telecom/mch (C.3)
+TSPC_PBAP_2_13e	False (*)	PCE: Telecom/cch (C.3)
+TSPC_PBAP_2_13f	False		PCE: Telecom/spd (C.3)
+TSPC_PBAP_2_13g	False		PCE: Telecom/fav (C.3)
+TSPC_PBAP_2_13h	False		PCE: SIM1/Telecom/pb (C.3)
+TSPC_PBAP_2_13i	False		PCE: SIM1/Telecom/ich (C.3)
+TSPC_PBAP_2_13j	False		PCE: SIM1/Telecom/och (C.3)
+TSPC_PBAP_2_13k	False		PCE: SIM1/Telecom/mch (C.3)
+TSPC_PBAP_2_13l	False		PCE: SIM1/Telecom/cch (C.3)
+-------------------------------------------------------------------------------
+C.1: It is mandatory to support at least one of the defined features.
+C.2: Optional if TSPC_PBAP_0_3 (PBAP 1.2) is supported, otherwise Excluded.
+C.3: Mandatory to support at least one of the listed phonebook objects .
+C.4: Optional if TSPC_PBAP_0_3 (PBAP 1.2) and any of the mch or cch folders
+	(13d,13e,13k,13l) are supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+		Supported Phone Book Download functions (PCE)
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_3_1	False (*)	PCE: Pull Phone Book (C.1)
+-------------------------------------------------------------------------------
+C1: Mandatory for PCE if Phone Book Download (TSPC_PBAP_2_1) is supported,
+	otherwise excluded.
+-------------------------------------------------------------------------------
+
+
+		Supported Phone Book Browsing functions (PCE)
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_4_1	False (*)	PCE: Set Phone Book (C.1)
+TSPC_PBAP_4_2	False (*)	PCE: Pull vCard Listing (C.1)
+TSPC_PBAP_4_3	False (*)	PCE: Pull vCard Entry (C.1)
+-------------------------------------------------------------------------------
+C1: Mandatory for PCE if Phone Book Browsing TSPC_PBAP_2_2 is supported,
+	otherwise excluded.
+-------------------------------------------------------------------------------
+
+
+		Used vCard formats (PCE)
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_5_1	False (*)	PCE: vCard 2.1 (C.1)
+TSPC_PBAP_5_2	False (*)	PCE: vCard 3.0 (C.1)
+-------------------------------------------------------------------------------
+C1: It is mandatory to support at least one of the defined versions if PCE
+	supported.
+-------------------------------------------------------------------------------
+
+
+		OBEX Functions for PCE
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_6_1	False (*)	PCE: Connect (M)
+TSPC_PBAP_6_2	False (*)	PCE: Disconnect (M)
+TSPC_PBAP_6_3	False (*)	PCE: Get (M)
+TSPC_PBAP_6_4	False (*)	PCE: Abort (M)
+TSPC_PBAP_6_5	False (*)	PCE: SetPath (C.1)
+TSPC_PBAP_6_6	False		PCE: Support for OBEX authentication initiation
+					(C.2)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_PBAP_2_2 (Phone Book Browsing) is supported,
+	otherwise Excluded.
+C.2: Optional to support initiation if TSPC_PBAP_0_1 (PBAP 1.0) or
+	TSPC_PBAP_0_2 (PBAP 1.1) is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+		PCE OBEX Header Support
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_7_1	False (*)	PCE: Name (M)
+TSPC_PBAP_7_2	False (*)	PCE: Type (M)
+TSPC_PBAP_7_3	False (*)	PCE: Body (M)
+TSPC_PBAP_7_4	False (*)	PCE: End of Body (M)
+TSPC_PBAP_7_5	False (*)	PCE: Target (M)
+TSPC_PBAP_7_6	False (*)	PCE: Who (M)
+TSPC_PBAP_7_7	False (*)	PCE: Connection ID (M)
+TSPC_PBAP_7_8	False (*)	PCE: Authentication Challenge (M)
+TSPC_PBAP_7_9	False (*)	PCE: Authentication Response (M)
+TSPC_PBAP_7_10	False (*)	PCE: Application Parameters (M)
+TSPC_PBAP_7_11	False		PCE: Single Response Mode (C.1)
+TSPC_PBAP_7_12	False		PCE: Single Response Mode Parameter
+					(ability to parse) (C.1)
+TSPC_PBAP_7_13	False		PCE: Single Response Mode Parameter
+					(ability to send) (C.1)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_PBAP_0_3 (PBAP 1.2) is supported, otherwise Excluded.
+C.2: Optional if TSPC_PBAP_0_3 (PBAP 1.2) is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+		OBEX Error Codes for PCE
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_8_1	False (*)	PCE: Bad Request (M)
+TSPC_PBAP_8_2	False (*)	PCE: Not Implemented (M)
+TSPC_PBAP_8_3	False (*)	PCE: Unauthorized (M)
+TSPC_PBAP_8_4	False (*)	PCE: Precondition Failed (M)
+TSPC_PBAP_8_5	False (*)	PCE: Not Found (M)
+TSPC_PBAP_8_6	False (*)	PCE: Not Acceptable (M)
+TSPC_PBAP_8_7	False (*)	PCE: Service Unavailable (M)
+TSPC_PBAP_8_8	False (*)	PCE: Forbidden (M)
+-------------------------------------------------------------------------------
+
+
+		Supported features ( PSE )
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_9_1	True		PSE: Phone Book Download (M)
+TSPC_PBAP_9_2	True		PSE: Phone Book Browsing (M)
+TSPC_PBAP_9_3	True		PSE: Session Management (M)
+TSPC_PBAP_9_4	True		PSE: Able to request the size of the Phonebook
+					(M)
+TSPC_PBAP_9_5	False		PSE: Database Identifier (C.1)
+TSPC_PBAP_9_5a	False		PSE: Able to keep a persistent Database
+					Identifier (C.2)
+TSPC_PBAP_9_5b	False		PSE: Able to regenerate a Database Identifier
+					(C.2)
+TSPC_PBAP_9_6	False		PSE: Folder Version Counters (C.1)
+TSPC_PBAP_9_6a	False		PSE: Able to Insert or Remove Entries (C.2)
+TSPC_PBAP_9_6b	False		PSE: Able to Modify contact primary Fields (C.2)
+TSPC_PBAP_9_6c	False		PSE: Able to Modify contact secondary Fields
+					(C.2)
+TSPC_PBAP_9_7	False (*)	PSE: vCard Selecting (C.1)
+TSPC_PBAP_9_8	False (*)	PSE: Enhanced Missed Calls (C.4)
+TSPC_PBAP_9_9	False		PSE: X-BT-UCI vCard Field (C.2)
+TSPC_PBAP_9_10	False		PSE: X-BT-UID vCard Field (C.2)
+TSPC_PBAP_9_10a	False		PSE: Referencing Contacts (C.3)
+TSPC_PBAP_9_12	False		PSE: Contact Image Default Format (C.1)
+TSPC_PBAP_9_12a	False		PSE: Able to request Contact Images (C.2)
+TSPC_PBAP_9_13	False		PSE: Supported Phonebook Objects
+TSPC_PBAP_9_13a	False (*)	PSE: Telecom/pb (M)
+TSPC_PBAP_9_13b	False		PSE: Telecom/ich (O)
+TSPC_PBAP_9_13c	False		PSE: Telecom/och (O)
+TSPC_PBAP_9_13d	False		PSE: Telecom/mch (O)
+TSPC_PBAP_9_13e	False (*)	PSE: Telecom/cch (O)
+TSPC_PBAP_9_13f	False		PSE: Telecom/spd (C.2)
+TSPC_PBAP_9_13g	False		PSE: Telecom/fav (C.2)
+TSPC_PBAP_9_13h	False (*)	PSE: SIM1/Telecom/pb (O)
+TSPC_PBAP_9_13i	False		PSE: SIM1/Telecom/ich (O)
+TSPC_PBAP_9_13j	False		PSE: SIM1/Telecom/och (O)
+TSPC_PBAP_9_13k	False (*)	PSE: SIM1/Telecom/mch (O)
+TSPC_PBAP_9_13l	False		PSE: SIM1/Telecom/cch (O)
+TSPC_PBAP_9_14	False		PSE: Deleted Handles Behavior
+TSPC_PBAP_9_14a	False (*)	PSE: Error reporting (C.5)
+TSPC_PBAP_9_14b	False		PSE: Change tracking (C.5)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_PBAP_0_3 (PBAP 1.2) is supported, otherwise Excluded.
+C.2: Optional if TSPC_PBAP_0_3 (PBAP 1.2) is supported, otherwise Excluded.
+C.3: Optional if TSPC_PBAP_9_10 (X-BT-UID vCard Property) is supported,
+	otherwise Excluded.
+C.4: Optional if TSPC_PBAP_0_3 (PBAP 1.2) and any of the mch or cch folders
+	(13d,13e,13k,13l) are supported, otherwise Excluded.
+C.5: It is mandatory to support at least one of the defined deleted handles
+	behaviors.
+-------------------------------------------------------------------------------
+
+
+		Supported Phone Book Download functions ( PSE )
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_10_1	True		PSE: Pull Phone Book (M)
+TSPC_PBAP_10_2	False		PSE: Call History Function (O)
+-------------------------------------------------------------------------------
+
+
+		Supported Phone Book Browsing functions ( PSE )
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_11_1	True		PSE: Set Phone Book (M)
+TSPC_PBAP_11_2	True		PSE: Pull vCard Listing (M)
+TSPC_PBAP_11_3	True		PSE: Pull vCard Entry (M)
+-------------------------------------------------------------------------------
+
+
+		Used vCard formats (PSE)
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_12_1	True		PSE: vCard 2.1 (M)
+TSPC_PBAP_12_2	True		PSE: vCard 3.0 (M)
+-------------------------------------------------------------------------------
+
+
+		OBEX Functions for PSE
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_13_1	True		PSE: Connect (M)
+TSPC_PBAP_13_2	True		PSE: Disconnect (M)
+TSPC_PBAP_13_3	True		PSE: Get (M)
+TSPC_PBAP_13_4	True		PSE: Abort (M)
+TSPC_PBAP_13_5	True		PSE: SetPath (M)
+TSPC_PBAP_13_6	False		PSE: Support for OBEX authentication initiation
+					(C.1)
+-------------------------------------------------------------------------------
+C.1: Optional to support initiation if TSPC_PBAP_0_1 (PBAP 1.0) or
+	TSPC_PBAP_0_2 (PBAP 1.1) is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+		PSE OBEX Header Support
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_14_1	True		PSE: Name (M)
+TSPC_PBAP_14_2	True		PSE: Type (M)
+TSPC_PBAP_14_3	True		PSE: Body (M)
+TSPC_PBAP_14_4	True		PSE: End of Body (M)
+TSPC_PBAP_14_5	True		PSE: Target (M)
+TSPC_PBAP_14_6	True		PSE: Who (M)
+TSPC_PBAP_14_7	True		PSE: Connection ID (M)
+TSPC_PBAP_14_8	True		PSE: Authentication Challenge (M)
+TSPC_PBAP_14_9	True		PSE: Authentication Response (M)
+TSPC_PBAP_14_10	True		PSE: Application Parameters (M)
+TSPC_PBAP_14_11	False		PSE: Single Response Mode (C.1)
+TSPC_PBAP_14_12	False		PSE: Single Response Mode Parameter
+					(ability to parse) (C.1)
+TSPC_PBAP_14_13	False		PSE: Single Response Mode Parameter
+					(ability to send) (C.2)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_PBAP_0_3 (PBAP 1.2) is supported, otherwise Excluded.
+C.2: Optional if TSPC_PBAP_0_3 (PBAP 1.2) is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+		OBEX Error Codes for PSE
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_15_1	True		PSE: Bad Request (M)
+TSPC_PBAP_15_2	True		PSE: Not Implemented (M)
+TSPC_PBAP_15_3	True (*)	PSE: Unauthorized (O)
+TSPC_PBAP_15_4	True (*)	PSE: Precondition Failed (C.1)
+TSPC_PBAP_15_5	True		PSE: Not Found (M)
+TSPC_PBAP_15_6	True (*)	PSE: Not Acceptable (O)
+TSPC_PBAP_15_7	True		PSE: Service Unavailable (M)
+TSPC_PBAP_15_8	True (*)	PSE: Forbidden (O)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_PBAP_9_14a (Error reporting) is supported, otherwise
+	Optional.
+-------------------------------------------------------------------------------
+
+
+		GAP Modes for PCE
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_16_1	False (*)	PCE: General discoverable mode (M)
+TSPC_PBAP_16_2	False (*)	PCE: Pairable mode (M)
+-------------------------------------------------------------------------------
+
+
+		GAP Modes for PSE
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_17_1	True		PSE: General discoverable mode (M)
+TSPC_PBAP_17_2	True		PSE: Pairable mode (M)
+-------------------------------------------------------------------------------
+
+
+		GAP Security Modes for PCE
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_18_1	False (*)	PCE: Authentication Procedure (M)
+TSPC_PBAP_18_2	False (*)	PCE: Initiate LMP-Authentication (M)
+TSPC_PBAP_18_3	False		PCE: Security mode 1 (C.1)
+TSPC_PBAP_18_4	False		PCE: Security mode 2 (C.1)
+TSPC_PBAP_18_5	False		PCE: Security mode 3 (C.1)
+TSPC_PBAP_18_6	False		PCE: Security mode 4 (C.1)
+-------------------------------------------------------------------------------
+C.1: At least one of TSPC_PBAP_18_4, TSPC_PBAP_18_5 or TSPC_PBAP_18_6
+	(security mode 2, 3, or 4) shall be supported.
+-------------------------------------------------------------------------------
+
+
+		GAP Security Modes for PSE
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_19_1	True		PSE: Authentication Procedure (M)
+TSPC_PBAP_19_2	True		PSE: Initiate LMP-Authentication (M)
+TSPC_PBAP_19_3	False		PSE: Security mode 1 (C.2)
+TSPC_PBAP_19_4	False		PSE: Security mode 2 (C.1)
+TSPC_PBAP_19_5	False		PSE: Security mode 3 (C.1)
+TSPC_PBAP_19_6	False		PSE: Security mode 4 (C.1)
+-------------------------------------------------------------------------------
+C.1: At least one of TSPC_PBAP_19_3, TSPC_PBAP_19_4, TSPC_PBAP_19_5 or
+	TSPC_PBAP_19_6 (security mode 2, 3, or 4) shall be supported.
+C.2: Excluded in PSE.
+-------------------------------------------------------------------------------
+
+
+		GAP Idle Modes for PSE
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_21_1	True		PSE: Initiation of General Inquiry (M)
+TSPC_PBAP_21_2	False		PSE: Initiation of Limited Inquiry (O)
+-------------------------------------------------------------------------------
+
+
+		SDP Attributes (PCE)
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_22_1	False (*)	PCE: BluetoothProfileDescriptorList (M)
+-------------------------------------------------------------------------------
+
+		SDP Attributes (PSE)
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_23_1	True		PSE: ProtocolDescriptorList (M)
+TSPC_PBAP_23_2	True		PSE: BluetoothProfileDescriptorList (M)
+-------------------------------------------------------------------------------
+
+
+		Additional PBAP Capabilities
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_24_1	False		PCE: Retrieve Large Phone Book (C.1)
+TSPC_PBAP_24_2	False		PSE: Transfer Large Phone Book (C.2)
+TSPC_PBAP_24_3	False		PCE: Retrieve Empty Phone Book (C.1)
+TSPC_PBAP_24_4	False		PSE: Transfer Empty Phone Book (C.2)
+TSPC_PBAP_24_5	False		PSE: Return Phonebook – Limit number of entries
+					(C.2)
+TSPC_PBAP_24_6	False		PSE: Return vCard listing – Limit number of
+					entries  (C.2)
+TSPC_PBAP_24_7	False		PSE: Phone Book Order (C.2)
+TSPC_PBAP_24_8	False		PSE: Call stack timestamps (C.3)
+TSPC_PBAP_24_9	False		PSE: No User Interaction (C.2)
+TSPC_PBAP_24_10	False		PSE: Special Character Handling  (C.2)
+-------------------------------------------------------------------------------
+C.1: Optional if TSPC_PBAP_2_1 is supported, otherwise excluded.
+C.2: Optional if TSPC_PBAP_1_2 is supported, otherwise excluded.
+C.3: Optional if TSPC_PBAP_10_2 is supported, otherwise excluded.
+-------------------------------------------------------------------------------
+
+
+		GOEP 2.0 or later Features (PCE)
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_25_1	False (*)	PCE: GOEP v2.0 or later (M)
+TSPC_PBAP_25_2	False (*)	PCE: GOEP v2 Backwards Compatibility (M)
+TSPC_PBAP_25_3	False		PCE: OBEX over L2CAP (M)
+TSPC_PBAP_25_4	False		PCE: OBEX SRM (M)
+TSPC_PBAP_25_5	False (*)	PCE: Send OBEX SRMP header (C.1)
+TSPC_PBAP_25_6	False		PCE: Receive OBEX SRMP header (M)
+-------------------------------------------------------------------------------
+C.1: Optional to support if TSPC_PBAP_25_4 (OBEX SRM) is supported,
+	otherwise Excluded.
+-------------------------------------------------------------------------------
+
+
+		GOEP 2.0 or later Features (PSE)
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_PBAP_26_1	False (*)	PSE: GOEP v2.0 or later (M)
+TSPC_PBAP_26_2	False (*)	PSE: GOEP v2 Backwards Compatibility (M)
+TSPC_PBAP_26_3	False		PSE: OBEX over L2CAP (M)
+TSPC_PBAP_26_4	False		PSE: OBEX SRM (M)
+TSPC_PBAP_26_5	False (*)	PSE: Send OBEX SRMP header (C.1)
+TSPC_PBAP_26_6	False		PSE: Receive OBEX SRMP header (M)
+TSPC_ALL	False (*)	Turns on all the test cases
+-------------------------------------------------------------------------------
+C.1: Optional if TSPC_PBAP_26_4 (OBEX SRM) is supported, otherwise Excluded.
+-------------------------------------------------------------------------------
-- 
1.8.4.1


^ permalink raw reply related

* Re: [PATCH v2 2/2] gitignore: Add unit/test-avdtp
From: Luiz Augusto von Dentz @ 2013-11-28 12:40 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1385638409-1955-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Thu, Nov 28, 2013 at 1:33 PM, Szymon Janc <szymon.janc@tieto.com> wrote:
> ---
> v2: fixed commit message
>  .gitignore | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/.gitignore b/.gitignore
> index d567d26..2d3435a 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -100,6 +100,7 @@ unit/test-gobex-apparam
>  unit/test-gobex-header
>  unit/test-gobex-packet
>  unit/test-gobex-transfer
> +unit/test-avdtp
>  unit/test-*.log
>  unit/test-*.trs
>
> --
> 1.8.3.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Both patches pushed, thanks.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* [PATCH v2 2/2] gitignore: Add unit/test-avdtp
From: Szymon Janc @ 2013-11-28 11:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385637056-561-2-git-send-email-szymon.janc@tieto.com>

---
v2: fixed commit message
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index d567d26..2d3435a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -100,6 +100,7 @@ unit/test-gobex-apparam
 unit/test-gobex-header
 unit/test-gobex-packet
 unit/test-gobex-transfer
+unit/test-avdtp
 unit/test-*.log
 unit/test-*.trs
 
-- 
1.8.3.2


^ permalink raw reply related

* Re: [PATCH 2/2] gitignore: Add tools/avdtp-tester
From: Szymon Janc @ 2013-11-28 11:31 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: BlueZ development
In-Reply-To: <CAJdJm_P_mho-QXy_Gfpqqps1b5cM0AuVKp30=EQCrVzuNLGSVQ@mail.gmail.com>

Hi,

> Hi Szymon,
> 
> On Thu, Nov 28, 2013 at 7:10 AM, Szymon Janc <szymon.janc@tieto.com> wrote:
> > ---
> >  .gitignore | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/.gitignore b/.gitignore
> > index d567d26..2d3435a 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -100,6 +100,7 @@ unit/test-gobex-apparam
> >  unit/test-gobex-header
> >  unit/test-gobex-packet
> >  unit/test-gobex-transfer
> > +unit/test-avdtp
> >  unit/test-*.log
> >  unit/test-*.trs
> 
> The tool name on the commit description is incorrect.

Ahh right, copy-paste error :) will send v2

-- 
BR
Szymon


^ permalink raw reply

* Re: [PATCH 2/2] gitignore: Add tools/avdtp-tester
From: Anderson Lizardo @ 2013-11-28 11:26 UTC (permalink / raw)
  To: Szymon Janc; +Cc: BlueZ development
In-Reply-To: <1385637056-561-2-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Thu, Nov 28, 2013 at 7:10 AM, Szymon Janc <szymon.janc@tieto.com> wrote:
> ---
>  .gitignore | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/.gitignore b/.gitignore
> index d567d26..2d3435a 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -100,6 +100,7 @@ unit/test-gobex-apparam
>  unit/test-gobex-header
>  unit/test-gobex-packet
>  unit/test-gobex-transfer
> +unit/test-avdtp
>  unit/test-*.log
>  unit/test-*.trs

The tool name on the commit description is incorrect.

Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

^ permalink raw reply

* [PATCH 2/2] gitignore: Add tools/avdtp-tester
From: Szymon Janc @ 2013-11-28 11:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1385637056-561-1-git-send-email-szymon.janc@tieto.com>

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index d567d26..2d3435a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -100,6 +100,7 @@ unit/test-gobex-apparam
 unit/test-gobex-header
 unit/test-gobex-packet
 unit/test-gobex-transfer
+unit/test-avdtp
 unit/test-*.log
 unit/test-*.trs
 
-- 
1.8.3.2


^ permalink raw reply related


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