Device: Various improvements: added missing functions, mutex, threaded recv loop
[hayes-ril.git] / hayes-ril.c
index 28d9954..7fd6656 100644 (file)
@@ -52,31 +52,23 @@ const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env, int argc, char **a
 
        LOGD("Starting %s for device: %s", RIL_VERSION_STRING, ril_device->name);
 
-       rc = ril_device_data_create(ril_device);
+       rc = ril_device_init(ril_device);
        if(rc < 0) {
-               goto failure;
-       }
+               LOGE("Failed to init device!");
+               ril_device_deinit(ril_device);
 
-       rc = ril_device_power_on(ril_device);
-       if(rc < 0) {
-               goto failure;
+               return NULL;
        }
 
-       rc = ril_device_boot(ril_device);
+       rc = ril_device_recv_thread_start(ril_device);
        if(rc < 0) {
-               goto failure;
-       }
+               LOGE("Failed to start device thread!");
+               ril_device_deinit(ril_device);
 
-       rc = ril_device_open(ril_device);
-       if(rc < 0) {
-               goto failure;
+               return NULL;
        }
 
-       LOGD("Init process done");
+       LOGD("Initialization complete");
 
        return &ril_ops;
-
-failure:
-       LOGE("Failure, aborting!");
-       return NULL;
 }