2013-10-25 13:28:45

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 1/2] android/hal: Use defined function to check that interface is ready

From: Andrei Emeltchenko <[email protected]>

---
android/hal-bluetooth.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index 894f5b5..282a680 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -78,10 +78,15 @@ void bt_thread_disassociate(void)
bt_hal_cbacks->thread_evt_cb(DISASSOCIATE_JVM);
}

+static bool interface_ready(void)
+{
+ return bt_hal_cbacks != NULL;
+}
+
/* will be called from notification thread context */
void bt_notify_adapter(uint16_t opcode, void *buf, uint16_t len)
{
- if (!bt_hal_cbacks)
+ if (!interface_ready())
return;

switch (opcode) {
@@ -97,11 +102,6 @@ void bt_notify_adapter(uint16_t opcode, void *buf, uint16_t len)
}
}

-static bool interface_ready(void)
-{
- return bt_hal_cbacks != NULL;
-}
-
static int init(bt_callbacks_t *callbacks)
{
struct hal_cmd_register_module cmd;
--
1.7.10.4



2013-10-27 11:21:16

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH 1/2] android/hal: Use defined function to check that interface is ready

Hi Andrei,

On Fri, Oct 25, 2013 at 4:28 PM, Andrei Emeltchenko
<[email protected]> wrote:
> From: Andrei Emeltchenko <[email protected]>
>
> ---
> android/hal-bluetooth.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
> index 894f5b5..282a680 100644
> --- a/android/hal-bluetooth.c
> +++ b/android/hal-bluetooth.c
> @@ -78,10 +78,15 @@ void bt_thread_disassociate(void)
> bt_hal_cbacks->thread_evt_cb(DISASSOCIATE_JVM);
> }
>
> +static bool interface_ready(void)
> +{
> + return bt_hal_cbacks != NULL;
> +}
> +
> /* will be called from notification thread context */
> void bt_notify_adapter(uint16_t opcode, void *buf, uint16_t len)
> {
> - if (!bt_hal_cbacks)
> + if (!interface_ready())
> return;
>
> switch (opcode) {
> @@ -97,11 +102,6 @@ void bt_notify_adapter(uint16_t opcode, void *buf, uint16_t len)
> }
> }
>
> -static bool interface_ready(void)
> -{
> - return bt_hal_cbacks != NULL;
> -}
> -
> static int init(bt_callbacks_t *callbacks)
> {
> struct hal_cmd_register_module cmd;
> --
> 1.7.10.4
>
> --

Pushed, thanks.



--
Luiz Augusto von Dentz

2013-10-25 13:28:46

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 2/2] android/hal: Use debug helpers from hal client

From: Andrei Emeltchenko <[email protected]>

Debug helpers really helps a lot when debugging on Android target. The
patch uses helper functions already defined for hal test tool so
we do not need to reimplement them.
---
android/Android.mk | 1 +
android/hal-bluetooth.c | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/android/Android.mk b/android/Android.mk
index 946e9cd..56c43cb 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -73,6 +73,7 @@ LOCAL_SRC_FILES := \
hal-hidhost.c \
hal-pan.c \
hal-av.c \
+ client/textconv.c \

LOCAL_C_INCLUDES += \
$(call include-path-for, system-core) \
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index 282a680..5929fff 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -25,6 +25,8 @@
#include "hal-msg.h"
#include "hal-ipc.h"

+#include "client/textconv.h"
+
static const bt_callbacks_t *bt_hal_cbacks = NULL;

static void handle_adapter_state_changed(void *buf)
@@ -192,7 +194,7 @@ static int get_adapter_property(bt_property_type_t type)
{
struct hal_cmd_get_adapter_prop cmd;

- DBG("");
+ DBG("prop: %s", bt_property_type_t2str(type));

if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -224,7 +226,7 @@ static int set_adapter_property(const bt_property_t *property)
char buf[sizeof(struct hal_cmd_set_adapter_prop) + property->len];
struct hal_cmd_set_adapter_prop *cmd = (void *) buf;

- DBG("");
+ DBG("prop: %s", bt_property_type_t2str(property->type));

if (!interface_ready())
return BT_STATUS_NOT_READY;
--
1.7.10.4