From 8d523a075b96024d01ab7657e80c8126c6485df1 Mon Sep 17 00:00:00 2001 From: Timo Gienger Date: Wed, 23 Nov 2011 14:11:56 +0100 Subject: [PATCH] Fix reading of on_mode in btd_adapter_get_mode If InitiallyPowered was set to false, it was not possible to use hciconfig tool, as on_mode variable was set to MODE_OFF making it impossible to enable BT via hciconfig until a D-Bus call was done and the variable was set in config file as connectable. Additionally the patch removes the if-else condition, as the both calls done exactly the same. Removed also last else condition as MODE_OFF should not be valid for on_mode. Fix tested with hciops interface. --- src/adapter.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/adapter.c b/src/adapter.c index 2b4b7e365..84e33a75f 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2220,14 +2220,8 @@ void btd_adapter_get_mode(struct btd_adapter *adapter, uint8_t *mode, *mode = main_opts.mode; } - if (on_mode) { - if (main_opts.remember_powered == FALSE) - *on_mode = get_mode(&adapter->bdaddr, "on"); - else if (read_on_mode(address, str, sizeof(str)) == 0) - *on_mode = get_mode(&adapter->bdaddr, str); - else - *on_mode = main_opts.mode; - } + if (on_mode) + *on_mode = get_mode(&adapter->bdaddr, "on"); if (pairable) *pairable = adapter->pairable; -- 2.47.3