From b22a71eccc23958986dca6c0126f36929bc6bd4f Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Mon, 5 Mar 2012 20:05:23 +0100 Subject: [PATCH] mgmtops: When settings discoverable also set connectable if not set yet Otherwise command would be rejected e.g. when setting discoverable at bluetoothd startup. --- plugins/mgmtops.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c index 89355ad8a..afed1654a 100644 --- a/plugins/mgmtops.c +++ b/plugins/mgmtops.c @@ -317,12 +317,15 @@ static void update_settings(struct btd_adapter *adapter, uint32_t settings) info = &controllers[index]; - if (on_mode == MODE_DISCOVERABLE && !mgmt_discoverable(settings)) + if (on_mode == MODE_DISCOVERABLE && !mgmt_discoverable(settings)) { + if(!mgmt_connectable(settings)) + mgmt_set_connectable(index, TRUE); mgmt_set_discoverable(index, TRUE, discoverable_timeout); - else if (on_mode == MODE_CONNECTABLE && !mgmt_connectable(settings)) + } else if (on_mode == MODE_CONNECTABLE && !mgmt_connectable(settings)) { mgmt_set_connectable(index, TRUE); - else if (mgmt_powered(settings)) + } else if (mgmt_powered(settings)) { adapter_mode_changed(adapter, create_mode(settings)); + } if (mgmt_pairable(settings) != pairable) mgmt_set_pairable(index, pairable); -- 2.47.3