int rfs_manager_start(struct rfs_manager *mgr) { int fd; if (!mgr) return -1; g_message("Starting up RFS manager ..."); ipc_client_create_handlers_common_data(mgr->client); ipc_client_open(mgr->client); ipc_client_set_log_handler(mgr->client, log_handler, NULL); fd = ipc_client_get_handlers_common_data_fd(mgr->client); if (fd < 0) return -1; mgr->io = g_io_channel_unix_new(fd); g_io_channel_set_encoding(mgr->io, NULL, NULL); g_io_channel_set_buffered(mgr->io, FALSE); mgr->read_watch = g_io_add_watch_full(mgr->io, G_PRIORITY_DEFAULT, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, received_data, mgr, read_watch_destroy); g_io_channel_unref(mgr->io); return 0; }
int ipc_fmt_create(struct ril_client *client) { struct ipc_client *ipc_client; int rc; if (client == NULL) return -EINVAL; RIL_LOGD("Creating new FMT client"); ipc_client = ipc_client_create(IPC_CLIENT_TYPE_FMT); if (ipc_client == NULL) { RIL_LOGE("FMT client creation failed"); goto error_client_create; } client->data = (void *) ipc_client; RIL_LOGD("Setting log handler"); rc = ipc_client_set_log_callback(ipc_client, ipc_log_handler, NULL); if (rc < 0) { RIL_LOGE("Setting log handler failed"); goto error_log_callback; } RIL_LOGD("Creating data"); rc = ipc_client_data_create(ipc_client); if (rc < 0) { RIL_LOGE("Creating data failed"); goto error_data_create; } RIL_LOGD("Starting bootstrap"); rc = ipc_client_bootstrap(ipc_client); if (rc < 0) { RIL_LOGE("Modem bootstrap failed"); goto error_bootstrap; } RIL_LOGD("Client power on..."); rc = ipc_client_power_on(ipc_client); if (rc < 0) { RIL_LOGE("%s: failed to power on ipc client", __func__); goto error_power_on; } RIL_LOGD("Client open..."); rc = ipc_client_open(ipc_client); if (rc < 0) { RIL_LOGE("%s: failed to open ipc client", __func__); goto error_open; } RIL_LOGD("IPC FMT client done"); return 0; error: ipc_client_power_off(ipc_client); error_power_on: error_get_fd: ipc_client_close(ipc_client); error_open: error_bootstrap: ipc_client_data_destroy(ipc_client); error_data_create: error_log_callback: ipc_client_destroy(ipc_client); error_client_create: client->data = NULL; return -1; }
int ipc_rfs_create(struct ril_client *client) { struct ipc_client *ipc_client; int rc; if (client == NULL) return -EINVAL; RIL_LOGD("Creating new RFS client"); ipc_client = ipc_client_create(IPC_CLIENT_TYPE_RFS); if (ipc_client == NULL) { RIL_LOGE("RFS client creation failed"); goto error_client_create; } client->data = (void *) ipc_client; RIL_LOGD("Setting log handler"); rc = ipc_client_set_log_callback(ipc_client, ipc_log_handler, NULL); if (rc < 0) { RIL_LOGE("Setting log handler failed"); goto error_log_callback; } RIL_LOGD("Creating data"); rc = ipc_client_data_create(ipc_client); if (rc < 0) { RIL_LOGE("Creating data failed"); goto error_data_create; } RIL_LOGD("Client open..."); rc = ipc_client_open(ipc_client); if (rc < 0) { RIL_LOGE("%s: failed to open ipc client", __func__); goto error_open; } RIL_LOGD("IPC RFS client done"); return 0; error: error_get_fd: ipc_client_close(ipc_client); error_open: ipc_client_data_destroy(ipc_client); error_data_create: error_log_callback: ipc_client_destroy(ipc_client); error_client_create: client->data = NULL; return -1; }