* Re: [PATCHv1 0/2] Enable av interface
From: Jerzy Kasenberg @ 2013-10-24 7:39 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1382598639-6920-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
On 24 October 2013 09:10, Andrei Emeltchenko
<Andrei.Emeltchenko.news@gmail.com> wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> For some reason get av interface was missing from hal-bluetooth and from
> hal test tool.
>
> PS: Not sure that haltest is fully implemented, Jerzy please comment here.
I must have missed if-bt in commit.
Thanks Andrei.
Apart from one line in if-bt.c all code to call av interface is there
and should be
functional.
>
> Andrei Emeltchenko (2):
> android: haltest: Enable av interface in test tool
> android: Enable AV interface
>
> android/client/if-bt.c | 2 +-
> android/hal-bluetooth.c | 3 +++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Jerzy
^ permalink raw reply
* Re: [PATCHv1 0/2] Enable av interface
From: Luiz Augusto von Dentz @ 2013-10-24 7:28 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1382598639-6920-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Thu, Oct 24, 2013 at 10:10 AM, Andrei Emeltchenko
<Andrei.Emeltchenko.news@gmail.com> wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> For some reason get av interface was missing from hal-bluetooth and from
> hal test tool.
>
> PS: Not sure that haltest is fully implemented, Jerzy please comment here.
>
> Andrei Emeltchenko (2):
> android: haltest: Enable av interface in test tool
> android: Enable AV interface
>
> android/client/if-bt.c | 2 +-
> android/hal-bluetooth.c | 3 +++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> --
> 1.7.10.4
Pushed, thanks.
--
Luiz Augusto von Dentz
^ permalink raw reply
* [PATCHv1 2/2] android: Enable AV interface
From: Andrei Emeltchenko @ 2013-10-24 7:10 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1382598639-6920-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Include av_interface to get_interface function.
---
android/hal-bluetooth.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index d988778..52c7c68 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -310,6 +310,9 @@ static const void *get_profile_interface(const char *profile_id)
if (!strcmp(profile_id, BT_PROFILE_PAN_ID))
return bt_get_pan_interface();
+ if (!strcmp(profile_id, BT_PROFILE_ADVANCED_AUDIO_ID))
+ return bt_get_av_interface();
+
return NULL;
}
--
1.7.10.4
^ permalink raw reply related
* [PATCHv1 1/2] android: haltest: Enable av interface in test tool
From: Andrei Emeltchenko @ 2013-10-24 7:10 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1382598639-6920-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
android/client/if-bt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/android/client/if-bt.c b/android/client/if-bt.c
index 2d9c0b5..f5c84c1 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
@@ -803,7 +803,7 @@ static void get_profile_interface_p(int argc, const char **argv)
if (strcmp(BT_PROFILE_HANDSFREE_ID, id) == 0)
pif = &dummy; /* TODO: change when if_hf is there */
else if (strcmp(BT_PROFILE_ADVANCED_AUDIO_ID, id) == 0)
- pif = &dummy; /* TODO: change when if_av is there */
+ pif = (const void **)&if_av;
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)
--
1.7.10.4
^ permalink raw reply related
* [PATCHv1 0/2] Enable av interface
From: Andrei Emeltchenko @ 2013-10-24 7:10 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
For some reason get av interface was missing from hal-bluetooth and from
hal test tool.
PS: Not sure that haltest is fully implemented, Jerzy please comment here.
Andrei Emeltchenko (2):
android: haltest: Enable av interface in test tool
android: Enable AV interface
android/client/if-bt.c | 2 +-
android/hal-bluetooth.c | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
--
1.7.10.4
^ permalink raw reply
* Use Bluez as peripheral
From: Elvis Angelaccio @ 2013-10-23 22:16 UTC (permalink / raw)
To: linux-bluetooth
Hi all, this is my first post to this mailing list, sorry if I am in the
wrong place.
I'm learning Bluetooth Low Energy with a simple Android application. Since
the Android API implements only the "central" side of the BTLE stack, I
need to implement the "peripheral" side on my laptop (thinkpad edge e130,
bluetooth 4.0, linux 3.11).
As I understand, Bluez should support this feature (while Windows 8 and Max
OSX don't).
For now I'm able to "advertise" my laptop using the command "hciconfig hci0
leadv". My android app succeeds to find my laptop after a btleScan().
Of course actually there is no a GATT server and no "characteristics" to
read and write.
I really need some hints on how to create a GATT server using Bluez, so I
have some questions.
1. In my distro, I have by default Bluez 4.101. Should I compile Bluez 5?
2. If I have to use Bluez 5, should I learn how to program using DBus?
3. I I can use Bluez 4, what are the header files that I'm required to
include? (i.e. the function that I have to use?)
I know the C language, but I have no idea how to deal with kernel code as
Bluez seems to be, sorry if these are noob questions.
Thank you all in Advance,
Elvis
^ permalink raw reply
* Re: [PATCH] Bluetooth: Fix limited discoverable mode for Zeevo modules
From: Johan Hedberg @ 2013-10-23 16:44 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1382542081-36918-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 23, 2013, Marcel Holtmann wrote:
> There is an old Panasonic module with a Zeevo chip in there that is
> not really operating according to Bluetooth core specification when
> it comes to setting the IAC LAP for limited discoverable mode.
>
> For reference, this is the vendor information about this module:
>
> < HCI Command: Read Local Version Information (0x04|0x0001) plen 0
> > HCI Event: Command Complete (0x0e) plen 12
> Read Local Version Information (0x04|0x0001) ncmd 1
> Status: Success (0x00)
> HCI version: Bluetooth 1.2 (0x02) - Revision 196 (0x00c4)
> LMP version: Bluetooth 1.2 (0x02) - Subversion 61 (0x003d)
> Manufacturer: Zeevo, Inc. (18)
>
> The module reports only the support for one IAC at a time. And that
> is totally acceptable according to the Bluetooth core specification
> since the minimum supported IAC is only one.
>
> < HCI Command: Read Number of Supported IAC (0x03|0x0038) plen 0
> > HCI Event: Command Complete (0x0e) plen 5
> Read Number of Supported IAC (0x03|0x0038) ncmd 1
> Status: Success (0x00)
> Number of IAC: 1
>
> The problem arises when trying to program two IAC into the module
> on a controller that only supports one.
>
> < HCI Command: Write Current IAC LAP (0x03|0x003a) plen 7
> Number of IAC: 2
> Access code: 0x9e8b00 (Limited Inquiry)
> Access code: 0x9e8b33 (General Inquiry)
> > HCI Event: Command Status (0x0f) plen 4
> Write Current IAC LAP (0x03|0x003a) ncmd 1
> Status: Unknown HCI Command (0x01)
>
> While this looks strange, but according to the Bluetooth core
> specification it is a legal operation. The controller has to
> ignore the other values and only program as many as it supports.
>
> This command shall clear any existing IACs and stores Num_Current_IAC
> and the IAC_LAPs in to the controller. If Num_Current_IAC is greater
> than Num_Support_IAC then only the first Num_Support_IAC shall be
> stored in the controller, and a Command Complete event with error
> code Success (0x00) shall be generated.
>
> This specific controller has a bug here and just returns an error. So
> in case the number of supported IAC is less than two and the limited
> discoverable mode is requested, now only the LIAC is written to
> the controller.
>
> < HCI Command: Write Current IAC LAP (0x03|0x003a) plen 4
> Number of IAC: 1
> Access code: 0x9e8b00 (Limited Inquiry)
> > HCI Event: Command Complete (0x0e) plen 4
> Write Current IAC LAP (0x03|0x003a) ncmd 1
> Status: Success (0x00)
>
> All other controllers that only support one IAC seem to handle this
> perfectly fine, but this fix will only write the LIAC for these
> controllers as well.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] android: Add calls to av methods in haltest
From: Johan Hedberg @ 2013-10-23 16:35 UTC (permalink / raw)
To: Jerzy Kasenberg; +Cc: linux-bluetooth
In-Reply-To: <1382539105-10811-1-git-send-email-jerzy.kasenberg@tieto.com>
Hi Jerzy,
On Wed, Oct 23, 2013, Jerzy Kasenberg wrote:
> This patch adds calls to av interface in haltest.
> ---
> Makefile.android | 2 +
> android/Android.mk | 1 +
> android/client/haltest.c | 1 +
> android/client/if-av.c | 130 ++++++++++++++++++++++++++++++++++++++++++++++
> android/client/if-main.h | 2 +
> 5 files changed, 136 insertions(+)
> create mode 100644 android/client/if-av.c
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 1/6] android: Add missing adapter state values to IPC documentation
From: Johan Hedberg @ 2013-10-23 16:34 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1382535986-30684-1-git-send-email-szymon.janc@tieto.com>
Hi Szymon,
On Wed, Oct 23, 2013, Szymon Janc wrote:
> ---
> android/hal-ipc-api.txt | 3 +++
> 1 file changed, 3 insertions(+)
All six patches have been applied. Thanks.
Johan
^ permalink raw reply
* [PATCH] Bluetooth: Fix limited discoverable mode for Zeevo modules
From: Marcel Holtmann @ 2013-10-23 15:28 UTC (permalink / raw)
To: linux-bluetooth
There is an old Panasonic module with a Zeevo chip in there that is
not really operating according to Bluetooth core specification when
it comes to setting the IAC LAP for limited discoverable mode.
For reference, this is the vendor information about this module:
< HCI Command: Read Local Version Information (0x04|0x0001) plen 0
> HCI Event: Command Complete (0x0e) plen 12
Read Local Version Information (0x04|0x0001) ncmd 1
Status: Success (0x00)
HCI version: Bluetooth 1.2 (0x02) - Revision 196 (0x00c4)
LMP version: Bluetooth 1.2 (0x02) - Subversion 61 (0x003d)
Manufacturer: Zeevo, Inc. (18)
The module reports only the support for one IAC at a time. And that
is totally acceptable according to the Bluetooth core specification
since the minimum supported IAC is only one.
< HCI Command: Read Number of Supported IAC (0x03|0x0038) plen 0
> HCI Event: Command Complete (0x0e) plen 5
Read Number of Supported IAC (0x03|0x0038) ncmd 1
Status: Success (0x00)
Number of IAC: 1
The problem arises when trying to program two IAC into the module
on a controller that only supports one.
< HCI Command: Write Current IAC LAP (0x03|0x003a) plen 7
Number of IAC: 2
Access code: 0x9e8b00 (Limited Inquiry)
Access code: 0x9e8b33 (General Inquiry)
> HCI Event: Command Status (0x0f) plen 4
Write Current IAC LAP (0x03|0x003a) ncmd 1
Status: Unknown HCI Command (0x01)
While this looks strange, but according to the Bluetooth core
specification it is a legal operation. The controller has to
ignore the other values and only program as many as it supports.
This command shall clear any existing IACs and stores Num_Current_IAC
and the IAC_LAPs in to the controller. If Num_Current_IAC is greater
than Num_Support_IAC then only the first Num_Support_IAC shall be
stored in the controller, and a Command Complete event with error
code Success (0x00) shall be generated.
This specific controller has a bug here and just returns an error. So
in case the number of supported IAC is less than two and the limited
discoverable mode is requested, now only the LIAC is written to
the controller.
< HCI Command: Write Current IAC LAP (0x03|0x003a) plen 4
Number of IAC: 1
Access code: 0x9e8b00 (Limited Inquiry)
> HCI Event: Command Complete (0x0e) plen 4
Write Current IAC LAP (0x03|0x003a) ncmd 1
Status: Success (0x00)
All other controllers that only support one IAC seem to handle this
perfectly fine, but this fix will only write the LIAC for these
controllers as well.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 074d836..22cf547 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1264,7 +1264,7 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data,
if (cp->val == 0x02) {
/* Limited discoverable mode */
- hci_cp.num_iac = 2;
+ hci_cp.num_iac = min_t(u8, hdev->num_iac, 2);
hci_cp.iac_lap[0] = 0x00; /* LIAC */
hci_cp.iac_lap[1] = 0x8b;
hci_cp.iac_lap[2] = 0x9e;
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] android: Use helper function for finding headers
From: Luiz Augusto von Dentz @ 2013-10-23 14:41 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1382535737-9757-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Wed, Oct 23, 2013 at 4:42 PM, Andrei Emeltchenko
<andrei.emeltchenko@gmail.com> wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Using helper function allows us to overcome possible location
> change in future Android releases. This was inspired by
> Szymon Janc's comment to my previous patch.
> ---
> android/Android.mk | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/android/Android.mk b/android/Android.mk
> index dd9c36d..1f20e57 100644
> --- a/android/Android.mk
> +++ b/android/Android.mk
> @@ -75,7 +75,7 @@ LOCAL_SRC_FILES := \
> hal-av.c \
>
> LOCAL_C_INCLUDES += \
> - system/core/include \
> + $(call include-path-for, system-core) \
>
> LOCAL_SHARED_LIBRARIES := \
> libcutils \
> --
> 1.8.1.2
Pushed, thanks.
--
Luiz Augusto von Dentz
^ permalink raw reply
* [PATCH] android: Add calls to av methods in haltest
From: Jerzy Kasenberg @ 2013-10-23 14:38 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jerzy Kasenberg
This patch adds calls to av interface in haltest.
---
Makefile.android | 2 +
android/Android.mk | 1 +
android/client/haltest.c | 1 +
android/client/if-av.c | 130 ++++++++++++++++++++++++++++++++++++++++++++++
android/client/if-main.h | 2 +
5 files changed, 136 insertions(+)
create mode 100644 android/client/if-av.c
diff --git a/Makefile.android b/Makefile.android
index a398537..8e09a78 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -49,6 +49,7 @@ android_haltest_SOURCES = android/client/haltest.c \
android/client/history.c \
android/client/textconv.c \
android/client/tabcompletion.c \
+ android/client/if-av.c \
android/client/if-bt.c \
android/client/if-hh.c \
android/client/if-pan.c \
@@ -79,6 +80,7 @@ EXTRA_DIST += android/client/terminal.c \
android/client/hwmodule.c \
android/client/pollhandler.c \
android/client/history.c \
+ android/client/if-av.c \
android/client/if-bt.c \
android/client/if-hh.c \
android/client/if-pan.c \
diff --git a/android/Android.mk b/android/Android.mk
index dd9c36d..6c73ecb 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -100,6 +100,7 @@ LOCAL_SRC_FILES := \
client/history.c \
client/textconv.c \
client/tabcompletion.c \
+ client/if-av.c \
client/if-bt.c \
client/if-hh.c \
client/if-pan.c \
diff --git a/android/client/haltest.c b/android/client/haltest.c
index 7168dfd..19e81b8 100644
--- a/android/client/haltest.c
+++ b/android/client/haltest.c
@@ -31,6 +31,7 @@
const struct interface *interfaces[] = {
&bluetooth_if,
+ &av_if,
&hh_if,
&pan_if,
&sock_if,
diff --git a/android/client/if-av.c b/android/client/if-av.c
new file mode 100644
index 0000000..3f133eb
--- /dev/null
+++ b/android/client/if-av.c
@@ -0,0 +1,130 @@
+/*
+ * 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 "if-main.h"
+
+const btav_interface_t *if_av = NULL;
+
+SINTMAP(btav_connection_state_t, -1, "(unknown)")
+ DELEMENT(BTAV_CONNECTION_STATE_DISCONNECTED),
+ DELEMENT(BTAV_CONNECTION_STATE_CONNECTING),
+ DELEMENT(BTAV_CONNECTION_STATE_CONNECTED),
+ DELEMENT(BTAV_CONNECTION_STATE_DISCONNECTING),
+ENDMAP
+
+SINTMAP(btav_audio_state_t, -1, "(unknown)")
+ DELEMENT(BTAV_AUDIO_STATE_REMOTE_SUSPEND),
+ DELEMENT(BTAV_AUDIO_STATE_STOPPED),
+ DELEMENT(BTAV_AUDIO_STATE_STARTED),
+ENDMAP
+
+static char last_addr[MAX_ADDR_STR_LEN];
+
+static void connection_state(btav_connection_state_t state,
+ bt_bdaddr_t *bd_addr)
+{
+ haltest_info("%s: connection_state=%s remote_bd_addr=%s\n", __func__,
+ btav_connection_state_t2str(state),
+ bt_bdaddr_t2str(bd_addr, last_addr));
+}
+
+static void audio_state(btav_audio_state_t state, bt_bdaddr_t *bd_addr)
+{
+ haltest_info("%s: audio_state=%s remote_bd_addr=%s\n", __func__,
+ btav_audio_state_t2str(state),
+ bt_bdaddr_t2str(bd_addr, last_addr));
+}
+
+static btav_callbacks_t av_cbacks = {
+ .size = sizeof(av_cbacks),
+ .connection_state_cb = connection_state,
+ .audio_state_cb = audio_state
+};
+
+/* init */
+
+static void init_p(int argc, const char **argv)
+{
+ RETURN_IF_NULL(if_av);
+
+ EXEC(if_av->init, &av_cbacks);
+}
+
+/* connect */
+
+static void connect_c(int argc, const char **argv, enum_func *enum_func,
+ void **user)
+{
+ if (argc == 3) {
+ *user = NULL;
+ *enum_func = enum_devices;
+ }
+}
+
+static void connect_p(int argc, const char **argv)
+{
+ bt_bdaddr_t addr;
+
+ RETURN_IF_NULL(if_hh);
+ VERIFY_ADDR_ARG(2, &addr);
+
+ EXEC(if_av->connect, &addr);
+}
+
+/* disconnect */
+
+static void disconnect_c(int argc, const char **argv, enum_func *enum_func,
+ void **user)
+{
+ if (argc == 3) {
+ *user = last_addr;
+ *enum_func = enum_one_string;
+ }
+}
+
+static void disconnect_p(int argc, const char **argv)
+{
+ bt_bdaddr_t addr;
+
+ RETURN_IF_NULL(if_hh);
+ VERIFY_ADDR_ARG(2, &addr);
+
+ EXEC(if_av->disconnect, &addr);
+}
+
+/* cleanup */
+
+static void cleanup_p(int argc, const char **argv)
+{
+ RETURN_IF_NULL(if_av);
+
+ EXECV(if_av->cleanup);
+ if_av = NULL;
+}
+
+static struct method methods[] = {
+ STD_METHOD(init),
+ STD_METHODCH(connect, "<addr>"),
+ STD_METHODCH(disconnect, "<addr>"),
+ STD_METHOD(cleanup),
+ END_METHOD
+};
+
+const struct interface av_if = {
+ .name = "av",
+ .methods = methods
+};
diff --git a/android/client/if-main.h b/android/client/if-main.h
index e214ed0..f2d35d9 100644
--- a/android/client/if-main.h
+++ b/android/client/if-main.h
@@ -44,6 +44,7 @@
/* Interfaces from hal that can be populated during application lifetime */
extern const bt_interface_t *if_bluetooth;
+extern const btav_interface_t *if_av;
extern const bthh_interface_t *if_hh;
extern const btpan_interface_t *if_pan;
extern const btsock_interface_t *if_sock;
@@ -58,6 +59,7 @@ struct interface {
};
extern const struct interface bluetooth_if;
+extern const struct interface av_if;
extern const struct interface pan_if;
extern const struct interface sock_if;
extern const struct interface hh_if;
--
1.7.9.5
^ permalink raw reply related
* [PATCH 6/6] android: Fix use of invalid service ID in response
From: Szymon Janc @ 2013-10-23 13:46 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1382535986-30684-1-git-send-email-szymon.janc@tieto.com>
Adapter should use HAL_SERVICE_ID_BLUETOOTH service ID.
---
android/adapter.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/android/adapter.c b/android/adapter.c
index 7a219df..6b0fab2 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -347,7 +347,8 @@ void bt_adapter_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf,
}
if (set_mode(MGMT_OP_SET_POWERED, 0x01)) {
- ipc_send(io, HAL_SERVICE_ID_CORE, opcode, 0, NULL, -1);
+ ipc_send(io, HAL_SERVICE_ID_BLUETOOTH, opcode, 0, NULL,
+ -1);
return;
}
break;
@@ -358,7 +359,8 @@ void bt_adapter_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf,
}
if (set_mode(MGMT_OP_SET_POWERED, 0x00)) {
- ipc_send(io, HAL_SERVICE_ID_CORE, opcode, 0, NULL, -1);
+ ipc_send(io, HAL_SERVICE_ID_BLUETOOTH, opcode, 0, NULL,
+ -1);
return;
}
break;
--
1.8.4
^ permalink raw reply related
* [PATCH 5/6] android/hal: Verify if command response service ID match
From: Szymon Janc @ 2013-10-23 13:46 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1382535986-30684-1-git-send-email-szymon.janc@tieto.com>
Received response service ID should match command service ID in
command, abort if it doesn't.
---
android/hal-ipc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/android/hal-ipc.c b/android/hal-ipc.c
index 97a3d29..8f13e88 100644
--- a/android/hal-ipc.c
+++ b/android/hal-ipc.c
@@ -335,6 +335,12 @@ int hal_ipc_cmd(uint8_t service_id, uint8_t opcode, uint16_t len, void *param,
exit(EXIT_FAILURE);
}
+ if (hal_msg.service_id != service_id) {
+ error("Invalid service id (%u vs %u), aborting",
+ hal_msg.service_id, service_id);
+ exit(EXIT_FAILURE);
+ }
+
if (ret != (ssize_t) (sizeof(hal_msg) + hal_msg.len)) {
error("Malformed response received(%zd bytes), aborting", ret);
exit(EXIT_FAILURE);
--
1.8.4
^ permalink raw reply related
* [PATCH 4/6] android: Send notification on adapter power state change
From: Szymon Janc @ 2013-10-23 13:46 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1382535986-30684-1-git-send-email-szymon.janc@tieto.com>
---
android/adapter.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/android/adapter.c b/android/adapter.c
index f9843d1..7a219df 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -74,6 +74,20 @@ static void mgmt_local_name_changed_event(uint16_t index, uint16_t length,
/* TODO Update services if needed */
}
+static void settings_changed_powered(struct bt_adapter *adapter)
+{
+ struct hal_msg_ev_bt_adapter_state_changed ev;
+
+ ev.state = (adapter->current_settings & MGMT_SETTING_POWERED) ?
+ HAL_BT_ADAPTER_STATE_ON : HAL_BT_ADAPTER_STATE_OFF;
+
+ DBG("%u", ev.state);
+
+ ipc_send(notification_io, HAL_SERVICE_ID_BLUETOOTH,
+ HAL_MSG_EV_BT_ADAPTER_STATE_CHANGED,
+ sizeof(ev), &ev, -1);
+}
+
static void settings_changed_connectable(struct bt_adapter *adapter)
{
/* TODO */
@@ -94,16 +108,8 @@ static void settings_changed(struct bt_adapter *adapter, uint32_t settings)
DBG("0x%08x", changed_mask);
- if (changed_mask & MGMT_SETTING_POWERED) {
- info("Powered");
-
- /*
- if (adapter->current_settings & MGMT_SETTING_POWERED)
- start_adapter()
- else
- stop_adapter()
- */
- }
+ if (changed_mask & MGMT_SETTING_POWERED)
+ settings_changed_powered(adapter);
if (changed_mask & MGMT_SETTING_CONNECTABLE) {
DBG("Connectable");
--
1.8.4
^ permalink raw reply related
* [PATCH 3/6] android/hal: Fix crash while receiving notification
From: Szymon Janc @ 2013-10-23 13:46 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1382535986-30684-1-git-send-email-szymon.janc@tieto.com>
This fix following crash:
Invalid read of size 8
at 0x408B33: notification_handler (hal-ipc.c:122)
by 0x4E39E99: start_thread (pthread_create.c:308)
Address 0x8 is not stack'd, malloc'd or (recently) free'd
---
android/hal-ipc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/android/hal-ipc.c b/android/hal-ipc.c
index e8bba11..97a3d29 100644
--- a/android/hal-ipc.c
+++ b/android/hal-ipc.c
@@ -118,7 +118,7 @@ static void *notification_handler(void *data)
fd = -1;
/* Receive auxiliary data in msg */
- for (cmsg = CMSG_FIRSTHDR(&msg); !cmsg;
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg;
cmsg = CMSG_NXTHDR(&msg, cmsg)) {
if (cmsg->cmsg_level == SOL_SOCKET
&& cmsg->cmsg_type == SCM_RIGHTS) {
--
1.8.4
^ permalink raw reply related
* [PATCH 2/6] android: Add missing adapter state values to IPC header
From: Szymon Janc @ 2013-10-23 13:46 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1382535986-30684-1-git-send-email-szymon.janc@tieto.com>
---
android/hal-msg.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 9ff0510..2840a92 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -252,6 +252,9 @@ struct hal_msg_cmd_bt_hid_send_data {
/* Notifications and confirmations */
+#define HAL_BT_ADAPTER_STATE_OFF 0x00
+#define HAL_BT_ADAPTER_STATE_ON 0x01
+
#define HAL_MSG_EV_BT_ADAPTER_STATE_CHANGED 0x81
struct hal_msg_ev_bt_adapter_state_changed {
uint8_t state;
--
1.8.4
^ permalink raw reply related
* [PATCH 1/6] android: Add missing adapter state values to IPC documentation
From: Szymon Janc @ 2013-10-23 13:46 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
android/hal-ipc-api.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index dcd1553..a5437c1 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -314,6 +314,9 @@ Notifications:
Notifications parameters: State (1 octect)
+ Valid state values: 0x00 = Off
+ 0x01 = On
+
Opcode 0x82 - Adapter Properties Changed notification
Notification parameters: Status (1 octect)
--
1.8.4
^ permalink raw reply related
* [PATCH] android: Use helper function for finding headers
From: Andrei Emeltchenko @ 2013-10-23 13:42 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Using helper function allows us to overcome possible location
change in future Android releases. This was inspired by
Szymon Janc's comment to my previous patch.
---
android/Android.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/android/Android.mk b/android/Android.mk
index dd9c36d..1f20e57 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -75,7 +75,7 @@ LOCAL_SRC_FILES := \
hal-av.c \
LOCAL_C_INCLUDES += \
- system/core/include \
+ $(call include-path-for, system-core) \
LOCAL_SHARED_LIBRARIES := \
libcutils \
--
1.8.1.2
^ permalink raw reply related
* Re: [PATCH] android: Fix compilation error
From: Johan Hedberg @ 2013-10-23 13:06 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1382532785-5873-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Wed, Oct 23, 2013, Andrei Emeltchenko wrote:
> The patch fixes errors with undefined symbols EXIT_FAILURE on Android.
> ---
> android/hal-ipc.c | 1 +
> 1 file changed, 1 insertion(+)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH v3] android: Fix build error for Android
From: Johan Hedberg @ 2013-10-23 12:59 UTC (permalink / raw)
To: Lukasz Rymanowski; +Cc: linux-bluetooth, szymon.janc, andrei.emeltchenko
In-Reply-To: <1382532559-25830-1-git-send-email-lukasz.rymanowski@tieto.com>
Hi Lukasz,
On Wed, Oct 23, 2013, Lukasz Rymanowski wrote:
> Android uses functions and defines from sys/capability.h which
> requires additional include. However file capability.h shows up
> in bionic in version Android 4.3, therefore we do check
> PLATFORM_SDK_VERSION to no break builds of previous Android versions.
> In previous Android version unistd.h contain this functionality.
> ---
> android/Android.mk | 3 ++-
> android/main.c | 6 ++++++
> 2 files changed, 8 insertions(+), 1 deletion(-)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] android: Make use of Android system headers instead of local one
From: Johan Hedberg @ 2013-10-23 12:59 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1382532281-5445-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Wed, Oct 23, 2013, Andrei Emeltchenko wrote:
> Since the headers were copied to android/ folder Android build started
> to use those instead of original Android system headers. The patch
> puts Android system headers first.
> ---
> android/Android.mk | 3 +++
> 1 file changed, 3 insertions(+)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] android: Make use of Android system headers instead of local one
From: Szymon Janc @ 2013-10-23 12:54 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1382532281-5445-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi,
On Wednesday 23 of October 2013 15:44:41 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Since the headers were copied to android/ folder Android build started
> to use those instead of original Android system headers. The patch
> puts Android system headers first.
> ---
> android/Android.mk | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/android/Android.mk b/android/Android.mk
> index 3163763..0640842 100644
> --- a/android/Android.mk
> +++ b/android/Android.mk
> @@ -71,6 +71,9 @@ LOCAL_SRC_FILES := \
> hal-pan.c \
> hal-av.c \
>
> +LOCAL_C_INCLUDES += \
> + system/core/include \
> +
We could use include-path-for to not hardcode path to core
LOCAL_C_INCLUDES += $(call include-path-for, system-core)
> LOCAL_SHARED_LIBRARIES := \
> libcutils \
>
>
--
BR
Szymon Janc
^ permalink raw reply
* [PATCH] android: Fix compilation error
From: Andrei Emeltchenko @ 2013-10-23 12:53 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
The patch fixes errors with undefined symbols EXIT_FAILURE on Android.
---
android/hal-ipc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/android/hal-ipc.c b/android/hal-ipc.c
index 2d58038..1e32774 100644
--- a/android/hal-ipc.c
+++ b/android/hal-ipc.c
@@ -24,6 +24,7 @@
#include <poll.h>
#include <unistd.h>
#include <stdint.h>
+#include <stdlib.h>
#include <cutils/properties.h>
--
1.8.1.2
^ permalink raw reply related
* [PATCH v3] android: Fix build error for Android
From: Lukasz Rymanowski @ 2013-10-23 12:49 UTC (permalink / raw)
To: linux-bluetooth
Cc: szymon.janc, andrei.emeltchenko, johan.hedberg, Lukasz Rymanowski
Android uses functions and defines from sys/capability.h which
requires additional include. However file capability.h shows up
in bionic in version Android 4.3, therefore we do check
PLATFORM_SDK_VERSION to no break builds of previous Android versions.
In previous Android version unistd.h contain this functionality.
---
android/Android.mk | 3 ++-
android/main.c | 6 ++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/android/Android.mk b/android/Android.mk
index c4b0621..a569650 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -36,7 +36,8 @@ LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/../src \
$(LOCAL_PATH)/../lib \
-LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
+LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\" \
+ -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
LOCAL_SHARED_LIBRARIES := \
libglib \
diff --git a/android/main.c b/android/main.c
index 988d08b..5a85f74 100644
--- a/android/main.c
+++ b/android/main.c
@@ -52,6 +52,12 @@
#include "hal-msg.h"
#include "ipc.h"
+/* TODO: Consider to remove PLATFORM_SDKVERSION check if requirement
+* for minimal Android platform version increases. */
+#if defined(ANDROID) && PLATFORM_SDK_VERSION >= 18
+#include <sys/capability.h>
+#endif
+
static GMainLoop *event_loop;
static struct mgmt *mgmt_if = NULL;
--
1.8.4
^ permalink raw reply related
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