From 9adef843d11172a625a6e17b1688cf5a1ccff36e Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Fri, 19 Jan 2018 17:01:41 +0900 Subject: [PATCH] Seperate haptic driver rpms and configuration rpms Change-Id: I17321f88d8602c9d92071fd1bab8d203bb2fe1e0 Signed-off-by: pr.jung --- CMakeLists.txt | 23 +- packaging/feedbackd.spec | 277 +++++++++++++++------ .../haptic-level3.conf} | 0 .../haptic-level6.conf} | 0 src/haptic/haptic-iot.conf | 24 -- src/haptic/haptic.c | 2 + src/haptic/standard-vibcore.c | 2 - 7 files changed, 210 insertions(+), 118 deletions(-) rename src/haptic/{haptic-wearable.conf => conf/haptic-level3.conf} (100%) rename src/haptic/{haptic-mobile.conf => conf/haptic-level6.conf} (100%) delete mode 100644 src/haptic/haptic-iot.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index 63c0854..974f5a7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,15 +16,20 @@ SET(SRCS src/core/log.c src/core/dbus.c src/haptic/haptic.c - src/haptic/external.c - src/haptic/emulator.c - src/haptic/circle.c ) -IF(STANDARD_MIX STREQUAL on) - SET(SRCS ${SRCS} src/haptic/standard-mix.c) -ELSE() +IF(DRIVER STREQUAL external) + SET(SRCS ${SRCS} src/haptic/external.c) +ELSEIF(DRIVER STREQUAL emulator) + SET(SRCS ${SRCS} src/haptic/emulator.c) +ELSEIF(DRIVER STREQUAL gpio) + SET(SRCS ${SRCS} src/haptic/gpio_haptic.c src/haptic/standard-vibcore.c) +ELSEIF(DRIVER STREQUAL standard) SET(SRCS ${SRCS} src/haptic/standard.c src/haptic/standard-vibcore.c) +ELSEIF(DRIVER STREQUAL circle) + SET(SRCS ${SRCS} src/haptic/circle.c src/haptic/standard-vibcore.c) +ELSEIF(DRIVER STREQUAL mix) + SET(SRCS ${SRCS} src/haptic/standard-mix.c) ENDIF() INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src) @@ -40,8 +45,7 @@ SET(PKG_MODULES capi-system-info ) -IF(GPIO_HAPTIC STREQUAL on) - SET(SRCS ${SRCS} src/haptic/gpio_haptic.c) +IF(DRIVER STREQUAL gpio) SET(PKG_MODULES ${PKG_MODULES} capi-system-peripheral-io) ENDIF() @@ -68,4 +72,5 @@ INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/systemd/ DESTINATION lib/systemd/system FILES_MATCHING PATTERN "feedbackd.service") -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/haptic/haptic-${PROFILE}.conf DESTINATION /etc/feedbackd) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/haptic/conf/haptic-level3.conf DESTINATION /etc/feedbackd) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/haptic/conf/haptic-level6.conf DESTINATION /etc/feedbackd) diff --git a/packaging/feedbackd.spec b/packaging/feedbackd.spec index 69e1a79..8c2985e 100644 --- a/packaging/feedbackd.spec +++ b/packaging/feedbackd.spec @@ -29,7 +29,10 @@ BuildRequires: pkgconfig(capi-system-peripheral-io) Requires(post): /usr/bin/vconftool Requires: %{name}-compat = %{version}-%{release} -Recommends: %{name}-profile_mobile = %{version}-%{release} +Recommends: %{name}-driver-standard = %{version}-%{release} + +Requires: configuration-compat = %{version}-%{release} +Recommends: %{name}-conf-level6 = %{version}-%{release} %description feedback daemon @@ -41,107 +44,175 @@ Group: main %description feedbackd feedback daemon. -# if profile = mobile or common or undefined -%package profile_mobile -Summary: Deviced binaries targeting mobile profile +# if driver = external or undefined +%package driver-external +Summary: Feedbackd binaries targeting external plugin +Provides: %{name}-compat = %{version}-%{release} +Conflicts: %{name}-driver-emulator +Conflicts: %{name}-driver-gpio +Conflicts: %{name}-driver-standard +Conflicts: %{name}-driver-circle +%description driver-external +Feedbackd binaries with external plugin. Required by main feedbackd package +# if driver = emulator or undefined +%package driver-emulator +Summary: Feedbackd binaries targeting emulator plugin Provides: %{name}-compat = %{version}-%{release} -Conflicts: %{name}-profile_wearable -Conflicts: %{name}-profile_iot -%description profile_mobile -Deviced binaries targeting mobile profile. Required by main deviced package -# if profile = wearable or common or undefined -%package profile_wearable -Summary: Deviced binaries targeting wearable profile +Conflicts: %{name}-driver-external +Conflicts: %{name}-driver-gpio +Conflicts: %{name}-driver-standard +Conflicts: %{name}-driver-circle +%description driver-emulator +Feedbackd binaries with emulator plugin. Required by main feedbackd package +# if driver = gpio or undefined +%package driver-gpio +Summary: Feedbackd binaries targeting gpio plugin Provides: %{name}-compat = %{version}-%{release} -Conflicts: %{name}-profile_mobile -Conflicts: %{name}-profile_iot -%description profile_wearable -Deviced binaries targeting wearable profile. Required by main deviced package -# if profile = iot or common or undefined -%package profile_iot -Summary: Deviced binaries targeting iot profile +Conflicts: %{name}-driver-external +Conflicts: %{name}-driver-emulator +Conflicts: %{name}-driver-standard +Conflicts: %{name}-driver-circle +%description driver-gpio +Feedbackd binaries with gpio plugin. Required by main feedbackd package +# if driver = standard or undefined +%package driver-standard +Summary: Feedbackd binaries targeting emulator plugin Provides: %{name}-compat = %{version}-%{release} -Conflicts: %{name}-profile_mobile -Conflicts: %{name}-profile_wearable -%description profile_iot -Deviced binaries targeting iot profile. Required by main deviced package +Conflicts: %{name}-driver-external +Conflicts: %{name}-driver-emulator +Conflicts: %{name}-driver-gpio +Conflicts: %{name}-driver-circle +%description driver-standard +Feedbackd binaries with standard plugin. Required by main feedbackd package +# if driver = circle or undefined +%package driver-circle +Summary: Feedbackd binaries targeting circle plugin +Provides: %{name}-compat = %{version}-%{release} +Conflicts: %{name}-driver-external +Conflicts: %{name}-driver-emulator +Conflicts: %{name}-driver-gpio +Conflicts: %{name}-driver-standard +%description driver-circle +Feedbackd binaries with circle plugin. Required by main feedbackd package + +%package conf-level3 +Summary: Feedbackd configuration file +Provides: configuration-compat = %{version}-%{release} +Conflicts: %{name}-conf-level6 +%description conf-level3 +Feedbackd configuration file. + +%package conf-level6 +Summary: Feedbackd configuration file +Provides: configuration-compat = %{version}-%{release} +Conflicts: %{name}-conf-level3 +%description conf-level6 +Feedbackd configuration file. %prep %setup -q -# Build per profile -# if profile = mobile or common or undefined -mkdir -p build_mobile -pushd build_mobile +# Build per driver +# if driver = external or undefined +mkdir -p build_external +pushd build_external +%cmake .. \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DDRIVER=external \ + #eol +popd + +# if driver = emulator or undefined +mkdir -p build_emulator +pushd build_emulator +%cmake .. \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DDRIVER=emulator \ + #eol +popd + +# if driver = gpio or undefined +mkdir -p build_gpio +pushd build_gpio %cmake .. \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ - -DPROFILE=mobile \ - -DSTANDARD_MIX=%{standard_mix} \ - -DGPIO_HAPTIC=off \ + -DDRIVER=gpio \ #eol popd -# if profile = wearable or common or undefined -mkdir -p build_wearable -pushd build_wearable +# if driver = standard or undefined +mkdir -p build_standard +pushd build_standard %cmake .. \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ - -DPROFILE=wearable \ - -DSTANDARD_MIX=%{standard_mix} \ - -DGPIO_HAPTIC=off \ + -DDRIVER=standard \ #eol popd -# Build per profile -# if profile = iot or common or undefined -mkdir -p build_iot -pushd build_iot +# if driver = circle or undefined +mkdir -p build_circle +pushd build_circle %cmake .. \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ - -DPROFILE=iot \ - -DSTANDARD_MIX=%{standard_mix} \ - -DGPIO_HAPTIC=on \ + -DDRIVER=circle \ #eol popd %build cp %{SOURCE1} . -# Build per profile -# if profile = mobile or common or undefined -pushd build_mobile +# Build per driver +# if driver = external or undefined +pushd build_external make %{?jobs:-j%jobs} popd -# if profile = wearable or common or undefined -pushd build_wearable +# if driver = emulator or undefined +pushd build_emulator make %{?jobs:-j%jobs} popd -# if profile = iot or common or undefined -pushd build_iot +# if driver = gpio or undefined +pushd build_gpio +make %{?jobs:-j%jobs} +popd + +# if driver = standard or undefined +pushd build_standard +make %{?jobs:-j%jobs} +popd + +# if driver = circle or undefined +pushd build_circle make %{?jobs:-j%jobs} popd %install rm -rf %{buildroot} -# Build per profile -# if profile = mobile or common or undefined -pushd build_mobile +# Build per driver +pushd build_external %make_install -mv %{buildroot}%{_bindir}/feedbackd %{buildroot}%{_bindir}/feedbackd.mobile +mv %{buildroot}%{_bindir}/feedbackd %{buildroot}%{_bindir}/feedbackd.external popd -# if profile = wearable or common or undefined -pushd build_wearable +pushd build_emulator %make_install -mv %{buildroot}%{_bindir}/feedbackd %{buildroot}%{_bindir}/feedbackd.wearable +mv %{buildroot}%{_bindir}/feedbackd %{buildroot}%{_bindir}/feedbackd.emulator popd -# if profile = iot or common or undefined -pushd build_iot +pushd build_gpio %make_install -mv %{buildroot}%{_bindir}/feedbackd %{buildroot}%{_bindir}/feedbackd.iot +mv %{buildroot}%{_bindir}/feedbackd %{buildroot}%{_bindir}/feedbackd.gpio +popd + +pushd build_standard +%make_install +mv %{buildroot}%{_bindir}/feedbackd %{buildroot}%{_bindir}/feedbackd.standard +popd + +pushd build_circle +%make_install +mv %{buildroot}%{_bindir}/feedbackd %{buildroot}%{_bindir}/feedbackd.circle popd %install_service multi-user.target.wants feedbackd.service @@ -152,39 +223,62 @@ if [ "$1" == "1" ]; then systemctl restart feedbackd.service fi -%post profile_mobile -mv %{_bindir}/feedbackd.mobile %{_bindir}/feedbackd -mv %{_sysconfdir}/feedbackd/haptic-mobile.conf %{_sysconfdir}/feedbackd/haptic.conf +%post driver-external +mv %{_bindir}/feedbackd.external %{_bindir}/feedbackd -%preun profile_mobile -mv %{_bindir}/feedbackd %{_bindir}/feedbackd.mobile +%preun driver-external +mv %{_bindir}/feedbackd %{_bindir}/feedbackd.external if [ "$1" == "0" ]; then systemctl stop feedbackd.service fi -%post profile_wearable -mv %{_bindir}/feedbackd.wearable %{_bindir}/feedbackd -mv %{_sysconfdir}/feedbackd/haptic-wearable.conf %{_sysconfdir}/feedbackd/haptic.conf +%post driver-emulator +mv %{_bindir}/feedbackd.emulator %{_bindir}/feedbackd -%preun profile_wearable -mv %{_bindir}/feedbackd %{_bindir}/feedbackd.wearable +%preun driver-emulator +mv %{_bindir}/feedbackd %{_bindir}/feedbackd.emulator if [ "$1" == "0" ]; then systemctl stop feedbackd.service fi -%post profile_iot -mv %{_bindir}/feedbackd.iot %{_bindir}/feedbackd -mv %{_sysconfdir}/feedbackd/haptic-iot.conf %{_sysconfdir}/feedbackd/haptic.conf +%post driver-gpio +mv %{_bindir}/feedbackd.gpio %{_bindir}/feedbackd -%preun profile_iot -mv %{_bindir}/feedbackd %{_bindir}/feedbackd.iot +%preun driver-gpio +mv %{_bindir}/feedbackd %{_bindir}/feedbackd.gpio if [ "$1" == "0" ]; then systemctl stop feedbackd.service fi +%post driver-standard +mv %{_bindir}/feedbackd.standard %{_bindir}/feedbackd + +%preun driver-standard +mv %{_bindir}/feedbackd %{_bindir}/feedbackd.standard + +if [ "$1" == "0" ]; then + systemctl stop feedbackd.service +fi + +%post driver-circle +mv %{_bindir}/feedbackd.circle %{_bindir}/feedbackd + +%preun driver-circle +mv %{_bindir}/feedbackd %{_bindir}/feedbackd.circle + +if [ "$1" == "0" ]; then + systemctl stop feedbackd.service +fi + +%post conf-level3 +mv %{_sysconfdir}/feedbackd/haptic-level3.conf %{_sysconfdir}/feedbackd/haptic.conf + +%post conf-level6 +mv %{_sysconfdir}/feedbackd/haptic-level6.conf %{_sysconfdir}/feedbackd/haptic.conf + %files -n feedbackd %manifest %{name}.manifest %license LICENSE @@ -192,21 +286,38 @@ fi %{_unitdir}/feedbackd.service %{_unitdir}/multi-user.target.wants/feedbackd.service -%files profile_mobile +%files driver-external +%license LICENSE +%manifest %{name}.manifest +%{_bindir}/feedbackd.external + +%files driver-emulator +%license LICENSE +%manifest %{name}.manifest +%{_bindir}/feedbackd.emulator + +%files driver-gpio +%license LICENSE +%manifest %{name}.manifest +%{_bindir}/feedbackd.gpio + +%files driver-standard +%license LICENSE +%manifest %{name}.manifest +%{_bindir}/feedbackd.standard + +%files driver-circle %license LICENSE %manifest %{name}.manifest -%config %{_sysconfdir}/feedbackd/haptic-mobile.conf -%{_bindir}/feedbackd.mobile +%{_bindir}/feedbackd.circle -%files profile_wearable +%files conf-level3 %license LICENSE %manifest %{name}.manifest -%config %{_sysconfdir}/feedbackd/haptic-wearable.conf -%{_bindir}/feedbackd.wearable +%config %{_sysconfdir}/feedbackd/haptic-level3.conf -%files profile_iot +%files conf-level6 %license LICENSE %manifest %{name}.manifest -%config %{_sysconfdir}/feedbackd/haptic-iot.conf -%{_bindir}/feedbackd.iot +%config %{_sysconfdir}/feedbackd/haptic-level6.conf diff --git a/src/haptic/haptic-wearable.conf b/src/haptic/conf/haptic-level3.conf similarity index 100% rename from src/haptic/haptic-wearable.conf rename to src/haptic/conf/haptic-level3.conf diff --git a/src/haptic/haptic-mobile.conf b/src/haptic/conf/haptic-level6.conf similarity index 100% rename from src/haptic/haptic-mobile.conf rename to src/haptic/conf/haptic-level6.conf diff --git a/src/haptic/haptic-iot.conf b/src/haptic/haptic-iot.conf deleted file mode 100644 index 84271f1..0000000 --- a/src/haptic/haptic-iot.conf +++ /dev/null @@ -1,24 +0,0 @@ -[Haptic] -# level -# how much does the vibration level to subdivide. -# The max value of vibration level fixed at 100. -# The min value of vibration level fixed at 0. -level=6 - -[level0] -value=0 - -[level1] -value=20 - -[level2] -value=40 - -[level3] -value=60 - -[level4] -value=80 - -[level5] -value=100 diff --git a/src/haptic/haptic.c b/src/haptic/haptic.c index d9521a5..6741a58 100644 --- a/src/haptic/haptic.c +++ b/src/haptic/haptic.c @@ -95,6 +95,8 @@ static int haptic_stop(void); static int haptic_internal_init(void); static int remove_haptic_info(struct haptic_info *info); +struct haptic_data cur_h_data; + void add_haptic(const struct haptic_ops *ops) { DD_LIST_APPEND(h_head, (void *)ops); diff --git a/src/haptic/standard-vibcore.c b/src/haptic/standard-vibcore.c index 4e40c22..09ce668 100644 --- a/src/haptic/standard-vibcore.c +++ b/src/haptic/standard-vibcore.c @@ -44,8 +44,6 @@ static Ecore_Timer *duration_timer; static t_vibrate_monotone real_vibrate_monotone; -struct haptic_data cur_h_data; - static int vibration_load_config(struct parse_result *result, void *user_data) { struct vibration_config *conf; -- 2.7.4