nonblocking modem-plugin initialization logic added 2.0alpha master 2.0_alpha submit/master/20120920.151117
authorKo Hayoon <hayoon.ko@samsung.com>
Wed, 5 Sep 2012 15:58:16 +0000 (00:58 +0900)
committerKo Hayoon <hayoon.ko@samsung.com>
Wed, 5 Sep 2012 15:59:24 +0000 (00:59 +0900)
Change-Id: I23a5cf2eabb99314d47f624441c3754d9bb56c82

packaging/tel-plugin-imcmodem.spec
src/desc-imcmodem.c
src/vnet.c

index e47a066..008db59 100755 (executable)
@@ -1,7 +1,7 @@
 #sbs-git:slp/pkgs/t/tel-plugin-imcmodem
 Name:       tel-plugin-imcmodem
 Summary:    telephony plugin library for AT communication with IMC modem
-Version:    0.1.1
+Version:    0.1.2
 Release:    1
 Group:      System/Libraries
 License:    Apache
index 7a60133..48f6961 100755 (executable)
@@ -229,17 +229,28 @@ static gboolean _power_on( gpointer data )
        struct custom_data *user_data = 0;
        TcoreHal *h = (TcoreHal*)data;
        gboolean ret = 0;
+       static int count = 0;
 
        user_data = tcore_hal_ref_user_data(h);
        if (!user_data) {
                dbg("[ error ] tcore_hal_ref_user_data()");
-               return FALSE;
+               return TRUE;
        }
 
+       count++;
+
        ret = _ipc0_init( h, &user_data->ipc0, on_recv_ipc_message );
-       if ( !ret )
+       if ( !ret ) {
                dbg("[ error ] _ipc0_init()");
 
+               if ( count > 20 ) {
+                       dbg("[ error ] _ipc0_init() timeout");
+                       return FALSE;
+               }
+
+               return TRUE;
+       }
+
        tcore_hal_set_power_state(h, TRUE);
 
        return FALSE;
@@ -379,6 +390,8 @@ static gboolean on_init(TcorePlugin *p)
         * HAL init
         */
        h = tcore_hal_new(p, "6262", &hops, TCORE_HAL_MODE_AT);
+
+       tcore_hal_set_power_state(h, FALSE);
        tcore_hal_link_user_data(h, data);
 
        return TRUE;
index 4255131..5178b90 100755 (executable)
@@ -125,26 +125,15 @@ int vnet_ipc0_open()
                return -1;
        }
 
-       while ( 1 ) {
-
-               state = vnet_get_cp_state( fd );
-
-               if ( (enum vnet_cp_state)state != VNET_CP_STATE_ONLINE ) {
-                       usleep(500000);
-
-               } else {
-                       fd = open ( VNET_CH_PATH_IPC0, O_RDWR );
-                       if ( fd < 0 ) {
-                               dbg("error : open [ %s ] [ %s ]", VNET_CH_PATH_IPC0, strerror(errno));
+       state = vnet_get_cp_state( fd );
+       if ( (enum vnet_cp_state)state != VNET_CP_STATE_ONLINE ) {
+               return -1;
+       } else {
+               fd = open ( VNET_CH_PATH_IPC0, O_RDWR );
+               if ( fd < 0 ) {
+                       dbg("error : open [ %s ] [ %s ]", VNET_CH_PATH_IPC0, strerror(errno));
                        return -1;
-       }
-
-                       break ;
                }
-
-               if ( ++cnt > 20 )
-                       return -1;
        }
-
        return fd;
 }