Add hal-backend-service-sensor plugin for unified system service support sandbox/sykwak/unified-system-service
authorSangYoun Kwak <sy.kwak@samsung.com>
Mon, 14 Apr 2025 10:10:07 +0000 (19:10 +0900)
committerSangYoun Kwak <sy.kwak@samsung.com>
Tue, 15 Apr 2025 06:55:55 +0000 (15:55 +0900)
Change-Id: I32427b59ec34aa671081a8ccc854541a5e7b4cb0
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
packaging/sensord.service
packaging/sensord.socket
packaging/sensord.spec
src/server/CMakeLists.txt
src/server/main.cpp

index 85eb2f495e6c86faae8e57ce21863dcea9cff635..9138d3e3d6393804bac50896de59c1c4472f91b7 100644 (file)
@@ -1,15 +1,8 @@
 [Unit]
 Description=Sensor Daemon
-Requires=sensord.socket
 
 [Service]
-User=sensor
-Group=input
-Type=notify
-SmackProcessLabel=System
-ExecStart=/usr/bin/sensord
-MemoryMax=20M
-Nice=-5
+Type=simple
 
 [Install]
 WantedBy=multi-user.target
index a64cd4b079e83bc91755384c68cdb744de35299e..ce2f0ce47fa411dce43b1f0b588d3924ac1fdf45 100644 (file)
@@ -2,8 +2,6 @@
 Description=Sensor socket
 
 [Socket]
-SocketUser=sensor
-SocketGroup=input
 ListenStream=/run/.sensord.socket
 SocketMode=0777
 PassCredentials=yes
index 87c5c3c8a781067b80b36e827e1b943d7f4413f4..d384c94208b8a4cd4530e33a078d3fdd8ba28800 100644 (file)
@@ -111,6 +111,7 @@ echo "You need to reinstall %{name}-dummy to keep using the APIs after uninstall
 %{_unitdir}/sensord.socket
 %{_unitdir}/multi-user.target.wants/sensord.service
 %{_unitdir}/sockets.target.wants/sensord.socket
+%{_libdir}/hal/libhal-backend-service-sensord.so
 %config %{_sysconfdir}/sensord/auto_rotation.conf
 %license LICENSE.APLv2
 
@@ -140,7 +141,6 @@ rm -f %{_unitdir}/sockets.target.wants/sensord.socket
 
 %files  devel
 %manifest packaging/sensord.manifest
-%exclude %{_includedir}/sensor/sensor_hal.h
 %{_includedir}/sensor/*.h
 %{_libdir}/libsensor.so
 %{_libdir}/pkgconfig/sensor.pc
index 4b38e0598167177df840690d0229a09ac7d7688d..d5386fb905a2a0e9351954db3a55922d508a5031 100644 (file)
@@ -1,7 +1,18 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(sensord CXX)
 
-SET(DEPENDENTS "glib-2.0 gio-2.0 dlog libsystemd cynara-client cynara-creds-socket cynara-session vconf hal-api-sensor hal-api-common")
+SET(DEPENDENTS
+       glib-2.0
+       gio-2.0
+       dlog
+       libsystemd
+       cynara-client
+       cynara-creds-socket
+       cynara-session
+       vconf
+       hal-api-sensor
+       hal-api-common
+)
 
 INCLUDE(FindPkgConfig)
 PKG_CHECK_MODULES(SERVER_PKGS REQUIRED ${DEPENDENTS})
@@ -29,3 +40,8 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${SENSOR_SRCS} ${SERVER_SRCS})
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SERVER_PKGS_LDFLAGS} ${CMAKE_DL_LIBS} "sensord-shared")
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+SET(LIBRARY_NAME "hal-backend-service-sensord")
+ADD_LIBRARY(${LIBRARY_NAME} SHARED ${SERVER_SRCS})
+TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${SERVER_PKGS_LDFLAGS} ${CMAKE_DL_LIBS} "sensord-shared")
+INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION ${LIB_INSTALL_DIR}/hal COMPONENT RuntimeLibraries)
index c4ec0488a0fad5fea0e60eef4e0b1bfc04dcc4e8..bc403f688e0b56725acca6f1d426617423f5b815 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <glib-unix.h>
 
+#include <hal/hal-common.h>
 #include <sensor_log.h>
 #include "server.h"
 
@@ -82,3 +83,31 @@ int main(int argc, char *argv[])
 
        return 0;
 }
+
+static int sensord_init(void *data)
+{
+       _I("Started");
+
+       server::run();
+
+       return 0;
+}
+
+static int sensord_exit(void *data)
+{
+       server::stop();
+
+       _I("Stopped");
+
+       return 0;
+}
+
+__attribute__((visibility("default")))
+hal_backend_service hal_backend_service_sensord_data = {
+       .module         = HAL_MODULE_SENSORD,
+       .name           = "hal-backend-service-sensord-data",
+       .early_init     = NULL,
+       .init           = sensord_init,
+       .exit           = sensord_exit,
+       .late_exit      = NULL,
+};