src/time/time-handler.c
)
+IF(${ENABLE_SYSTEM_SERVER})
+ SET(SRCS ${SRCS} src/core/system-server-deviced.c)
+ENDIF()
+
IF(DISPLAY_MODULE STREQUAL on)
ADD_SOURCE(src/display DISPLAY_SRCS)
SET(SRCS ${SRCS} ${DISPLAY_SRCS})
argos_watchdog
)
+IF(${ENABLE_SYSTEM_SERVER})
+ SET(PKG_MODULES "${PKG_MODULES} bundle tizen-core united-service")
+ENDIF()
+
IF(DISPLAY_MODULE STREQUAL on)
SET(PKG_MODULES ${PKG_MODULES} libinput capi-system-sensor)
ENDIF()
# Build libdeviced-common-private.so
ADD_SUBDIRECTORY(src/shared)
-ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
SET(deviced_LDFLAGS ${REQUIRED_PKGS_LDFLAGS})
+
+IF(${ENABLE_SYSTEM_SERVER})
+ADD_LIBRARY("system-server-deviced" SHARED ${SRCS})
+TARGET_LINK_LIBRARIES("system-server-deviced" ${REQUIRED_PKGS_LDFLAGS} "-lrt -ldl -lm" deviced-common-private)
+TARGET_LINK_LIBRARIES("system-server-deviced" PUBLIC "-lpthread")
+INSTALL(TARGETS "system-server-deviced" DESTINATION ${SYSTEM_SERVER_DIR}/mod COMPONENT RuntimeLibraries)
+ELSE()
+LIST(REMOVE_ITEM SRCS "${CMAKE_CURRENT_SOURCE_DIR}/system-server-deviced.c")
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${REQUIRED_PKGS_LDFLAGS} "-lrt -ldl -lm" deviced-common-private)
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+ENDIF()
INSTALL(DIRECTORY DESTINATION ${MAKE_INSTALL_PREFIX}${DD_PLUGIN_PATH})
CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/org.tizen.system.deviced.conf DESTINATION /etc/dbus-1/system.d)
+IF(${ENABLE_SYSTEM_SERVER})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/system-server-deviced.service
+ DESTINATION ${SYSTEM_SERVER_DIR}/conf)
+ELSE()
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/org.tizen.system.deviced.service DESTINATION /usr/share/dbus-1/system-services)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/deviced.service DESTINATION /usr/lib/systemd/system)
+ENDIF()
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/org.tizen.system.deviced.conf DESTINATION /etc/dbus-1/system.d)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/usb-host-ffs-test-daemon.service DESTINATION /usr/lib/systemd/system)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/usb-host-test.socket DESTINATION /usr/lib/systemd/system)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/strs DESTINATION /etc/mtp-responder-dummy)
+%define enable_system_server 0
+%define _system_server_dir %{_datadir}/united-service/system-server
+
# display, extcon, power, usb are always enabled
#Just For debugging
BuildRequires: pkgconfig(gtest)
BuildRequires: pkgconfig(gmock)
BuildRequires: pkgconfig(security-manager)
+%if %{enable_system_server}
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(tizen-core)
+BuildRequires: pkgconfig(united-service)
+%endif
Requires: %{name}-tools = %{version}-%{release}
%{?systemd_requires}
-DDEVICE_BOARD_MODULE=on \
-DDEVICE_INPUT_MODULE=on \
-DCRITICAL_LOG_MODULE=on \
+%if %{enable_system_server}
+ -DSYSTEM_SERVER_DIR=%{_system_server_dir} \
+%endif
+ -DENABLE_SYSTEM_SERVER=%{enable_system_server} \
#eol
%build
rm -rf %{buildroot}
%make_install
+%if "%{enable_system_server}" != "1"
%install_service multi-user.target.wants deviced.service
+%endif
# usb_module condition is removed because it is always on
%if %{?sdb_prestart} == on
%install_service basic.target.wants sdb-prestart.service
%manifest %{name}.manifest
%license LICENSE.Apache-2.0
%license LICENSE.MIT
-%{_bindir}/deviced
%{_libdir}/libdeviced-common-private.so
+%if %{enable_system_server}
+%{_system_server_dir}/mod/libsystem-server-deviced.so
+%{_system_server_dir}/conf/system-server-deviced.service
+%else
+%{_bindir}/deviced
%{_unitdir}/multi-user.target.wants/deviced.service
%{_unitdir}/deviced.service
%{_datadir}/dbus-1/system-services/org.tizen.system.deviced.service
+%endif
%dir %{plugindir}
%if %{?sdb_prestart} == on
%{_unitdir}/sdb-prestart.service
--- /dev/null
+[United-Service]
+Description=deviced plugin for system-server
+Name=system-server-deviced
+Type=notify
+Mode=normal
+Path=/usr/share/united-service/system-server/mod/libsystem-server-deviced.so
+Priority=1
\ No newline at end of file
--- /dev/null
+/*
+ * deviced
+ *
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <service.h>
+
+#include "core/log.h"
+#include "core/deviced.h"
+
+static void system_server_create_callback(service_h service, void *user_data)
+{
+ _I("Create deviced for system-server");
+ deviced_init(NULL);
+}
+
+static void system_server_destroy_callback(service_h service, void *user_data)
+{
+ _I("Destroy deviced for system-server");
+ deviced_exit(NULL);
+}
+
+static void system_server_message_callback(service_h service,
+ const char *sender, bundle *envelope, void *user_data)
+{
+ _I("Message from sender(%s)", sender);
+}
+
+__attribute__ ((visibility("default")))
+int USD_MOD_INIT(const char *name)
+{
+ int ret = 0;
+ service_lifecycle_callback_s system_server_callback = {
+ .create = system_server_create_callback,
+ .destroy = system_server_destroy_callback,
+ .message = system_server_message_callback,
+ };
+
+ _I("Start deviced");
+
+ ret = service_register(name, &system_server_callback, NULL);
+ if (ret != SERVICE_ERROR_NONE) {
+ _E("Failed to create service: name(%s), ret(%d)", name, ret);
+ return ret;
+ }
+
+ return SERVICE_ERROR_NONE;
+}
+
+__attribute__ ((visibility("default")))
+void USD_MOD_SHUTDOWN(const char *name)
+{
+ _I("Shutdown deviced");
+
+ service_unregister(name);
+}
\ No newline at end of file