From 31598a8688edd79da7267219bca4f7834034caef Mon Sep 17 00:00:00 2001 From: seungku kim Date: Tue, 9 Jun 2015 14:47:11 +0900 Subject: [PATCH] 3.0 specific patch: fix build error Change-Id: I5133e9ed92abbda3588bdb5d52107c34226e116d --- bluetooth-frwk-core.manifest | 22 ------------ bluetooth-frwk-test.manifest | 13 ------- bluetooth-frwk.manifest | 50 ++------------------------ bt-api/bt-common.c | 5 --- bt-api/bt-request-sender.c | 15 -------- bt-api/include/bt-common.h | 8 ----- bt-core/CMakeLists.txt | 5 +++ bt-core/bluetooth-frwk-core.conf | 14 ++++++++ bt-service/CMakeLists.txt | 15 ++++---- bt-service/bt-service-event-receiver.c | 13 ++++++- bt-service/bt-service-main.c | 3 +- bt-service/org.projectx.bt.service.in | 4 +++ packaging/bluetooth-frwk-common.service | 14 ++++++++ packaging/bluetooth-frwk.spec | 63 +++++++++++++++++---------------- 14 files changed, 93 insertions(+), 151 deletions(-) delete mode 100644 bluetooth-frwk-core.manifest delete mode 100644 bluetooth-frwk-test.manifest create mode 100755 bt-core/bluetooth-frwk-core.conf create mode 100644 bt-service/org.projectx.bt.service.in create mode 100644 packaging/bluetooth-frwk-common.service diff --git a/bluetooth-frwk-core.manifest b/bluetooth-frwk-core.manifest deleted file mode 100644 index c2a794d..0000000 --- a/bluetooth-frwk-core.manifest +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/bluetooth-frwk-test.manifest b/bluetooth-frwk-test.manifest deleted file mode 100644 index 5f737de..0000000 --- a/bluetooth-frwk-test.manifest +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/bluetooth-frwk.manifest b/bluetooth-frwk.manifest index 1eedb7f..017d22d 100644 --- a/bluetooth-frwk.manifest +++ b/bluetooth-frwk.manifest @@ -1,49 +1,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + diff --git a/bt-api/bt-common.c b/bt-api/bt-common.c index 9d22e43..8535457 100644 --- a/bt-api/bt-common.c +++ b/bt-api/bt-common.c @@ -46,9 +46,6 @@ static bt_user_info_t user_info[BT_MAX_USER_INFO]; static DBusGConnection *system_conn = NULL; static GDBusConnection *system_gdbus_conn = NULL; -static char *cookie; -static size_t cookie_size; - static guint bus_id; static GDBusConnection *system_gconn = NULL; @@ -1705,8 +1702,6 @@ BT_EXPORT_API int bluetooth_unregister_callback(void) { int ret; - _bt_destroy_cookie(); - ret = _bt_deinit_event_handler(); if (ret != BLUETOOTH_ERROR_NONE) { BT_ERR("Fail to deinit the event handler"); diff --git a/bt-api/bt-request-sender.c b/bt-api/bt-request-sender.c index b1c1c77..8acad4d 100644 --- a/bt-api/bt-request-sender.c +++ b/bt-api/bt-request-sender.c @@ -379,7 +379,6 @@ int _bt_sync_send_request(int service_type, int service_function, GArray **out_param1) { int result = BLUETOOTH_ERROR_NONE; - char *cookie; GError *error = NULL; GArray *in_param5 = NULL; // GArray *out_param2 = NULL; @@ -403,13 +402,6 @@ int _bt_sync_send_request(int service_type, int service_function, in_param5 = g_array_new(TRUE, TRUE, sizeof(gchar)); - cookie = _bt_get_cookie(); - - if (cookie) { - g_array_append_vals(in_param5, cookie, - _bt_get_cookie_size()); - } - param1 = g_variant_new_from_data((const GVariantType *)"ay", in_param1->data, in_param1->len, TRUE, NULL, NULL); @@ -493,7 +485,6 @@ int _bt_async_send_request(int service_type, int service_function, { GArray* in_param5 = NULL; bt_req_info_t *cb_data; - char *cookie; GDBusProxy *proxy; int timeout; @@ -531,12 +522,6 @@ int _bt_async_send_request(int service_type, int service_function, in_param5 = g_array_new(TRUE, TRUE, sizeof(gchar)); - cookie = _bt_get_cookie(); - - if (cookie) { - g_array_append_vals(in_param5, cookie, - _bt_get_cookie_size()); - } param1 = g_variant_new_from_data((const GVariantType *)"ay", in_param1->data, in_param1->len, TRUE, NULL, NULL); diff --git a/bt-api/include/bt-common.h b/bt-api/include/bt-common.h index 828bebe..e72304b5 100644 --- a/bt-api/include/bt-common.h +++ b/bt-api/include/bt-common.h @@ -345,17 +345,9 @@ DBusConnection *_bt_get_system_conn(void); GDBusConnection *_bt_init_system_gdbus_conn(void); -char *_bt_get_cookie(void); - -int _bt_get_cookie_size(void); - int _bt_register_osp_server_in_agent(int type, char *uuid, char *path, int fd); int _bt_unregister_osp_server_in_agent(int type, char *uuid); -void _bt_generate_cookie(void); - -void _bt_destroy_cookie(void); - int _bt_check_privilege(int service_type, int service_function); GDBusConnection *_bt_gdbus_init_system_gconn(void); diff --git a/bt-core/CMakeLists.txt b/bt-core/CMakeLists.txt index 3f7b1f8..319913a 100644 --- a/bt-core/CMakeLists.txt +++ b/bt-core/CMakeLists.txt @@ -39,6 +39,10 @@ IF("${ARCH}" STREQUAL "arm") MESSAGE("add -DTARGET") ENDIF("${ARCH}" STREQUAL "arm") +FIND_PROGRAM(DBUS_BINDING_TOOL NAMES dbus-binding-tool) +EXEC_PROGRAM("${DBUS_BINDING_TOOL}" ARGS "--prefix=bt ${CMAKE_CURRENT_SOURCE_DIR}/bt-request-service.xml --mode=glib-client --output=${CMAKE_CURRENT_SOURCE_DIR}/include/bt-request-service.h") +EXEC_PROGRAM("${DBUS_BINDING_TOOL}" ARGS "--prefix=bt_core ${CMAKE_CURRENT_SOURCE_DIR}/bt-core-adapter.xml --mode=glib-server --output=${CMAKE_CURRENT_SOURCE_DIR}/include/bt-core-adapter-method.h") + ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DVENDOR=\"${APP_VENDOR}\"") ADD_DEFINITIONS("-DAPPNAME=\"${APP_NAME}\"") @@ -56,3 +60,4 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.projectx.bt_core.service DESTINATION share/dbus-1/system-services) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-core.conf DESTINATION /etc/dbus-1/system.d) diff --git a/bt-core/bluetooth-frwk-core.conf b/bt-core/bluetooth-frwk-core.conf new file mode 100755 index 0000000..815a54a --- /dev/null +++ b/bt-core/bluetooth-frwk-core.conf @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/bt-service/CMakeLists.txt b/bt-service/CMakeLists.txt index 751ff12..96e5b8c 100644 --- a/bt-service/CMakeLists.txt +++ b/bt-service/CMakeLists.txt @@ -50,6 +50,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) SET(PKG_MODULES + vconf aul vconf libprivilege-control @@ -109,8 +110,8 @@ ADD_DEFINITIONS("-DAPP_LOCALEDIR=\"${APP_LOCALEDIR}\"") ADD_DEFINITIONS("-DAPP_SYSCONFDIR=\"${APP_SYSCONFDIR}\"") IF(LIBNOTIFY_SUPPORT OR LIBNOTIFICATION_SUPPORT) - ADD_DEFINITIONS("-DDATA_DIR_ICON=\"${SHARE_INSTALL_PREFIX}\"") - MESSAGE("Icon used for notification is : ${SHARE_INSTALL_PREFIX}/icons/default/bt-icon.png") + ADD_DEFINITIONS("-DDATA_DIR_ICON=\"${SHARE_INSTALL_PREFIX}\"") + MESSAGE("Icon used for notification is : ${SHARE_INSTALL_PREFIX}/icons/default/bt-icon.png") ENDIF(LIBNOTIFY_SUPPORT OR LIBNOTIFICATION_SUPPORT) SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") @@ -119,15 +120,13 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) # to permit usage of bluetooth_cancel_bonding in bt-popup.c. This build bluetooth-api first. IF(LIBNOTIFY_SUPPORT) - ADD_DEPENDENCIES(${PROJECT_NAME} bluetooth-api) - TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${service_pkgs_LDFLAGS} bluetooth-api) + ADD_DEPENDENCIES(${PROJECT_NAME} bluetooth-api) + TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${service_pkgs_LDFLAGS} bluetooth-api) ELSE(LIBNOTIFY_SUPPORT) - TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${service_pkgs_LDFLAGS}) + TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${service_pkgs_LDFLAGS}) ENDIF(LIBNOTIFY_SUPPORT) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${service_pkgs_LDFLAGS}) - -#INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service DESTINATION /etc/rc.d/init.d) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/org.projectx.bt.service.in ${CMAKE_CURRENT_SOURCE_DIR}/org.projectx.bt.service) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.projectx.bt.service DESTINATION share/dbus-1/system-services) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) diff --git a/bt-service/bt-service-event-receiver.c b/bt-service/bt-service-event-receiver.c index d6f8c3a..d15a7f4 100644 --- a/bt-service/bt-service-event-receiver.c +++ b/bt-service/bt-service-event-receiver.c @@ -720,10 +720,15 @@ static void __bt_adapter_property_changed_event(GVariant *msg, const char *path) g_variant_get(val, "b" ,&powered); BT_DBG("Powered = %d", powered); if (powered == FALSE) { +#ifdef TIZEN_TV + _bt_handle_adapter_removed(); +#else if (vconf_get_int(VCONFKEY_BT_STATUS, &bt_state) == 0 && bt_state != VCONFKEY_BT_STATUS_OFF) { _bt_disable_adapter(); } +#endif + #ifdef ENABLE_TIZEN_2_4 if (vconf_get_int(VCONFKEY_BT_LE_STATUS, &bt_state) == 0 && bt_state != VCONFKEY_BT_LE_STATUS_OFF) { @@ -731,6 +736,11 @@ static void __bt_adapter_property_changed_event(GVariant *msg, const char *path) } #endif } + else { +#ifdef TIZEN_TV + _bt_handle_adapter_added(); +#endif + } } else if (strcasecmp(property, "Connectable") == 0) { gboolean connectable = FALSE; @@ -3081,6 +3091,7 @@ fail: static int __bt_init_obexd_receiver(void) { BT_DBG("+"); +#if 0 GError *error = NULL; if (obexd_conn == NULL) { @@ -3099,7 +3110,7 @@ static int __bt_init_obexd_receiver(void) obexd_conn = NULL; return BLUETOOTH_ERROR_INTERNAL; } - +#endif BT_DBG("-"); return BLUETOOTH_ERROR_NONE; diff --git a/bt-service/bt-service-main.c b/bt-service/bt-service-main.c index 6e88007..6b2ca29 100644 --- a/bt-service/bt-service-main.c +++ b/bt-service/bt-service-main.c @@ -241,12 +241,13 @@ int main(void) BT_ERR("Fail to init cynara"); return EXIT_FAILURE; } - +#if 0 #ifndef TIZEN_WEARABLE if (perm_app_set_privilege("bluetooth-frwk-service", NULL, NULL) != PC_OPERATION_SUCCESS) BT_ERR("Failed to set app privilege"); #endif +#endif /* Event reciever Init */ if (_bt_init_service_event_receiver() != BLUETOOTH_ERROR_NONE) { BT_ERR("Fail to init event reciever"); diff --git a/bt-service/org.projectx.bt.service.in b/bt-service/org.projectx.bt.service.in new file mode 100644 index 0000000..bf43821 --- /dev/null +++ b/bt-service/org.projectx.bt.service.in @@ -0,0 +1,4 @@ +[D-BUS Service] +Name=org.projectx.bt +Exec=/bin/sh -c 'export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID/dbus/user_bus_socket; exec /usr/bin/bt-service' +User=@TZ_SYS_DEFAULT_USER@ diff --git a/packaging/bluetooth-frwk-common.service b/packaging/bluetooth-frwk-common.service new file mode 100644 index 0000000..4523df9 --- /dev/null +++ b/packaging/bluetooth-frwk-common.service @@ -0,0 +1,14 @@ +[Unit] +Description=Bluetooth service +After=multi-user.target + +[Service] +Type=dbus +BusName=org.projectx.bt +ExecStart=/usr/bin/bt-service +Restart=always +RestartSec=1 +KillMode=process + +[Install] +WantedBy=starter.target diff --git a/packaging/bluetooth-frwk.spec b/packaging/bluetooth-frwk.spec index 5de0445..0394314 100644 --- a/packaging/bluetooth-frwk.spec +++ b/packaging/bluetooth-frwk.spec @@ -49,17 +49,17 @@ BuildRequires: pkgconfig(appcore-efl) BuildRequires: pkgconfig(pkgmgr) #BuildRequires: pkgconfig(journal) #BuildRequires: pkgconfig(eventsystem) -%if "%{?tizen_profile_name}" == "mobile" +%if "%{?profile}" == "mobile" BuildRequires: pkgconfig(capi-network-tethering) %endif +BuildRequires: cmake BuildRequires: pkgconfig(libprivilege-control) BuildRequires: pkgconfig(cynara-client) BuildRequires: pkgconfig(cynara-creds-dbus) -BuildRequires: cmake - -Requires(post): vconf -Requires(postun): eglibc +Requires(post): /usr/bin/vconftool +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig Requires: psmisc %description @@ -102,6 +102,7 @@ This package is Bluetooth test application. %prep %setup -q +cp %{SOURCE1001} . %build @@ -109,32 +110,33 @@ export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE" export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE" export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" -export CFLAGS="$CFLAGS -fpie -DRFCOMM_DIRECT " -export LDFLAGS="$CFLAGS -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie" - -%if "%{?tizen_profile_name}" == "mobile" +%if "%{?profile}" == "mobile" +echo mobile export CFLAGS="$CFLAGS -DTIZEN_NETWORK_TETHERING_ENABLE -DTIZEN_BT_FLIGHTMODE_ENABLED" %endif -%if "%{?tizen_profile_name}" == "wearable" +%if "%{?profile}" == "wearable" +echo wearable export CFLAGS="$CFLAGS -DTIZEN_WEARABLE" -%define _servicefile packaging/bluetooth-frwk-wearable.service -%define _servicedir multi-user.target.wants -%else -%define _servicefile packaging/bluetooth-frwk-mobile.service -%define _servicedir graphical.target.wants %endif -%define _servicedir multi-user.target.wants + +%if "%{?profile}" == "tv" +echo tv +export CFLAGS="$CFLAGS -DUSB_BLUETOOTH" +%endif %ifarch x86_64 export CFLAGS="$CFLAGS -Wall -g -fvisibility=hidden -fPIC" +export LDFLAGS="$CFLAGS -Wl,--rpath=%{_libdir} -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs" +%else +export CFLAGS="$CFLAGS -fpie -DRFCOMM_DIRECT " +export LDFLAGS="$CFLAGS -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie" %endif %ifarch aarch64 export CFLAGS="$CFLAGS -D__TIZEN_MOBILE__ -DTIZEN_TELEPHONY_ENABLED" %endif - cmake . -DCMAKE_INSTALL_PREFIX=/usr \ -DTZ_SYS_USER_GROUP=%TZ_SYS_USER_GROUP \ -DTZ_SYS_DEFAULT_USER=%TZ_SYS_DEFAULT_USER \ @@ -152,16 +154,15 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr \ make %cmake \ -%if "%{?tizen_profile_name}" == "wearable" +%if "%{?profile}" == "wearable" -DTIZEN_WEARABLE=YES \ %else -DTIZEN_WEARABLE=NO \ %endif -%if "%{?tizen_profile_name}" == "common" +%if "%{?profile}" == "common" -DTIZEN_WEARABLE=NO \ %endif - %install rm -rf %{buildroot} %make_install @@ -173,9 +174,6 @@ install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk-devel mkdir -p %{buildroot}%{_unitdir_user} install -m 0644 bt-service/bluetooth-frwk-service.service %{buildroot}%{_unitdir_user} -mkdir -p %{buildroot}%{_dumpdir} -install -m 0755 bluetooth_log_dump.sh %{buildroot}%{_dumpdir} - %if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification} mkdir -p %{buildroot}%{_datadir}/icons/default install -m 0644 %{SOURCE1002} %{buildroot}%{_datadir}/icons/default/bt-icon.png @@ -189,13 +187,13 @@ sed -i 's/%TZ_SYS_DEFAULT_USER/app/' %{buildroot}%{_datadir}/dbus-1/system-servi %post /sbin/ldconfig -%if "%{?tizen_profile_name}" == "wearable" +%if "%{?profile}" == "wearable" vconftool set -f -t int db/bluetooth/status "1" -g 6520 %endif -%if "%{?tizen_profile_name}" == "mobile" +%if "%{?profile}" == "mobile" vconftool set -f -t int db/bluetooth/status "0" -g 6520 %endif -%if "%{?tizen_profile_name}" == "common" +%if "%{?profile}" == "common" vconftool set -f -t int db/bluetooth/status "0" -g 6520 %endif @@ -212,11 +210,12 @@ vconftool set -f -t bool memory/bluetooth/dutmode "0" -g 6520 -i #%post service #mkdir -p %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/ -#ln -sf %{_libdir}/systemd/system/bluetooth-frwk.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/ +#ln -sf %{_unitdir_user}/bluetooth-frwk.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/ %postun -p /sbin/ldconfig %files +%manifest %{name}.manifest %defattr(-, root, root) %{_libdir}/libbluetooth-api.so.* %{_datadir}/license/bluetooth-frwk @@ -236,9 +235,10 @@ vconftool set -f -t bool memory/bluetooth/dutmode "0" -g 6520 -i %{_datadir}/license/bluetooth-frwk-devel %files service -%manifest bluetooth-frwk.manifest +%manifest %{name}.manifest %defattr(-, root, root) %{_datadir}/dbus-1/system-services/org.projectx.bt.service + %{_bindir}/bt-service %{_unitdir_user}/bluetooth-frwk-service.service %{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-service.conf @@ -249,20 +249,21 @@ vconftool set -f -t bool memory/bluetooth/dutmode "0" -g 6520 -i %{_prefix}/etc/bluetooth #%attr(0666,-,-) %{_varlibdir}/bluetooth/auto-pair-blacklist #%attr(0666,-,-) %{_prefix}/etc/bluetooth/stack_info -%{_dumpdir}/bluetooth_log_dump.sh +#%{_dumpdir}/bluetooth_log_dump.sh %{_datadir}/license/bluetooth-frwk-service %if %{with bluetooth_frwk_libnotify} || %{with bluetooth_frwk_libnotification} %{_datadir}/icons/default/bt-icon.png %endif %files core -%manifest bluetooth-frwk-core.manifest +%manifest %{name}.manifest %defattr(-, root, root) %{_datadir}/dbus-1/system-services/org.projectx.bt_core.service %{_bindir}/bt-core +%{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-core.conf %files test -%manifest bluetooth-frwk-test.manifest +%manifest %{name}.manifest %defattr(-, root, root) %{_bindir}/bluetooth-frwk-test %{_bindir}/bluetooth-gatt-test -- 2.7.4