diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2017-08-09 21:01:53 -0700 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2017-09-26 14:00:11 -0700 |
commit | e7dd8ab5054e031a669532c154435af35682444b (patch) | |
tree | 3bd70c4aa168881079ceb2a4b6bea671843d0878 | |
parent | f977ee160a08ddfb3eccdb5bbff113a6d3f10c16 (diff) |
binding: bluetooth: cancel autoconnect when discovery mode requesteddab_4.0.3dab_4.0.2dab/4.0.3dab/4.0.24.0.34.0.2dab
Autoconnection was causing some devices not to be spotted ever
when discovery mode was requested
It can be safely assumed on user loading the Bluetooth setting
page no currently paired devices are expected to autoconnected
Bug-AGL: SPEC-795 SPEC-913
Change-Id: Ic66d97e559e5ed8fada4ca0a4a7bb481a19bdc36
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r-- | binding-bluetooth/bluetooth-manager.c | 7 | ||||
-rw-r--r-- | binding-bluetooth/bluetooth-manager.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/binding-bluetooth/bluetooth-manager.c b/binding-bluetooth/bluetooth-manager.c index 407518f..2ff8925 100644 --- a/binding-bluetooth/bluetooth-manager.c +++ b/binding-bluetooth/bluetooth-manager.c @@ -1258,7 +1258,7 @@ static void *bt_event_loop_thread() BluetoothManage_InitFlag_Set(TRUE); BluetoothMonitorInit(); - g_timeout_add_seconds(5, bt_autoconnect, NULL); + BluetoothManage.autoconnect = g_timeout_add_seconds(5, bt_autoconnect, NULL); LOGD("g_main_loop_run\n"); g_main_loop_run(cli.clientloop); @@ -1493,6 +1493,11 @@ int adapter_start_discovery() return -1; } + if (BluetoothManage.autoconnect > 0) { + LOGW("Canceling autoconnection for discovery mode\n"); + g_source_remove(BluetoothManage.autoconnect); + } + value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE, ADAPTER_PATH, ADAPTER_INTERFACE, "StartDiscovery", NULL, NULL, G_DBUS_CALL_FLAGS_NONE, diff --git a/binding-bluetooth/bluetooth-manager.h b/binding-bluetooth/bluetooth-manager.h index 54d7ff8..36222df 100644 --- a/binding-bluetooth/bluetooth-manager.h +++ b/binding-bluetooth/bluetooth-manager.h @@ -161,6 +161,7 @@ typedef struct { gboolean inited; GMutex m; gint watch; + guint autoconnect; GSList * device; GSList * priorities; } stBluetoothManage; |