use dbus notifier for mounting mmc card instead of vconf callback 87/15187/1
authorByungsoo Kim <bs1770.kim@samsung.com>
Mon, 10 Jun 2013 15:17:26 +0000 (00:17 +0900)
committerKrzysztof Sasiak <k.sasiak@samsung.com>
Thu, 16 Jan 2014 15:26:26 +0000 (16:26 +0100)
Change-Id: Iebfe1e92fd1f14176a3d10c60ac287b7620d1674
Signed-off-by: Byungsoo Kim <bs1770.kim@samsung.com>
src/core/device-notifier.h
src/core/log.h
src/mmc/mmc-handler.c

index 5b290e3..3111744 100644 (file)
@@ -21,6 +21,7 @@
 #define __DEVICE_NOTIFIER_H__
 
 enum device_notifier_type {
+       DEVICE_NOTIFIER_BOOTING_DONE,
        DEVICE_NOTIFIER_LCD,
        DEVICE_NOTIFIER_TA,
        DEVICE_NOTIFIER_INPUT_ADD,
index 3761467..82365ff 100644 (file)
 #ifndef __LOG_H__
 #define __LOG_H__
 
-#include <stdio.h>
+#ifndef ENABLE_DLOG_OUT
+#define ENABLE_DLOG_OUT
+#endif
 
-#if defined(ENABLE_DLOG_OUT)
+#ifdef ENABLE_DLOG_OUT
 #define LOG_TAG        "SYSTEM_SERVER"
 #include <dlog.h>
-#define DLOG_ERR               DLOG_ERROR
 #define _D(fmt, arg...) \
        do { SLOGD(fmt, ##arg); } while(0)
 #define _I(fmt, arg...) \
        do { SECURE_SLOGW(fmt, ##arg); } while(0)
 #define _SE(fmt, arg...) \
        do { SECURE_SLOGE(fmt, ##arg); } while(0)
-#define __LOGD(prio, fmt, arg...) \
-       do { SLOG(prio, LOG_TAG, fmt, ##arg); } while (0)
-#define __PRT(prio, fmt, arg...) \
-       do { fprintf(((D##prio) == DLOG_ERR ? stderr : stdout), fmt"\n", ##arg); } while (0)
 #else
-#include <syslog.h>
 #define _D(x, ...)     do { } while (0)
 #define _I(x, ...)     do { } while (0)
 #define _W(x, ...)     do { } while (0)
 #define _SI(fmt, args...)      do { } while (0)
 #define _SW(fmt, args...)      do { } while (0)
 #define _SE(fmt, args...)      do { } 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)
-#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_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
index a6db707..6c40be6 100644 (file)
 #include <mntent.h>
 
 #include "core/log.h"
+#include "core/device-notifier.h"
 #include "core/common.h"
 #include "core/devices.h"
 #include "mmc-handler.h"
 
 #define VCONFKEY_INTERNAL_PRIVATE_MMC_ID       "db/private/sysman/mmc_device_id"
+#define VCONFKEY_SYSMAN_MMC_INIT       -1
 
 #define PREDEF_MOUNT_MMC               "mountmmc"
 #define PREDEF_UNMOUNT_MMC             "unmountmmc"
@@ -788,26 +790,22 @@ int register_mmc_handler(const char *name, const struct mmc_filesystem_ops files
        return 0;
 }
 
-static void mmc_poweron_changed_cb(keynode_t *key, void* data)
+static void ss_mmc_booting_done(void* data)
 {
-       int val;
-       if (vconf_get_int(VCONFKEY_DEVICED_BOOT_POWER_ON_STATUS, &val) < 0)
-               return;
-
-       /* unregister poweron callback */
-       vconf_ignore_key_changed(VCONFKEY_DEVICED_BOOT_POWER_ON_STATUS,
-                   mmc_poweron_changed_cb);
+       ss_mmc_inserted();
 }
 
 static void mmc_init(void *data)
 {
+       int ret, op;
+
+       /* IPC between libdeviced and deviced, used by setting application */
        action_entry_add_internal(PREDEF_MOUNT_MMC, ss_mmc_inserted, NULL, NULL);
        action_entry_add_internal(PREDEF_UNMOUNT_MMC, ss_mmc_unmounted, NULL, NULL);
        action_entry_add_internal(PREDEF_FORMAT_MMC, ss_mmc_format, NULL, NULL);
 
-       /* register vconf callback */
-       vconf_notify_key_changed(VCONFKEY_DEVICED_BOOT_POWER_ON_STATUS,
-                       mmc_poweron_changed_cb, NULL);  /* mmc card mount */
+       /* register notifier if mmc exist or not */
+       register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, ss_mmc_booting_done);
 
        /* mmc card mount */
        mmc_mount();