Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] android/hidhost: Fix not unregistering HID
@ 2013-10-31 13:51 Andrei Emeltchenko
  2013-10-31 14:04 ` Johan Hedberg
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Emeltchenko @ 2013-10-31 13:51 UTC (permalink / raw)
  To: linux-bluetooth

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

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 |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index a72410b..a81fea5 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -301,12 +301,17 @@ 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;
+
+	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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] android/hidhost: Fix not unregistering HID
  2013-10-31 13:51 [PATCH] android/hidhost: Fix not unregistering HID Andrei Emeltchenko
@ 2013-10-31 14:04 ` Johan Hedberg
  2013-10-31 14:08   ` Andrei Emeltchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Hedberg @ 2013-10-31 14:04 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

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 |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
> index a72410b..a81fea5 100644
> --- a/android/hal-hidhost.c
> +++ b/android/hal-hidhost.c
> @@ -301,12 +301,17 @@ 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;
> +
> +	hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
> +					sizeof(cmd), &cmd, 0, NULL, NULL);
>  }

Did you test this at all? It looks completely broken to me since you
pass an uninitialized variable to hal_ipc_cmd. You should be at least
setting the right service id for HID in the cmd struct.

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] android/hidhost: Fix not unregistering HID
  2013-10-31 14:04 ` Johan Hedberg
@ 2013-10-31 14:08   ` Andrei Emeltchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andrei Emeltchenko @ 2013-10-31 14:08 UTC (permalink / raw)
  To: linux-bluetooth

Hi Johan,

On Thu, Oct 31, 2013 at 04:04:58PM +0200, Johan Hedberg wrote:
> 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 |    5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
> > index a72410b..a81fea5 100644
> > --- a/android/hal-hidhost.c
> > +++ b/android/hal-hidhost.c
> > @@ -301,12 +301,17 @@ 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;
> > +
> > +	hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
> > +					sizeof(cmd), &cmd, 0, NULL, NULL);
> >  }
> 
> Did you test this at all? It looks completely broken to me since you
> pass an uninitialized variable to hal_ipc_cmd. You should be at least
> setting the right service id for HID in the cmd struct.

Sorry, I will send the right one (after testing)

Best regards 
Andrei Emeltchenko 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-31 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-31 13:51 [PATCH] android/hidhost: Fix not unregistering HID Andrei Emeltchenko
2013-10-31 14:04 ` Johan Hedberg
2013-10-31 14:08   ` Andrei Emeltchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox