Modify to path activation for hciconfig command 33/189833/2 accepted/tizen/unified/20180928.080457 submit/tizen/20180927.020120
authorWootak Jung <wootak.jung@samsung.com>
Fri, 21 Sep 2018 04:52:20 +0000 (13:52 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 27 Sep 2018 00:28:58 +0000 (09:28 +0900)
Change-Id: Ia091b30464fc2cf1fef96d65c95ff3b0ea296312

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

index 3d8f729..2def3c4 100644 (file)
@@ -258,16 +258,18 @@ int _bt_enable_adapter(void)
 
        __bt_core_set_status(BT_ACTIVATING);
        if (TIZEN_FEATURE_BT_USB_DONGLE) {
-               char *argv_up[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "up", NULL};
-               ret = __execute_command("/usr/bin/hciconfig", argv_up);
+               ret = __bt_call_systemact_service(BT_SYSTEMACT_HCI_UP);
+               if (ret < 0)
+                       BT_ERR("Failed to call systemact service");
        } else {
                ret = __bt_stack_up();
        }
        if (ret < 0) {
                BT_ERR("running script failed");
                if (TIZEN_FEATURE_BT_USB_DONGLE) {
-                       char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
-                       ret = __execute_command("/usr/bin/hciconfig", argv_down);
+                       ret = __bt_call_systemact_service(BT_SYSTEMACT_HCI_DOWN);
+                       if (ret < 0)
+                               BT_ERR("Failed to call systemact service");
                } else {
                        ret = __execute_command("/usr/etc/bluetooth/bt-dev-end.sh", NULL);
                }
@@ -304,11 +306,9 @@ int _bt_disable_adapter(void)
        if (status == BT_ACTIVATING) {
                /* Forcely terminate */
                if (TIZEN_FEATURE_BT_USB_DONGLE) {
-                       char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
-                       if (__execute_command("/usr/bin/hciconfig", argv_down) < 0)
-                               BT_ERR("running script failed");
+                       if (__bt_call_systemact_service(BT_SYSTEMACT_HCI_DOWN) < 0)
+                               BT_ERR("Failed to call systemact service");
                } else {
-
 #ifdef TIZEN_FEATURE_RADIO
                        int radio_status = VCONFKEY_RADIO_STATUS_OFF;
 
@@ -339,9 +339,8 @@ int _bt_disable_adapter(void)
 
        __bt_core_set_status(BT_DEACTIVATING);
        if (TIZEN_FEATURE_BT_USB_DONGLE) {
-               char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
-               if (__execute_command("/usr/bin/hciconfig", argv_down) < 0) {
-                       BT_ERR("running script failed");
+               if (__bt_call_systemact_service(BT_SYSTEMACT_HCI_DOWN) < 0) {
+                       BT_ERR("Failed to call systemact service");
                        __bt_core_set_status(BT_ACTIVATED);
                        return -1;
                }
@@ -395,16 +394,18 @@ int _bt_enable_adapter_le(void)
                __bt_core_set_le_status(BT_LE_ACTIVATING);
                BT_DBG("Activate BT");
                if (TIZEN_FEATURE_BT_USB_DONGLE) {
-                       char *argv_up[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "up", NULL};
-                       ret = __execute_command("/usr/bin/hciconfig", argv_up);
+                       ret = __bt_call_systemact_service(BT_SYSTEMACT_HCI_UP);
+                       if (ret < 0)
+                               BT_ERR("Failed to call systemact service");
                } else {
                        ret = __execute_command("/usr/etc/bluetooth/bt-stack-up.sh", NULL);
                }
                if (ret < 0) {
                        BT_ERR("running script failed");
                        if (TIZEN_FEATURE_BT_USB_DONGLE) {
-                               char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
-                               ret = __execute_command("/usr/bin/hciconfig", argv_down);
+                               ret = __bt_call_systemact_service(BT_SYSTEMACT_HCI_DOWN);
+                               if (ret < 0)
+                                       BT_ERR("Failed to call systemact service");
                        } else {
                                ret = __execute_command("/usr/etc/bluetooth/bt-dev-end.sh &", NULL);
                        }
@@ -469,8 +470,9 @@ int _bt_disable_adapter_le(void)
                __bt_core_set_le_status(BT_LE_DEACTIVATING);
                int ret;
                if (TIZEN_FEATURE_BT_USB_DONGLE) {
-                       char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
-                       ret = __execute_command("/usr/bin/hciconfig", argv_down);
+                       ret = __bt_call_systemact_service(BT_SYSTEMACT_HCI_DOWN);
+                       if (ret < 0)
+                               BT_ERR("Failed to call systemact service");
                } else {
                        ret = __execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL);
                }
index aaa40be..7e61402 100755 (executable)
@@ -36,6 +36,8 @@ extern "C" {
 
 #define BT_SYSTEMACT_HCI_LOGGER_START "/run/.hci_logger_start"
 #define BT_SYSTEMACT_HCI_LOGGER_STOP "/run/.hci_logger_stop"
+#define BT_SYSTEMACT_HCI_UP "/run/.hci_up"
+#define BT_SYSTEMACT_HCI_DOWN "/run/.hci_down"
 #define BT_SYSTEMACT_BLUEZ_START "/run/.bluez_start"
 #define BT_SYSTEMACT_BLUETOOTH_SHARE_START "/run/.bluetooth_share_start"
 #define BT_SYSTEMACT_RFKILL_UNBLOCK "/run/.rfkill_unblock"