2013-10-31 14:45:04

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 1/2] android/hidhost: Fix not unregistering HID

From: Andrei Emeltchenko <[email protected]>

If HID is not unregistered it cannot be registered again and we get
following error:
...
E/BluetoothHidServiceJni( 2849): Failed to initialize Bluetooth HID, status: 1
...
---
android/hal-hidhost.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index a72410b..e148dc2 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -301,12 +301,19 @@ static bt_status_t hh_init(bthh_callbacks_t *callbacks)

static void hh_cleanup(void)
{
+ struct hal_cmd_unregister_module cmd;
+
DBG("");

if (!interface_ready())
return;

bt_hh_cbacks = NULL;
+
+ cmd.service_id = HAL_SERVICE_ID_HIDHOST;
+
+ hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}

static bthh_interface_t hh_if = {
--
1.7.10.4



2013-10-31 14:58:40

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH 1/2] android/hidhost: Fix not unregistering HID

Hi Andrei,

On Thu, Oct 31, 2013, Andrei Emeltchenko wrote:
> If HID is not unregistered it cannot be registered again and we get
> following error:
> ...
> E/BluetoothHidServiceJni( 2849): Failed to initialize Bluetooth HID, status: 1
> ...
> ---
> android/hal-hidhost.c | 7 +++++++
> 1 file changed, 7 insertions(+)

Both patches have been applied. Thanks.

Johan

2013-10-31 14:45:05

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH 2/2] android/hid: Add error message to error print

From: Andrei Emeltchenko <[email protected]>

---
android/hid.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/android/hid.c b/android/hid.c
index 5caa25b..4075ecb 100644
--- a/android/hid.c
+++ b/android/hid.c
@@ -419,7 +419,7 @@ bool bt_hid_register(GIOChannel *io, const bdaddr_t *addr)
BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
BT_IO_OPT_INVALID);
if (!ctrl_io) {
- error("Failed to listen on control channel");
+ error("Failed to listen on ctrl channel: %s", err->message);
g_error_free(err);
return false;
}
@@ -429,7 +429,7 @@ bool bt_hid_register(GIOChannel *io, const bdaddr_t *addr)
BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
BT_IO_OPT_INVALID);
if (!intr_io) {
- error("Failed to listen on interrupt channel");
+ error("Failed to listen on intr channel: %s", err->message);
g_io_channel_unref(ctrl_io);
g_error_free(err);
return false;
--
1.7.10.4