From 2758599c63c1fd511609e54bb72cb899f69917de Mon Sep 17 00:00:00 2001 From: Wook Song Date: Fri, 18 Nov 2016 09:27:53 +0900 Subject: [PATCH] pass: Change names of project and daemon to "pass" This patch simply changes names of this project and the main daemon to "pass". When the packages are successfully built, you can find the following files as the results: - libpass-0.0.1-1.armv7l.rpm - libpass-devel-0.0.1-1.armv7l.rpm - pass-debuginfo-0.0.1-1.armv7l.rpm - pass-tools-0.0.1-1.armv7l.rpm - libpass-debuginfo-0.0.1-1.armv7l.rpm - pass-0.0.1-1.armv7l.rpm - pass-debugsource-0.0.1-1.armv7l.rpm - pass-tools-debuginfo-0.0.1-1.armv7l.rpm Note: although those packages can be built without any errors, you should not install them to your target device since it may cause conflict with the existing deviced. Signed-off-by: Wook Song --- CMakeLists.txt | 295 ++++++++++++++++++++++++++++ packaging/libpass.manifest | 5 + packaging/pass.manifest | 5 + packaging/pass.spec | 326 +++++++++++++++++++++++++++++++ pass.pc.in | 14 ++ scripts/deviced-vibrator.conf | 19 ++ scripts/direct_set_debug.sh | 58 ++++++ scripts/mmc-smack-label | 12 ++ scripts/pass.conf | 37 ++++ src/libdeviced/CMakeLists.txt | 12 +- systemd/deviced-vibrator.service | 18 ++ systemd/pass.service | 12 ++ systemd/pass.socket | 10 + systemd/sdb-prestart.service | 10 + systemd/usb-host-ffs-test-daemon.service | 7 + systemd/usb-host-test.socket | 6 + 16 files changed, 841 insertions(+), 5 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 packaging/libpass.manifest create mode 100644 packaging/pass.manifest create mode 100644 packaging/pass.spec create mode 100644 pass.pc.in create mode 100644 scripts/deviced-vibrator.conf create mode 100755 scripts/direct_set_debug.sh create mode 100755 scripts/mmc-smack-label create mode 100644 scripts/pass.conf create mode 100644 systemd/deviced-vibrator.service create mode 100644 systemd/pass.service create mode 100644 systemd/pass.socket create mode 100644 systemd/sdb-prestart.service create mode 100644 systemd/usb-host-ffs-test-daemon.service create mode 100644 systemd/usb-host-test.socket diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e7235b0 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,295 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(pass C) + +######################################################## +# Build options: +######################################################## +IF("${ARCH}" STREQUAL "emulator") + OPTION(USE_EMULATOR "Use Emulator" ON) +ELSEIF("${ARCH}" STREQUAL "arm") + OPTION(USE_ARM "Use Arm" ON) +ENDIF() + +IF("${ARCH_BIT}" STREQUAL "32") + OPTION(USE_32BIT "Use 32bit architecture" ON) +ELSEIF("${ARCH_BIT}" STREQUAL "64") + OPTION(USE_64BIT "Use 64bit architecture" ON) +ENDIF() + +######################################################## +# Deviced Macros +######################################################## + +MACRO(ADD_SOURCE DIR OUT) + FILE(GLOB ALL_SRCS "${DIR}/*.c") + FOREACH(SRC ${ALL_SRCS}) + IF(NOT ${SRC} MATCHES "ivi|mobile|wearable|tv|none") + SET(D_SRCS ${D_SRCS} ${SRC}) + ENDIF() + ENDFOREACH() + FILE(GLOB S_SRCS "${DIR}/*-${PROFILE}.c") + IF(DEFINED S_SRCS) + SET(D_SRCS ${D_SRCS} ${S_SRCS}) + ENDIF() + SET(${OUT} ${D_SRCS}) +ENDMACRO() + +MACRO(INSTALL_CONF DIR CONF) + SET(T_CONF ${DIR}/${CONF}-${PROFILE}.conf) + SET(E_CONF ${DIR}/${CONF}-emul-${PROFILE}.conf) + IF(USE_EMULATOR AND EXISTS ${E_CONF}) + SET(T_CONF ${E_CONF}) + ENDIF() + IF(NOT EXISTS ${T_CONF}) + SET(T_CONF ${DIR}/${CONF}.conf) + ENDIF() + IF(DEFINED T_CONF) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${T_CONF} + DESTINATION /etc/deviced + RENAME ${CONF}.conf) + ENDIF() +ENDMACRO() + +######################################################## +# Deviced CMakeLists.txt +######################################################## +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(EXEC_PREFIX "${PREFIX}/bin") +SET(INCLUDEDIR "${PREFIX}/include/${PROJECT_NAME}") +SET(DATADIR "${PREFIX}/share/${PROJECT_NAME}") +SET(CONFDIR "/etc/${PROJECT_NAME}") +SET(VERSION 0.1.0) + +SET(SRCS + src/apps/apps.c + src/control/control.c + src/core/common.c + src/core/config-parser.c + src/core/device-idler.c + src/core/device-notifier.c + src/core/devices.c + src/core/edbus-handler.c + src/core/execute.c + src/core/launch.c + src/core/log.c + src/core/main.c + src/core/sig-handler.c + src/core/udev.c + src/proc/cpu-info.c + src/proc/proc-handler.c + src/time/time-handler.c +) + +IF(BATTERY_MODULE STREQUAL on) + ADD_SOURCE(src/battery BATTERY_SRCS) + SET(SRCS ${SRCS} ${BATTERY_SRCS}) +ENDIF() + +IF(BLOCK_MODULE STREQUAL on) + ADD_SOURCE(src/block BLOCK_SRCS) + SET(SRCS ${SRCS} ${BLOCK_SRCS}) + IF(BLOCK_TMPFS STREQUAL on) + ADD_DEFINITIONS("-DBLOCK_TMPFS") + ENDIF(BLOCK_TMPFS STREQUAL on) +ENDIF() + +IF(EXTCON_MODULE STREQUAL on) + ADD_SOURCE(src/extcon EXTCON_SRCS) + SET(SRCS ${SRCS} ${EXTCON_SRCS}) +ENDIF() + +IF(LED_MODULE STREQUAL on) + ADD_SOURCE(src/led LED_SRCS) + SET(SRCS ${SRCS} ${LED_SRCS}) +ENDIF() + +IF(TOUCHSCREEN_MODULE STREQUAL on) + ADD_SOURCE(src/touchscreen TOUCHSCREEN_SRCS) + SET(SRCS ${SRCS} ${TOUCHSCREEN_SRCS}) +ENDIF() + +IF(TZIP_MODULE STREQUAL on) + ADD_SOURCE(src/tzip TZIP_SRCS) + SET(SRCS ${SRCS} ${TZIP_SRCS}) +ENDIF() + +IF(POWER_MODULE STREQUAL on) + ADD_SOURCE(src/power POWER_SRCS) + SET(SRCS ${SRCS} ${POWER_SRCS}) +ENDIF() + +IF(DISPLAY_MODULE STREQUAL on) + ADD_SOURCE(src/display DISPLAY_SRCS) + SET(SRCS ${SRCS} ${DISPLAY_SRCS}) + + IF("${DPMS}" STREQUAL "x") + SET(SRCS ${SRCS} src/display/dpms-x-none.c) + ELSEIF("${DPMS}" STREQUAL "wayland") + SET(SRCS ${SRCS} src/display/dpms-wayland-none.c) + ENDIF() +ENDIF() + +# usb client +IF(${USB_MODULE} STREQUAL on) + ADD_SOURCE(src/usb USB_SRCS) + SET(SRCS ${SRCS} ${USB_SRCS}) +ENDIF() + +# usb host +IF(${USBHOST_MODULE} STREQUAL on) + ADD_SOURCE(src/usbhost USBHOST_SRCS) + SET(SRCS ${SRCS} ${USBHOST_SRCS}) +ENDIF() + +IF(IR_MODULE STREQUAL on) + ADD_SOURCE(src/ir IR_SRCS) + SET(SRCS ${SRCS} ${IR_SRCS}) +ENDIF() + +IF(TIZEN_FEATURE_USBHOST_TEST STREQUAL on) + ADD_SOURCE(src/usb-host-test USB_HOST_TEST_SRCS) + SET(SRCS ${SRCS} ${USB_HOST_TEST_SRCS}) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/usb-host-test/test_gadget.gs + DESTINATION /etc/deviced/usb-host-test/) +ENDIF() + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/deviced) + +SET(PKG_MODULES + ecore + edbus + vconf + dlog + libudev + device-node + capi-base-common + glib-2.0 + dbus-1 + gio-2.0 + eventsystem + libtzplatform-config + hwcommon + mount +) + +IF(DISPLAY_MODULE STREQUAL on) + IF("${DPMS}" STREQUAL "x") + SET(PKG_MODULES ${PKG_MODULES} x11 xext) + ENDIF() + SET(PKG_MODULES ${PKG_MODULES} libinput capi-system-sensor) +ENDIF() +IF(BLOCK_MODULE STREQUAL on) + SET(PKG_MODULES ${PKG_MODULES} storage app2sd capi-system-info) +ENDIF() +IF(TZIP_MODULE STREQUAL on) + SET(PKG_MODULES ${PKG_MODULES} minizip fuse) +ENDIF() +IF(TIZEN_FEATURE_USBHOST_TEST STREQUAL on) + SET(PKG_MODULES ${PKG_MODULES} libkmod libusbg) +ENDIF() + +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED ${PKG_MODULES}) + +FOREACH(flag ${pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -fPIE") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -lrt") +SET(CMAKE_EXE_LINKER_FLAGS "-pie") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") +ADD_DEFINITIONS("-DLIBPATH=\"${LIB_INSTALL_DIR}\"") +ADD_DEFINITIONS("-DENABLE_DEVICED_DLOG") +ADD_DEFINITIONS("-DENABLE_LIBDEVICED_DLOG") +ADD_DEFINITIONS("-DENABLE_PM_LOG") +IF(ENGINEER_MODE STREQUAL on) +ADD_DEFINITIONS("-DENGINEER_MODE") +ENDIF(ENGINEER_MODE STREQUAL on) +IF(PROFILE STREQUAL tv) + ADD_DEFINITIONS("-DPROFILE_TV") +ENDIF() +IF(USE_ARM) + ADD_DEFINITIONS("-DTARGET") +ELSEIF(USE_EMULATOR) + ADD_DEFINITIONS("-DEMULATOR") +ENDIF() +IF(USE_32BIT) + ADD_DEFINITIONS("-DARCH_32BIT") +ELSEIF(USE_64BIT) + ADD_DEFINITIONS("-DARCH_64BIT") +ENDIF() +ADD_DEFINITIONS("-DDEBUG") +IF(TIZEN_FEATURE_BLOCK_SET_PERMISSION STREQUAL on) + ADD_DEFINITIONS("-DTIZEN_FEATURE_BLOCK_SET_PERMISSION") +ENDIF(TIZEN_FEATURE_BLOCK_SET_PERMISSION STREQUAL on) + +ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-ldl" "-lm" shared) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) + +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/deviced/ DESTINATION include/${PROJECT_NAME} + FILES_MATCHING + PATTERN "*_doc.h" EXCLUDE + PATTERN "*.h") + +IF(BATTERY_MODULE STREQUAL on) + INSTALL_CONF(src/battery battery) +ENDIF() +IF(BLOCK_MODULE STREQUAL on) + INSTALL_CONF(src/block block) + INSTALL_CONF(src/block storage) + IF(TIZEN_FEATURE_BLOCK_SET_PERMISSION STREQUAL on) + INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/mmc-smack-label DESTINATION bin) + ENDIF(TIZEN_FEATURE_BLOCK_SET_PERMISSION STREQUAL on) +ENDIF() + +IF(DISPLAY_MODULE STREQUAL on) + INSTALL_CONF(src/display display) +ENDIF() + +# USB connection +IF(${USB_MODULE} STREQUAL on) + INSTALL_CONF(src/usb usb-operation) + + # USB (Manual setting) + INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/direct_set_debug.sh DESTINATION bin) + IF(${SDB_PRESTART} STREQUAL on) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/sdb-prestart.service DESTINATION lib/systemd/system) + ENDIF(${SDB_PRESTART} STREQUAL on) +ENDIF() + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/${PROJECT_NAME}.conf DESTINATION /etc/dbus-1/system.d) + +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(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/systemd/ DESTINATION lib/systemd/system + FILES_MATCHING + PATTERN "*.service" + PATTERN "*.socket" + PATTERN "sdb-prestart.service" EXCLUDE + PATTERN "deviced-vibrator.service" EXCLUDE + PATTERN "usb-host*" EXCLUDE) + +IF(TIZEN_FEATURE_USBHOST_TEST STREQUAL on) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/usb-host-ffs-test-daemon.service + DESTINATION lib/systemd/system) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/usb-host-test.socket + DESTINATION lib/systemd/system) +ENDIF() + +ADD_SUBDIRECTORY(src/shared) +ADD_SUBDIRECTORY(src/libdeviced) +ADD_SUBDIRECTORY(src/devicectl) +IF(HAPTIC_MODULE STREQUAL on) + ADD_SUBDIRECTORY(src/haptic) +ENDIF() +IF(TIZEN_FEATURE_USBHOST_TEST STREQUAL on) + ADD_SUBDIRECTORY(src/usb-host-ffs-test-daemon) +ENDIF() diff --git a/packaging/libpass.manifest b/packaging/libpass.manifest new file mode 100644 index 0000000..3256181 --- /dev/null +++ b/packaging/libpass.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/pass.manifest b/packaging/pass.manifest new file mode 100644 index 0000000..97e8c31 --- /dev/null +++ b/packaging/pass.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/pass.spec b/packaging/pass.spec new file mode 100644 index 0000000..a872b5a --- /dev/null +++ b/packaging/pass.spec @@ -0,0 +1,326 @@ + +#These options are DEACTIVATED by default. +%bcond_with x +%bcond_with wayland +%bcond_with emulator + +%define daemon_name pass +%define libdaemon_name lib%{daemon_name} + +# display, extcon, power, usb are always enable +%define battery_module off +%define block_module on +%define TIZEN_FEATURE_BLOCK_SET_PERMISSION on +%define block_tmpfs off +%define display_module on +%define extcon_module on +%define haptic_module off +%define ir_module off +%define led_module off +%define power_module on +%define touchscreen_module off +%define tzip_module off +%define usb_module on +%define usbhost_module off +%define TIZEN_FEATURE_USBHOST_TEST off + +#Just For debugging +%define sdb_prestart off + +# Support two pattern combination vibration +%define standard_mix off + +%if "%{?profile}" == "mobile" +%define battery_module on +%define haptic_module on +%define ir_module on +%define led_module on +%define touchscreen_module on +%define tzip_module on +%define usbhost_module on +%define TIZEN_FEATURE_USBHOST_TEST on +%endif +%if "%{?profile}" == "wearable" +%define battery_module on +%define haptic_module on +%define touchscreen_module on +%define tzip_module on +%endif +%if "%{?profile}" == "tv" +%define block_tmpfs on +%define sdb_prestart off +%define usbhost_module on +%endif +%if "%{?profile}" == "ivi" +%if "%{?_repository}" == "x86_64" +%define TIZEN_FEATURE_BLOCK_SET_PERMISSION off +%endif +%endif + +Name: %{daemon_name} +Summary: PASS +Version: 0.0.1 +Release: 1 +Group: System/Management +License: Apache-2.0 +Source0: %{name}-%{version}.tar.gz +Source1: %{name}.manifest +Source2: %{libdaemon_name}.manifest + +BuildRequires: cmake +BuildRequires: libattr-devel +BuildRequires: gettext-devel +BuildRequires: pkgconfig(ecore) +BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(device-node) +BuildRequires: pkgconfig(edbus) +BuildRequires: pkgconfig(capi-base-common) +BuildRequires: pkgconfig(dbus-1) +BuildRequires: pkgconfig(dbus-glib-1) +BuildRequires: pkgconfig(libudev) +BuildRequires: pkgconfig(gio-2.0) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(eventsystem) +BuildRequires: pkgconfig(libtzplatform-config) +BuildRequires: pkgconfig(hwcommon) +%if %{?display_module} == on +%if %{with x} +BuildRequires: pkgconfig(x11) +BuildRequires: pkgconfig(xext) +%endif +BuildRequires: pkgconfig(libinput) +BuildRequires: pkgconfig(capi-system-sensor) +%endif +%if %{?block_module} == on +BuildRequires: pkgconfig(storage) +BuildRequires: pkgconfig(app2sd) +BuildRequires: pkgconfig(capi-system-info) +%endif +%if %{?tzip_module} == on +BuildRequires: pkgconfig(fuse) +BuildRequires: pkgconfig(minizip) +%endif +%if %{?TIZEN_FEATURE_USBHOST_TEST} == on +BuildRequires: pkgconfig(libkmod) +BuildRequires: pkgconfig(libusbg) +%endif + +Requires: %{name}-tools = %{version}-%{release} +%{?systemd_requires} +Requires(post): /usr/bin/vconftool + +%if %{?block_module} == on +Requires: /usr/bin/fsck_msdosfs +Requires: /usr/bin/newfs_msdos +%endif + +%description +PASS (Power-Aware System Service) + +%package %{daemon_name} +Summary: %{daemon_name} main +Group: main + +%description %{daemon_name} +PASS systemd daemon. + +%package tools +Summary: %{daemon_name} tools +Group: System/Utilities + +%description tools +PASS helper tools + +%package -n %{libdaemon_name} +Summary: PASS library +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description -n %{libdaemon_name} +PASS library for the helper tools. + +%package -n %{libdaemon_name}-devel +Summary: PASS library for (devel) +Group: Development/Libraries +Requires: %{libdaemon_name} = %{version}-%{release} + +%description -n %{libdaemon_name}-devel +Deviced library for device control (devel) + +%prep +%setup -q +%if %{with emulator} + %define ARCH emulator +%else + %ifarch %{arm} aarch64 + %define ARCH arm + %else + %define ARCH x86 + %endif +%endif + +%ifarch %{arm} %ix86 + %define ARCH_BIT 32 +%else + %define ARCH_BIT 64 +%endif + +%define DPMS none +%if %{with x} +%define DPMS x +%endif +%if %{with wayland} +%define DPMS wayland +%endif + +%if 0%{?tizen_build_devel_mode} == 1 +%define engineer_mode on +%else +%define engineer_mode off +%endif + +%cmake . \ + -DTZ_SYS_ETC=%TZ_SYS_ETC \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DARCH=%{ARCH} \ + -DARCH_BIT=%{ARCH_BIT} \ + -DDPMS=%{DPMS} \ + -DENGINEER_MODE=%{engineer_mode} \ + -DPROFILE=%{profile} \ + -DBATTERY_MODULE=%{battery_module} \ + -DBLOCK_MODULE=%{block_module} \ + -DTIZEN_FEATURE_BLOCK_SET_PERMISSION=%{TIZEN_FEATURE_BLOCK_SET_PERMISSION} \ + -DBLOCK_TMPFS=%{block_tmpfs} \ + -DDISPLAY_MODULE=%{display_module} \ + -DEXTCON_MODULE=%{extcon_module} \ + -DHAPTIC_MODULE=%{haptic_module} \ + -DSTANDARD_MIX=%{standard_mix} \ + -DIR_MODULE=%{ir_module} \ + -DLED_MODULE=%{led_module} \ + -DPOWER_MODULE=%{power_module} \ + -DSDB_PRESTART=%{sdb_prestart} \ + -DTOUCHSCREEN_MODULE=%{touchscreen_module} \ + -DTZIP_MODULE=%{tzip_module} \ + -DUSB_MODULE=%{usb_module} \ + -DUSBHOST_MODULE=%{usbhost_module} \ + -DTIZEN_FEATURE_USBHOST_TEST=%{TIZEN_FEATURE_USBHOST_TEST} \ + #eol + +%build +cp %{SOURCE1} . +cp %{SOURCE2} . +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +%install_service multi-user.target.wants %{daemon_name}.service +%install_service sockets.target.wants %{daemon_name}.socket + +%if %{?haptic_module} == on +%install_service multi-user.target.wants deviced-vibrator.service +%endif + +%if %{?usb_module} == on && %{?sdb_prestart} == on +%install_service basic.target.wants sdb-prestart.service +%endif + +%if %{?usbhost_module} == on +mkdir -p %{buildroot}%{_prefix}/lib/udev/rules.d +install -m 644 udev/99-usbhost.rules %{buildroot}%{_prefix}/lib/udev/rules.d/99-usbhost.rules +%endif + +%post +#memory type vconf key init +users_gid=$(getent group %{TZ_SYS_USER_GROUP} | cut -f3 -d':') + +systemctl daemon-reload +if [ "$1" == "1" ]; then + systemctl restart %{daemon_name}.service +%if %{?haptic_module} == on + systemctl restart deviced-vibrator.service +%endif +fi + +%preun +if [ "$1" == "0" ]; then + systemctl stop %{daemon_name}.service +%if %{?haptic_module} == on + systemctl stop deviced-vibrator.service +%endif +fi + +%postun +systemctl daemon-reload + +%post -n %{libdaemon_name} -p /sbin/ldconfig + +%postun -n %{libdaemon_name} -p /sbin/ldconfig + +%files -n %{daemon_name} +%manifest %{name}.manifest +%license LICENSE +%config %{_sysconfdir}/dbus-1/system.d/%{daemon_name}.conf +%{_bindir}/%{daemon_name} +%{_unitdir}/multi-user.target.wants/%{daemon_name}.service +%if %{?haptic_module} == on +%config %{_sysconfdir}/dbus-1/system.d/deviced-vibrator.conf +%{_unitdir}/deviced-vibrator.service +%{_unitdir}/multi-user.target.wants/deviced-vibrator.service +%{_bindir}/deviced-vibrator +%endif +%{_unitdir}/sockets.target.wants/%{daemon_name}.socket +%{_unitdir}/%{daemon_name}.service +%{_unitdir}/%{daemon_name}.socket +%if %{?battery_module} == on +%config %{_sysconfdir}/deviced/battery.conf +%endif +%if %{?block_module} == on +%if %{?TIZEN_FEATURE_BLOCK_SET_PERMISSION} == on +%{_bindir}/mmc-smack-label +%endif +%config %{_sysconfdir}/deviced/block.conf +%config %{_sysconfdir}/deviced/storage.conf +%endif +%if %{?display_module} == on +%config %{_sysconfdir}/deviced/display.conf +%endif +%if %{?usb_module} == on +%config %{_sysconfdir}/deviced/usb-operation.conf +%if %{?sdb_prestart} == on +%{_unitdir}/sdb-prestart.service +%{_unitdir}/basic.target.wants/sdb-prestart.service +%endif +%endif +%if %{?TIZEN_FEATURE_USBHOST_TEST} == on +%{_sysconfdir}/deviced/usb-host-test/test_gadget.gs +%{_bindir}/usb-host-ffs-test-daemon +%{_unitdir}/usb-host-ffs-test-daemon.service +%{_unitdir}/usb-host-test.socket +%{_sysconfdir}/deviced/usb-host-test/descs +%{_sysconfdir}/deviced/usb-host-test/strs +%endif + +%if %{?usbhost_module} == on +%{_prefix}/lib/udev/rules.d/99-usbhost.rules +%endif + +%files tools +%manifest %{name}.manifest +%{_bindir}/devicectl +%if %{?usb_module} == on +%{_bindir}/direct_set_debug.sh +%endif + +%files -n %{libdaemon_name} +%manifest %{libdaemon_name}.manifest +%defattr(-,root,root,-) +%{_libdir}/%{libdaemon_name}.so.* + +%files -n %{libdaemon_name}-devel +%defattr(-,root,root,-) +%{_includedir}/%{daemon_name}/*.h +%{_libdir}/%{libdaemon_name}.so +%{_libdir}/pkgconfig/%{daemon_name}.pc diff --git a/pass.pc.in b/pass.pc.in new file mode 100644 index 0000000..c3decdc --- /dev/null +++ b/pass.pc.in @@ -0,0 +1,14 @@ +# Package Information for pkg-config + +package_name=pass +prefix=@PREFIX@ +exec_prefix=@EXEC_PREFIX@ +libdir=@LIB_INSTALL_DIR@ +includedir=/usr/include/${package_name} + +Name: ${package_name} +Description: -- +Version: @VERSION@ +Requires: +Libs: -L${libdir} -l${package_name} +Cflags: -I${includedir} diff --git a/scripts/deviced-vibrator.conf b/scripts/deviced-vibrator.conf new file mode 100644 index 0000000..5b70ebb --- /dev/null +++ b/scripts/deviced-vibrator.conf @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + diff --git a/scripts/direct_set_debug.sh b/scripts/direct_set_debug.sh new file mode 100755 index 0000000..17c4224 --- /dev/null +++ b/scripts/direct_set_debug.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +load_usb_gadget() { + echo 0 > /sys/class/usb_mode/usb0/enable + echo 04e8 > /sys/class/usb_mode/usb0/idVendor + echo $1 > /sys/class/usb_mode/usb0/idProduct + echo $2 > /sys/class/usb_mode/usb0/funcs_fconf + echo $3 > /sys/class/usb_mode/usb0/funcs_sconf + echo 239 > /sys/class/usb_mode/usb0/bDeviceClass + echo 2 > /sys/class/usb_mode/usb0/bDeviceSubClass + echo 1 > /sys/class/usb_mode/usb0/bDeviceProtocol + echo 1 > /sys/class/usb_mode/usb0/enable +} + +unload_usb_gadget() { + echo 0 > /sys/class/usb_mode/usb0/enable +} + +sdb_set() { + load_usb_gadget "6860" "" "sdb" + /usr/bin/systemctl start sdbd.service + /usr/bin/vconftool set -t int memory/sysman/usb_status 2 -f + echo "SDB enabled" +} + +sdb_unset() { + unload_usb_gadget + /usr/bin/vconftool set -t int memory/sysman/usb_status 0 -f + /usr/bin/systemctl stop sdbd.service + echo "SDB disabled" +} + +show_options() { + echo "direct_set_debug.sh: usage:" + echo " --help This message" + echo " --sdb-set Load sdb without usb-manager" + echo " --sdb-unset Unload sdb without usb-manager" +} + +case "$1" in +"--sdb-set") + sdb_set + ;; + +"--sdb-unset") + sdb_unset + ;; + +"--help") + show_options + ;; + +*) + echo "Wrong parameters. Please use option --help to check options " + ;; +esac diff --git a/scripts/mmc-smack-label b/scripts/mmc-smack-label new file mode 100755 index 0000000..c206758 --- /dev/null +++ b/scripts/mmc-smack-label @@ -0,0 +1,12 @@ +#!/bin/bash + +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +source /etc/tizen-platform.conf +MOUNT_DIRECTORY=$1 +find $MOUNT_DIRECTORY -type d | xargs chsmack -a '*' -t +find $MOUNT_DIRECTORY -type f | xargs chsmack -a '*' +find $MOUNT_DIRECTORY -type d | xargs chmod 770 +find $MOUNT_DIRECTORY -type f | xargs chmod 660 +find $MOUNT_DIRECTORY -type d | xargs chown root:priv_externalstorage +find $MOUNT_DIRECTORY -type f | xargs chown root:priv_externalstorage diff --git a/scripts/pass.conf b/scripts/pass.conf new file mode 100644 index 0000000..5432b90 --- /dev/null +++ b/scripts/pass.conf @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libdeviced/CMakeLists.txt b/src/libdeviced/CMakeLists.txt index 8ca1402..28e0e2c 100755 --- a/src/libdeviced/CMakeLists.txt +++ b/src/libdeviced/CMakeLists.txt @@ -1,7 +1,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(libdeviced C) +PROJECT(libpass C) -SET(LIBDEVICED_SRCS +SET(MAIN_PRJ_NAME pass) + +SET(LIBPASS_SRCS display.c dbus.c haptic.c @@ -31,12 +33,12 @@ FOREACH(flag ${libpkgs_CFLAGS}) ENDFOREACH(flag) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_LIB_CFLAGS}") -# libdeviced -ADD_LIBRARY(${PROJECT_NAME} SHARED ${LIBDEVICED_SRCS}) +# libpass +ADD_LIBRARY(${PROJECT_NAME} SHARED ${LIBPASS_SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${libpkgs_LDFLAGS}) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) # CMake Policy (CMP0002) # The logical name of executable and library targes # does not have to correspond to the physical file name built. -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES OUTPUT_NAME deviced) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${MAIN_PRJ_NAME}) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) diff --git a/systemd/deviced-vibrator.service b/systemd/deviced-vibrator.service new file mode 100644 index 0000000..26f06a6 --- /dev/null +++ b/systemd/deviced-vibrator.service @@ -0,0 +1,18 @@ +[Unit] +Description=System Vibrator Daemon +After=deviced.service + +[Service] +BusName=org.tizen.system.vibrator +SmackProcessLabel=System +ExecStart=/usr/bin/deviced-vibrator +Restart=always +RestartSec=0 +KillSignal=SIGUSR1 +CapabilityBoundingSet=~CAP_MAC_ADMIN +CapabilityBoundingSet=~CAP_MAC_OVERRIDE +User=system_fw +Group=system_fw + +[Install] +WantedBy=multi-user.target diff --git a/systemd/pass.service b/systemd/pass.service new file mode 100644 index 0000000..ec30d82 --- /dev/null +++ b/systemd/pass.service @@ -0,0 +1,12 @@ +[Unit] +Description=System device daemon + +[Service] +SmackProcessLabel=System::Privileged +ExecStart=/usr/bin/deviced +Restart=always +RestartSec=0 +KillSignal=SIGUSR1 + +[Install] +WantedBy=multi-user.target diff --git a/systemd/pass.socket b/systemd/pass.socket new file mode 100644 index 0000000..aa36429 --- /dev/null +++ b/systemd/pass.socket @@ -0,0 +1,10 @@ +[Unit] +Description=System server socket + +[Socket] +ListenStream=/tmp/sn +SocketMode=0777 +PassCredentials=yes +SmackLabelIPIn=* +SmackLabelIPOut=@ +Accept=false diff --git a/systemd/sdb-prestart.service b/systemd/sdb-prestart.service new file mode 100644 index 0000000..4c6d4c5 --- /dev/null +++ b/systemd/sdb-prestart.service @@ -0,0 +1,10 @@ +[Unit] +Description=Enadle sdb at booting time +DefaultDependencies=no + +[Service] +SmackProcessLabel=System +ExecStart=/usr/bin/direct_set_debug.sh --sdb-set + +[Install] +WantedBy=basic.target diff --git a/systemd/usb-host-ffs-test-daemon.service b/systemd/usb-host-ffs-test-daemon.service new file mode 100644 index 0000000..08572af --- /dev/null +++ b/systemd/usb-host-ffs-test-daemon.service @@ -0,0 +1,7 @@ +[Unit] +Description=FFS daemon required by usb-host test suite + +[Service] +ExecStart=/usr/bin/usb-host-ffs-test-daemon +USBFunctionDescriptors=/etc/deviced/usb-host-test/descs +USBFunctionStrings=/etc/deviced/usb-host-test/strs diff --git a/systemd/usb-host-test.socket b/systemd/usb-host-test.socket new file mode 100644 index 0000000..abcbc08 --- /dev/null +++ b/systemd/usb-host-test.socket @@ -0,0 +1,6 @@ +[Unit] +Description=USB test functionfs socket + +[Socket] +ListenUSBFunction=/run/usb-host-test-ffs +Service=usb-host-ffs-test-daemon.service -- 2.7.4