int ipc_rfs_destroy(struct ril_client *client) { struct ipc_client *ipc_client; int rc; if (client == NULL || client->data == NULL) { RIL_LOGE("Client was already destroyed"); return 0; } ipc_client = (struct ipc_client *) client->data; RIL_LOGD("Destroying ipc rfs client"); if (ipc_client != NULL) { ipc_client_close(ipc_client); ipc_client_data_destroy(ipc_client); ipc_client_destroy(ipc_client); } client->data = NULL; return 0; }
/* For writing data to a specific port - use it in the external process. */ int ipc_connect_buf_write(u16 port, void *data, int data_len) { int fd, rc; if ((fd = ipc_connect(port)) < 0) return -1; rc = ipc_write(fd, data, data_len); ipc_client_close(fd, rc); return rc; }
int rfs_manager_stop(struct rfs_manager *mgr) { if (!mgr) return -1; g_message("Stopping RFS manager ..."); if (mgr->read_watch > 0) g_source_remove(mgr->read_watch); ipc_client_close(mgr->client); ipc_client_destroy_handlers_common_data(mgr->client); 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; }