OSDN Git Service

android/hidhost: Fix not unregistering HID
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>
Thu, 31 Oct 2013 14:45:04 +0000 (16:45 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 31 Oct 2013 14:57:58 +0000 (16:57 +0200)
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

index a72410b..e148dc2 100644 (file)
@@ -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 = {