Add bt-driver-insmod.service trigger logic 97/181697/1
authorWootak Jung <wootak.jung@samsung.com>
Mon, 18 Jun 2018 01:18:43 +0000 (10:18 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 18 Jun 2018 01:18:43 +0000 (10:18 +0900)
Change-Id: I50c045b7116cea43bdff0fc9fb5c211ed7d3a04e

bt-core/bt-core-adapter.c
bt-core/include/bt-core-adapter.h

index 686f44a..3d8f729 100644 (file)
@@ -189,6 +189,17 @@ 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);
+       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");
index 38f53d5..aaa40be 100755 (executable)
@@ -42,6 +42,7 @@ extern "C" {
 #define BT_SYSTEMACT_RFKILL_BLOCK "/run/.rfkill_block"
 #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())