From c972105aae6113614ae066b604789905db7e2245 Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Mon, 5 Nov 2018 17:03:19 +0900 Subject: [PATCH] Migrate insmod logic into bt-stack-up.service insmod logic should be executed before bt-stack-up.sh logic. But, insmod logic has been executed after bt-stack-up.sh logic on ARTIK530. This patch migrates insmod logic into bt-stack-up.sh and creates bt-stack-up.service This patch should be merged with bluetooth-tools. Change-Id: I15e3ab996379600173e441effb9d52577ae3203b --- bt-core/bt-core-adapter.c | 18 ++++-------------- bt-core/include/bt-core-adapter.h | 2 +- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/bt-core/bt-core-adapter.c b/bt-core/bt-core-adapter.c index 2def3c4..ee43d10 100644 --- a/bt-core/bt-core-adapter.c +++ b/bt-core/bt-core-adapter.c @@ -189,22 +189,10 @@ static int __bt_stack_up(void) return -1; } - /* We need to insert BT driver module by using 'insmod' in case of ARTIK530, - * and 'insmod' should be executed by systemd not bt-core. */ - ret = __bt_call_systemact_service(BT_SYSTEMACT_BT_DRIVER_INSMOD); + ret = __bt_call_systemact_service(BT_SYSTEMACT_STACK_UP); if (ret < 0) { BT_ERR("Failed to call systemact service"); return -1; - } else { - /* Insmod should run before bt-stack-up.sh command */ - usleep(1000 * 200); /* 200ms */ - } - - ret = __execute_command("/usr/etc/bluetooth/bt-stack-up.sh", NULL); - if (ret < 0) { - BT_ERR("Failed to run script"); - __bt_call_systemact_service(BT_SYSTEMACT_HCI_LOGGER_STOP); - return -1; } /* activate Bluez */ @@ -398,7 +386,9 @@ int _bt_enable_adapter_le(void) if (ret < 0) BT_ERR("Failed to call systemact service"); } else { - ret = __execute_command("/usr/etc/bluetooth/bt-stack-up.sh", NULL); + ret = __bt_call_systemact_service(BT_SYSTEMACT_STACK_UP); + if (ret < 0) + BT_ERR("Failed to call systemact service"); } if (ret < 0) { BT_ERR("running script failed"); diff --git a/bt-core/include/bt-core-adapter.h b/bt-core/include/bt-core-adapter.h index 7e61402..3f4ecc6 100755 --- a/bt-core/include/bt-core-adapter.h +++ b/bt-core/include/bt-core-adapter.h @@ -42,9 +42,9 @@ extern "C" { #define BT_SYSTEMACT_BLUETOOTH_SHARE_START "/run/.bluetooth_share_start" #define BT_SYSTEMACT_RFKILL_UNBLOCK "/run/.rfkill_unblock" #define BT_SYSTEMACT_RFKILL_BLOCK "/run/.rfkill_block" +#define BT_SYSTEMACT_STACK_UP "/run/.bt_stack_up" #define BT_SYSTEMACT_STACK_DOWN "/run/.bt_stack_down" #define BT_SYSTEMACT_STACK_DOWN_WITH_RADIO "/run/.bt_stack_down_with_radio" -#define BT_SYSTEMACT_BT_DRIVER_INSMOD "/run/.bt_driver_insmod" #define BT_CORE_TYPE (bt_core_get_type()) -- 2.7.4