diff options
author | Lukasz Rymanowski <lukasz.rymanowski@tieto.com> | 2014-08-04 12:34:19 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-08-04 14:28:52 +0300 |
commit | c8a9069f95dfb7cc183db0ce2069a5ecc8d3d020 (patch) | |
tree | ef7ec18ae8a4956b1ef016bfc29f38d4371f7a78 /android/bluetooth.c | |
parent | ce60a906bd4f71b862345c25ac1549c429deda44 (diff) | |
download | bluez-c8a9069f95dfb7cc183db0ce2069a5ecc8d3d020.tar.gz |
android/bluetooth: Clear auto connect list on startup
In android we add devices to auto connect list when application trigger
connect. We need to make sure that when bluetooth is turn on there is
no devices in auto connect list in the kernel.
Diffstat (limited to 'android/bluetooth.c')
-rw-r--r-- | android/bluetooth.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/android/bluetooth.c b/android/bluetooth.c index 34690b7cb..38ee9a92d 100644 --- a/android/bluetooth.c +++ b/android/bluetooth.c @@ -3129,6 +3129,34 @@ static void add_mps_record(void) } } +static void clear_auto_connect_list_complete(uint8_t status, + uint16_t length, + const void *param, + void *user_data) +{ + if (status != MGMT_STATUS_SUCCESS) + error("Failed to clear auto connect list: %s (0x%02x)", + mgmt_errstr(status), status); +} + +static void clear_auto_connect_list(void) +{ + struct mgmt_cp_remove_device cp; + + if (!kernel_conn_control) + return; + + memset(&cp, 0, sizeof(cp)); + + if (mgmt_send(mgmt_if, MGMT_OP_REMOVE_DEVICE, adapter.index, + sizeof(cp), &cp, + clear_auto_connect_list_complete, + NULL, NULL) > 0) + return; + + error("Could not clear auto connect list"); +} + static void read_info_complete(uint8_t status, uint16_t length, const void *param, void *user_data) { @@ -3186,6 +3214,7 @@ static void read_info_complete(uint8_t status, uint16_t length, register_mgmt_handlers(); clear_uuids(); + clear_auto_connect_list(); set_io_capability(); set_device_id(); |