summaryrefslogtreecommitdiffstats
path: root/binding-bluetooth
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2017-08-09 21:01:53 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2017-08-09 21:01:53 -0700
commit2effd810aef1ed7e8c58893acc794f423e41d06d (patch)
tree026dda3f98dfb54be02cd685062fa79d63f2e0ec /binding-bluetooth
parent7f2e623ac793f2715b4487593efb6df51dd441a8 (diff)
binding: bluetooth: cancel autoconnect when discovery mode requested
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 Change-Id: Ic66d97e559e5ed8fada4ca0a4a7bb481a19bdc36 Bug-AGL: SPEC-795 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding-bluetooth')
-rw-r--r--binding-bluetooth/bluetooth-manager.c7
-rw-r--r--binding-bluetooth/bluetooth-manager.h1
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;