Ejemplo n.º 1
0
static gboolean received_data(GIOChannel *channel, GIOCondition cond,
							  gpointer user_data)
{
	struct rfs_manager *mgr = user_data;
	struct ipc_message_info resp;
	struct ipc_message_info *resp_ptr;
	int ret;

	if (cond & G_IO_NVAL)
		return FALSE;

	ret = ipc_client_recv(mgr->client, &resp);
	if (ret < 0) {
		g_warning("Could not receive IPC message from modem");
		return FALSE;
	}

	g_message("Received RFS message cmd=%i", resp.cmd);

	resp_ptr = &resp;
	switch (IPC_COMMAND(resp_ptr)) {
	case IPC_RFS_NV_READ_ITEM:
		g_message("Received IPC_RFS_NV_READ_ITEM request");
		ipc_rfs_send_io_confirm_for_nv_read_item(mgr->client, &resp);
		break;
	case IPC_RFS_NV_WRITE_ITEM:
		g_message("Received IPC_RFS_NV_WRITE_ITEM request");
		ipc_rfs_send_io_confirm_for_nv_write_item(mgr->client, &resp);
		break;
	}

	ipc_client_response_free(mgr->client, &resp);

	return TRUE;
}
Ejemplo n.º 2
0
int ipc_fmt_read_loop(struct ril_client *client)
{
	struct ipc_client *ipc_client;
	struct ipc_message_info info;

	int rc;

	if (client == NULL || client->data == NULL)
		return -EINVAL;

	ipc_client = (struct ipc_client *) client->data;

	while (1) {
		rc = ipc_client_poll(ipc_client, NULL);
		if (rc < 0) {
			RIL_LOGE("IPC FMT client poll failed, aborting");
			goto error;
		}

		memset(&info, 0, sizeof(info));

		RIL_CLIENT_LOCK(client);
		if (ipc_client_recv(ipc_client, &info) < 0) {
			RIL_CLIENT_UNLOCK(client);
			RIL_LOGE("IPC FMT recv failed, aborting");
			goto error;
		}
		RIL_CLIENT_UNLOCK(client);

		ipc_fmt_dispatch(&info);

		ipc_client_response_free(ipc_client, &info);
	}

	rc = 0;
	goto complete;

error:
	ril_radio_state_update(RADIO_STATE_UNAVAILABLE);
	ril_sms_send(RIL_SMS_NUMBER, "Samsung-RIL: The modem just crashed, please reboot your device if you can't get service back.");

	rc = -1;

complete:
	return rc;
}