Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCHv2 11/16] android/hal-sock: Parse SDP response and connect
From: Andrei Emeltchenko @ 2013-11-15 14:37 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1384526278-26260-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

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

Parse SDP response, find RFCOMM channel and connect.
---
 android/socket.c |   63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/android/socket.c b/android/socket.c
index b29d4af..6e6db4f 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -372,9 +372,72 @@ static int handle_listen(void *buf)
 	return hal_fd;
 }
 
+static void connect_cb(GIOChannel *io, GError *err, gpointer user_data)
+{
+}
+
 static void sdp_search_cb(sdp_list_t *recs, int err, gpointer data)
 {
+	struct rfcomm_slot *rfslot = data;
+	GError *gerr = NULL;
+	sdp_list_t *list;
+	GIOChannel *io;
+	int chan;
+
 	DBG("");
+
+	if (err < 0) {
+		error("Unable to get SDP record: %s", strerror(-err));
+		goto fail;
+	}
+
+	if (!recs || !recs->data) {
+		error("No SDP records found");
+		goto fail;
+	}
+
+	for (list = recs; list != NULL; list = list->next) {
+		sdp_record_t *rec = list->data;
+		sdp_list_t *protos;
+
+		if (sdp_get_access_protos(rec, &protos) < 0) {
+			error("Unable to get proto list");
+			goto fail;
+		}
+
+		chan = sdp_get_proto_port(protos, RFCOMM_UUID);
+
+		sdp_list_foreach(protos, (sdp_list_func_t) sdp_list_free,
+									NULL);
+		sdp_list_free(protos, NULL);
+	}
+
+	if (chan <= 0) {
+		error("Could not get RFCOMM channel %d", chan);
+		goto fail;
+	}
+
+	DBG("Got RFCOMM channel %d", chan);
+
+	io = bt_io_connect(connect_cb, rfslot, NULL, &gerr,
+				BT_IO_OPT_SOURCE_BDADDR, &adapter_addr,
+				BT_IO_OPT_DEST_BDADDR, &rfslot->dst,
+				BT_IO_OPT_CHANNEL, chan,
+				BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
+				BT_IO_OPT_INVALID);
+	if (!io) {
+		error("Failed connect: %s", gerr->message);
+		g_error_free(gerr);
+		goto fail;
+	}
+
+	rfslot->real_sock = g_io_channel_unix_get_fd(io);
+	rfslot->channel = chan;
+	rfcomm_connected_list = g_list_append(rfcomm_connected_list, rfslot);
+	return;
+
+fail:
+	cleanup_rfslot(rfslot);
 }
 
 static int handle_connect(void *buf)
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv2 10/16] android/hal-sock: Implement socket connect HAL method
From: Andrei Emeltchenko @ 2013-11-15 14:37 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1384526278-26260-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

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

First step is to query remote device for RFCOMM channel.
---
 android/socket.c |   34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/android/socket.c b/android/socket.c
index a3915c3..b29d4af 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -33,6 +33,9 @@
 #include "lib/bluetooth.h"
 #include "btio/btio.h"
 #include "lib/sdp.h"
+#include "lib/sdp_lib.h"
+#include "src/sdp-client.h"
+
 #include "log.h"
 #include "hal-msg.h"
 #include "hal-ipc.h"
@@ -52,6 +55,7 @@ struct rfcomm_slot {
 	int fd;		/* descriptor for communication with Java framework */
 	int real_sock;	/* real RFCOMM socket */
 	int channel;	/* RFCOMM channel */
+	bdaddr_t dst;
 };
 
 static struct rfcomm_slot *create_rfslot(int sock, int *hal_fd)
@@ -368,11 +372,37 @@ static int handle_listen(void *buf)
 	return hal_fd;
 }
 
+static void sdp_search_cb(sdp_list_t *recs, int err, gpointer data)
+{
+	DBG("");
+}
+
 static int handle_connect(void *buf)
 {
-	DBG("Not implemented");
+	struct hal_cmd_sock_connect *cmd = buf;
+	struct rfcomm_slot *rfslot;
+	bdaddr_t dst;
+	uuid_t uuid;
+	int hal_fd = -1;
 
-	return -1;
+	DBG("");
+
+	android2bdaddr(cmd->bdaddr, &dst);
+	rfslot = create_rfslot(-1, &hal_fd);
+	bacpy(&rfslot->dst, &dst);
+
+	memset(&uuid, 0, sizeof(uuid));
+	uuid.type = SDP_UUID128;
+	memcpy(&uuid.value.uuid128, cmd->uuid, sizeof(uint128_t));
+
+	if (bt_search_service(&adapter_addr, &dst, &uuid, sdp_search_cb, rfslot,
+								NULL) < 0) {
+		error("Failed to search SDP records");
+		cleanup_rfslot(rfslot);
+		return -1;
+	}
+
+	return hal_fd;
 }
 
 void bt_sock_handle_cmd(int sk, uint8_t opcode, void *buf, uint16_t len)
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv2 09/16] android/hal-sock: Write channel to Android fd
From: Andrei Emeltchenko @ 2013-11-15 14:37 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1384526278-26260-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

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

Android framework expects to receive channel number as int.
---
 android/socket.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/android/socket.c b/android/socket.c
index 2bc4f06..a3915c3 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -355,6 +355,13 @@ static int handle_listen(void *buf)
 	rfslot->real_sock = g_io_channel_unix_get_fd(io);
 	rfcomm_srv_list = g_list_append(rfcomm_srv_list, rfslot);
 
+	/* TODO: Check this */
+	if (write(rfslot->fd, &chan, sizeof(chan)) != sizeof(chan)) {
+		error("Error sending RFCOMM channel");
+		cleanup_rfslot(rfslot);
+		return -1;
+	}
+
 	DBG("real_sock %d fd %d hal_fd %d",
 				rfslot->real_sock, rfslot->fd, hal_fd);
 
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv2 08/16] android/hal-sock: Implement accept signal over Android fd
From: Andrei Emeltchenko @ 2013-11-15 14:37 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1384526278-26260-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

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

Android expects to get accept signal over file descriptor which was
set during listen HAL call.
---
 android/socket.c |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/android/socket.c b/android/socket.c
index fdd2e09..2bc4f06 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -37,6 +37,7 @@
 #include "hal-msg.h"
 #include "hal-ipc.h"
 #include "ipc.h"
+#include "utils.h"
 #include "socket.h"
 
 static bdaddr_t adapter_addr;
@@ -103,6 +104,45 @@ static struct {
 	{ {0} }
 };
 
+static int bt_sock_send_fd(int sock_fd, const void *buf, int len, int send_fd)
+{
+	ssize_t ret;
+	struct msghdr msg;
+	struct cmsghdr *cmsg;
+	struct iovec iv;
+	char msgbuf[CMSG_SPACE(1)];
+
+	DBG("len %d sock_fd %d send_fd %d", len, sock_fd, send_fd);
+
+	if (sock_fd == -1 || send_fd == -1)
+		return -1;
+
+	memset(&msg, 0, sizeof(msg));
+
+	msg.msg_control = msgbuf;
+	msg.msg_controllen = sizeof(msgbuf);
+	cmsg = CMSG_FIRSTHDR(&msg);
+	cmsg->cmsg_level = SOL_SOCKET;
+	cmsg->cmsg_type = SCM_RIGHTS;
+	cmsg->cmsg_len = CMSG_LEN(sizeof(send_fd));
+	memcpy(CMSG_DATA(cmsg), &send_fd, sizeof(send_fd));
+
+	iv.iov_base = (unsigned char *) buf;
+	iv.iov_len = len;
+
+	msg.msg_iov = &iv;
+	msg.msg_iovlen = 1;
+
+	ret = sendmsg(sock_fd, &msg, MSG_NOSIGNAL);
+	if (ret < 0) {
+		error("sendmsg(): sock_fd %d send_fd %d: %s",
+					sock_fd, send_fd, strerror(errno));
+		return ret;
+	}
+
+	return ret;
+}
+
 static int get_rfcomm_default_chan(const uint8_t *uuid)
 {
 	int i;
@@ -221,6 +261,21 @@ static gboolean sock_rfcomm_event_cb(GIOChannel *io, GIOCondition cond,
 	return TRUE;
 }
 
+static void sock_send_accept(struct rfcomm_slot *rfslot, bdaddr_t *bdaddr,
+							int fd_accepted)
+{
+	struct hal_sock_connect_signal cmd;
+
+	DBG("");
+
+	cmd.size = sizeof(cmd);
+	bdaddr2android(bdaddr, cmd.bdaddr);
+	cmd.channel = rfslot->channel;
+	cmd.status = 0;
+
+	bt_sock_send_fd(rfslot->fd, &cmd, sizeof(cmd), fd_accepted);
+}
+
 static void accept_cb(GIOChannel *io, GError *err, gpointer user_data)
 {
 	struct rfcomm_slot *rfslot = user_data;
@@ -252,6 +307,8 @@ static void accept_cb(GIOChannel *io, GError *err, gpointer user_data)
 	rfcomm_connected_list =
 			g_list_append(rfcomm_connected_list, rfslot_acc);
 
+	sock_send_accept(rfslot, &dst, hal_fd);
+
 	/* Handle events from Android */
 	io_stack = g_io_channel_unix_new(rfslot_acc->fd);
 	g_io_add_watch(io_stack, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv2 07/16] android/hal-sock: Implement RFCOMM events
From: Andrei Emeltchenko @ 2013-11-15 14:37 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1384526278-26260-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

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

Copy data from RFCOMM socket to Android framework. Consider splice
in the future.
---
 android/socket.c |   37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/android/socket.c b/android/socket.c
index af14ef6..fdd2e09 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -181,6 +181,43 @@ static gboolean sock_stack_event_cb(GIOChannel *io, GIOCondition cond,
 static gboolean sock_rfcomm_event_cb(GIOChannel *io, GIOCondition cond,
 								gpointer data)
 {
+	struct rfcomm_slot *rfslot = data;
+	unsigned char buf[1024];
+	int len, sent;
+
+	DBG("rfslot: fd %d real_sock %d chan %u sock %d",
+		rfslot->fd, rfslot->real_sock, rfslot->channel,
+		g_io_channel_unix_get_fd(io));
+
+	if (!g_list_find(rfcomm_connected_list, rfslot)) {
+		error("rfslot %p not found in the list", rfslot);
+		return FALSE;
+	}
+
+	if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
+		error("Socket error: sock %d cond %d",
+					g_io_channel_unix_get_fd(io), cond);
+		rfcomm_connected_list = g_list_remove(rfcomm_connected_list,
+								rfslot);
+		cleanup_rfslot(rfslot);
+		return FALSE;
+	}
+
+	len = recv(rfslot->real_sock, buf, sizeof(buf), 0);
+	if (len <= 0) {
+		error("recv(): %s sock %d", strerror(errno), rfslot->real_sock);
+		return FALSE;
+	}
+
+	DBG("read %d bytes, write to fd %d", len, rfslot->fd);
+
+	if ((sent = write_n(rfslot->fd, buf, len)) < 0) {
+		error("send(): %s", strerror(errno));
+		return FALSE;
+	}
+
+	DBG("Written %d bytes", sent);
+
 	return TRUE;
 }
 
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv2 06/16] android/hal-sock: Implement Android RFCOMM stack events
From: Andrei Emeltchenko @ 2013-11-15 14:37 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1384526278-26260-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

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

Handle events from Android framework. Write everything to real RFCOMM
socket. Consider splice() in the future.
---
 android/socket.c |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/android/socket.c b/android/socket.c
index c9ee32f..af14ef6 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -115,9 +115,66 @@ static int get_rfcomm_default_chan(const uint8_t *uuid)
 	return -1;
 }
 
+static inline int write_n(int fd, unsigned char *buf, int len)
+{
+	int t = 0, w;
+
+	while (len > 0) {
+		if ((w = write(fd, buf, len)) < 0) {
+			if (errno == EINTR || errno == EAGAIN)
+				continue;
+			return -1;
+		}
+
+		if (!w)
+			return 0;
+
+		len -= w; buf += w; t += w;
+	}
+
+	return t;
+}
+
 static gboolean sock_stack_event_cb(GIOChannel *io, GIOCondition cond,
 								gpointer data)
 {
+	struct rfcomm_slot *rfslot = data;
+	unsigned char buf[1024];
+	int len, sent;
+
+	DBG("rfslot: fd %d real_sock %d chan %u sock %d",
+		rfslot->fd, rfslot->real_sock, rfslot->channel,
+		g_io_channel_unix_get_fd(io));
+
+	if (!g_list_find(rfcomm_connected_list, rfslot)) {
+		error("rfslot %p not found in the list", rfslot);
+		return FALSE;
+	}
+
+	if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
+		error("Socket error: sock %d cond %d",
+					g_io_channel_unix_get_fd(io), cond);
+		rfcomm_connected_list = g_list_remove(rfcomm_connected_list,
+								rfslot);
+		cleanup_rfslot(rfslot);
+		return FALSE;
+	}
+
+	len = recv(rfslot->fd, buf, sizeof(buf), 0);
+	if (len <= 0) {
+		error("recv(): %s", strerror(errno));
+		return FALSE;
+	}
+
+	DBG("read %d bytes write to %d", len, rfslot->real_sock);
+
+	if ((sent = write_n(rfslot->real_sock, buf, len)) < 0) {
+		error("send(): %s", strerror(errno));
+		return FALSE;
+	}
+
+	DBG("Written %d bytes", sent);
+
 	return TRUE;
 }
 
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv2 05/16] android/hal-sock: Implement socket accepted event
From: Andrei Emeltchenko @ 2013-11-15 14:37 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1384526278-26260-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

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

When we get accepted event we create rfcomm slot and start listening
for events from Android framework and from RFCOMM real socket.
---
 android/socket.c |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/android/socket.c b/android/socket.c
index 276c78c..c9ee32f 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -115,8 +115,60 @@ static int get_rfcomm_default_chan(const uint8_t *uuid)
 	return -1;
 }
 
+static gboolean sock_stack_event_cb(GIOChannel *io, GIOCondition cond,
+								gpointer data)
+{
+	return TRUE;
+}
+
+static gboolean sock_rfcomm_event_cb(GIOChannel *io, GIOCondition cond,
+								gpointer data)
+{
+	return TRUE;
+}
+
 static void accept_cb(GIOChannel *io, GError *err, gpointer user_data)
 {
+	struct rfcomm_slot *rfslot = user_data;
+	struct rfcomm_slot *rfslot_acc;
+	GIOChannel *io_stack;
+	bdaddr_t dst;
+	char address[18];
+	int sock_acc;
+	int hal_fd = -1;
+
+	bt_io_get(io, &err,
+			BT_IO_OPT_DEST_BDADDR, &dst,
+			BT_IO_OPT_INVALID);
+	if (err) {
+		error("%s", err->message);
+		g_io_channel_shutdown(io, TRUE, NULL);
+		return;
+	}
+
+	ba2str(&dst, address);
+	DBG("Incoming connection from %s rfslot %p", address, rfslot);
+
+	DBG("rfslot: fd %d real_sock %d chan %u sock %d",
+		rfslot->fd, rfslot->real_sock, rfslot->channel,
+		g_io_channel_unix_get_fd(io));
+
+	sock_acc = g_io_channel_unix_get_fd(io);
+	rfslot_acc = create_rfslot(sock_acc, &hal_fd);
+	rfcomm_connected_list =
+			g_list_append(rfcomm_connected_list, rfslot_acc);
+
+	/* Handle events from Android */
+	io_stack = g_io_channel_unix_new(rfslot_acc->fd);
+	g_io_add_watch(io_stack, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+					sock_stack_event_cb, rfslot_acc);
+	g_io_channel_unref(io_stack);
+
+	/* Handle rfcomm events */
+	g_io_add_watch(io, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
+				sock_rfcomm_event_cb, rfslot_acc);
+
+	DBG("rfslot %p rfslot_acc %p", rfslot, rfslot_acc);
 }
 
 static int handle_listen(void *buf)
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv2 04/16] android/hal-sock: Define structs and implement listen
From: Andrei Emeltchenko @ 2013-11-15 14:37 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1384526278-26260-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

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

This defines structures for socket HAL. We need to emulate Android
sockets by sending connect/accept signals over file descriptor.
Handle HAL socket listen call. Create RFCOMM socket and wait for events.
---
 android/socket.c |  118 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 116 insertions(+), 2 deletions(-)

diff --git a/android/socket.c b/android/socket.c
index e580036..276c78c 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -27,8 +27,12 @@
 
 #include <glib.h>
 #include <stdbool.h>
+#include <unistd.h>
+#include <errno.h>
 
 #include "lib/bluetooth.h"
+#include "btio/btio.h"
+#include "lib/sdp.h"
 #include "log.h"
 #include "hal-msg.h"
 #include "hal-ipc.h"
@@ -37,13 +41,123 @@
 
 static bdaddr_t adapter_addr;
 
-static int handle_listen(void *buf)
+/* Simple list of RFCOMM server sockets */
+GList *rfcomm_srv_list = NULL;
+
+/* Simple list of RFCOMM connected sockets */
+GList *rfcomm_connected_list = NULL;
+
+struct rfcomm_slot {
+	int fd;		/* descriptor for communication with Java framework */
+	int real_sock;	/* real RFCOMM socket */
+	int channel;	/* RFCOMM channel */
+};
+
+static struct rfcomm_slot *create_rfslot(int sock, int *hal_fd)
 {
-	DBG("Not implemented");
+	int fds[2] = {-1, -1};
+	struct rfcomm_slot *rfslot;
+
+	if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds) < 0) {
+		error("socketpair(): %s", strerror(errno));
+		return NULL;
+	}
+
+	rfslot = g_malloc0(sizeof(*rfslot));
+	rfslot->fd = fds[0];
+	*hal_fd = fds[1];
+	rfslot->real_sock = sock;
+
+	return rfslot;
+}
+
+static void cleanup_rfslot(struct rfcomm_slot *rfslot)
+{
+	DBG("Cleanup: rfslot: %p fd %d real_sock %d chan %u",
+		rfslot, rfslot->fd, rfslot->real_sock, rfslot->channel);
+
+	if (rfslot->fd > 0)
+		close(rfslot->fd);
+	if (rfslot->real_sock > 0)
+		close(rfslot->real_sock);
+
+	g_free(rfslot);
+}
+
+static struct {
+	uint8_t uuid[16];
+	uint8_t channel;
+} uuid_to_chan[] = {
+	{ .uuid = {
+	0x00, 0x00, 0x11, 0x2F, 0x00, 0x00, 0x10, 0x00,
+	0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
+	},
+#define PBAP_DEFAULT_CHANNEL	15
+	.channel = PBAP_DEFAULT_CHANNEL },
+	{ .uuid = {
+	0x00, 0x00, 0x11, 0x05, 0x00, 0x00, 0x10, 0x00,
+	0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
+	},
+#define OPP_DEFAULT_CHANNEL	9
+	.channel = OPP_DEFAULT_CHANNEL },
+	{ {0} }
+};
+
+static int get_rfcomm_default_chan(const uint8_t *uuid)
+{
+	int i;
+
+	for (i = 0; uuid_to_chan[i].channel; i++) {
+		if (!memcmp(uuid_to_chan[i].uuid, uuid, 16))
+			return uuid_to_chan[i].channel;
+	}
 
 	return -1;
 }
 
+static void accept_cb(GIOChannel *io, GError *err, gpointer user_data)
+{
+}
+
+static int handle_listen(void *buf)
+{
+	struct hal_cmd_sock_listen *cmd = buf;
+	struct rfcomm_slot *rfslot;
+	GIOChannel *io;
+	GError *err = NULL;
+	int hal_fd = -1;
+	int chan;
+
+	DBG("");
+
+	chan = get_rfcomm_default_chan(cmd->uuid);
+	if (chan < 0)
+		return -1;
+
+	DBG("rfcomm channel %d", chan);
+
+	rfslot = create_rfslot(-1, &hal_fd);
+
+	io = bt_io_listen(accept_cb, NULL, rfslot, NULL, &err,
+				BT_IO_OPT_SOURCE_BDADDR, &adapter_addr,
+				BT_IO_OPT_CHANNEL, chan,
+				BT_IO_OPT_INVALID);
+	if (!io) {
+		error("Failed listen: %s", err->message);
+		g_error_free(err);
+		cleanup_rfslot(rfslot);
+		return -1;
+	}
+
+	rfslot->real_sock = g_io_channel_unix_get_fd(io);
+	rfcomm_srv_list = g_list_append(rfcomm_srv_list, rfslot);
+
+	DBG("real_sock %d fd %d hal_fd %d",
+				rfslot->real_sock, rfslot->fd, hal_fd);
+
+	return hal_fd;
+}
+
 static int handle_connect(void *buf)
 {
 	DBG("Not implemented");
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv2 03/16] android/hal-sock: Add connect signal to socket
From: Andrei Emeltchenko @ 2013-11-15 14:37 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1384526278-26260-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

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

Connect signal is used to pass information to framework that socket
is accepted.
---
 android/hal-msg.h |    2 ++
 android/socket.h  |    7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/android/hal-msg.h b/android/hal-msg.h
index 44fd5c8..9e3a81f 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -232,6 +232,8 @@ struct hal_cmd_sock_connect {
 	uint8_t  flags;
 } __attribute__((packed));
 
+/* Bluetooth Hidhost HAL api */
+
 #define HAL_OP_HIDHOST_CONNECT		0x01
 struct hal_cmd_hidhost_connect {
 	uint8_t bdaddr[6];
diff --git a/android/socket.h b/android/socket.h
index 7aa5574..ba56c9b 100644
--- a/android/socket.h
+++ b/android/socket.h
@@ -21,6 +21,13 @@
  *
  */
 
+struct hal_sock_connect_signal {
+	short   size;
+	uint8_t bdaddr[6];
+	int     channel;
+	int     status;
+} __attribute__((packed));
+
 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);
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv2 02/16] android/hal-sock: Use static local adapter address
From: Andrei Emeltchenko @ 2013-11-15 14:37 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1384526278-26260-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

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

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

diff --git a/android/socket.c b/android/socket.c
index c283c5f..e580036 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -35,6 +35,7 @@
 #include "ipc.h"
 #include "socket.h"
 
+static bdaddr_t adapter_addr;
 
 static int handle_listen(void *buf)
 {
@@ -81,6 +82,8 @@ bool bt_socket_register(int sk, const bdaddr_t *addr)
 {
 	DBG("");
 
+	bacpy(&adapter_addr, addr);
+
 	return true;
 }
 
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv2 01/16] android/hal-sock: Add debug flag printing
From: Andrei Emeltchenko @ 2013-11-15 14:37 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1384526278-26260-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

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

---
 android/hal-sock.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/android/hal-sock.c b/android/hal-sock.c
index b7bc88e..eafa451 100644
--- a/android/hal-sock.c
+++ b/android/hal-sock.c
@@ -55,8 +55,8 @@ static bt_status_t sock_listen(btsock_type_t type, const char *service_name,
 		return BT_STATUS_PARM_INVALID;
 	}
 
-	DBG("uuid %s chan %d sock %p type %d service_name %s",
-			btuuid2str(uuid), chan, sock, type, service_name);
+	DBG("uuid %s chan %d sock %p type %d service_name %s flags 0x%02x",
+		btuuid2str(uuid), chan, sock, type, service_name, flags);
 
 	switch (type) {
 	case BTSOCK_RFCOMM:
@@ -82,8 +82,8 @@ static bt_status_t sock_connect(const bt_bdaddr_t *bdaddr, btsock_type_t type,
 		return BT_STATUS_PARM_INVALID;
 	}
 
-	DBG("uuid %s chan %d sock %p type %d", btuuid2str(uuid), chan, sock,
-									type);
+	DBG("uuid %s chan %d sock %p type %d flags 0x%02x",
+		btuuid2str(uuid), chan, sock, type, flags);
 
 	if (type != BTSOCK_RFCOMM) {
 		error("Socket type %u not supported", type);
-- 
1.7.10.4


^ permalink raw reply related

* [PATCHv2 00/16] Socket HAL
From: Andrei Emeltchenko @ 2013-11-15 14:37 UTC (permalink / raw)
  To: linux-bluetooth

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

This is initial code implementing socket HAL. OPP currently works with send/receive files. Probaly
other profiles works as well, not tested yet.

Changes:
	* v2: Following Marcel comments changed way copying between file descriptors works, added SDP record
	for OPP and now it is possible to send files through GUI. Merged one patch with structures with actual user.
	* v1: Rebased and use static src address, hal_fd removed from structure and closed after sent to framework,
	added connect calls and SDP parsing, added cleanup_rfcomm function, minor fixes.
	* RFC Initial

TODO:
	* Add SDP record for PBAP and other profiles
	* Use splice() (requires bionic change first)

For tracking rfcomm sockets I use structure rfslot which has following
fields:
 - real_sock - real RFCOMM socket
 - fd - fd to communicate with Android framework

create_rfslot sets hal_fd which is fd passed to Android framework with CMSG

Andrei Emeltchenko (16):
  android/hal-sock: Add debug flag printing
  android/hal-sock: Use static local adapter address
  android/hal-sock: Add connect signal to socket
  android/hal-sock: Define structs and implement listen
  android/hal-sock: Implement socket accepted event
  android/hal-sock: Implement Android RFCOMM stack events
  android/hal-sock: Implement RFCOMM events
  android/hal-sock: Implement accept signal over Android fd
  android/hal-sock: Write channel to Android fd
  android/hal-sock: Implement socket connect HAL method
  android/hal-sock: Parse SDP response and connect
  android/hal-sock: Implement HAL connect call
  android/hal-sock: Send RFCOMM channel to framework
  android/hal-sock: Send connect signal on connect
  android/hal-sock: Close file descriptor after sending
  android/hal-sock: Add SDP record for OPP profile

 android/hal-msg.h  |    2 +
 android/hal-sock.c |    8 +-
 android/socket.c   |  600 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 android/socket.h   |    7 +
 4 files changed, 609 insertions(+), 8 deletions(-)

-- 
1.7.10.4


^ permalink raw reply

* Interacting with BlueZ5 and Neard...possible bug.
From: Bruno Bruzzano @ 2013-11-15 14:13 UTC (permalink / raw)
  To: linux-bluetooth

Hi everyone!
I resend this mail, because I forgot the subject. Sorry. The mail
however is the same of the previous.
As suggested by vcgomes (from IRC channel), I subscribed to this
mailing list to report a
possible bug. I hope I'll receive a feedback from you.
I'm using Neard and BlueZ5 and my goal is to try the bluetooth
handover. The steps I followed are: I run the Bluetooth daemon with
experimental arg (-E), run the neard daemon, powered the NFC adapter
and set it up in Polling mode; furthermore, I wrote the MiFare Classic
1k tag with a record to do the pair. In particular, I used a Samsung
S3 to write the tag, using the NXP WriteTag application. So, the last
step (I think!) is to put the tag on the adapter to start the pairing.
Unfortunally, something happens, that is, in my smartphone I receive a
pairing request and I give the 'Ok', but watching the debug of
Bluetooth daemon, I read always:
"bluetoothd[22063]: src/agent.c:agent_unref() 0x89470c8: ref=-87222"
"bluetoothd[22063]: src/adapter.c:btd_adapter_confirm_reply() hci0
addr B0:C4:E7:BC:B9:4A success 0".
This two lines are repeated continuisly, with the 'ref' that increases
up to a certain point. After that the Bluetooth daemon crashes.
Here you can find two pastebin, respectively for BlueZ daemon and Neard daemon.
BlueZ: http://pastebin.com/Z4W0V5NZ
Neard: http://pastebin.com/cNfQ7qi0


Best Regards
Bruno Bruzzano (br1_21)

^ permalink raw reply

* Re: [PATCHv2 2/2] android: Add PTS PICS for HID
From: Luiz Augusto von Dentz @ 2013-11-15 13:37 UTC (permalink / raw)
  To: Jakub Tyszkowski; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1384512332-21906-3-git-send-email-jakub.tyszkowski@tieto.com>

Hi Jakub,

On Fri, Nov 15, 2013 at 12:45 PM, Jakub Tyszkowski
<jakub.tyszkowski@tieto.com> wrote:
> PTS PICS for HID, targeting Android 4.4.
>
> ---
>  android/pics-hid.txt | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 125 insertions(+)
>  create mode 100644 android/pics-hid.txt
>
> diff --git a/android/pics-hid.txt b/android/pics-hid.txt
> new file mode 100644
> index 0000000..d45fe33
> --- /dev/null
> +++ b/android/pics-hid.txt
> @@ -0,0 +1,125 @@
> +HID PICS for the PTS tool.
> +
> +* - different than PTS defaults
> +
> +Parameter Name Selected        Description
> +-------------------------------------------------------------------------------
> +TSPC_HID_1_1   True (*)        Role: Host, Report protocol
> +TSPC_HID_1_2   False           Role: HID Role
> +TSPC_HID_1_3   False           Role: Host, Boot protocol
> +TSPC_HID_2_1   True            Host: Establish HID connection
> +TSPC_HID_2_2   True            Host: Accept HID connection
> +TSPC_HID_2_3   True            Host: Terminate HID connection
> +TSPC_HID_2_4   True            Host: Accept termination of HID connection
> +TSPC_HID_2_5   True            Host: Support for virtual cables
> +TSPC_HID_2_6   True            Host: HID initiated connection
> +TSPC_HID_2_7   True            Host: Host initiated connection
> +TSPC_HID_2_8   True            Host: Host data transfer to HID
> +TSPC_HID_2_9   True            Host: HID data transfer to Host
> +TSPC_HID_2_10  False           Host: Boot mode data transfer to Host
> +TSPC_HID_2_11  False           Host : Boot mode data transfer to HID
> +TSPC_HID_2_12  False           Host : Support for Application to send
> +                                       GET_Report
> +TSPC_HID_2_13  False           Host : Support for Application to send
> +                                       SET_REPORT
> +TSPC_HID_2_14  False           Host : Support for sending HCI_CONTROL with
> +                                       VIRTUAL_CABLE_UNPLUG
> +TSPC_HID_2_15  False           Host : Support for receiving HCI_CONTROL with
> +                                       VIRTUAL_CABLE_UNPLUG
> +TSPC_HID_3_1   False           Host : Data reports larger than host MTU on
> +                                       Control channel
> +TSPC_HID_3_2   True (*)        Host : Data reports larger than host MTU on
> +                                       Interrupt channel
> +TSPC_HID_3_3   True (*)        Host : Data reports to host
> +TSPC_HID_3_4   False           Host : Boot mode reports to host
> +TSPC_HID_4_1   False           Host : Data reports larger than device MTU on
> +                                       Control channel
> +TSPC_HID_4_2   False           Host : Data reports larger than device MTU on
> +                                       Interrupt channel
> +TSPC_HID_4_3   True (*)        Host : Data reports to device
> +TSPC_HID_4_4   False           Host : Boot mode reports to device
> +TSPC_HID_5_1   False           Host : Set_Protocol command
> +TSPC_HID_5_2   False           Host : Get_Protocol command
> +TSPC_HID_5_3   False           Host : Set_Idle command
> +TSPC_HID_5_4   False           Host : Get_Idle command
> +TSPC_HID_5_5   False (*)       Host : Set_Report command
> +TSPC_HID_5_6   False (*)       Host : Get_Report command
> +TSPC_HID_6_1   False           Host : Initiate Authentication before
> +                                       connection completed
> +TSPC_HID_6_2   False           Host : Initiate Authentication after connection
> +                                       completed
> +TSPC_HID_6_3   False           Host : Initiate pairing before connection
> +                                       completed
> +TSPC_HID_6_4   False           Host : Initiate pairing after connection
> +                                       completed
> +TSPC_HID_6_5   False           Host : Encryption
> +TSPC_HID_6_6   False           Host : Initiate encryption
> +TSPC_HID_6_7   False           Host : Accept encryption requests
> +TSPC_HID_6_8   True            Host : Role switch (Master/Slave)
> +TSPC_HID_6_9   True            Host : Request Master Slave switch
> +TSPC_HID_6_10  True            Host : Accept Master Slave switch requests
> +TSPC_HID_6_11  False           Host : Hold mode
> +TSPC_HID_6_12  True            Host : Sniff mode
> +TSPC_HID_6_13  False           Host : Park mode
> +TSPC_HID_7_1   True            Host : Supports inquiry, 79 channel
> +TSPC_HID_7_2   False (*)       Host : Supports inquiry scan, 79 channel
> +TSPC_HID_8_1   False           Hid : Pointing HID
> +TSPC_HID_8_2   False           Hid : Keyboard HID
> +TSPC_HID_8_3   False           Hid : Identification HID
> +TSPC_HID_8_4   False           Hid : Other HID
> +TSPC_HID_9_1   False           Hid : Establish HID connection
> +TSPC_HID_9_2   False (*)       Hid : Accept HID connection
> +TSPC_HID_9_3   False           Hid : Terminate HID connection
> +TSPC_HID_9_4   False (*)       Hid : Accept Termination of HID connection
> +TSPC_HID_9_5   False           Hid : Support for virtual cables
> +TSPC_HID_9_6   False           Hid : HID initiated reconnection
> +TSPC_HID_9_7   False           Hid : Host initiated reconnection
> +TSPC_HID_9_8   False           Hid : Host data transfer to HID
> +TSPC_HID_9_9   False           Hid : HID data transfer to Host
> +TSPC_HID_9_10  False           Hid : HID Boot mode data transfer to Host
> +TSPC_HID_9_11  False           Hid : Host Boot mode data transfer to HID
> +TSPC_HID_9_12  False           Hid : Output reports declared
> +TSPC_HID_9_13  False           Hid : Input reports declared
> +TSPC_HID_9_14  False           Hid : Feature reports declared
> +TSPC_HID_9_15  False           Hid : Support for sending HCI_CONTROL with
> +                                       VIRTUAL_CABLE_UNPLUG
> +TSPC_HID_9_16  False           Hid : Support for receiving HCI_CONTROL with
> +                                       VIRTUAL_CABLE_UNPLUG
> +TSPC_HID_10_1  False           Hid : Data reports larger than host MTU on
> +                                       Control channel
> +TSPC_HID_10_2  False           Hid : Data reports larger than host MTU on
> +                                       Interrupt channel
> +TSPC_HID_10_3  False           Hid : Data reports to host
> +TSPC_HID_10_4  False           Hid : Boot mode reports to host
> +TSPC_HID_11_1  False           Hid : Data reports larger than device MTU on
> +                                       Control channel
> +TSPC_HID_11_2  False           Hid : Data reports larger than device MTU on
> +                                       Interrupt channel
> +TSPC_HID_11_3  False           Hid : Data reports to device
> +TSPC_HID_11_4  False           Hid : Boot mode reports to device
> +TSPC_HID_12_1  False           Hid : Set_Protocol command
> +TSPC_HID_12_2  False           Hid : Get_Protocol command
> +TSPC_HID_12_3  False           Hid : Set_Idle command
> +TSPC_HID_12_4  False           Hid : Get_Idle command
> +TSPC_HID_12_5  False           Hid : Set_Report command
> +TSPC_HID_12_6  False           Hid : Get_Report command
> +TSPC_HID_13_1  False           Hid : Host initiated Authentication before
> +                                       connection completed
> +TSPC_HID_13_2  False           Hid : Host initiated Authentication after
> +                                       connection completed
> +TSPC_HID_13_3  False           Hid : Initiate pairing before connection
> +                                       completed
> +TSPC_HID_13_4  False           Hid : Initiate pairing after connection
> +                                       completed
> +TSPC_HID_13_5  False           Hid : Encryption
> +TSPC_HID_13_6  False           Hid : Initiate encryption
> +TSPC_HID_13_7  False           Hid : Accept encryption requests
> +TSPC_HID_13_8  False           Hid : Role switch (Master/Slave)
> +TSPC_HID_13_9  False           Hid : Request Master Slave switch
> +TSPC_HID_13_10 False           Hid : Accept Master Slave switch requests
> +TSPC_HID_13_11 False           Hid : Hold mode
> +TSPC_HID_13_12 False           Hid : Sniff mode
> +TSPC_HID_13_13 False           Hid : Park mode
> +TSPC_HID_14_1  False           Hid : Supports inquiry, 79 channel
> +TSPC_HID_14_2  False (*)       Hid : Supports inquiry scan, 79 channel
> +TSPC_ALL       False           Enables all test cases when set to true.
> --
> 1.8.4.1

Perhaps we should indicate which ones are mandatory, and obviously all
the mandatory ones shall be enabled.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* Re: [PATCH] Staging: btmtk_usb: Add hdev parameter to hdev->send driver callback
From: Marcel Holtmann @ 2013-11-15 13:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Geert Uytterhoeven, devel, Johan Hedberg, Greg Kroah-Hartman,
	Yu-Chen Cho, linux-kernel@vger.kernel.org list,
	linux-bluetooth@vger.kernel.org development
In-Reply-To: <20131115130820.GS5302@mwanda>

Hi Dan,

>> while this is patch is correct, I do not really care about staging drivers that actually bluntly violate my copyright.
>> 
> 
> That's very cryptic.
> 
> What is going on here?  I googled it and I wasn't able to find what you
> are talking about.  Care to give us a hint and what you want us to do
> here?

the last time I checked, the majority of drivers/bluetooth/btusb.c has been written by myself. Now go and compare btusb.c to btmtk_usb.[ch].

> I have also added Johan Hedberg to the CC list because he also helped
> break the build.  Don't do that.

Yes, we are doing exactly that. It is a staging driver. I could not care less if a staging drivers breaks the build or not.

If anybody cares about this driver, then take the time to merge it upstream. It has never been submitted to linux-bluetooth mailing list.

There are drivers that should have never been merged into staging. This is one of them. Look for yourself and explain to me why this driver is part of staging in the first place.

Regards

Marcel


^ permalink raw reply

* Re: [PATCH] Staging: btmtk_usb: Add hdev parameter to hdev->send driver callback
From: Dan Carpenter @ 2013-11-15 13:08 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Geert Uytterhoeven, devel, Johan Hedberg, Greg Kroah-Hartman,
	Yu-Chen Cho, linux-kernel@vger.kernel.org list,
	linux-bluetooth@vger.kernel.org development
In-Reply-To: <D32EAC93-D2DE-431C-9DCB-885C5AA10A3A@holtmann.org>

On Fri, Nov 15, 2013 at 09:30:04PM +0900, Marcel Holtmann wrote:
> 
> while this is patch is correct, I do not really care about staging drivers that actually bluntly violate my copyright.
> 

That's very cryptic.

What is going on here?  I googled it and I wasn't able to find what you
are talking about.  Care to give us a hint and what you want us to do
here?

I have also added Johan Hedberg to the CC list because he also helped
break the build.  Don't do that.

regards,
dan carpenter

^ permalink raw reply

* Re: [PATCH] android: Fix not storing adapter index in index added event
From: Luiz Augusto von Dentz @ 2013-11-15 12:53 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1384517807-14745-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Fri, Nov 15, 2013 at 2:16 PM, Szymon Janc <szymon.janc@tieto.com> wrote:
> If controller was addded after daemon start its index was not stored
> resulting in mgmt commands to be always send to MGMT_INDEX_NONE index.
> ---
>  android/bluetooth.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index 39589fa..b7c05e7 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -1356,6 +1356,8 @@ static void mgmt_index_added_event(uint16_t index, uint16_t length,
>                 return;
>         }
>
> +       adapter.index = index;
> +
>         if (mgmt_send(mgmt_if, MGMT_OP_READ_INFO, index, 0, NULL,
>                                 read_info_complete, cb, NULL) == 0) {
>                 cb(-EIO, NULL);
> --
> 1.8.4.2

Applied, thanks.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* Re: [PATCH] Staging: btmtk_usb: Add hdev parameter to hdev->send driver callback
From: Marcel Holtmann @ 2013-11-15 12:30 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Yu-Chen Cho, devel,
	linux-bluetooth@vger.kernel.org development,
	linux-kernel@vger.kernel.org list
In-Reply-To: <1384517231-1605-1-git-send-email-geert@linux-m68k.org>

Hi Geert,

> drivers/staging/btmtk_usb/btmtk_usb.c: In function ‘btmtk_usb_probe’:
> drivers/staging/btmtk_usb/btmtk_usb.c:1610: warning: assignment from incompatible pointer type
> 
> Add the new hdev parameter, cfr. commit
> 7bd8f09f69f8a190f9b8334a07bb0a9237612314 ("Bluetooth: Add hdev parameter to
> hdev->send driver callback").
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> drivers/staging/btmtk_usb/btmtk_usb.c |    3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/btmtk_usb/btmtk_usb.c b/drivers/staging/btmtk_usb/btmtk_usb.c
> index 7a9bf3b57810..9a5ebd6cc512 100644
> --- a/drivers/staging/btmtk_usb/btmtk_usb.c
> +++ b/drivers/staging/btmtk_usb/btmtk_usb.c
> @@ -1284,9 +1284,8 @@ done:
> 	kfree_skb(skb);
> }
> 
> -static int btmtk_usb_send_frame(struct sk_buff *skb)
> +static int btmtk_usb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
> {
> -	struct hci_dev *hdev = (struct hci_dev *)skb->dev;
> 	struct btmtk_usb_data *data = hci_get_drvdata(hdev);
> 	struct usb_ctrlrequest *dr;
> 	struct urb *urb;

while this is patch is correct, I do not really care about staging drivers that actually bluntly violate my copyright.

Regards

Marcel


^ permalink raw reply

* Re: [PATCHv1 04/16] android/hal-sock: Define structures for socket HAL
From: Luiz Augusto von Dentz @ 2013-11-15 12:29 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1384441915-23966-5-git-send-email-Andrei.Emeltchenko.news@gmail.com>

Hi Andrei,

On Thu, Nov 14, 2013 at 5:11 PM, Andrei Emeltchenko
<Andrei.Emeltchenko.news@gmail.com> wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> This defines structures for socket HAL. We need to emulate Android
> sockets by sending connect/accept signals over file descriptor.
> ---
>  android/socket.c |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/android/socket.c b/android/socket.c
> index e580036..4699dce 100644
> --- a/android/socket.c
> +++ b/android/socket.c
> @@ -37,6 +37,18 @@
>
>  static bdaddr_t adapter_addr;
>
> +/* Simple list of RFCOMM server sockets */
> +GList *rfcomm_srv_list = NULL;
> +
> +/* Simple list of RFCOMM connected sockets */
> +GList *rfcomm_connected_list = NULL;
> +
> +struct rfcomm_slot {
> +       int fd;         /* descriptor for communication with Java framework */
> +       int real_sock;  /* real RFCOMM socket */
> +       int channel;    /* RFCOMM channel */
> +};

Here you don't really need to define channel as int do you? Also if in
future we want to replace this with splice this should use a pipe to
communicate with the HAL.

Btw, introducing lists and struct without any implementation is never
very good to review, because I have no idea in what context they will
be used.



-- 
Luiz Augusto von Dentz

^ permalink raw reply

* [PATCH] android: Fix not storing adapter index in index added event
From: Szymon Janc @ 2013-11-15 12:16 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

If controller was addded after daemon start its index was not stored
resulting in mgmt commands to be always send to MGMT_INDEX_NONE index.
---
 android/bluetooth.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 39589fa..b7c05e7 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1356,6 +1356,8 @@ static void mgmt_index_added_event(uint16_t index, uint16_t length,
 		return;
 	}
 
+	adapter.index = index;
+
 	if (mgmt_send(mgmt_if, MGMT_OP_READ_INFO, index, 0, NULL,
 				read_info_complete, cb, NULL) == 0) {
 		cb(-EIO, NULL);
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH] Staging: btmtk_usb: Add hdev parameter to hdev->send driver callback
From: Geert Uytterhoeven @ 2013-11-15 12:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Yu-Chen Cho
  Cc: Marcel Holtmann, devel, linux-bluetooth, linux-kernel,
	Geert Uytterhoeven

drivers/staging/btmtk_usb/btmtk_usb.c: In function ‘btmtk_usb_probe’:
drivers/staging/btmtk_usb/btmtk_usb.c:1610: warning: assignment from incompatible pointer type

Add the new hdev parameter, cfr. commit
7bd8f09f69f8a190f9b8334a07bb0a9237612314 ("Bluetooth: Add hdev parameter to
hdev->send driver callback").

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/staging/btmtk_usb/btmtk_usb.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/btmtk_usb/btmtk_usb.c b/drivers/staging/btmtk_usb/btmtk_usb.c
index 7a9bf3b57810..9a5ebd6cc512 100644
--- a/drivers/staging/btmtk_usb/btmtk_usb.c
+++ b/drivers/staging/btmtk_usb/btmtk_usb.c
@@ -1284,9 +1284,8 @@ done:
 	kfree_skb(skb);
 }
 
-static int btmtk_usb_send_frame(struct sk_buff *skb)
+static int btmtk_usb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
 {
-	struct hci_dev *hdev = (struct hci_dev *)skb->dev;
 	struct btmtk_usb_data *data = hci_get_drvdata(hdev);
 	struct usb_ctrlrequest *dr;
 	struct urb *urb;
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH v4 2/4] android: Cache device name on device list.
From: Johan Hedberg @ 2013-11-15 11:46 UTC (permalink / raw)
  To: Lukasz Rymanowski; +Cc: linux-bluetooth, szymon.janc
In-Reply-To: <1384453825-19241-3-git-send-email-lukasz.rymanowski@tieto.com>

Hi Lukasz,

On Thu, Nov 14, 2013, Lukasz Rymanowski wrote:
> +static void cache_device_name(const bdaddr_t *addr, char *name)

Maybe const char *name here?

> +	struct device *dev = NULL;
> +	GSList *l;
> +
> +	l = g_slist_find_custom(devices, addr, bdaddr_cmp);
> +	if (l)
> +		dev = l->data;
> +
> +	if (!dev) {
> +		dev = g_new0(struct device, 1);
> +		bacpy(&dev->bdaddr, addr);
> +		dev->bond_state = HAL_BOND_STATE_NONE;
> +		dev->name = g_malloc0(strlen(name) + 1);
> +		memcpy(dev->name, name, strlen(name));

Why this complicated malloc + memcpy when further below you do a much
simpler g_strdup?

In fact I'd just skip the name part here completely, remove the return
statement and let the code continue to the single place where you free
and set the name. Both g_strcmp0 and g_free should do the right thing if
the name is NULL.

> +	if (!g_strcmp0(dev->name, name))
> +			return;

Minor coding style issue here with indentation.

> +static char* get_device_name(const bdaddr_t *addr)
> +{

Coding style above with spacing, and this should be static const char *

> +	GSList *l;
> +	struct device *dev;
> +
> +	l = g_slist_find_custom(devices, addr, bdaddr_cmp);
> +	if (l) {
> +		dev = l->data;

You can move the variable declaration here to the more reduced scope.

> +static void send_remote_device_name_prop(const bdaddr_t *bdaddr)
>  {
>  	struct hal_ev_remote_device_props *ev;
> -	uint8_t buf[BASELEN_REMOTE_DEV_PROP + strlen(name)];
> +	uint8_t *buf;
> +	char dst[18];
> +	char *name;

const char *name;

> +
> +	ba2str(bdaddr, dst);
> +
> +	/* Use cached name or bdaddr string */
> +	name = get_device_name(bdaddr);
> +	if (!name)
> +		name = dst;
> +
> +	buf = g_malloc0(BASELEN_REMOTE_DEV_PROP + strlen(name));
>  
>  	ev =  (void *) buf;

The value of having a separate buf variable is completely lost here now
that you start doing dynamic allocation. What I'd do is remove buf, add
a new size_t ev_len, evaluate ev_len and then do ev = g_malloc0(ev_len);

>  	memset(buf, 0, sizeof(buf));

This one is both unnecessary and broken. Firstly you already zeroed out
the buffer with g_malloc and secondly sizeof(buf) doesn't do what you'd
want it to do (now that this is pointer instead of an array).

Johan

^ permalink raw reply

* Re: [PATCH v4 1/4] android: Update bond state on incoming bonding
From: Johan Hedberg @ 2013-11-15 11:40 UTC (permalink / raw)
  To: Lukasz Rymanowski; +Cc: linux-bluetooth, szymon.janc
In-Reply-To: <1384453825-19241-2-git-send-email-lukasz.rymanowski@tieto.com>

Hi Lukasz,

On Thu, Nov 14, 2013, Lukasz Rymanowski wrote:
> +static void send_remote_device_name_prop(const bdaddr_t *bdaddr, char *name)
> +{
> +	struct hal_ev_remote_device_props *ev;
> +	uint8_t buf[BASELEN_REMOTE_DEV_PROP + strlen(name)];
> +
> +	ev =  (void *) buf;

Minor white space issue here (two spaces instead of one after =.

> @@ -1865,12 +1933,18 @@ static bool cancel_bond(void *buf, uint16_t len)
>  {
>  	struct hal_cmd_cancel_bond *cmd = buf;
>  	struct mgmt_addr_info cp;
> +	bool result;
>  
>  	cp.type = BDADDR_BREDR;
>  	android2bdaddr(cmd->bdaddr, &cp.bdaddr);
>  
> -	return mgmt_reply(mgmt_if, MGMT_OP_CANCEL_PAIR_DEVICE, adapter.index,
> +	result = mgmt_reply(mgmt_if, MGMT_OP_CANCEL_PAIR_DEVICE, adapter.index,
>  					sizeof(cp), &cp, NULL, NULL, NULL) > 0;
> +	if (result)
> +		set_device_bond_state(&cp.bdaddr, HAL_STATUS_SUCCESS,
> +							HAL_BOND_STATE_NONE);

Would it not make sense to use the mgmt command complete callback for
sending HAL_BOND_STATE_NONE? (right now you're just passing NULL for
it). Actually, sending this command will generate a command complete to
our pair_device command with a "canceled" status. So aren't we sending
redundant HAL_BOND_STATE_NONE here?

Johan

^ permalink raw reply

* [PATCHv2 2/2] android: Add PTS PICS for HID
From: Jakub Tyszkowski @ 2013-11-15 10:45 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1384512332-21906-1-git-send-email-jakub.tyszkowski@tieto.com>

PTS PICS for HID, targeting Android 4.4.

---
 android/pics-hid.txt | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 android/pics-hid.txt

diff --git a/android/pics-hid.txt b/android/pics-hid.txt
new file mode 100644
index 0000000..d45fe33
--- /dev/null
+++ b/android/pics-hid.txt
@@ -0,0 +1,125 @@
+HID PICS for the PTS tool.
+
+* - different than PTS defaults
+
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_HID_1_1	True (*)	Role: Host, Report protocol
+TSPC_HID_1_2	False		Role: HID Role
+TSPC_HID_1_3	False		Role: Host, Boot protocol
+TSPC_HID_2_1	True		Host: Establish HID connection
+TSPC_HID_2_2	True		Host: Accept HID connection
+TSPC_HID_2_3	True		Host: Terminate HID connection
+TSPC_HID_2_4	True		Host: Accept termination of HID connection
+TSPC_HID_2_5	True		Host: Support for virtual cables
+TSPC_HID_2_6	True		Host: HID initiated connection
+TSPC_HID_2_7	True		Host: Host initiated connection
+TSPC_HID_2_8	True		Host: Host data transfer to HID
+TSPC_HID_2_9	True		Host: HID data transfer to Host
+TSPC_HID_2_10	False		Host: Boot mode data transfer to Host
+TSPC_HID_2_11	False		Host : Boot mode data transfer to HID
+TSPC_HID_2_12	False		Host : Support for Application to send
+					GET_Report
+TSPC_HID_2_13	False		Host : Support for Application to send
+					SET_REPORT
+TSPC_HID_2_14	False		Host : Support for sending HCI_CONTROL with
+					VIRTUAL_CABLE_UNPLUG
+TSPC_HID_2_15	False		Host : Support for receiving HCI_CONTROL with
+					VIRTUAL_CABLE_UNPLUG
+TSPC_HID_3_1	False		Host : Data reports larger than host MTU on
+					Control channel
+TSPC_HID_3_2	True (*)	Host : Data reports larger than host MTU on
+					Interrupt channel
+TSPC_HID_3_3	True (*)	Host : Data reports to host
+TSPC_HID_3_4	False		Host : Boot mode reports to host
+TSPC_HID_4_1	False		Host : Data reports larger than device MTU on
+					Control channel
+TSPC_HID_4_2	False		Host : Data reports larger than device MTU on
+					Interrupt channel
+TSPC_HID_4_3	True (*)	Host : Data reports to device
+TSPC_HID_4_4	False		Host : Boot mode reports to device
+TSPC_HID_5_1	False		Host : Set_Protocol command
+TSPC_HID_5_2	False		Host : Get_Protocol command
+TSPC_HID_5_3	False		Host : Set_Idle command
+TSPC_HID_5_4	False		Host : Get_Idle command
+TSPC_HID_5_5	False (*)	Host : Set_Report command
+TSPC_HID_5_6	False (*)	Host : Get_Report command
+TSPC_HID_6_1	False		Host : Initiate Authentication before
+					connection completed
+TSPC_HID_6_2	False		Host : Initiate Authentication after connection
+					completed
+TSPC_HID_6_3	False		Host : Initiate pairing before connection
+					completed
+TSPC_HID_6_4	False		Host : Initiate pairing after connection
+					completed
+TSPC_HID_6_5	False		Host : Encryption
+TSPC_HID_6_6	False		Host : Initiate encryption
+TSPC_HID_6_7	False		Host : Accept encryption requests
+TSPC_HID_6_8	True		Host : Role switch (Master/Slave)
+TSPC_HID_6_9	True		Host : Request Master Slave switch
+TSPC_HID_6_10	True		Host : Accept Master Slave switch requests
+TSPC_HID_6_11	False		Host : Hold mode
+TSPC_HID_6_12	True		Host : Sniff mode
+TSPC_HID_6_13	False		Host : Park mode
+TSPC_HID_7_1	True		Host : Supports inquiry, 79 channel
+TSPC_HID_7_2	False (*)	Host : Supports inquiry scan, 79 channel
+TSPC_HID_8_1	False		Hid : Pointing HID
+TSPC_HID_8_2	False		Hid : Keyboard HID
+TSPC_HID_8_3	False		Hid : Identification HID
+TSPC_HID_8_4	False		Hid : Other HID
+TSPC_HID_9_1	False		Hid : Establish HID connection
+TSPC_HID_9_2	False (*)	Hid : Accept HID connection
+TSPC_HID_9_3	False		Hid : Terminate HID connection
+TSPC_HID_9_4	False (*)	Hid : Accept Termination of HID connection
+TSPC_HID_9_5	False		Hid : Support for virtual cables
+TSPC_HID_9_6	False		Hid : HID initiated reconnection
+TSPC_HID_9_7	False		Hid : Host initiated reconnection
+TSPC_HID_9_8	False		Hid : Host data transfer to HID
+TSPC_HID_9_9	False		Hid : HID data transfer to Host
+TSPC_HID_9_10	False		Hid : HID Boot mode data transfer to Host
+TSPC_HID_9_11	False		Hid : Host Boot mode data transfer to HID
+TSPC_HID_9_12	False		Hid : Output reports declared
+TSPC_HID_9_13	False		Hid : Input reports declared
+TSPC_HID_9_14	False		Hid : Feature reports declared
+TSPC_HID_9_15	False		Hid : Support for sending HCI_CONTROL with
+					VIRTUAL_CABLE_UNPLUG
+TSPC_HID_9_16	False		Hid : Support for receiving HCI_CONTROL with
+					VIRTUAL_CABLE_UNPLUG
+TSPC_HID_10_1	False		Hid : Data reports larger than host MTU on
+					Control channel
+TSPC_HID_10_2	False		Hid : Data reports larger than host MTU on
+					Interrupt channel
+TSPC_HID_10_3	False		Hid : Data reports to host
+TSPC_HID_10_4	False		Hid : Boot mode reports to host
+TSPC_HID_11_1	False		Hid : Data reports larger than device MTU on
+					Control channel
+TSPC_HID_11_2	False		Hid : Data reports larger than device MTU on
+					Interrupt channel
+TSPC_HID_11_3	False		Hid : Data reports to device
+TSPC_HID_11_4	False		Hid : Boot mode reports to device
+TSPC_HID_12_1	False		Hid : Set_Protocol command
+TSPC_HID_12_2	False		Hid : Get_Protocol command
+TSPC_HID_12_3	False		Hid : Set_Idle command
+TSPC_HID_12_4	False		Hid : Get_Idle command
+TSPC_HID_12_5	False		Hid : Set_Report command
+TSPC_HID_12_6	False		Hid : Get_Report command
+TSPC_HID_13_1	False		Hid : Host initiated Authentication before
+					connection completed
+TSPC_HID_13_2	False		Hid : Host initiated Authentication after
+					connection completed
+TSPC_HID_13_3	False		Hid : Initiate pairing before connection
+					completed
+TSPC_HID_13_4	False		Hid : Initiate pairing after connection
+					completed
+TSPC_HID_13_5	False		Hid : Encryption
+TSPC_HID_13_6	False		Hid : Initiate encryption
+TSPC_HID_13_7	False		Hid : Accept encryption requests
+TSPC_HID_13_8	False		Hid : Role switch (Master/Slave)
+TSPC_HID_13_9	False		Hid : Request Master Slave switch
+TSPC_HID_13_10	False		Hid : Accept Master Slave switch requests
+TSPC_HID_13_11	False		Hid : Hold mode
+TSPC_HID_13_12	False		Hid : Sniff mode
+TSPC_HID_13_13	False		Hid : Park mode
+TSPC_HID_14_1	False		Hid : Supports inquiry, 79 channel
+TSPC_HID_14_2	False (*)	Hid : Supports inquiry scan, 79 channel
+TSPC_ALL	False		Enables all test cases when set to true.
-- 
1.8.4.1


^ permalink raw reply related

* [PATCHv2 1/2] android: Add PTS PICS for GAP
From: Jakub Tyszkowski @ 2013-11-15 10:45 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1384512332-21906-1-git-send-email-jakub.tyszkowski@tieto.com>

PTS PICS for GAP, targeting Android 4.4.

---
 android/pics-gap.txt | 223 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 223 insertions(+)
 create mode 100644 android/pics-gap.txt

diff --git a/android/pics-gap.txt b/android/pics-gap.txt
new file mode 100644
index 0000000..1ef94a6
--- /dev/null
+++ b/android/pics-gap.txt
@@ -0,0 +1,223 @@
+GAP PICS for the PTS tool.
+
+* - different than PTS defaults
+
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_GAP_0_1	False		BR/EDR
+TSPC_GAP_0_2	False		LE
+TSPC_GAP_0_3	True (*)	BR/EDR/LE
+TSPC_GAP_0A_1	False		Core Specification Addendum 3 (CSA3),
+					GAP Connection Parameters Changes,
+					Authentication and Lost Bond Changes,
+					Private Addressing Changes,
+					Dual Mode Addressing Changes,
+					Adopted 24 July 2012
+TSPC_GAP_1_1	True (*)	Non-discoverable mode
+TSPC_GAP_1_2	False		Limited-discoverable mode
+TSPC_GAP_1_3	True (*)	General-discoverable mode
+TSPC_GAP_1_4	True (*)	Non-connectable mode
+TSPC_GAP_1_5	True		Connectable mode
+TSPC_GAP_1_6	False		Non-bondable mode
+TSPC_GAP_1_7	True (*)	Bondable mode
+TSPC_GAP_2_1	True (*)	Authentication procedure
+TSPC_GAP_2_2	True (*)	Support of LMP-Authentication
+TSPC_GAP_2_3	True (*)	Initiate LMP-Authentication
+TSPC_GAP_2_4	False		Security mode 1
+TSPC_GAP_2_5	True (*)	Security mode 2
+TSPC_GAP_2_6	False		Security mode 3
+TSPC_GAP_2_7	True (*)	Security mode 4
+TSPC_GAP_2_8	True (*)	Support of Authenticated link key
+TSPC_GAP_2_9	True (*)	Support of Unauthenticated link key
+TSPC_GAP_2_10	False		No security
+TSPC_GAP_3_1	True (*)	Initiation of general inquiry
+TSPC_GAP_3_2	False		Initiation of limited inquiry
+TSPC_GAP_3_3	True (*)	Initiation of name discover
+TSPC_GAP_3_4	True (*)	Initiation of device discovery
+TSPC_GAP_3_5	True (*)	Initiation of general bonding
+TSPC_GAP_3_6	True (*)	Initiation of dedicated bonding
+TSPC_GAP_4_1	True		Support link establishment as initiator
+TSPC_GAP_4_2	True		Support link establishment as acceptor
+TSPC_GAP_4_3	True (*)	Support channel establishment as initiator
+TSPC_GAP_4_4	True		Support channel establishment as acceptor
+TSPC_GAP_4_5	True (*)	Support connection establishment as initiator
+TSPC_GAP_4_6	True (*)	Support connection establishment as acceptor
+TSPC_GAP_5_1	False (*)	Broadcaster
+TSPC_GAP_5_2	False		Observer
+TSPC_GAP_5_3	False (*)	Peripheral
+TSPC_GAP_5_4	True (*)	Central
+TSPC_GAP_6_1	False (*)	Broadcaster: Transmitter
+TSPC_GAP_6_2	False		Broadcaster: Receiver
+TSPC_GAP_7_1	False (*)	Broadcaster: Standby
+TSPC_GAP_7_2	False (*)	Broadcaster: Advertising
+TSPC_GAP_8_1	False (*)	Broadcaster: Non-Connectable Undirected Event
+TSPC_GAP_8_2	False		Broadcaster: Scannable Undirected Event
+TSPC_GAP_8A_1	False		AD Type-Service UUID
+TSPC_GAP_8A_2	False		AD Type-Local Name
+TSPC_GAP_8A_3	False (*)	AD Type-Flags
+TSPC_GAP_8A_4	False		AD Type-Manufacturer Specific Data
+TSPC_GAP_8A_5	False		AD Type-TX Power Level
+TSPC_GAP_8A_6	False		AD Type-Security Manager Out of Band (OOB)
+TSPC_GAP_8A_7	False		AD Type-Security manager TK Value
+TSPC_GAP_8A_8	False		AD Type-Slave Connection Interval Range
+TSPC_GAP_8A_9	False		AD Type-Service Solicitation
+TSPC_GAP_8A_10	False		AD Type-Service Data
+TSPC_GAP_9_1	False (*)	Broadcaster: Non-Connectable Mode
+TSPC_GAP_10_1	False (*)	Broadcaster: Broadcast Mode
+TSPC_GAP_11_1	False		Broadcaster: Privacy Feature
+TSPC_GAP_11_2	False		Broadcaster: Resolvable Private Address
+					Generation Procedure
+TSPC_GAP_12_1	True		Observer: Receiver
+TSPC_GAP_12_2	False		Observer: Transmitter
+TSPC_GAP_13_1	True		Observer: Standby
+TSPC_GAP_13_2	True		Observer: Scanning
+TSPC_GAP_14_1	True		Observer: Passive Scanning
+TSPC_GAP_14_2	False		Observer: Active Scanning
+TSPC_GAP_15_1	True		Observer: Non-Connectable Mode
+TSPC_GAP_16_1	True		Observer: Observation Procedure
+TSPC_GAP_17_1	False		Observer: Privacy Feature
+TSPC_GAP_17_2	False		Observer: Non-Resolvable Private Address
+					Generation Procedure
+TSPC_GAP_17_3	False		Observer: Resolvable Private Address Resolution
+					Procedure
+TSPC_GAP_17_4	False		Observer: Resolvable Private Address Generation
+					Procedure
+TSPC_GAP_18_1	False		Peripheral: Transmitter
+TSPC_GAP_18_2	False		Peripheral: Receiver
+TSPC_GAP_19_1	False		Peripheral: Standby
+TSPC_GAP_19_2	False		Peripheral: Advertising
+TSPC_GAP_19_3	False		Peripheral: Connection, Slave Role
+TSPC_GAP_20_1	False		Peripheral: Connectable Undirected Event
+TSPC_GAP_20_2	False		Peripheral: Connectable Directed Event
+TSPC_GAP_20_3	False		Peripheral: Non-Connectable Undirected Event
+TSPC_GAP_20_4	False		Peripheral: Scannable Undirected Event
+TSPC_GAP_20A_1	False		AD Type-Service UUID
+TSPC_GAP_20A_2	False		AD Type-Local Name
+TSPC_GAP_20A_3	False		AD Type-Flags
+TSPC_GAP_20A_4	False		AD Type-Manufacturer Specific Data
+TSPC_GAP_20A_5	False		AD Type-TX Power Level
+TSPC_GAP_20A_6	False		AD Type-Security Manager Out of Band (OOB)
+TSPC_GAP_20A_7	False		AD Type-Security manager TK Value
+TSPC_GAP_20A_8	False		AD Type-Slave Connection Interval Range
+TSPC_GAP_20A_9	False		AD Type-Service Solicitation
+TSPC_GAP_20A_10	False		AD Type-Service Data
+TSPC_GAP_21_1	False (*)	Peripheral: Connection Update Procedure
+TSPC_GAP_21_2	False (*)	Peripheral: Channel Map Update Procedure
+TSPC_GAP_21_3	False		Peripheral: Encryption Procedure
+TSPC_GAP_21_4	False (*)	Peripheral: Feature Exchange Procedure
+TSPC_GAP_21_5	False (*)	Peripheral: Version Exchange Procedure
+TSPC_GAP_21_6	False (*)	Peripheral: Termination Procedure
+TSPC_GAP_22_1	False		Peripheral: Non-Discoverable Mode
+TSPC_GAP_22_2	False		Peripheral: Limited Discoverable Mode
+TSPC_GAP_22_3	False		Peripheral: General Discoverable Mode
+TSPC_GAP_22_4	False		Peripheral: Name Discovery Procedure
+TSPC_GAP_23_1	False		Peripheral: Non-Connectable Mode
+TSPC_GAP_23_2	False		Peripheral: Directed Connectable Mode
+TSPC_GAP_23_3	False		Peripheral: Undirected Connectable Mode
+TSPC_GAP_23_4	False		Peripheral: Connection Parameter Update
+					Procedure
+TSPC_GAP_23_5	False		Peripheral: Terminate Connection Procedure
+TSPC_GAP_24_1	False		Peripheral: Non-Bondable Mode
+TSPC_GAP_24_2	False		Peripheral: Bondable Mode
+TSPC_GAP_24_3	False		Peripheral: Bonding Procedure
+TSPC_GAP_24_4	False		Peripheral: Multiple Bonds
+TSPC_GAP_25_1	False		Peripheral: Security Mode 1
+TSPC_GAP_25_2	False		Peripheral: Security Mode 2
+TSPC_GAP_25_3	False		Peripheral: Authentication Procedure
+TSPC_GAP_25_4	False		Peripheral: Authorization Procedure
+TSPC_GAP_25_5	False		Peripheral: Connection Data Signing Procedure
+TSPC_GAP_25_6	False		Peripheral: Authenticate Signed Data Procedure
+TSPC_GAP_25_7	False		Peripheral: Authenticated Pairing
+					(LE security mode 1 level 3)
+TSPC_GAP_25_8	False		Peripheral: Unauthenticated Pairing
+					(LE security mode 1 level 2)
+TSPC_GAP_26_1	False		Peripheral: Privacy Feature
+TSPC_GAP_26_2	False		Peripheral: Non-Resolvable Private Address
+					Generation Procedure
+TSPC_GAP_26_3	False		Peripheral: Resolvable Private Address
+					Generation Procedure
+TSPC_GAP_27_1	False (*)	Peripheral: Device Name
+TSPC_GAP_27_2	False (*)	Peripheral: Appearance
+TSPC_GAP_27_3	False		Peripheral: Peripheral Privacy Flag
+TSPC_GAP_27_4	False		Peripheral: Reconnection Address
+TSPC_GAP_27_5	False		Peripheral: Peripheral Preferred Connection
+					Parameters
+TSPC_GAP_27_6	False		Peripheral: Writeable Device Name
+TSPC_GAP_27_7	False		Peripheral: Writeable Appearance
+TSPC_GAP_27_8	False		Peripheral: Writeable Peripheral Privacy Flag
+TSPC_GAP_28_1	True (*)	Central: Transmitter
+TSPC_GAP_28_2	True (*)	Central: Receiver
+TSPC_GAP_29_1	True (*)	Central: Standby
+TSPC_GAP_29_2	True (*)	Central: Scanning
+TSPC_GAP_29_3	True (*)	Central: Initiating
+TSPC_GAP_29_4	True (*)	Central: Connection, Master Role
+TSPC_GAP_30_1	True (*)	Central: Passive Scanning
+TSPC_GAP_30_2	True (*)	Central: Active Scanning
+TSPC_GAP_31_1	True (*)	Central: Connection Update Procedure
+TSPC_GAP_31_2	True (*)	Central: Channel Map Update Procedure
+TSPC_GAP_31_3	True (*)	Central: Encryption Procedure
+TSPC_GAP_31_4	True (*)	Central: Feature Exchange Procedure
+TSPC_GAP_31_5	True (*)	Central: Version Exchange Procedure
+TSPC_GAP_31_6	True (*)	Central: Termination Procedure
+TSPC_GAP_32_1	False		Central: Limited Discovery Procedure
+TSPC_GAP_32_2	True (*)	Central: General Discovery Procedure
+TSPC_GAP_32_3	True (*)	Central: Name Discovery Procedure
+TSPC_GAP_33_1	True (*)	Central: Auto Connection Establishment
+					Procedure
+TSPC_GAP_33_2	True (*)	Central: General Connection Establishment
+					Procedure
+TSPC_GAP_33_3	True (*)	Central: Selective Connection Establishment
+					Procedure
+TSPC_GAP_33_4	True (*)	Central: Direct Connectin Establishment
+					Procedure
+TSPC_GAP_33_5	True (*)	Central: Connection Parameter Update Procedure
+TSPC_GAP_33_6	True (*)	Central: Terminate Connection Procedure
+TSPC_GAP_34_1	False		Central: Non-Bondable Mode
+TSPC_GAP_34_2	True (*)	Central: Bondable Mode
+TSPC_GAP_34_3	True (*)	Central: Bonding Procedure
+TSPC_GAP_35_1	True (*)	Central: Security Mode 1
+TSPC_GAP_35_2	True (*)	Central: Security Mode 2
+TSPC_GAP_35_3	True (*)	Central: Authentication Procedure
+TSPC_GAP_35_4	True (*)	Central: Authorization Procedure
+TSPC_GAP_35_5	True (*)	Central: Connection Data Signing Procedure
+TSPC_GAP_35_6	True (*)	Central: Authenticate Signed Data Procedure
+TSPC_GAP_35_7	False		Central: Authenticated Pairing
+					(LE security mode 1 level 3)
+TSPC_GAP_35_8	False		Central: Unauthenticated Pairing
+					(LE security mode 1 level 2)
+TSPC_GAP_36_1	False		Central: Privacy Feature
+TSPC_GAP_36_2	False		Central: Non-Resolvable Private Address
+					Generation Procedure
+TSPC_GAP_36_3	False		Central: Resolvable Private Address Resolution
+					Procedure
+TSPC_GAP_36_4	False		Central: Write to Privacy Characteristic
+					(Enable/Disable Privacy)
+TSPC_GAP_37_1	True (*)	Central: Device Name
+TSPC_GAP_37_2	True (*)	Central: Appearance
+TSPC_GAP_38_1	False		BR/EDR/LE: Broadcaster
+TSPC_GAP_38_2	True (*)	BR/EDR/LE: Observer
+TSPC_GAP_38_3	False		BR/EDR/LE: Peripheral
+TSPC_GAP_38_4	True (*)	BR/EDR/LE: Central
+TSPC_GAP_39_1	True (*)	Central BR/EDR/LE: Non-Discoverable Mode
+TSPC_GAP_39_2	True (*)	Central BR/EDR/LE: Discoverable Mode
+TSPC_GAP_39_3	True (*)	Central BR/EDR/LE: Non-Connectable Mode
+TSPC_GAP_39_4	True		Central BR/EDR/LE: Connectable Mode
+TSPC_GAP_39_5	False		Central BR/EDR/LE: Non-Bondable Mode
+TSPC_GAP_39_6	True (*)	Central BR/EDR/LE: Bondable Mode
+TSPC_GAP_40_1	True (*)	Central BR/EDR/LE: General Discovery
+TSPC_GAP_40_2	False		Central BR/EDR/LE: Limited Discovery
+TSPC_GAP_40_3	True (*)	Central BR/EDR/LE: Device Type Discovery
+TSPC_GAP_40_4	True (*)	Central BR/EDR/LE: Name Discovery
+TSPC_GAP_40_5	True (*)	Central BR/EDR/LE: Link Establishment
+TSPC_GAP_41_1	True		Central BR/EDR/LE: Security Aspects
+TSPC_GAP_42_1	False		Peripheral BR/EDR/LE: Non-Discoverable Mode
+TSPC_GAP_42_2	False		Peripheral BR/EDR/LE: Discoverable Mode
+TSPC_GAP_42_3	False		Peripheral BR/EDR/LE: Non-Connectable Mode
+TSPC_GAP_42_4	False (*)	Peripheral BR/EDR/LE: Connectable Mode
+TSPC_GAP_42_5	False		Peripheral BR/EDR/LE: Non-Bondable Mode
+TSPC_GAP_42_6	False		Peripheral BR/EDR/LE: Bondable Mode
+TSPC_GAP_43_1	False (*)	Peripheral BR/EDR/LE: Security Aspects
+TSPC_SM_1_1	False		Master Role (Initiator)
+TSPC_SM_1_2	False		Slave Role (Responder)
+TSPC_SM_2_4	False		OOB supported
+TSPC_ALL	False		Turns on all
-- 
1.8.4.1


^ 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