From: Deokhyun Kim Date: Wed, 5 Feb 2020 06:12:15 +0000 (+0900) Subject: Not enable BT on booting time in factory mode X-Git-Tag: accepted/tizen/unified/20200210.131841~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F35%2F223935%2F3;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git Not enable BT on booting time in factory mode Change-Id: Iae2ea70769807e527d55175aff808d033f2833b4 Signed-off-by: Deokhyun Kim --- diff --git a/bt-service-adaptation/CMakeLists.txt b/bt-service-adaptation/CMakeLists.txt index d3477fd..73c5603 100644 --- a/bt-service-adaptation/CMakeLists.txt +++ b/bt-service-adaptation/CMakeLists.txt @@ -73,8 +73,24 @@ ENDIF() INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../bt-oal/include) LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../bt-oal) +IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_FEATURE_BT_FACTORY_MODE") SET(PKG_MODULES vconf + dbus-1 + gio-2.0 + gio-unix-2.0 + alarm-service + capi-network-connection + cynara-client + cynara-creds-gdbus + eventsystem + storage + capi-system-info + libsystemd-daemon + bincfg +) +ELSE() +SET(PKG_MODULES vconf dbus-1 gio-2.0 @@ -88,6 +104,7 @@ SET(PKG_MODULES capi-system-info libsystemd-daemon ) +ENDIF() INCLUDE(FindPkgConfig) pkg_check_modules(service_pkgs REQUIRED ${PKG_MODULES}) diff --git a/bt-service-adaptation/services/bt-service-main.c b/bt-service-adaptation/services/bt-service-main.c index c941296..34394c1 100644 --- a/bt-service-adaptation/services/bt-service-main.c +++ b/bt-service-adaptation/services/bt-service-main.c @@ -19,6 +19,9 @@ #include #include #include +#ifdef TIZEN_FEATURE_BT_FACTORY_MODE +#include +#endif #include #include @@ -139,6 +142,23 @@ gboolean _bt_reliable_terminate_service(gpointer user_data) return FALSE; } +static void __bt_check_factory_mode(void) +{ +#ifdef TIZEN_FEATURE_BT_FACTORY_MODE + int factorymode_status = 0; + /* BT should not be activated automatically in factory binary */ + /* factorymode_status :: 0 - normal binary, 1 - factory binary */ + factorymode_status = bincfg_is_factory_binary(); + if (factorymode_status != 0) { + BT_INFO("factory mode [%d]", factorymode_status); + if(vconf_set_int(VCONFKEY_BT_STATUS, VCONFKEY_BT_STATUS_OFF) != 0) + BT_ERR("Set vconf failed"); + if(vconf_set_int(VCONFKEY_BT_LE_STATUS, VCONFKEY_BT_LE_STATUS_OFF) != 0) + BT_ERR("Set vconf failed"); + } +#endif +} + static gboolean __bt_check_bt_service(void *data) { bt_status_t status = BT_DEACTIVATED; @@ -320,6 +340,8 @@ int main(void) sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); + __bt_check_factory_mode(); + if (_bt_service_initialize() != BLUETOOTH_ERROR_NONE) return 0; diff --git a/packaging/bluetooth-frwk.spec b/packaging/bluetooth-frwk.spec index 74015cb..d200c7e 100644 --- a/packaging/bluetooth-frwk.spec +++ b/packaging/bluetooth-frwk.spec @@ -21,8 +21,12 @@ Requires: bluetooth-tools %define bt_gatt_client_fd ENABLED %define bt_permanent_log DISABLED %define bt_http_proxy DISABLED +%define bt_factory_mode DISABLED BuildRequires: pkgconfig(aul) +%if %{bt_factory_mode} == ENABLED +BuildRequires: pkgconfig(bincfg) +%endif BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gio-2.0) @@ -275,6 +279,10 @@ export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_PERMANENT_LOG" export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_HTTP_PROXY" %endif +%if %{bt_factory_mode} == ENABLED +export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_FACTORY_MODE" +%endif + %ifarch %{ix86} x86_64 export CFLAGS+=" -DTIZEN_TEST_EMUL" export CXXFLAGS+=" -DTIZEN_TEST_EMUL"