Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fed62520 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "diag: Add support for Extended Mobile ID"

parents c950223d b75b1dc0
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1682,6 +1682,10 @@ static int diag_dci_process_apps_pkt(struct diag_pkt_header_t *pkt_header,
			write_len = sizeof(struct diag_pkt_header_t);
			*(uint16_t *)(payload_ptr + write_len) = wrap_count;
			write_len += sizeof(uint16_t);
		} else if (ss_cmd_code == DIAG_EXT_MOBILE_ID) {
			write_len = diag_cmd_get_mobile_id(req_buf, req_len,
						   payload_ptr,
						   APPS_BUF_SIZE - header_len);
		}
	}

+9 −1
Original line number Diff line number Diff line
/* Copyright (c) 2008-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2008-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -90,6 +90,7 @@
#define DIAG_DIAG_POLL		0x03
#define DIAG_DEL_RSP_WRAP	0x04
#define DIAG_DEL_RSP_WRAP_CNT	0x05
#define DIAG_EXT_MOBILE_ID	0x06

#define DIAG_CMD_OP_LOG_DISABLE		0
#define DIAG_CMD_OP_GET_LOG_RANGE	1
@@ -210,6 +211,13 @@ struct diag_pkt_header_t {
	uint16_t subsys_cmd_code;
} __packed;

struct diag_cmd_ext_mobile_rsp_t {
	struct diag_pkt_header_t header;
	uint8_t version;
	uint8_t padding[3];
	uint32_t family;
};

struct diag_master_table {
	uint16_t cmd_code;
	uint16_t subsys_id;
+39 −0
Original line number Diff line number Diff line
@@ -1025,6 +1025,33 @@ int diag_cmd_log_on_demand(unsigned char *src_buf, int src_len,
	return write_len;
}

int diag_cmd_get_mobile_id(unsigned char *src_buf, int src_len,
			   unsigned char *dest_buf, int dest_len)
{
	int write_len = 0;
	struct diag_pkt_header_t *header = NULL;
	struct diag_cmd_ext_mobile_rsp_t rsp;

	if (!src_buf || src_len != sizeof(*header) || !dest_buf ||
	    dest_len < sizeof(rsp))
		return -EIO;

	header = (struct diag_pkt_header_t *)src_buf;
	rsp.header.cmd_code = header->cmd_code;
	rsp.header.subsys_id = header->subsys_id;
	rsp.header.subsys_cmd_code = header->subsys_cmd_code;
	rsp.version = 1;
	rsp.padding[0] = 0;
	rsp.padding[1] = 0;
	rsp.padding[2] = 0;
	rsp.family = (uint32_t)socinfo_get_msm_cpu();

	memcpy(dest_buf, &rsp, sizeof(rsp));
	write_len += sizeof(rsp);

	return write_len;
}

int diag_check_common_cmd(struct diag_pkt_header_t *header)
{
	int i;
@@ -1187,6 +1214,18 @@ int diag_process_apps_pkt(unsigned char *buf, int len)
		if (write_len > 0)
			encode_rsp_and_send(write_len - 1);
		return 0;
	}
	/* Mobile ID Rsp */
	else if ((*buf == DIAG_CMD_DIAG_SUBSYS) &&
		(*(buf+1) == DIAG_SS_PARAMS) &&
		(*(buf+2) == DIAG_EXT_MOBILE_ID) && (*(buf+3) == 0x0)) {
		write_len = diag_cmd_get_mobile_id(buf, len,
						   driver->apps_rsp_buf,
						   APPS_BUF_SIZE);
		if (write_len > 0) {
			encode_rsp_and_send(write_len - 1);
			return 0;
		}
	}
	 /*
	  * If the apps processor is master and no other
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2008-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2008-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -46,6 +46,8 @@ int chk_apps_master(void);
int chk_polling_response(void);
int diag_cmd_log_on_demand(unsigned char *src_buf, int src_len,
			   unsigned char *dest_buf, int dest_len);
int diag_cmd_get_mobile_id(unsigned char *src_buf, int src_len,
			   unsigned char *dest_buf, int dest_len);
int diag_check_common_cmd(struct diag_pkt_header_t *header);
void diag_update_userspace_clients(unsigned int type);
void diag_update_sleeping_process(int process_id, int data_type);