* [PATCH v3 BlueZ 1/4] android: Fix build dependency of bluetoothd on target
From: Luiz Augusto von Dentz @ 2013-10-23 8:50 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds missing headers necessary to build bluetoothd.
---
android/Android.mk | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/android/Android.mk b/android/Android.mk
index 7132279..d67a62d 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -15,9 +15,10 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
main.c \
log.c \
- adapter.c \
- hid.c \
+ adapter.c adapter.h \
+ hid.c hid.h \
ipc.c ipc.h \
+ ../src/sdp.h \
../src/shared/mgmt.c \
../src/shared/util.c \
../src/sdpd-database.c \
--
1.8.3.1
^ permalink raw reply related
* [PATCH 2/2] android: Add calls to pan methods to haltest
From: Jerzy Kasenberg @ 2013-10-23 8:34 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jerzy Kasenberg
In-Reply-To: <1382517298-28093-1-git-send-email-jerzy.kasenberg@tieto.com>
This patch allows to call pan methods in haltest.
---
Makefile.android | 2 +
android/Android.mk | 1 +
android/client/haltest.c | 1 +
android/client/if-bt.c | 2 +-
android/client/if-main.h | 2 +
android/client/if-pan.c | 209 ++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 216 insertions(+), 1 deletion(-)
create mode 100644 android/client/if-pan.c
diff --git a/Makefile.android b/Makefile.android
index 30e9110..0a05e9e 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -50,6 +50,7 @@ android_haltest_SOURCES = android/client/haltest.c \
android/client/tabcompletion.c \
android/client/if-bt.c \
android/client/if-hh.c \
+ android/client/if-pan.c \
android/client/if-sock.c \
android/client/hwmodule.c
@@ -79,6 +80,7 @@ EXTRA_DIST += android/client/terminal.c \
android/client/history.c \
android/client/if-bt.c \
android/client/if-hh.c \
+ android/client/if-pan.c \
android/client/if-sock.c \
android/client/textconv.c \
android/client/tabcompletion.c \
diff --git a/android/Android.mk b/android/Android.mk
index 7fdd70c..9f91576 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -97,6 +97,7 @@ LOCAL_SRC_FILES := \
client/tabcompletion.c \
client/if-bt.c \
client/if-hh.c \
+ client/if-pan.c \
client/if-sock.c \
LOCAL_CFLAGS := -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
diff --git a/android/client/haltest.c b/android/client/haltest.c
index 49c05e9..7168dfd 100644
--- a/android/client/haltest.c
+++ b/android/client/haltest.c
@@ -32,6 +32,7 @@
const struct interface *interfaces[] = {
&bluetooth_if,
&hh_if,
+ &pan_if,
&sock_if,
NULL
};
diff --git a/android/client/if-bt.c b/android/client/if-bt.c
index d90786a..2d9c0b5 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
@@ -811,7 +811,7 @@ static void get_profile_interface_p(int argc, const char **argv)
else if (strcmp(BT_PROFILE_HIDHOST_ID, id) == 0)
pif = (const void **)&if_hh;
else if (strcmp(BT_PROFILE_PAN_ID, id) == 0)
- pif = &dummy; /* TODO: change when if_pan is there */
+ pif = (const void **)&if_pan;
#if PLATFORM_SDK_VERSION > 17
else if (strcmp(BT_PROFILE_AV_RC_ID, id) == 0)
pif = &dummy; /* TODO: change when if_rc is there */
diff --git a/android/client/if-main.h b/android/client/if-main.h
index 9c732c1..e214ed0 100644
--- a/android/client/if-main.h
+++ b/android/client/if-main.h
@@ -45,6 +45,7 @@
/* Interfaces from hal that can be populated during application lifetime */
extern const bt_interface_t *if_bluetooth;
extern const bthh_interface_t *if_hh;
+extern const btpan_interface_t *if_pan;
extern const btsock_interface_t *if_sock;
/*
@@ -57,6 +58,7 @@ struct interface {
};
extern const struct interface bluetooth_if;
+extern const struct interface pan_if;
extern const struct interface sock_if;
extern const struct interface hh_if;
diff --git a/android/client/if-pan.c b/android/client/if-pan.c
new file mode 100644
index 0000000..fc296a6
--- /dev/null
+++ b/android/client/if-pan.c
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2013 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <hardware/bluetooth.h>
+
+#include "if-main.h"
+
+const btpan_interface_t *if_pan = NULL;
+
+typedef int btpan_role_t;
+
+SINTMAP(btpan_role_t, -1, "(unknown)")
+ DELEMENT(BTPAN_ROLE_NONE),
+ DELEMENT(BTPAN_ROLE_PANNAP),
+ DELEMENT(BTPAN_ROLE_PANU),
+ENDMAP
+
+SINTMAP(btpan_connection_state_t, -1, "(unknown)")
+ DELEMENT(BTPAN_STATE_CONNECTED),
+ DELEMENT(BTPAN_STATE_CONNECTING),
+ DELEMENT(BTPAN_STATE_DISCONNECTED),
+ DELEMENT(BTPAN_STATE_DISCONNECTING),
+ENDMAP
+
+SINTMAP(btpan_control_state_t, -1, "(unknown)")
+ DELEMENT(BTPAN_STATE_ENABLED),
+ DELEMENT(BTPAN_STATE_DISABLED),
+ENDMAP
+
+static void control_state_cb(btpan_control_state_t state, bt_status_t error,
+ int local_role, const char *ifname)
+{
+ haltest_info("%s: state=%s error=%s local_role=%s ifname=%s\n",
+ __func__, btpan_control_state_t2str(state),
+ bt_status_t2str(error), btpan_role_t2str(local_role),
+ ifname);
+}
+
+static char last_used_addr[18];
+
+static void connection_state_cb(btpan_connection_state_t state,
+ bt_status_t error, const bt_bdaddr_t *bd_addr,
+ int local_role, int remote_role)
+{
+ haltest_info("%s: state=%s error=%s bd_addr=%s local_role=%s remote_role=%s\n",
+ __func__, btpan_connection_state_t2str(state),
+ bt_status_t2str(error),
+ bt_bdaddr_t2str(bd_addr, last_used_addr),
+ btpan_role_t2str(local_role),
+ btpan_role_t2str(remote_role));
+}
+
+static btpan_callbacks_t pan_cbacks = {
+ .size = sizeof(pan_cbacks),
+ .control_state_cb = control_state_cb,
+ .connection_state_cb = connection_state_cb
+};
+
+static void init_p(int argc, const char **argv)
+{
+ RETURN_IF_NULL(if_pan);
+
+ EXEC(if_pan->init, &pan_cbacks);
+}
+
+/* enable */
+
+static void enable_c(int argc, const const char **argv,
+ enum_func *penum_func, void **puser)
+{
+ if (argc == 3) {
+ *puser = TYPE_ENUM(btpan_role_t);
+ *penum_func = enum_defines;
+ }
+}
+
+static void enable_p(int argc, const char **argv)
+{
+ int local_role;
+
+ RETURN_IF_NULL(if_pan);
+
+ /* local role */
+ if (argc < 3) {
+ haltest_error("No local mode specified\n");
+ return;
+ }
+ local_role = str2btpan_role_t(argv[2]);
+ if (local_role == -1)
+ local_role = atoi(argv[2]);
+
+ EXEC(if_pan->enable, local_role);
+}
+
+/* get_local_role */
+
+static void get_local_role_p(int argc, const char **argv)
+{
+ int local_role;
+
+ RETURN_IF_NULL(if_pan);
+
+ local_role = if_pan->get_local_role();
+ haltest_info("local_role: %s\n", btpan_role_t2str(local_role));
+}
+
+/* connect */
+
+static void connect_c(int argc, const const char **argv,
+ enum_func *penum_func, void **puser)
+{
+ if (argc == 3) {
+ *puser = NULL;
+ *penum_func = enum_devices;
+ } else if (argc == 4 || argc == 5) {
+ *puser = TYPE_ENUM(btpan_role_t);
+ *penum_func = enum_defines;
+ }
+}
+
+static void connect_p(int argc, const char **argv)
+{
+ bt_bdaddr_t addr;
+ int local_role;
+ int remote_role;
+
+ RETURN_IF_NULL(if_pan);
+ VERIFY_ADDR_ARG(2, &addr);
+
+ /* local role */
+ if (argc < 4) {
+ haltest_error("No local mode specified\n");
+ return;
+ }
+ local_role = str2btpan_role_t(argv[3]);
+ if (local_role == -1)
+ local_role = atoi(argv[3]);
+
+ /* remote role */
+ if (argc < 5) {
+ haltest_error("No remote mode specified\n");
+ return;
+ }
+ remote_role = str2btpan_role_t(argv[4]);
+ if (remote_role == -1)
+ remote_role = atoi(argv[4]);
+
+ EXEC(if_pan->connect, &addr, local_role, remote_role);
+}
+
+/* disconnect */
+
+static void disconnect_c(int argc, const const char **argv,
+ enum_func *penum_func, void **puser)
+{
+ if (argc == 3) {
+ *puser = last_used_addr;
+ *penum_func = enum_one_string;
+ }
+}
+
+static void disconnect_p(int argc, const char **argv)
+{
+ bt_bdaddr_t addr;
+
+ RETURN_IF_NULL(if_pan);
+ VERIFY_ADDR_ARG(2, &addr);
+
+ EXEC(if_pan->disconnect, &addr);
+}
+
+/* cleanup */
+
+static void cleanup_p(int argc, const char **argv)
+{
+ RETURN_IF_NULL(if_pan);
+
+ EXECV(if_pan->cleanup);
+ if_pan = NULL;
+}
+
+static struct method methods[] = {
+ STD_METHOD(init),
+ STD_METHODCH(connect, "<addr> <local_role> <remote_role>"),
+ STD_METHODCH(enable, "<local_role>"),
+ STD_METHOD(get_local_role),
+ STD_METHODCH(disconnect, "<addr>"),
+ STD_METHOD(cleanup),
+ END_METHOD
+};
+
+const struct interface pan_if = {
+ .name = "pan",
+ .methods = methods
+};
--
1.7.9.5
^ permalink raw reply related
* [PATCH 1/2] android: Add calls to socket methods in haltest
From: Jerzy Kasenberg @ 2013-10-23 8:34 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jerzy Kasenberg
In-Reply-To: <1382517298-28093-1-git-send-email-jerzy.kasenberg@tieto.com>
This patch adds calls to socket methods.
---
Makefile.android | 2 +
android/Android.mk | 1 +
android/client/haltest.c | 1 +
android/client/if-bt.c | 2 +-
android/client/if-main.h | 2 +
android/client/if-sock.c | 334 ++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 341 insertions(+), 1 deletion(-)
create mode 100644 android/client/if-sock.c
diff --git a/Makefile.android b/Makefile.android
index 90d5973..30e9110 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -50,6 +50,7 @@ android_haltest_SOURCES = android/client/haltest.c \
android/client/tabcompletion.c \
android/client/if-bt.c \
android/client/if-hh.c \
+ android/client/if-sock.c \
android/client/hwmodule.c
android_haltest_LDADD = android/libhal-internal.la
@@ -78,6 +79,7 @@ EXTRA_DIST += android/client/terminal.c \
android/client/history.c \
android/client/if-bt.c \
android/client/if-hh.c \
+ android/client/if-sock.c \
android/client/textconv.c \
android/client/tabcompletion.c \
android/client/textconv.h \
diff --git a/android/Android.mk b/android/Android.mk
index 7132279..7fdd70c 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -97,6 +97,7 @@ LOCAL_SRC_FILES := \
client/tabcompletion.c \
client/if-bt.c \
client/if-hh.c \
+ client/if-sock.c \
LOCAL_CFLAGS := -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
diff --git a/android/client/haltest.c b/android/client/haltest.c
index 2894565..49c05e9 100644
--- a/android/client/haltest.c
+++ b/android/client/haltest.c
@@ -32,6 +32,7 @@
const struct interface *interfaces[] = {
&bluetooth_if,
&hh_if,
+ &sock_if,
NULL
};
diff --git a/android/client/if-bt.c b/android/client/if-bt.c
index 01bf1d1..d90786a 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
@@ -807,7 +807,7 @@ static void get_profile_interface_p(int argc, const char **argv)
else if (strcmp(BT_PROFILE_HEALTH_ID, id) == 0)
pif = &dummy; /* TODO: change when if_hl is there */
else if (strcmp(BT_PROFILE_SOCKETS_ID, id) == 0)
- pif = &dummy; /* TODO: change when if_sock is there */
+ pif = (const void **)&if_sock;
else if (strcmp(BT_PROFILE_HIDHOST_ID, id) == 0)
pif = (const void **)&if_hh;
else if (strcmp(BT_PROFILE_PAN_ID, id) == 0)
diff --git a/android/client/if-main.h b/android/client/if-main.h
index 21fdcfe..9c732c1 100644
--- a/android/client/if-main.h
+++ b/android/client/if-main.h
@@ -45,6 +45,7 @@
/* Interfaces from hal that can be populated during application lifetime */
extern const bt_interface_t *if_bluetooth;
extern const bthh_interface_t *if_hh;
+extern const btsock_interface_t *if_sock;
/*
* Structure defines top level interfaces that can be used in test tool
@@ -56,6 +57,7 @@ struct interface {
};
extern const struct interface bluetooth_if;
+extern const struct interface sock_if;
extern const struct interface hh_if;
/* Interfaces that will show up in tool (first part of command line) */
diff --git a/android/client/if-sock.c b/android/client/if-sock.c
new file mode 100644
index 0000000..f761a0f
--- /dev/null
+++ b/android/client/if-sock.c
@@ -0,0 +1,334 @@
+/*
+ * Copyright (C) 2013 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+#include <unistd.h>
+
+#include "if-main.h"
+#include "pollhandler.h"
+
+const btsock_interface_t *if_sock = NULL;
+
+SINTMAP(btsock_type_t, -1, "(unknown)")
+ DELEMENT(BTSOCK_RFCOMM),
+ DELEMENT(BTSOCK_SCO),
+ DELEMENT(BTSOCK_L2CAP),
+ENDMAP
+
+#define MAX_LISTEN_FD 15
+static int listen_fd[MAX_LISTEN_FD];
+static int listen_fd_count;
+
+/*
+ * This function reads data from file descriptor and
+ * prints it to the user
+ */
+static void receive_from_client(struct pollfd *pollfd)
+{
+ char buf[16];
+ /* Buffer for lines:
+ * 41 42 43 20 20 00 31 32 00 07 04 00 00 00 00 00 ABC .12.....
+ */
+ char outbuf[sizeof(buf) * 4 + 2];
+ int i;
+ int ret;
+
+ if (pollfd->revents & POLLHUP) {
+ haltest_error("Disconnected fd=%d\n", pollfd->fd);
+ poll_unregister_fd(pollfd->fd, receive_from_client);
+ } else if (pollfd->revents & POLLIN) {
+
+ haltest_info("receiving from client fd=%d\n", pollfd->fd);
+
+ do {
+ memset(outbuf, ' ', sizeof(outbuf));
+ outbuf[sizeof(outbuf) - 1] = 0;
+ ret = recv(pollfd->fd, buf, sizeof(buf), MSG_DONTWAIT);
+
+ for (i = 0; i < ret; ++i)
+ sprintf(outbuf + i * 3, "%02X ",
+ (unsigned) buf[i]);
+ outbuf[i * 3] = ' ';
+ for (i = 0; i < ret; ++i)
+ sprintf(outbuf + 48 + i, "%c",
+ (isprint(buf[i]) ? buf[i] : '.'));
+ if (ret > 0)
+ haltest_info("%s\n", outbuf);
+ } while (ret > 0);
+ } else {
+ /* For now disconnect on all other events */
+ haltest_error("Poll event %x\n", pollfd->revents);
+ poll_unregister_fd(pollfd->fd, receive_from_client);
+ }
+}
+
+/*
+ * This function read from fd socket information about
+ * connected socket
+ */
+static void receive_sock_connect_signal(struct pollfd *pollfd)
+{
+ sock_connect_signal_t cs;
+ char addr_str[MAX_ADDR_STR_LEN];
+
+ if (pollfd->revents & POLLIN) {
+ int ret;
+
+ poll_unregister_fd(pollfd->fd, receive_sock_connect_signal);
+ ret = read(pollfd->fd, &cs, sizeof(cs));
+ if (ret != sizeof(cs)) {
+ haltest_info("Read on connect return %d\n", ret);
+ return;
+ }
+ haltest_info("Connection to %s channel %d status=%d\n",
+ bt_bdaddr_t2str(&cs.bd_addr, addr_str),
+ cs.channel, cs.status);
+
+ if (cs.status == 0)
+ poll_register_fd(pollfd->fd, POLLIN,
+ receive_from_client);
+ }
+
+ if (pollfd->revents & POLLHUP) {
+ haltest_error("Disconnected fd=%d revents=0x%X\n", pollfd->fd,
+ pollfd->revents);
+ poll_unregister_fd(pollfd->fd, receive_sock_connect_signal);
+ }
+}
+
+/*
+ * This function read from fd socket information about
+ * incoming connection and starts monitoring new connection
+ * on file descriptor read from fd.
+ */
+static void read_accepted(int fd)
+{
+ int ret;
+ struct msghdr msg;
+ struct iovec iv;
+ char cmsgbuf[CMSG_SPACE(1)];
+ struct cmsghdr *cmsgptr;
+ sock_connect_signal_t cs;
+ int accepted_fd = -1;
+ char addr_str[MAX_ADDR_STR_LEN];
+
+ memset(&msg, 0, sizeof(msg));
+ memset(&iv, 0, sizeof(iv));
+
+ iv.iov_base = &cs;
+ iv.iov_len = sizeof(cs);
+
+ msg.msg_iov = &iv;
+ msg.msg_iovlen = 1;
+ msg.msg_control = cmsgbuf;
+ msg.msg_controllen = sizeof(cmsgbuf);
+
+ do {
+ ret = recvmsg(fd, &msg, MSG_NOSIGNAL);
+ } while (ret < 0 && errno == EINTR);
+
+ if (ret < 16 ||
+ (msg.msg_flags & (MSG_CTRUNC | MSG_OOB | MSG_ERRQUEUE)) != 0)
+ haltest_error("Failed to accept connection\n");
+
+ for (cmsgptr = CMSG_FIRSTHDR(&msg);
+ cmsgptr != NULL; cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) {
+ int *descs;
+ int count;
+
+ if (cmsgptr->cmsg_level != SOL_SOCKET ||
+ cmsgptr->cmsg_type != SCM_RIGHTS)
+ continue;
+
+ descs = (int *) CMSG_DATA(cmsgptr);
+ count = ((cmsgptr->cmsg_len - CMSG_LEN(0)) / sizeof(int));
+
+ if (count != 1)
+ haltest_error("Failed to accept descriptors count=%d\n",
+ count);
+
+ accepted_fd = descs[0];
+ break;
+ }
+ haltest_info("Incoming connection from %s channel %d status=%d fd=%d\n",
+ bt_bdaddr_t2str(&cs.bd_addr, addr_str), cs.channel,
+ cs.status, accepted_fd);
+ poll_register_fd(accepted_fd, POLLIN, receive_from_client);
+}
+
+/* handles incoming connections on socket */
+static void client_connected(struct pollfd *pollfd)
+{
+ haltest_info("client connected %x\n", pollfd->revents);
+
+ if (pollfd->revents & POLLHUP)
+ poll_unregister_fd(pollfd->fd, client_connected);
+ else if (pollfd->revents & POLLIN)
+ read_accepted(pollfd->fd);
+}
+
+/** listen */
+
+static void listen_c(int argc, const char **argv,
+ enum_func *penum_func, void **puser)
+{
+ if (argc == 3) {
+ *puser = TYPE_ENUM(btsock_type_t);
+ *penum_func = enum_defines;
+ }
+}
+
+static void listen_p(int argc, const char **argv)
+{
+ btsock_type_t type;
+ const char *service_name;
+ bt_uuid_t service_uuid;
+ int channel;
+ int sock_fd;
+ int flags;
+
+ RETURN_IF_NULL(if_sock);
+
+ /* Socket type */
+ if (argc < 3) {
+ haltest_error("No socket type specified\n");
+ return;
+ }
+ type = str2btsock_type_t(argv[2]);
+ if ((int) type == -1)
+ type = atoi(argv[2]);
+
+ /* service name */
+ if (argc < 4) {
+ haltest_error("No service name specified\n");
+ return;
+ }
+ service_name = argv[3];
+
+ /* uuid */
+ if (argc < 5) {
+ haltest_error("No uuid specified\n");
+ return;
+ }
+ str2bt_uuid_t(argv[4], &service_uuid);
+
+ /* channel */
+ channel = argc > 5 ? atoi(argv[5]) : 0;
+
+ /* flags */
+ flags = argc > 6 ? atoi(argv[6]) : 0;
+
+ if (listen_fd_count >= MAX_LISTEN_FD) {
+ haltest_error("Max (%d) listening sockets exceeded\n",
+ listen_fd_count);
+ return;
+ }
+ EXEC(if_sock->listen, type, service_name,
+ &service_uuid.uu[0], channel, &sock_fd, flags);
+ if (sock_fd > 0) {
+ int channel = 0;
+ int ret = read(sock_fd, &channel, 4);
+ if (ret != 4)
+ haltest_info("Read channel failed\n");
+ haltest_info("Channel returned from first read %d\n", channel);
+ listen_fd[listen_fd_count++] = sock_fd;
+ poll_register_fd(sock_fd, POLLIN, client_connected);
+ }
+}
+
+/** connect */
+
+static void connect_c(int argc, const char **argv,
+ enum_func *penum_func, void **puser)
+{
+ if (argc == 3) {
+ *penum_func = enum_devices;
+ } else if (argc == 4) {
+ *puser = TYPE_ENUM(btsock_type_t);
+ *penum_func = enum_defines;
+ }
+}
+
+static void connect_p(int argc, const char **argv)
+{
+ bt_bdaddr_t addr;
+ btsock_type_t type;
+ bt_uuid_t uuid;
+ int channel;
+ int sock_fd;
+ int flags;
+
+ /* Address */
+ if (argc <= 2) {
+ haltest_error("No address specified\n");
+ return;
+ }
+ str2bt_bdaddr_t(argv[2], &addr);
+
+ /* Socket type */
+ if (argc <= 3) {
+ haltest_error("No socket type specified\n");
+ return;
+ }
+ type = str2btsock_type_t(argv[3]);
+ if ((int) type == -1)
+ type = atoi(argv[3]);
+
+ /* uuid */
+ if (argc <= 4) {
+ haltest_error("No uuid specified\n");
+ return;
+ }
+ str2bt_uuid_t(argv[4], &uuid);
+
+ /* channel */
+ if (argc <= 5) {
+ haltest_error("No channel specified\n");
+ return;
+ }
+ channel = atoi(argv[5]);
+
+ /* flags */
+ flags = argc <= 6 ? 0 : atoi(argv[6]);
+
+ RETURN_IF_NULL(if_sock);
+
+ EXEC(if_sock->connect, &addr, type, &uuid.uu[0], channel, &sock_fd,
+ flags);
+ if (sock_fd > 0) {
+ int channel = 0;
+ int ret = read(sock_fd, &channel, 4);
+ if (ret != 4)
+ haltest_info("Read channel failed\n");
+ haltest_info("Channel returned from first read %d\n", channel);
+ listen_fd[listen_fd_count++] = sock_fd;
+ poll_register_fd(sock_fd, POLLIN, receive_sock_connect_signal);
+ }
+}
+
+/* Methods available in btsock_interface_t */
+static struct method methods[] = {
+ STD_METHODCH(listen, "<sock_type> <srvc_name> <uuid> [<channle>] [<flags>]"),
+ STD_METHODCH(connect, "<addr> <sock_type> <uuid> <channle> [<flags>]"),
+ END_METHOD
+};
+
+const struct interface sock_if = {
+ .name = "socket",
+ .methods = methods
+};
--
1.7.9.5
^ permalink raw reply related
* [PATCH 0/2] Add support to pan and socket in haltest
From: Jerzy Kasenberg @ 2013-10-23 8:34 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jerzy Kasenberg
- Add calls to methods of socket and pan
Jerzy Kasenberg (2):
android: Add calls to socket methods in haltest
android: Add calls to pan methods to haltest
Makefile.android | 4 +
android/Android.mk | 2 +
android/client/haltest.c | 2 +
android/client/if-bt.c | 4 +-
android/client/if-main.h | 4 +
android/client/if-pan.c | 209 +++++++++++++++++++++++++++++
android/client/if-sock.c | 334 ++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 557 insertions(+), 2 deletions(-)
create mode 100644 android/client/if-pan.c
create mode 100644 android/client/if-sock.c
--
1.7.9.5
^ permalink raw reply
* [PATCH] android: Fix build error for Android
From: Lukasz Rymanowski @ 2013-10-23 8:26 UTC (permalink / raw)
To: linux-bluetooth
Cc: johan.hedberg, andrei.emeltchenko, szymon.janc, Lukasz Rymanowski
Android uses functions and defines from sys/capability.h which
requires additional include
---
android/main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/android/main.c b/android/main.c
index 988d08b..606baf2 100644
--- a/android/main.c
+++ b/android/main.c
@@ -52,6 +52,10 @@
#include "hal-msg.h"
#include "ipc.h"
+#if defined(ANDROID)
+#include <sys/capability.h>
+#endif
+
static GMainLoop *event_loop;
static struct mgmt *mgmt_if = NULL;
--
1.8.4
^ permalink raw reply related
* [PATCH v2 BlueZ 4/4] android: Add variable ROOT_PATH to Android.mk
From: Luiz Augusto von Dentz @ 2013-10-23 8:08 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1382515699-30338-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This makes it simpler to include files from other parts of the code.
---
android/Android.mk | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/android/Android.mk b/android/Android.mk
index 4c87a9b..20064fe 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -1,7 +1,8 @@
LOCAL_PATH := $(call my-dir)
+ROOT_PATH := $(LOCAL_PATH)/..
# Retrieve BlueZ version from configure.ac file
-BLUEZ_VERSION := $(shell grep ^AC_INIT $(LOCAL_PATH)/../configure.ac | cpp -P -D'AC_INIT(_,v)=v')
+BLUEZ_VERSION := $(shell grep ^AC_INIT $(ROOT_PATH)/configure.ac | cpp -P -D'AC_INIT(_,v)=v')
# Specify pathmap for glib
pathmap_INCL += glib:external/bluetooth/glib
@@ -18,25 +19,25 @@ LOCAL_SRC_FILES := \
adapter.c adapter.h \
hid.c hid.h \
ipc.c ipc.h \
- $(LOCAL_PATH)/../src/sdp.h \
- $(LOCAL_PATH)/../src/shared/mgmt.c \
- $(LOCAL_PATH)/../src/shared/util.c \
- $(LOCAL_PATH)/../src/sdpd-database.c \
- $(LOCAL_PATH)/../src/sdpd-service.c \
- $(LOCAL_PATH)/../src/sdpd-request.c \
- $(LOCAL_PATH)/../src/sdpd-server.c \
- $(LOCAL_PATH)/../lib/sdp.c \
- $(LOCAL_PATH)/../lib/bluetooth.c \
- $(LOCAL_PATH)/../lib/hci.c \
+ $(ROOT_PATH)/src/sdp.h \
+ $(ROOT_PATH)/src/shared/mgmt.c \
+ $(ROOT_PATH)/src/shared/util.c \
+ $(ROOT_PATH)/src/sdpd-database.c \
+ $(ROOT_PATH)/src/sdpd-service.c \
+ $(ROOT_PATH)/src/sdpd-request.c \
+ $(ROOT_PATH)/src/sdpd-server.c \
+ $(ROOT_PATH)/lib/sdp.c \
+ $(ROOT_PATH)/lib/bluetooth.c \
+ $(ROOT_PATH)/lib/hci.c \
LOCAL_C_INCLUDES := \
$(call include-path-for, glib) \
$(call include-path-for, glib)/glib \
LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/../ \
- $(LOCAL_PATH)/../src \
- $(LOCAL_PATH)/../lib \
+ $(ROOT_PATH)/ \
+ $(ROOT_PATH)/src \
+ $(ROOT_PATH)/lib \
LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
@@ -51,9 +52,9 @@ lib_headers := \
sdp_lib.h \
sdp.h \
-$(shell mkdir -p $(LOCAL_PATH)/../lib/bluetooth)
+$(shell mkdir -p $(ROOT_PATH)/lib/bluetooth)
-$(foreach file,$(lib_headers), $(shell ln -sf ../$(file) $(LOCAL_PATH)/../lib/bluetooth/$(file)))
+$(foreach file,$(lib_headers), $(shell ln -sf ../$(file) $(ROOT_PATH)/lib/bluetooth/$(file)))
LOCAL_MODULE := bluetoothd
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2 BlueZ 3/4] android: Fix build dependency of haltest on target
From: Luiz Augusto von Dentz @ 2013-10-23 8:08 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1382515699-30338-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds missing headers necessary to build haltest.
---
android/Android.mk | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/android/Android.mk b/android/Android.mk
index 01ef3e7..4c87a9b 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -92,11 +92,12 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
client/haltest.c \
- client/pollhandler.c \
- client/terminal.c \
- client/history.c \
- client/textconv.c \
+ client/pollhandler.c client/pollhandler.h \
+ client/terminal.c client/terminal.h \
+ client/history.c client/history.h \
+ client/textconv.c client/textconv.h \
client/tabcompletion.c \
+ client/if-main.h \
client/if-bt.c \
client/if-hh.c \
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2 BlueZ 2/4] android: Fix build dependency of bluetooth.default.so HAL on target
From: Luiz Augusto von Dentz @ 2013-10-23 8:08 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1382515699-30338-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds missing headers necessary to build bluetooth.default.so
---
android/Android.mk | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/android/Android.mk b/android/Android.mk
index d276102..01ef3e7 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -66,7 +66,8 @@ include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
- hal-ipc.c \
+ hal.h hal-msg.h hal-log.h \
+ hal-ipc.c hal-ipc.h \
hal-bluetooth.c \
hal-sock.c \
hal-hidhost.c \
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2 BlueZ 1/4] android: Fix build dependency of bluetoothd on target
From: Luiz Augusto von Dentz @ 2013-10-23 8:08 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds missing headers necessary to build bluetoothd.
---
android/Android.mk | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/android/Android.mk b/android/Android.mk
index 7132279..d276102 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -15,18 +15,19 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
main.c \
log.c \
- adapter.c \
- hid.c \
+ adapter.c adapter.h \
+ hid.c hid.h \
ipc.c ipc.h \
- ../src/shared/mgmt.c \
- ../src/shared/util.c \
- ../src/sdpd-database.c \
- ../src/sdpd-service.c \
- ../src/sdpd-request.c \
- ../src/sdpd-server.c \
- ../lib/sdp.c \
- ../lib/bluetooth.c \
- ../lib/hci.c \
+ $(LOCAL_PATH)/../src/sdp.h \
+ $(LOCAL_PATH)/../src/shared/mgmt.c \
+ $(LOCAL_PATH)/../src/shared/util.c \
+ $(LOCAL_PATH)/../src/sdpd-database.c \
+ $(LOCAL_PATH)/../src/sdpd-service.c \
+ $(LOCAL_PATH)/../src/sdpd-request.c \
+ $(LOCAL_PATH)/../src/sdpd-server.c \
+ $(LOCAL_PATH)/../lib/sdp.c \
+ $(LOCAL_PATH)/../lib/bluetooth.c \
+ $(LOCAL_PATH)/../lib/hci.c \
LOCAL_C_INCLUDES := \
$(call include-path-for, glib) \
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCHv2] android: Create header links for lib
From: Johan Hedberg @ 2013-10-23 8:00 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1382514501-20335-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Wed, Oct 23, 2013, Andrei Emeltchenko wrote:
> BlueZ headers are referring as bluetooth/* for headers which are
> located in lib/*. Create symlinks for now until we find better solution.
> ---
> android/Android.mk | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH_v2 0/7] Initial code for hal hid host
From: Johan Hedberg @ 2013-10-23 7:59 UTC (permalink / raw)
To: Ravi kumar Veeramally; +Cc: linux-bluetooth
In-Reply-To: <1382514120-13152-1-git-send-email-ravikumar.veeramally@linux.intel.com>
Hi Ravi,
On Wed, Oct 23, 2013, Ravi kumar Veeramally wrote:
> Patch set is all about initial code for hal hidhost interfaces which
> are .virtual_unplug, .set_info, .get_protocol, .set_protocol,
> .get_report, .set_report and .send_data. Also includes issue fixes
> for .connect and .disconnect interfaces.
> ---
> _v2 is about fixing issues as per Johan comments.
>
> Ravi kumar Veeramally (7):
> android: Return right from hal_ipc_cmd call in hal hid connect
> android: Return right from hal_ipc_cmd call in hal hid disconnect
> android: Add initial code for hidhost virtual unplug
> android: Add initial code for hidhost get and set protocol
> android: Add initial code for hidhost get and set report
> android: Add initial code for hidhost send data
> android: Add initial code for hidhost set hid information
>
> android/hal-hidhost.c | 126 ++++++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 105 insertions(+), 21 deletions(-)
All patches have been applied (after some minor coding style fixes).
Thanks.
Johan
^ permalink raw reply
* [PATCH BlueZ 4/4] android: Add variable ROOT_PATH to Android.mk
From: Luiz Augusto von Dentz @ 2013-10-23 7:58 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1382515098-28782-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This makes it simpler to include files from other parts of the code.
---
android/Android.mk | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/android/Android.mk b/android/Android.mk
index 9becddc..baa0a49 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -1,7 +1,8 @@
LOCAL_PATH := $(call my-dir)
+ROOT_PATH := $(LOCAL_PATH)/..
# Retrieve BlueZ version from configure.ac file
-BLUEZ_VERSION := $(shell grep ^AC_INIT $(LOCAL_PATH)/../configure.ac | cpp -P -D'AC_INIT(_,v)=v')
+BLUEZ_VERSION := $(shell grep ^AC_INIT $(ROOT_PATH)/configure.ac | cpp -P -D'AC_INIT(_,v)=v')
# Specify pathmap for glib
pathmap_INCL += glib:external/bluetooth/glib
@@ -18,25 +19,25 @@ LOCAL_SRC_FILES := \
adapter.c adapter.h \
hid.c hid.h \
ipc.c ipc.h \
- $(LOCAL_PATH)/../src/sdp.h \
- $(LOCAL_PATH)/../src/shared/mgmt.c \
- $(LOCAL_PATH)/../src/shared/util.c \
- $(LOCAL_PATH)/../src/sdpd-database.c \
- $(LOCAL_PATH)/../src/sdpd-service.c \
- $(LOCAL_PATH)/../src/sdpd-request.c \
- $(LOCAL_PATH)/../src/sdpd-server.c \
- $(LOCAL_PATH)/../lib/sdp.c \
- $(LOCAL_PATH)/../lib/bluetooth.c \
- $(LOCAL_PATH)/../lib/hci.c \
+ $(ROOT_PATH)/src/sdp.h \
+ $(ROOT_PATH)/src/shared/mgmt.c \
+ $(ROOT_PATH)/src/shared/util.c \
+ $(ROOT_PATH)/src/sdpd-database.c \
+ $(ROOT_PATH)/src/sdpd-service.c \
+ $(ROOT_PATH)/src/sdpd-request.c \
+ $(ROOT_PATH)/src/sdpd-server.c \
+ $(ROOT_PATH)/lib/sdp.c \
+ $(ROOT_PATH)/lib/bluetooth.c \
+ $(ROOT_PATH)/lib/hci.c \
LOCAL_C_INCLUDES := \
$(call include-path-for, glib) \
$(call include-path-for, glib)/glib \
LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/../ \
- $(LOCAL_PATH)/../src \
- $(LOCAL_PATH)/../lib \
+ $(ROOT_PATH)/ \
+ $(ROOT_PATH)/src \
+ $(ROOT_PATH)/lib \
LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 3/4] android: Fix build dependency of haltest on target
From: Luiz Augusto von Dentz @ 2013-10-23 7:58 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1382515098-28782-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds missing headers necessary to build haltest.
---
android/Android.mk | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/android/Android.mk b/android/Android.mk
index cdc99a8..9becddc 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -80,11 +80,12 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
client/haltest.c \
- client/pollhandler.c \
- client/terminal.c \
- client/history.c \
- client/textconv.c \
+ client/pollhandler.c client/pollhandler.h \
+ client/terminal.c client/terminal.h \
+ client/history.c client/history.h \
+ client/textconv.c client/textconv.h \
client/tabcompletion.c \
+ client/if-main.h \
client/if-bt.c \
client/if-hh.c \
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 2/4] android: Fix build dependency of bluetooth.default.so HAL on target
From: Luiz Augusto von Dentz @ 2013-10-23 7:58 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1382515098-28782-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds missing headers necessary to build bluetooth.default.so
---
android/Android.mk | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/android/Android.mk b/android/Android.mk
index a00b658..cdc99a8 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -54,7 +54,8 @@ include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
- hal-ipc.c \
+ hal.h hal-msg.h hal-log.h \
+ hal-ipc.c hal-ipc.h \
hal-bluetooth.c \
hal-sock.c \
hal-hidhost.c \
--
1.8.3.1
^ permalink raw reply related
* [PATCH BlueZ 1/4] android: Fix build dependency of bluetoothd on target
From: Luiz Augusto von Dentz @ 2013-10-23 7:58 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds missing headers necessary to build bluetoothd.
---
android/Android.mk | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/android/Android.mk b/android/Android.mk
index eef809a..a00b658 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -15,18 +15,19 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
main.c \
log.c \
- adapter.c \
- hid.c \
+ adapter.c adapter.h \
+ hid.c hid.h \
ipc.c ipc.h \
- ../src/shared/mgmt.c \
- ../src/shared/util.c \
- ../src/sdpd-database.c \
- ../src/sdpd-service.c \
- ../src/sdpd-request.c \
- ../src/sdpd-server.c \
- ../lib/sdp.c \
- ../lib/bluetooth.c \
- ../lib/hci.c \
+ $(LOCAL_PATH)/../src/sdp.h \
+ $(LOCAL_PATH)/../src/shared/mgmt.c \
+ $(LOCAL_PATH)/../src/shared/util.c \
+ $(LOCAL_PATH)/../src/sdpd-database.c \
+ $(LOCAL_PATH)/../src/sdpd-service.c \
+ $(LOCAL_PATH)/../src/sdpd-request.c \
+ $(LOCAL_PATH)/../src/sdpd-server.c \
+ $(LOCAL_PATH)/../lib/sdp.c \
+ $(LOCAL_PATH)/../lib/bluetooth.c \
+ $(LOCAL_PATH)/../lib/hci.c \
LOCAL_C_INCLUDES := \
$(call include-path-for, glib) \
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] android: Fix compilation error for Android 4.2.2
From: Johan Hedberg @ 2013-10-23 7:51 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1382438228-23422-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Tue, Oct 22, 2013, Andrei Emeltchenko wrote:
> On our current target the tools cannot be compiled.
> ---
> android/Android.mk | 2 ++
> android/client/if-bt.c | 6 ++++++
> android/client/if-main.h | 3 +++
> android/client/textconv.c | 2 ++
> 4 files changed, 13 insertions(+)
Applied. Thanks.
Johan
^ permalink raw reply
* [PATCHv2] android: Create header links for lib
From: Andrei Emeltchenko @ 2013-10-23 7:48 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
BlueZ headers are referring as bluetooth/* for headers which are
located in lib/*. Create symlinks for now until we find better solution.
---
android/Android.mk | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/android/Android.mk b/android/Android.mk
index c4b0621..3163763 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -41,6 +41,18 @@ LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
LOCAL_SHARED_LIBRARIES := \
libglib \
+lib_headers := \
+ bluetooth.h \
+ hci.h \
+ hci_lib.h \
+ l2cap.h \
+ sdp_lib.h \
+ sdp.h \
+
+$(shell mkdir -p $(LOCAL_PATH)/../lib/bluetooth)
+
+$(foreach file,$(lib_headers), $(shell ln -sf ../$(file) $(LOCAL_PATH)/../lib/bluetooth/$(file)))
+
LOCAL_MODULE := bluetoothd
include $(BUILD_EXECUTABLE)
--
1.7.10.4
^ permalink raw reply related
* [PATCH_v2 7/7] android: Add initial code for hidhost set hid information
From: Ravi kumar Veeramally @ 2013-10-23 7:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1382514120-13152-1-git-send-email-ravikumar.veeramally@linux.intel.com>
This adds the initial code for hidhost .set_info interface
---
android/hal-hidhost.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index 02a3f7d..4842a01 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -87,6 +87,8 @@ static bt_status_t hh_virtual_unplug(bt_bdaddr_t *bd_addr)
static bt_status_t hh_set_info(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info)
{
+ struct hal_msg_cmd_bt_hid_set_info cmd;
+
DBG("");
if (!interface_ready())
@@ -95,7 +97,18 @@ static bt_status_t hh_set_info(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info)
if (!bd_addr)
return BT_STATUS_PARM_INVALID;
- return BT_STATUS_UNSUPPORTED;
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+ cmd.attr = hid_info.attr_mask;
+ cmd.subclass = hid_info.sub_class;
+ cmd.app_id = hid_info.app_id;
+ cmd.vendor = hid_info.vendor_id;
+ cmd.product = hid_info.product_id;
+ cmd.country = hid_info.ctry_code;
+ cmd.descr_len = hid_info.dl_len;
+ memcpy(cmd.descr, hid_info.dsc_list, cmd.descr_len);
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_SET_INFO,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_get_protocol(bt_bdaddr_t *bd_addr,
--
1.7.9.5
^ permalink raw reply related
* [PATCH_v2 6/7] android: Add initial code for hidhost send data
From: Ravi kumar Veeramally @ 2013-10-23 7:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1382514120-13152-1-git-send-email-ravikumar.veeramally@linux.intel.com>
This adds the initial code for hidhost .send_data interface
---
android/hal-hidhost.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index 22045f1..02a3f7d 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -230,6 +230,8 @@ static bt_status_t hh_set_report(bt_bdaddr_t *bd_addr,
static bt_status_t hh_send_data(bt_bdaddr_t *bd_addr, char *data)
{
+ struct hal_msg_cmd_bt_hid_send_data cmd;
+
DBG("");
if (!interface_ready())
@@ -238,7 +240,10 @@ static bt_status_t hh_send_data(bt_bdaddr_t *bd_addr, char *data)
if (!bd_addr || !data)
return BT_STATUS_PARM_INVALID;
- return BT_STATUS_UNSUPPORTED;
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_SEND_DATA,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_init(bthh_callbacks_t *callbacks)
--
1.7.9.5
^ permalink raw reply related
* [PATCH_v2 5/7] android: Add initial code for hidhost get and set report
From: Ravi kumar Veeramally @ 2013-10-23 7:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1382514120-13152-1-git-send-email-ravikumar.veeramally@linux.intel.com>
This adds the initial code for hidhost .get_report and .set_report
interfaces
---
android/hal-hidhost.c | 39 +++++++++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index f289f7f..22045f1 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -167,6 +167,8 @@ static bt_status_t hh_get_report(bt_bdaddr_t *bd_addr,
uint8_t reportId,
int bufferSize)
{
+ struct hal_msg_cmd_bt_hid_get_report cmd;
+
DBG("");
if (!interface_ready())
@@ -175,13 +177,31 @@ static bt_status_t hh_get_report(bt_bdaddr_t *bd_addr,
if (!bd_addr)
return BT_STATUS_PARM_INVALID;
- return BT_STATUS_UNSUPPORTED;
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+ cmd.id = reportId;
+
+ switch (reportType) {
+ case BTHH_INPUT_REPORT:
+ cmd.type = HAL_MSG_BT_HID_INPUT_REPORT;
+ break;
+ case BTHH_OUTPUT_REPORT:
+ cmd.type = HAL_MSG_BT_HID_OUTPUT_REPORT;
+ break;
+ case BTHH_FEATURE_REPORT:
+ cmd.type = HAL_MSG_BT_HID_FEATURE_REPORT;
+ break;
+ }
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_GET_REPORT,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_set_report(bt_bdaddr_t *bd_addr,
bthh_report_type_t reportType,
char *report)
{
+ struct hal_msg_cmd_bt_hid_set_report cmd;
+
DBG("");
if (!interface_ready())
@@ -190,7 +210,22 @@ static bt_status_t hh_set_report(bt_bdaddr_t *bd_addr,
if (!bd_addr || !report)
return BT_STATUS_PARM_INVALID;
- return BT_STATUS_UNSUPPORTED;
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ switch (reportType) {
+ case BTHH_INPUT_REPORT:
+ cmd.type = HAL_MSG_BT_HID_INPUT_REPORT;
+ break;
+ case BTHH_OUTPUT_REPORT:
+ cmd.type = HAL_MSG_BT_HID_OUTPUT_REPORT;
+ break;
+ case BTHH_FEATURE_REPORT:
+ cmd.type = HAL_MSG_BT_HID_FEATURE_REPORT;
+ break;
+ }
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_SET_REPORT,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_send_data(bt_bdaddr_t *bd_addr, char *data)
--
1.7.9.5
^ permalink raw reply related
* [PATCH_v2 4/7] android: Add initial code for hidhost get and set protocol
From: Ravi kumar Veeramally @ 2013-10-23 7:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1382514120-13152-1-git-send-email-ravikumar.veeramally@linux.intel.com>
This adds the initial code for hidhost .get_protocol and .set_protocol
interfaces
---
android/hal-hidhost.c | 40 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index c6ac42f..f289f7f 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -101,6 +101,8 @@ static bt_status_t hh_set_info(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info)
static bt_status_t hh_get_protocol(bt_bdaddr_t *bd_addr,
bthh_protocol_mode_t protocolMode)
{
+ struct hal_msg_cmd_bt_hid_get_protocol cmd;
+
DBG("");
if (!interface_ready())
@@ -109,12 +111,30 @@ static bt_status_t hh_get_protocol(bt_bdaddr_t *bd_addr,
if (!bd_addr)
return BT_STATUS_PARM_INVALID;
- return BT_STATUS_UNSUPPORTED;
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ switch (protocolMode) {
+ case BTHH_REPORT_MODE:
+ cmd.mode = HAL_MSG_BT_HID_REPORT_PROTOCOL;
+ break;
+ case BTHH_BOOT_MODE:
+ cmd.mode = HAL_MSG_BT_HID_BOOT_PROTOCOL;
+ break;
+ case BTHH_UNSUPPORTED_MODE:
+ cmd.mode = HAL_MSG_BT_HID_UNSUPPORTED_PROTOCOL;
+ break;
+ }
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST,
+ HAL_MSG_OP_BT_HID_GET_PROTOCOL,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_set_protocol(bt_bdaddr_t *bd_addr,
bthh_protocol_mode_t protocolMode)
{
+ struct hal_msg_cmd_bt_hid_set_protocol cmd;
+
DBG("");
if (!interface_ready())
@@ -123,7 +143,23 @@ static bt_status_t hh_set_protocol(bt_bdaddr_t *bd_addr,
if (!bd_addr)
return BT_STATUS_PARM_INVALID;
- return BT_STATUS_UNSUPPORTED;
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ switch (protocolMode) {
+ case BTHH_REPORT_MODE:
+ cmd.mode = HAL_MSG_BT_HID_REPORT_PROTOCOL;
+ break;
+ case BTHH_BOOT_MODE:
+ cmd.mode = HAL_MSG_BT_HID_BOOT_PROTOCOL;
+ break;
+ case BTHH_UNSUPPORTED_MODE:
+ cmd.mode = HAL_MSG_BT_HID_UNSUPPORTED_PROTOCOL;
+ break;
+ }
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST,
+ HAL_MSG_OP_BT_HID_SET_PROTOCOL,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_get_report(bt_bdaddr_t *bd_addr,
--
1.7.9.5
^ permalink raw reply related
* [PATCH_v2 3/7] android: Add initial code for hidhost virtual unplug
From: Ravi kumar Veeramally @ 2013-10-23 7:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1382514120-13152-1-git-send-email-ravikumar.veeramally@linux.intel.com>
This adds initial code for hidhost .virtual_unplug interface
---
android/hal-hidhost.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index 1f54bc4..c6ac42f 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -69,6 +69,8 @@ static bt_status_t hh_disconnect(bt_bdaddr_t *bd_addr)
static bt_status_t hh_virtual_unplug(bt_bdaddr_t *bd_addr)
{
+ struct hal_msg_cmd_bt_hid_vp cmd;
+
DBG("");
if (!interface_ready())
@@ -77,7 +79,10 @@ static bt_status_t hh_virtual_unplug(bt_bdaddr_t *bd_addr)
if (!bd_addr)
return BT_STATUS_PARM_INVALID;
- return BT_STATUS_UNSUPPORTED;
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_VP,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_set_info(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info)
--
1.7.9.5
^ permalink raw reply related
* [PATCH_v2 2/7] android: Return right from hal_ipc_cmd call in hal hid disconnect
From: Ravi kumar Veeramally @ 2013-10-23 7:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1382514120-13152-1-git-send-email-ravikumar.veeramally@linux.intel.com>
Do not print any error message and return from hal_ipc_cmd call in hal
hid disconnect
---
android/hal-hidhost.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index f7d8cbf..1f54bc4 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -63,13 +63,8 @@ static bt_status_t hh_disconnect(bt_bdaddr_t *bd_addr)
memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
- if (hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_DISCONNECT,
- sizeof(cmd), &cmd, 0, NULL, NULL) < 0) {
- error("Failed to disconnect hid device");
- return BT_STATUS_FAIL;
- }
-
- return BT_STATUS_SUCCESS;
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_DISCONNECT,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_virtual_unplug(bt_bdaddr_t *bd_addr)
--
1.7.9.5
^ permalink raw reply related
* [PATCH_v2 1/7] android: Return right from hal_ipc_cmd call in hal hid connect
From: Ravi kumar Veeramally @ 2013-10-23 7:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
In-Reply-To: <1382514120-13152-1-git-send-email-ravikumar.veeramally@linux.intel.com>
Do not print any error message and return from hal_ipc_cmd call in hal
hid connect
---
android/hal-hidhost.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index f941f2f..f7d8cbf 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -45,13 +45,8 @@ static bt_status_t hh_connect(bt_bdaddr_t *bd_addr)
memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
- if (hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_CONNECT,
- sizeof(cmd), &cmd, 0, NULL, NULL) < 0) {
- error("Failed to connect hid device");
- return BT_STATUS_FAIL;
- }
-
- return BT_STATUS_SUCCESS;
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_CONNECT,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_disconnect(bt_bdaddr_t *bd_addr)
--
1.7.9.5
^ permalink raw reply related
* [PATCH_v2 0/7] Initial code for hal hid host
From: Ravi kumar Veeramally @ 2013-10-23 7:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Ravi kumar Veeramally
Patch set is all about initial code for hal hidhost interfaces which
are .virtual_unplug, .set_info, .get_protocol, .set_protocol,
.get_report, .set_report and .send_data. Also includes issue fixes
for .connect and .disconnect interfaces.
---
_v2 is about fixing issues as per Johan comments.
Ravi kumar Veeramally (7):
android: Return right from hal_ipc_cmd call in hal hid connect
android: Return right from hal_ipc_cmd call in hal hid disconnect
android: Add initial code for hidhost virtual unplug
android: Add initial code for hidhost get and set protocol
android: Add initial code for hidhost get and set report
android: Add initial code for hidhost send data
android: Add initial code for hidhost set hid information
android/hal-hidhost.c | 126 ++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 105 insertions(+), 21 deletions(-)
--
1.7.9.5
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox