From: jy910.yun Date: Fri, 22 Mar 2013 08:33:55 +0000 (+0900) Subject: create libdeviced.so X-Git-Tag: submit/tizen_2.2/20130627.045845~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d2a0ae31c732a0fd885405ed304c05d8bfa45482;p=platform%2Fcore%2Fsystem%2Fsystem-server.git create libdeviced.so this library is empty library, will be implement by system f/w developers. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ad3a00..1a2c7f8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,10 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(system_server C) +# deviced +SET(DEVICED_NAME deviced) +SET(VERSION 0.1.0) + SET(SRCS ss_main.c ss_sysnoti.c @@ -25,8 +29,18 @@ SET(SRCS ss_vibrator.c ) +# libdeviced +SET(DEVICED_SRCS + src/shared/battery.c) + +SET(DEVICED_HEADERS + src/deviced/dd-battery.h) + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +# libdeviced +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/deviced) + SET(MOVINAND_FORMAT movi_format.sh) INCLUDE(FindPkgConfig) @@ -49,6 +63,9 @@ FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) +# libdeviced +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") @@ -57,7 +74,7 @@ MESSAGE("FLAGS: ${CMAKE_C_FLAGS}") ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") -IF( $ENV{ARCH} MATCHES "arm" ) +IF( $ENV{ARCH} MATCHES "arm" ) ADD_DEFINITIONS("-DTARGET") ENDIF() ADD_DEFINITIONS("-DDEBUG -DENABLE_DLOG_OUT") @@ -67,10 +84,23 @@ SET(UDEV_RULES udev-rules/91-system-server.rules) CONFIGURE_FILE(${UDEV_RULES}.in ${UDEV_RULES} @ONLY) +# libdeviced +ADD_LIBRARY(${DEVICED_NAME} SHARED ${DEVICED_SRCS}) +TARGET_LINK_LIBRARIES(${DEVICED_NAME} ${pkgs_LDFLAGS}) +SET_TARGET_PROPERTIES(${DEVICED_NAME} PROPERTIES VERSION ${VERSION}) +INSTALL(TARGETS ${DEVICED_NAME} DESTINATION lib COMPONENT RuntimeLibraries) + +FOREACH(hfile ${DEVICED_HEADERS}) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/${DEVICED_NAME}) +ENDFOREACH(hfile) + +CONFIGURE_FILE(${DEVICED_NAME}.pc.in ${DEVICED_NAME}.pc @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DEVICED_NAME}.pc DESTINATION lib/pkgconfig) + ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-ldl") - INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) + INSTALL(FILES ${MOVINAND_FORMAT} DESTINATION bin) INSTALL(FILES ${UDEV_RULES} DESTINATION ${UDEV_RULES_PATH}) INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/system_server.sh DESTINATION /etc/rc.d/init.d) diff --git a/deviced.pc.in b/deviced.pc.in new file mode 100644 index 0000000..3de6ff0 --- /dev/null +++ b/deviced.pc.in @@ -0,0 +1,13 @@ +# Package Information for pkg-config + +prefix=@PREFIX@ +exec_prefix=@EXEC_PREFIX@ +libdir=/usr/lib +includedir=/usr/include/deviced + +Name: deviced library +Description: Tizen platform device control library +Version: @VERSION@ +Requires: +Libs: -L${libdir} -ldeviced +Cflags: -I${includedir} diff --git a/packaging/deviced.manifest b/packaging/deviced.manifest new file mode 100644 index 0000000..3256181 --- /dev/null +++ b/packaging/deviced.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/system-server.spec b/packaging/system-server.spec index 52eec69..bdf5c50 100755 --- a/packaging/system-server.spec +++ b/packaging/system-server.spec @@ -8,6 +8,7 @@ License: Apache License, Version 2.0 Source0: system-server-%{version}.tar.gz Source1: system-server.service Source2: system-server.manifest +Source3: deviced.manifest BuildRequires: cmake BuildRequires: libattr-devel BuildRequires: pkgconfig(ecore) @@ -34,12 +35,28 @@ Requires(postun): /usr/bin/systemctl %description Description: System server +%package -n libdeviced +Summary: Deviced library +Group: Development/Libraries + +%description -n libdeviced +Deviced library for device control + +%package -n libdeviced-devel +Summary: Deviced library for (devel) +Group: Development/Libraries +Requires: libdeviced = %{version}-%{release} + +%description -n libdeviced-devel +Deviced library for device control (devel) + %prep %setup -q cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} %build cp %{SOURCE2} . +cp %{SOURCE3} . make %{?jobs:-j%jobs} %install @@ -147,3 +164,14 @@ systemctl daemon-reload %{_datadir}/system-server/udev-rules/91-system-server.rules %{_datadir}/system-server/sys_device_noti/res/locale/*/LC_MESSAGES/*.mo %{_datadir}/system-server/sys_pci_noti/res/locale/*/LC_MESSAGES/*.mo + +%files -n libdeviced +%defattr(-,root,root,-) +%{_libdir}/libdeviced.so.* +%manifest deviced.manifest + +%files -n libdeviced-devel +%defattr(-,root,root,-) +%{_includedir}/deviced/dd-battery.h +%{_libdir}/libdeviced.so +%{_libdir}/pkgconfig/deviced.pc \ No newline at end of file diff --git a/src/deviced/dd-battery.h b/src/deviced/dd-battery.h new file mode 100644 index 0000000..78fd9b3 --- /dev/null +++ b/src/deviced/dd-battery.h @@ -0,0 +1,35 @@ +/* + * deviced + * Copyright (c) 2012 - 2013 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. + */ + + +#ifndef __DD_BATTERY_H__ +#define __DD_BATTERY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file dd-battery.h + * @ingroup DEVICED_LIBRARY + * @brief This file provides for control of battery + */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/shared/battery.c b/src/shared/battery.c new file mode 100644 index 0000000..7d7d238 --- /dev/null +++ b/src/shared/battery.c @@ -0,0 +1,25 @@ +/* + * deviced + * Copyright (c) 2012 - 2013 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 +#include +#include +#include + +#include "log.h" +#include "dd-battery.h" diff --git a/src/shared/log.h b/src/shared/log.h new file mode 100644 index 0000000..78e7e47 --- /dev/null +++ b/src/shared/log.h @@ -0,0 +1,138 @@ +/* + * deviced + * Copyright (c) 2012 - 2013 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. + */ + + +#ifndef __LOG_H__ +#define __LOG_H__ + +#include + +#if defined(ENABLE_DLOG_OUT) +#define LOG_TAG "DEVICED" +#include +#define DLOG_ERR DLOG_ERROR +#define __LOG(prio, fmt, arg...) \ + do { SLOG(prio, LOG_TAG, fmt, ##arg); } while (0) +#define __LOGD(prio, fmt, arg...) \ + do { SLOG(prio, LOG_TAG, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); } while (0) +#define __PRT(prio, fmt, arg...) \ + do { fprintf(((D##prio) == DLOG_ERR ? stderr : stdout), fmt"\n", ##arg); } while (0) +#define __PRTD(prio, fmt, arg...) \ + do { \ + fprintf(((D##prio) == DLOG_ERR ? stderr : stdout), \ + "%s: %s(%d) > "fmt"\n", __MODULE__, __func__, __LINE__, ##arg); \ + } while (0) +#else +#include +#define __LOG(prio, fmt, arg...) \ + do { syslog(prio, fmt, ##arg); } while (0) +#define __LOGD(prio, fmt, arg...) \ + do { syslog(prio, "%s: %s(%d) > "fmt"\n", __MODULE__, __func__, __LINE__, ##arg); } while (0) +#define __PRT(prio, fmt, arg...) \ + do { fprintf(((prio) == LOG_ERR ? stderr : stdout), fmt"\n", ##arg); } while (0) +#define __PRTD(prio, fmt, arg...) \ + do { \ + fprintf(((prio) == LOG_ERR ? stderr : stdout), \ + "%s: %s(%d) > "fmt"\n", __MODULE__, __func__, __LINE__, ##arg); \ + } while (0) +#endif + +#ifdef DEBUG +extern int g_trace_depth; +#define __PRT_TRACE(prio, fmt, arg...) \ + do { __LOGD(prio, fmt, ##arg); } while (0) +/* do { \ + int ___i;\ + for(___i=0;___i