create libdeviced.so
authorjy910.yun <jy910.yun@samsung.com>
Fri, 22 Mar 2013 08:33:55 +0000 (17:33 +0900)
committerjy910.yun <jy910.yun@samsung.com>
Fri, 22 Mar 2013 08:33:55 +0000 (17:33 +0900)
this library is empty library, will be implement by system f/w developers.

CMakeLists.txt
deviced.pc.in [new file with mode: 0644]
packaging/deviced.manifest [new file with mode: 0644]
packaging/system-server.spec
src/deviced/dd-battery.h [new file with mode: 0644]
src/shared/battery.c [new file with mode: 0644]
src/shared/log.h [new file with mode: 0644]

index 8ad3a00..1a2c7f8 100755 (executable)
@@ -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 (file)
index 0000000..3de6ff0
--- /dev/null
@@ -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 (file)
index 0000000..3256181
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+<request>
+       <domain name="_"/>
+</request>
+</manifest>
index 52eec69..bdf5c50 100755 (executable)
@@ -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 (file)
index 0000000..78fd9b3
--- /dev/null
@@ -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 (file)
index 0000000..7d7d238
--- /dev/null
@@ -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 <stdio.h>
+#include <vconf.h>
+#include <errno.h>
+#include <device-node.h>
+
+#include "log.h"
+#include "dd-battery.h"
diff --git a/src/shared/log.h b/src/shared/log.h
new file mode 100644 (file)
index 0000000..78e7e47
--- /dev/null
@@ -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 <stdio.h>
+
+#if defined(ENABLE_DLOG_OUT)
+#define LOG_TAG                "DEVICED"
+#include <dlog.h>
+#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 <syslog.h>
+#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<g_trace_depth;___i++)\
+               {\
+                       fprintf(stdout, "  "); \
+               }\
+               fprintf(stdout,\
+                       "[%s:%d] "fmt"\n", __FUNCTION__, __LINE__,##arg); \
+               __LOGD(prio, fmt, ##arg); \
+       } while (0) */
+#define __PRT_TRACE_ERR(prio, fmt, arg...) \
+       do { __LOGD(prio, fmt, ##arg); } while (0)
+/*     do { \
+               int ___i;\
+               for(___i=0;___i<g_trace_depth;___i++)\
+               {\
+                       fprintf(stdout, "  "); \
+               }\
+               printf(\
+                       "%c[1;31m[%s:%d] "fmt"%c[0m\n",27, __FUNCTION__, __LINE__,##arg,27); \
+               __LOGD(prio, fmt, ##arg); \
+       } while (0)*/
+#define __PRT_TRACE_EM(prio, fmt, arg...) \
+       do { __LOGD(prio, fmt, ##arg); } while (0)
+/*     do { \
+               int ___i;\
+               for(___i=0;___i<g_trace_depth;___i++)\
+               {\
+                       fprintf(stdout, "  "); \
+               }\
+               printf(\
+                       "%c[1;34m[%s:%d] "fmt"%c[0m\n",27, __FUNCTION__, __LINE__,##arg,27); \
+               __LOGD(prio, fmt, ##arg); \
+       } while (0)*/
+#endif
+
+#define _NOUT(prio, fmt, arg...) do { } while (0)
+
+#ifdef DEBUG
+#  define _LOGD __LOGD
+#  define _LOG  __LOGD
+#  define _PRTD __PRTD
+#  define _PRT  __PRTD
+#  define _PRT_TRACE __PRT_TRACE
+#  define _PRT_TRACE_ERR __PRT_TRACE_ERR
+#  define _PRT_TRACE_EM __PRT_TRACE_EM
+#else
+#  define _LOGD _NOUT
+#  define _LOG  __LOG
+#  define _PRTD _NOUT
+#  define _PRT  __PRT
+#  define _PRT_TRACE _NOUT
+#  define _PRT_TRACE_ERR _NOUT
+#  define _PRT_TRACE_EM _NOUT
+#endif
+
+#define PRT_INFO(fmt, arg...) _PRT(LOG_INFO, fmt, ##arg)
+#define PRT_ERR(fmt, arg...) _PRT(LOG_ERR, fmt, ##arg)
+#define PRT_DBG(fmt, arg...) _PRTD(LOG_DEBUG, fmt, ##arg)
+#define PRT_TRACE(fmt, arg...) _PRT_TRACE(LOG_DEBUG, fmt, ##arg)
+#define PRT_TRACE_ERR(fmt, arg...) _PRT_TRACE_ERR(LOG_ERR, fmt, ##arg)
+#define PRT_TRACE_EM(fmt, arg...) _PRT_TRACE_EM(LOG_DEBUG, fmt, ##arg)
+
+#if defined(SYSLOG_OUT)
+#  define SYSLOG_INFO(fmt, arg...) _LOG(LOG_INFO, fmt, ##arg)
+#  define SYSLOG_ERR(fmt, arg...) _LOG(LOG_ERR, fmt, ##arg)
+#  define SYSLOG_DBG(fmt, arg...) _LOGD(LOG_DEBUG, fmt, ##arg)
+#  define INFO SYSLOG_INFO
+#  define ERR SYSLOG_ERR
+#  define DBG SYSLOG_DBG
+#elif defined(ENABLE_DLOG_OUT)
+#  define INFO SLOGI
+#  define ERR SLOGE
+#  define DBG SLOGD
+#else
+#  define INFO PRT_INFO
+#  define ERR PRT_ERR
+#  define DBG PRT_DBG
+#endif
+
+#endif