in case mmc is already inserted on booting time, target doesn't work properly submit/tizen_2.2/20130723.102003
authorjy910.yun <jy910.yun@samsung.com>
Tue, 23 Jul 2013 08:26:27 +0000 (17:26 +0900)
committerjy910.yun <jy910.yun@samsung.com>
Tue, 23 Jul 2013 10:03:46 +0000 (19:03 +0900)
emul occurs uevent twice unlike target
it has a routine to ignore twice uevent,
but in this part, it failed to consider the situation of mounting sd-card on booting time.

Signed-off-by: jy910.yun <jy910.yun@samsung.com>
Change-Id: Iad6b7229256520a1ab5bba46f6c0ab5a747db829

ss_device_change_handler.c

index 08e1594..9129a24 100755 (executable)
@@ -16,6 +16,7 @@
 
 
 #include <stdlib.h>
+#include <stdbool.h>
 #include <fcntl.h>
 #include <dirent.h>
 #include <errno.h>
@@ -272,25 +273,34 @@ static void keyboard_chgdet_cb(struct ss_main_data *ad)
 
 static void mmc_chgdet_cb(void *data)
 {
-       static int inserted;
+       static bool first, inserted;
+       int mmc_status;
        int ret = -1;
        int val = -1;
 
+       /* at first time, this part will be judge mmc is already inserted or not. */
+       if (!first) {
+               vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &mmc_status);
+               if (mmc_status == VCONFKEY_SYSMAN_MMC_MOUNTED)
+                       inserted = true;
+               first = true;
+       }
+
        if (data == NULL) {
                /* when removed mmc, emul kernel notify twice
                 * So this code ignores second event */
                if (!inserted)
                        return;
+               inserted = false;
                PRT_TRACE("mmc removed");
                ss_mmc_removed();
-               inserted = 0;
        } else {
                /* when inserted mmc, emul kernel notify twice(insert, changed)
                 * So this code ignores second event */
                if (inserted)
                        return;
+               inserted = true;
                PRT_TRACE("mmc added");
-               inserted = 1;
                ret = ss_mmc_inserted();
                if (ret == -1) {
                        vconf_get_int(VCONFKEY_SYSMAN_MMC_MOUNT,&val);