* { DEVICE_CONTROL_DISPLAY, &display_device_ops },
*/
/* Add id & ops to provide start/stop control */
+ { DEVICE_CONTROL_MMC, &mmc_device_ops },
};
static int control_handler(int argc, char **argv)
enum control_device_type {
/* Add device define here */
/* DEVICE_CONTROL_DISPLAY, */
+ DEVICE_CONTROL_MMC,
DEVICE_CONTROL_MAX,
};
/*
* Add new function to control in library.
*/
-/*
- * exmaple code
- * int deviced_display_control(bool enable);
- */
-
+int deviced_mmc_control(bool enable);
#ifdef __cplusplus
}
#include <sys/statfs.h>
#include <bundle.h>
#include <signal.h>
+#include <stdbool.h>
#include "core/log.h"
#include "core/common.h"
static int smack;
static int mmc_popup_pid;
static mmc_fs_type inserted_type;
+static bool mmc_disabled = false;
static void __attribute__ ((constructor)) smack_check(void)
{
struct statfs sfs;
int ret;
+ if (mmc_disabled) {
+ PRT_TRACE("mmc is blocked!");
+ vconf_set_int(VCONFKEY_SYSMAN_MMC_UNMOUNT, VCONFKEY_SYSMAN_MMC_UNMOUNT_COMPLETED);
+ return -ENODEV;
+ }
+
do {
ret = statfs(SMACKFS_MNT, &sfs);
} while (ret < 0 && errno == EINTR);
_E("failed to check mmc");
}
+static void mmc_start(void)
+{
+ mmc_disabled = false;
+ PRT_TRACE("start");
+}
+
+static void mmc_stop(void)
+{
+ mmc_disabled = true;
+ vconf_set_int(VCONFKEY_SYSMAN_MMC_UNMOUNT, VCONFKEY_SYSMAN_MMC_UNMOUNT_COMPLETED);
+
+ PRT_TRACE("stop");
+}
+
const struct device_ops mmc_device_ops = {
.init = mmc_init,
+ .start = mmc_start,
+ .stop = mmc_stop,
};
buf_dev, buf_enable);
}
+API int deviced_mmc_control(bool enable)
+{
+ return deviced_control_common(DEVICE_CONTROL_MMC, enable);
+}
+
/*
* example of control api
* API int deviced_display_control(bool enable)