int ipc_gen_phone_res_expect_unregister(struct ril_client *client,
	struct ipc_gen_phone_res_expect *expect)
{
	struct ipc_fmt_data *data;
	struct list_head *list;

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

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

	RIL_CLIENT_LOCK(client);

	list = data->gen_phone_res_expect;
	while (list != NULL) {
		if (list->data == (void *) expect) {
			memset(expect, 0, sizeof(struct ipc_gen_phone_res_expect));
			free(expect);

			if (list == data->gen_phone_res_expect)
				data->gen_phone_res_expect = list->next;

			list_head_free(list);

			break;
		}

list_continue:
		list = list->next;
	}

	RIL_CLIENT_UNLOCK(client);

	return 0;
}
struct ipc_gen_phone_res_expect *ipc_gen_phone_res_expect_find_aseq(struct ril_client *client,
	unsigned char aseq)
{
	struct ipc_gen_phone_res_expect *expect;
	struct ipc_fmt_data *data;
	struct list_head *list;

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

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

	RIL_CLIENT_LOCK(client);

	list = data->gen_phone_res_expect;
	while (list != NULL) {
		if (list->data == NULL)
			goto list_continue;

		expect = (struct ipc_gen_phone_res_expect *) list->data;

		if (expect->aseq == aseq) {
			RIL_CLIENT_UNLOCK(client);
			return expect;
		}

list_continue:
		list = list->next;
	}

	RIL_CLIENT_UNLOCK(client);

	return NULL;
}
示例#3
0
void ipc_fmt_send(const unsigned short command, const char type, unsigned char *data, const int length, unsigned char mseq)
{
	struct ipc_client *ipc_client;

	if (ril_data.ipc_fmt_client == NULL || ril_data.ipc_fmt_client->data == NULL)
		return;

	ipc_client = (struct ipc_client *) ril_data.ipc_fmt_client->data;

	RIL_CLIENT_LOCK(ril_data.ipc_fmt_client);
	ipc_client_send(ipc_client, command, type, data, length, mseq);
	RIL_CLIENT_UNLOCK(ril_data.ipc_fmt_client);
}
示例#4
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;
}
int ipc_gen_phone_res_expect_register(struct ril_client *client,
	unsigned char aseq, unsigned short command,
	int (*callback)(struct ipc_message *message),
	int complete, int abort)
{
	struct ipc_gen_phone_res_expect *expect;
	struct ipc_fmt_data *data;
	struct list_head *list_end;
	struct list_head *list;

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

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

	RIL_CLIENT_LOCK(client);

	expect = calloc(1, sizeof(struct ipc_gen_phone_res_expect));
	expect->aseq = aseq;
	expect->command = command;
	expect->callback = callback;
	expect->complete = complete;
	expect->abort = abort;

	list_end = data->gen_phone_res_expect;
	while (list_end != NULL && list_end->next != NULL)
		list_end = list_end->next;

	list = list_head_alloc(list_end, NULL, (void *) expect);

	if (data->gen_phone_res_expect == NULL)
		data->gen_phone_res_expect = list;

	RIL_CLIENT_UNLOCK(client);

	return 0;
}
int ipc_gen_phone_res_expect_flush(struct ril_client *client)
{
	struct ipc_gen_phone_res_expect *expect;
	struct ipc_fmt_data *data;
	struct list_head *list;
	struct list_head *list_next;

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

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

	RIL_CLIENT_LOCK(client);

	list = data->gen_phone_res_expect;
	while (list != NULL) {
		if (list->data != NULL) {
			expect = (struct ipc_gen_phone_res_expect *) list->data;
			memset(expect, 0, sizeof(struct ipc_gen_phone_res_expect));
			free(expect);
		}

		if (list == data->gen_phone_res_expect)
			data->gen_phone_res_expect = list->next;

		list_next = list->next;

		list_head_free(list);

list_continue:
		list = list_next;
	}

	RIL_CLIENT_UNLOCK(client);

	return 0;
}