void battery_info_get(struct batt_info* resp_buf)
{

	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	uint32_t out_len;
	int ret_val;
	struct batt_info rsp_buf;

	Open_check();

	arg.event = LG_FW_A2M_BATT_INFO_GET;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = 0;
	arg.input = NULL;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = sizeof(rsp_buf);

	ret.output = (char*)&rsp_buf;
	ret.out_len = &out_len;

	ret_val = oem_rapi_client_streaming_function(client, &arg, &ret);
	if(ret_val == 0) {
		resp_buf->valid_batt_id = GET_U_INT32(&rsp_buf.valid_batt_id);
		resp_buf->batt_therm = GET_U_INT32(&rsp_buf.batt_therm);
		resp_buf->batt_temp = GET_INT32(&rsp_buf.batt_temp);
	} else { /* In case error */
		resp_buf->valid_batt_id = 1; /* authenticated battery id */
		resp_buf->batt_therm = 100;  /* 100 battery therm adc */
		resp_buf->batt_temp = 30;    /* 30 degree celcius */
	}
	return;
}
void pseudo_batt_info_set(struct pseudo_batt_info_type* info)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;

	Open_check();

	arg.event = LG_FW_A2M_PSEUDO_BATT_INFO_SET;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = sizeof(struct pseudo_batt_info_type);
	arg.input = (char*)info;
	arg.out_len_valid = 0;
	arg.output_valid = 0;
	arg.output_size = 0;  /* alloc memory for response */

	ret.output = (char*)NULL;
	ret.out_len = 0;

	rc = oem_rapi_client_streaming_function(client, &arg, &ret);
	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed\r\n", __func__);
	}

/* MOD 0014591: [LG_RAPI] rpc request heap leakage bug fix */
	// free received buffers if it is not empty
	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);
	
	return;
}
void remote_eri_rpc(void)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;
	int errCount=0;
	int file_size=0;
	char fs_err_buf[20];

	memset(fs_err_buf, 0, sizeof(fs_err_buf));
	Open_check();

	do
	{
		arg.event = LGE_REQUEST_ERI_RPC;
		arg.cb_func = NULL;
		arg.handle = (void*) 0;
		arg.in_len =  sizeof(fs_err_buf);
		arg.input =fs_err_buf;
		arg.out_len_valid = 1;
		arg.output_valid = 1;
		arg.output_size = sizeof(eri_data);

		ret.output = NULL;
		ret.out_len = NULL;

		rc = oem_rapi_client_streaming_function(client,&arg,&ret);

		memset(fs_err_buf, 0, sizeof(fs_err_buf));
		//if ((rc < 0) || (GET_INT32(ret.output) <=0))
		if (rc < 0)
			pr_err("%s error \r\n", __func__);
		else
		{
			pr_info("%s succeeded, file size : %s\r\n",__func__, fs_err_to_string(GET_INT32(ret.output), fs_err_buf));
			pr_info("%s succeeded\r\n",__func__);
		}
	}while (rc < 0 && errCount++ < 3);

	if(ret.output == NULL || ret.out_len == NULL){ 
		printk(KERN_ERR "%s, output is NULL\n",__func__);
		return;
	}
	memcpy((void *)eri_data, ret.output, *ret.out_len);
	file_size=(int)*ret.out_len;
	//memcpy((void *)dest, psrc->output, *(psrc->out_len));

	eri_factory_direct_write(ERI_FILE_PATH, (char *)&eri_data,file_size );
	
		

/* MOD 0014591: [LG_RAPI] rpc request heap leakage bug fix */
	// free received buffers if it is not empty
	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);
	
	return;
}
void set_operation_mode(boolean info)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;

	Open_check();

	arg.event = LG_FW_SET_OPERATION_MODE;	
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = sizeof(boolean);
	arg.input = (char*) &info;
	arg.out_len_valid = 0;
	arg.output_valid = 0;
	arg.output_size = 0;

	ret.output = (char*) NULL;
	ret.out_len = 0;

	rc = oem_rapi_client_streaming_function(client,&arg, &ret);
	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed\r\n", __func__);
	}

/* MOD 0014591: [LG_RAPI] rpc request heap leakage bug fix */
	// free received buffers if it is not empty

	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);

}
void send_to_arm9(void*	pReq, void* pRsp)
{
    struct oem_rapi_client_streaming_func_arg arg;
    struct oem_rapi_client_streaming_func_ret ret;

    Open_check();

    arg.event = LG_FW_TESTMODE_EVENT_FROM_ARM11;
    arg.cb_func = NULL;
    arg.handle = (void*) 0;
    arg.in_len = sizeof(DIAG_TEST_MODE_F_req_type);
    arg.input = (char*)pReq;
    arg.out_len_valid = 1;
    arg.output_valid = 1;

    if( ((DIAG_TEST_MODE_F_req_type*)pReq)->sub_cmd_code == TEST_MODE_FACTORY_RESET_CHECK_TEST)
        arg.output_size = sizeof(DIAG_TEST_MODE_F_rsp_type) - sizeof(test_mode_rsp_type);
    else
        arg.output_size = sizeof(DIAG_TEST_MODE_F_rsp_type);

    ret.output = NULL;
    ret.out_len = NULL;

    oem_rapi_client_streaming_function(client, &arg, &ret);
    memcpy(pRsp,ret.output,*ret.out_len);

    return;
}
void msm_get_MEID_type(char* sMeid)
{
    struct oem_rapi_client_streaming_func_arg arg;
    struct oem_rapi_client_streaming_func_ret ret;

    Open_check();

    arg.event = LG_FW_MEID_GET;
    arg.cb_func = NULL;
    arg.handle = (void*) 0;
    arg.in_len = 0;
    arg.input = NULL;
    arg.out_len_valid = 1;
    arg.output_valid = 1;
    arg.output_size = 15;

    ret.output = NULL;
    ret.out_len = NULL;

    oem_rapi_client_streaming_function(client, &arg, &ret);

    memcpy(sMeid,ret.output,14);

    kfree(ret.output);
    kfree(ret.out_len);

    return;
}
Exemplo n.º 7
0
void remote_set_charging_stat_realtime_update(int info)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int ret_val;

	Open_check();

	arg.event = LG_FW_SET_CHARGING_STAT_REALTIME_UPDATE;
	arg.cb_func = NULL;
	arg.handle = (void *)0;
	arg.in_len = sizeof(int);
	arg.input = (char *)&info;
	arg.out_len_valid = 0;
	arg.output_valid = 0;
	arg.output_size = 0;	//alloc memory for response

	ret.output = NULL;
	ret.out_len = NULL;

	ret_val = oem_rapi_client_streaming_function(client, &arg, &ret);

	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);

	return;
}
void remote_set_chg_logo_mode(int info)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int ret_val;

	Open_check();

	arg.event = LG_FW_CHG_LOGO_MODE;
	arg.cb_func = NULL;
	arg.handle = (void *)0;
	arg.in_len = sizeof(int);
	arg.input = (char *)&info;
	arg.out_len_valid = 0;
	arg.output_valid = 0;
	arg.output_size = 0;	//alloc memory for response

	ret.output = NULL;
	ret.out_len = NULL;

	ret_val = oem_rapi_client_streaming_function(client, &arg, &ret);

	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);

	return;
}
int remote_rpc_request(uint32_t command)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	char output[4];
	int rc= -1;
	int request_cmd = command;

	Open_check();
	arg.event = LGE_RPC_HANDLE_REQUEST;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = sizeof(request_cmd);
	arg.input = (char*)&request_cmd;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = sizeof(output);

	ret.output = (char*)NULL;
	ret.out_len = 0;

	rc = oem_rapi_client_streaming_function(client,&arg,&ret);
	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed\r\n", __func__);
	}
	else
	{
		rc = lg_rapi_check_validity_and_copy_result((void*)&ret, (char*)output, arg.output_size);
		if(rc == LG_RAPI_INVALID_RESPONSE)
			memset(output,0,sizeof(output));
		
		switch(command)
		{
#ifdef CONFIG_LGE_SYNC_CMD
			case LGE_SYNC_REQUEST:
				pr_info("%s, sync retry count : %d\r\n", __func__, GET_INT32(output));
				if(rc != LG_RAPI_SUCCESS)
					rc = -1;
				break;
#endif
#ifdef CONFIG_LGE_NOTIFY_RECOVERY_MODE
			case LGE_RECOVERY_NOTIFICATION:
				pr_info("%s, recovery notification retry count : %d\r\n", __func__, GET_INT32(output));
				if(rc != LG_RAPI_SUCCESS)
					rc = -1;
				break;
#endif
			default :
				break;
		}
	}
	
	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);
	
	return rc;
}
void block_charging_set(int bypass)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;

	Open_check();
	arg.event = LG_FW_A2M_BLOCK_CHARGING_SET;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = sizeof(int);
	arg.input = (char*) &bypass;
	arg.out_len_valid = 0;
	arg.output_valid = 0;
	arg.output_size = 0;

	ret.output = (char*)NULL;
	ret.out_len = 0;

	rc = oem_rapi_client_streaming_function(client,&arg,&ret);
	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed\r\n", __func__);
	}

/* MOD 0014591: [LG_RAPI] rpc request heap leakage bug fix */
	// free received buffers if it is not empty
	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);
	
	return;
}
void lte_uart_start_request(int value)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;

	Open_check();

	arg.event = LG_FW_LTE_UART_START_REQ;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = sizeof(int);
	arg.input = (char*) &value;
	arg.out_len_valid = 0;
	arg.output_valid = 0;
	arg.output_size = 0;  /* alloc memory for response */

	ret.output = (char*)NULL;
	ret.out_len = 0;

	rc = oem_rapi_client_streaming_function(client, &arg, &ret);
	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed\r\n", __func__);
	}

	// free received buffers if it is not empty
	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);
	
	return;
}
Exemplo n.º 12
0
int msm_chg_LG_cable_type(void)
{
char output[LG_RAPI_CLIENT_MAX_OUT_BUFF_SIZE];
	#if 0
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
//	char output[LG_RAPI_CLIENT_MAX_OUT_BUFF_SIZE];
	int rc= -1;
	int errCount= 0;

	Open_check();

/* LGE_CHANGES_S [[email protected]] 2010-09-06, Add error control code. Repeat 3 times if error occurs*/

	do 
	{
		arg.event = LG_FW_RAPI_CLIENT_EVENT_GET_LINE_TYPE;
		arg.cb_func = NULL;
		arg.handle = (void*) 0;
		arg.in_len = 0;
		arg.input = NULL;
		arg.out_len_valid = 1;
		arg.output_valid = 1;
		arg.output_size = 4;

		ret.output = NULL;
		ret.out_len = NULL;

		rc= oem_rapi_client_streaming_function(client, &arg, &ret);
	
		if (rc < 0)
			pr_err("get LG_cable_type error \r\n");
		else
			pr_info("msm_chg_LG_cable_type: %d \r\n", GET_INT32(ret.output));

	} while (rc < 0 && errCount++ < 3);

/* LGE_CHANGES_E [[email protected]] */

/* BEGIN: 0015327 [email protected] 20110204 */
/* MOD 0015327: [KERNEL] LG RAPI validity check */
	memset(output, 0, LG_RAPI_CLIENT_MAX_OUT_BUFF_SIZE);

	rc = lg_rapi_check_validity_and_copy_result((void*)&ret, output, arg.output_size);
/* END: 0015327 [email protected] 20110204 */

/* BEGIN: 0014591 [email protected] 20110122 */
/* MOD 0014591: [LG_RAPI] rpc request heap leakage bug fix */
	// free received buffers if it is not empty
	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);
/* END: 0014591 [email protected] 2011022 */
#endif 
	return (GET_INT32(output));  


}
Exemplo n.º 13
0
int msm_get_manual_test_mode(void)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;
	char temp;

	char output[4];
	memset(output,0,4);

	Open_check();

	if (IS_ERR(client)) {
		pr_err("%s error \r\n", __func__);
		return 0;
	}

	arg.event = LG_FW_MANUAL_TEST_MODE;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = sizeof(temp);
	arg.input = (char*)&temp;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = 4;

	ret.output = NULL;
	ret.out_len = NULL;

	rc = oem_rapi_client_streaming_function(client, &arg, &ret);
	
/*                                            */
/* MOD 0015327: [KERNEL] LG RAPI validity check */
	if (rc < 0)
	{
		pr_err("%s error \r\n", __func__);
		memset(output,0,4);
	}
	else
	{
		rc = lg_rapi_check_validity_and_copy_result((void*)&ret, (char*)output, arg.output_size);
		if(rc == LG_RAPI_INVALID_RESPONSE)
			memset(output,0,4);
		else
			printk(KERN_INFO "MANUAL_TEST_MODE nv : %c\n", output[0]);
	}
/*                                          */

	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);

	if(output[0] == 0x31)
		return 1;
	else
		return 0;
}
Exemplo n.º 14
0
int vslt_rpc_command_string(char* in_data, int data_len, char* out_data)
{
	int i, ret, status = 0;
	int total_len = 0;
	char* offset = in_data;
	int total_pkt, last_pkt_len = 0;

	Open_check();

	total_len = data_len;
	total_pkt = (total_len / 120) + (total_len % 120 == 0 ? 0 : 1);
	last_pkt_len = (total_len % 120) + (total_len % 120 == 0 ? 120 : 0);
	
	for (i = 0; i < total_pkt; i++)
	{
		if(total_pkt-1 == i)
		{
			ret = last_pkt_len;
			status = RPC_LARGE_READ_FINISH;
		}
		else
		{
			ret = 120;
			status = RPC_LARGE_READ_CONTINUE;
		}
			
		pr_info(" *** vslt_rpc_command_string send loop (%d / %d)\n", i, total_pkt);
		if(remote_large_vslt_send_data(i, status, offset, &ret) <0 )
		{
			pr_err(" *** vslt_rpc_command_string send error..!!\n");
			return -1;
		}
		offset += ret;
	}
	status = 0;
	total_len = 0;
	ret =0;
	offset = out_data;
	
	for (i = 0; status != RPC_LARGE_READ_FINISH; i++)
	{
		pr_info(" *** vslt_rpc_command_string loop res (%d)\n", i);
		status = remote_large_vslt_response_data(i, offset, &ret);
		if (status < 0) {
			pr_err(" *** vslt_rpc_command_string res error..!!\n");
			return -1;
		}
		offset += ret;
		total_len +=ret;
	}

	out_data[total_len-1] = '\0';	

	pr_info(" *** vslt_rpc_command_string Done(%d bytes)..!!\n", total_len);
	return total_len;
}
Exemplo n.º 15
0
void msm_get_MEID_type(char* sMeid)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;
	
	char temp[16];
	memset(temp,0,16); // passing argument 2 of 'memset' makes integer from pointer without a cast, change NULL to 0
	
	Open_check();

	arg.event = LG_FW_MEID_GET;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	//FIX ME : RPC_ACCEPTSTAT_GARBAGE_ARGS rpc fail
	arg.in_len = sizeof(temp);
	arg.input = temp;
//	arg.in_len = 0;
//	arg.input = NULL;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = 10;

	ret.output = NULL;
	ret.out_len = NULL;

/*                                            */
/* MOD 0015327: [KERNEL] LG RAPI validity check */
	rc = oem_rapi_client_streaming_function(client, &arg, &ret);
	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed\r\n", __func__);
		memset(sMeid,0,9);
	}
	else
	{
		rc = lg_rapi_check_validity_and_copy_result((void*)&ret, (char*)sMeid, 9); // returned imei size is 9
		if(rc == LG_RAPI_INVALID_RESPONSE)
			memset(sMeid,0,9);
		else
			printk(KERN_INFO "IMEI from modem nv : '%s'\n", sMeid);
	}
/*                                          */

/*                                            */
/* MOD 0014591: [LG_RAPI] rpc request heap leakage bug fix */
	// free received buffers if it is not empty
	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);
/*                                         */

	return;  
}
int msm_chg_LG_cable_type(void)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	char output[LG_RAPI_CLIENT_MAX_OUT_BUFF_SIZE];
	int retValue = 0;
	int rc = -1;
	int errCount = 0;

	Open_check();

	do {
		arg.event = LG_FW_RAPI_CLIENT_EVENT_GET_LINE_TYPE;
		arg.cb_func = NULL;
		arg.handle = (void *)0;
		arg.in_len = 0;
		arg.input = NULL;
		arg.out_len_valid = 1;
		arg.output_valid = 1;
		arg.output_size = 4;

		ret.output = NULL;
		ret.out_len = NULL;

		rc = oem_rapi_client_streaming_function(client, &arg, &ret);
		if (rc < 0) {
			retValue = old_cable_type;
		} 
		else {
			memcpy(output, ret.output, *ret.out_len);
			retValue = GET_INT32(output);

			if (retValue == 0) // no init cable 
				retValue = old_cable_type;
			else //read ok.
				old_cable_type = retValue;
		}

		if (ret.output)
			kfree(ret.output);
		if (ret.out_len)
			kfree(ret.out_len);

	} while (rc < 0 && errCount++ < 3);

#ifdef CONFIG_MACH_MSM7X27_THUNDERC_SPRINT
	if (lge_bd_rev < HW_PCB_REV_B && retValue == 10) // LT_130K
		retValue = 0;
#endif

	printk("USB Cable type: %s(): %d\n", __func__, retValue);
	return retValue;
}
int msm_chg_LG_cable_type(void)
{
char output[LG_RAPI_CLIENT_MAX_OUT_BUFF_SIZE];
	#if 0
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
//	char output[LG_RAPI_CLIENT_MAX_OUT_BUFF_SIZE];
	int rc= -1;
	int errCount= 0;

	Open_check();


	do 
	{
		arg.event = LG_FW_RAPI_CLIENT_EVENT_GET_LINE_TYPE;
		arg.cb_func = NULL;
		arg.handle = (void*) 0;
		arg.in_len = 0;
		arg.input = NULL;
		arg.out_len_valid = 1;
		arg.output_valid = 1;
		arg.output_size = 4;

		ret.output = NULL;
		ret.out_len = NULL;

		rc= oem_rapi_client_streaming_function(client, &arg, &ret);
	
		if (rc < 0)
			pr_err("get LG_cable_type error \r\n");
		else
			pr_info("msm_chg_LG_cable_type: %d \r\n", GET_INT32(ret.output));

	} while (rc < 0 && errCount++ < 3);


/* MOD 0015327: [KERNEL] LG RAPI validity check */
	memset(output, 0, LG_RAPI_CLIENT_MAX_OUT_BUFF_SIZE);

	rc = lg_rapi_check_validity_and_copy_result((void*)&ret, output, arg.output_size);

/* MOD 0014591: [LG_RAPI] rpc request heap leakage bug fix */
	// free received buffers if it is not empty
	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);
#endif 
	return (GET_INT32(output));  


}
/* MOD 0014166: [KERNEL] send_to_arm9 work queue */
static void
do_send_to_arm9(void*	pReq, void* pRsp, int flag, unsigned int rsp_len)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;

	Open_check();
	printk(KERN_INFO "%s %s start\n", __func__, (flag==NORMAL_WORK_FLAG)?"[N]":"[WQ]");

	arg.event = LG_FW_TESTMODE_EVENT_FROM_ARM11;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = sizeof(DIAG_TEST_MODE_F_req_type);
	arg.input = (char*)pReq;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = rsp_len;

	ret.output = NULL;
	ret.out_len = NULL;

/* BEGIN: 0015327 [email protected] 20110204 */
/* MOD 0015327: [KERNEL] LG RAPI validity check */
	rc= oem_rapi_client_streaming_function(client, &arg, &ret);
	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed\r\n", __func__);
		((DIAG_TEST_MODE_F_rsp_type*)pRsp)->ret_stat_code = TEST_FAIL_S;
		
	}
	else
	{
		rc = lg_rapi_check_validity_and_copy_result((void*)&ret, (char*)pRsp, arg.output_size);
		if(rc == LG_RAPI_INVALID_RESPONSE)
		{
			((DIAG_TEST_MODE_F_rsp_type*)pRsp)->ret_stat_code = TEST_FAIL_S;
		}
	}
/* END: 0015327 [email protected] 20110204 */

/* BEGIN: 0014591 [email protected] 20110122 */
/* MOD 0014591: [LG_RAPI] rpc request heap leakage bug fix */
	// free received buffers if it is not empty
	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);
/* END: 0014591 [email protected] 2011022 */

	printk(KERN_INFO "%s %s end\n", __func__, (flag==NORMAL_WORK_FLAG)?"[N]":"[WQ]");
}
void battery_info_get(struct batt_info *resp_buf)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int ret_val;
	struct batt_info rsp_buf;

	Open_check();

	arg.event = LG_FW_A2M_BATT_INFO_GET;
	arg.cb_func = NULL;
	arg.handle = (void *)0;
	arg.in_len = 0;
	arg.input = NULL;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = sizeof(rsp_buf);

	ret.output = NULL;
	ret.out_len = NULL;

	ret_val = oem_rapi_client_streaming_function(client, &arg, &ret);
	if (ret_val == 0) {
		memcpy(&rsp_buf, ret.output, *ret.out_len);

		resp_buf->valid_batt_id = GET_U_INT32(&rsp_buf.valid_batt_id);
		resp_buf->batt_therm = GET_U_INT32(&rsp_buf.batt_therm);
		resp_buf->batt_temp = GET_INT32(&rsp_buf.batt_temp);
#if defined(CONFIG_MACH_MSM7X27_THUNDERC_SPRINT)
		resp_buf->chg_current = GET_U_INT32(&rsp_buf.chg_current);
		resp_buf->batt_thrm_state =
		    GET_U_INT32(&rsp_buf.batt_thrm_state);
#endif
	} else {		/* In case error */
		resp_buf->valid_batt_id = 1;	/* authenticated battery id */
		resp_buf->batt_therm = 100;	/* 100 battery therm adc */
		resp_buf->batt_temp = 30;	/* 30 degree celcius */
#if defined(CONFIG_MACH_MSM7X27_THUNDERC_SPRINT)
		resp_buf->chg_current = 0;
		resp_buf->batt_thrm_state = 0;
#endif
	}

	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);

}
Exemplo n.º 20
0
void msm_get_SUB_VER_type( char *sub_ver )
{
		struct oem_rapi_client_streaming_func_arg arg;
		struct oem_rapi_client_streaming_func_ret ret;
		int rc = -1;
		char temp[8];
		memset( temp, 0, 8 );
	
		Open_check();
	
		arg.event = LG_FW_SUB_VERSION_GET;
		arg.cb_func = NULL;
		arg.handle = (void*) 0;
		
		arg.in_len = sizeof(temp);
		arg.input = temp;	
	
	//	arg.in_len = 0;
	//	arg.input = NULL;
		arg.out_len_valid = 1;
		arg.output_valid = 1;
		arg.output_size = 1;
	
		ret.output = NULL;
		ret.out_len = NULL;
	
		rc = oem_rapi_client_streaming_function(client, &arg, &ret);
		if (rc < 0)
		{
			pr_err("%s, rapi reqeust failed\r\n", __func__);
			*sub_ver = 0;
		}
		else
		{
			rc = lg_rapi_check_validity_and_copy_result((void*)&ret, sub_ver, arg.output_size);
			if(rc == LG_RAPI_INVALID_RESPONSE)
				*sub_ver = 0;
			else
				printk(KERN_INFO "sw_ver from modem : '%02d'\n", *sub_ver);
		}
	
		if( ret.output )
			kfree( ret.output );
		if( ret.out_len )
			kfree ( ret.out_len );
	
		return;

}
int msm_get_manual_test_mode(void)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	char output[4];
	int rc= -1;
	byte temp = 0;

	Open_check();

	arg.event = LG_FW_MANUAL_TEST_MODE;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = sizeof(temp); 
	arg.input = &temp;
	//arg.in_len = 0;
	//arg.input = (char*) NULL;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = 4;

	ret.output = NULL;
	ret.out_len = NULL;

	rc = oem_rapi_client_streaming_function(client, &arg, &ret);
	
/* BEGIN: 0015327 [email protected] 20110204 */
/* MOD 0015327: [KERNEL] LG RAPI validity check */
	if (rc < 0)
		pr_err("%s error \r\n", __func__);
	else
	{
		rc = lg_rapi_check_validity_and_copy_result((void*)&ret, (char*)output, arg.output_size);
		if(rc == LG_RAPI_INVALID_RESPONSE)
			memset(output,0,4);
		else
			printk(KERN_INFO "MANUAL_TEST_MODE nv : %d\n", GET_INT32(output));
	}
/* END: 0015327 [email protected] 20110204 */

	//memcpy(output,ret.output,*ret.out_len);

	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);

	return (GET_INT32(output));
}
Exemplo n.º 22
0
void remote_eri_rpc(void)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;
	int errCount= 0;
	char fs_err_buf[20];

	Open_check();

	do
	{
		arg.event = LGE_REQUEST_ERI_RPC;
		arg.cb_func = NULL;
		arg.handle = (void*) 0;
		arg.in_len = 0;
		arg.input = (char*) NULL;
		arg.out_len_valid = 1;
		arg.output_valid = 1;
		arg.output_size = 4;

		ret.output = (char*)NULL;
		ret.out_len = 0;

		rc = oem_rapi_client_streaming_function(client,&arg,&ret);

		memset(fs_err_buf, 0, sizeof(fs_err_buf));
		//if ((rc < 0) || (GET_INT32(ret.output) <=0))
		if (rc < 0)
			pr_err("%s error \r\n", __func__);
		else
		{
			pr_info("%s succeeded, file size : %s\r\n",__func__, fs_err_to_string(GET_INT32(ret.output), fs_err_buf));
			pr_info("%s succeeded\r\n",__func__);
		}
	}while (rc < 0 && errCount++ < 3);

/* BEGIN: 0014591 [email protected] 20110122 */
/* MOD 0014591: [LG_RAPI] rpc request heap leakage bug fix */
	// free received buffers if it is not empty
	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);
/* END: 0014591 [email protected] 2011022 */
	
	return;
}
void remote_rpc_with_mdm(uint32 in_len, byte *input, uint32 *out_len, byte *output)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;

	printk(KERN_ERR "%s, start OEM_RAPI\n",__func__);

	Open_check();

	arg.event = LG_FW_OEM_RAPI_CLIENT_SRD_COMMAND;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len =  in_len;
	arg.input = input;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = sizeof(pbuf_emmc);

	ret.output = NULL;
	ret.out_len = NULL;

	rc = oem_rapi_client_streaming_function(client,&arg,&ret);
	
	if(ret.output == NULL || ret.out_len == NULL)
	{ 
		printk(KERN_ERR "%s, output is NULL\n",__func__);
		return;
	}
	
	printk(KERN_ERR "%s, output lenght =%dis\n",__func__,*ret.out_len);
	*out_len = *ret.out_len;
	memcpy(output, ret.output, *ret.out_len);

//=============================================================			

/* BEGIN: 0014591 [email protected] 20110122 */
/* MOD 0014591: [LG_RAPI] rpc request heap leakage bug fix */
	// free received buffers if it is not empty
	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);
/* END: 0014591 [email protected] 2011022 */
	
	return;
}
void msm_get_MEID_type(char* sMeid)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	unsigned int out_len = 0xFFFFFFFF;
	int rc = -1;
#if 1	/* LGE_CHANGES_S [[email protected]] 2011-02-09, to avoid compie error, need to check  */
	Open_check();

	arg.event = LG_FW_MEID_GET;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = 0;
	arg.input = NULL;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = 15;

	ret.output = NULL;
	ret.out_len = NULL;

	rc = oem_rapi_client_streaming_function(client, &arg, &ret);

	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed    rc=%d  ret.output=%s \r\n", __func__, rc, ret.output);
	}

	if (out_len && ret.output)
	{
		out_len = *ret.out_len;
		memcpy(sMeid,ret.output,14); 
		
		kfree(ret.output);
		kfree(ret.out_len);
	}
	else
	{
		memset(sMeid, 0x0, 14);
	}
	return;
#else
	memcpy(sMeid, "12345678912345", 14);
#endif
	return;  
}
Exemplo n.º 25
0
void msm_get_MEID_type(char* sMeid)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;

	char temp[16];
	memset(temp,0,16);
	
	Open_check();

	arg.event = LG_FW_MEID_GET;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = sizeof(temp);
	arg.input = temp;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = 15;

	ret.output = NULL;
	ret.out_len = NULL;

	rc = oem_rapi_client_streaming_function(client, &arg, &ret);
	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed\r\n", __func__);
		memset(sMeid,0,14);
	}
	else
	{
		rc = lg_rapi_check_validity_and_copy_result((void*)&ret, (char*)sMeid, 14);
		if(rc == LG_RAPI_INVALID_RESPONSE)
			memset(sMeid,0,14);
		else
			printk(KERN_INFO "meid from modem nv : '%s'\n", sMeid);
	}

	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);

	return;  
}
Exemplo n.º 26
0
void remote_rpc_srd_cmmand(void*pReq, void* pRsp )  //kabjoo.choi
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	//char output[4];
	int rc= -1;
	//int request_cmd = command;

	Open_check();
	arg.event = LG_FW_REQUEST_SRD_RPC;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = sizeof(udbp_req_type);
	arg.input = (char*)pReq;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = sizeof(udbp_rsp_type);

	ret.output = (char*)NULL;
	ret.out_len = 0;

	rc = oem_rapi_client_streaming_function(client,&arg,&ret);
	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed\r\n", __func__);
		((udbp_rsp_type*)pRsp)->header.err_code = UDBU_ERROR_CANNOT_COMPLETE;
		
	}

	
	else
	{
		rc = lg_rapi_check_validity_and_copy_result((void*)&ret, (char*)pRsp, arg.output_size);
		if(rc == LG_RAPI_INVALID_RESPONSE)
			((udbp_rsp_type*)pRsp)->header.err_code = UDBU_ERROR_CANNOT_COMPLETE;
	}


	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);
	
	return ;
}
void lg_get_spc_code(char * spc_code)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	unsigned int out_len = 0xFFFFFFFF;
	int rc = -1;
	char temp[6];
	memset(temp,0,6);

	Open_check();

	arg.event = LG_FW_GET_SPC_CODE;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = sizeof(temp);
	arg.input = temp;
//	arg.in_len = 0;
//	arg.input = NULL;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = 6;

	ret.output = NULL;
	ret.out_len = NULL;

	rc = oem_rapi_client_streaming_function(client, &arg, &ret);

	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed\r\n", __func__);
	}

	if (out_len && ret.output)
	{
		out_len = *ret.out_len;
		memcpy(spc_code, ret.output, out_len);
		
		kfree(ret.output);
		kfree(ret.out_len);
	}
	else
		memset(spc_code, 0x0, 6);
	return;
}
int remote_rpc_request_val(uint32_t command, char *buf, int size)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;
	int request_cmd = command;

	Open_check();
	printk(KERN_INFO "%s start\n", __func__);

	arg.event = LGE_REMOTE_RPC_REQUEST_VAL;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = sizeof(request_cmd);
	arg.input = (char*)&request_cmd;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = size;

	ret.output = NULL;
	ret.out_len = 0;

	rc= oem_rapi_client_streaming_function(client, &arg, &ret);

	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed\r\n", __func__);
		memcpy(buf, "UNKNOWN", strlen("UNKNOWN"));
		
	}
	else
	{
		rc = lg_rapi_check_validity_and_copy_result((void*)&ret, (char*)buf, arg.output_size);
	}

	// free received buffers if it is not empty
	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);

	printk(KERN_INFO "%s end\n", __func__);
}
Exemplo n.º 29
0
static void unifiedmsgtool_send_to_arm9(void*	pReq, void* pRsp, int flag)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;

	Open_check();
	printk(KERN_INFO "%s %s start\n", __func__, (flag==NORMAL_WORK_FLAG)?"[N]":"[WQ]");

	arg.event = LG_MSG_UNIFIEDMSGTOOL_FROM_ARM11;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = 160;
	arg.input = (char*)pReq;
	arg.out_len_valid = 1;
	arg.output_valid = 1;

	ret.output = NULL;
	ret.out_len = NULL;

	rc= oem_rapi_client_streaming_function(client, &arg, &ret);

	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed\r\n", __func__);
		((diag_sms_mode_rsp_type*)pRsp)->ret_stat_code = TEST_FAIL_S;
		
	}
	else
	{
		rc = lg_rapi_check_validity_and_copy_result((void*)&ret, (char*)pRsp, arg.output_size);
		if(rc == LG_RAPI_INVALID_RESPONSE)
			((diag_sms_mode_rsp_type*)pRsp)->ret_stat_code = TEST_FAIL_S;
	}

	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);

	printk(KERN_INFO "%s %s end\n", __func__, (flag==NORMAL_WORK_FLAG)?"[N]":"[WQ]");
}
Exemplo n.º 30
0
void webDload_rpc_srd_cmmand(void*pReq, void* pRsp ) 
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;

	Open_check();
	arg.event = LG_FW_WEB_DLOAD_STATUS;
	arg.cb_func = NULL;
	arg.handle = (void*) 0;
	arg.in_len = sizeof(diag_webdload_req_type);
	arg.input = (char*)pReq;
	arg.out_len_valid = 1;
	arg.output_valid = 1;
	arg.output_size = sizeof(diag_webdload_rsp_type);

	ret.output = (char*)NULL;
	ret.out_len = 0;

	rc = oem_rapi_client_streaming_function(client,&arg,&ret);
	if (rc < 0)
	{
		pr_err("%s, rapi reqeust failed\r\n", __func__);
		((diag_webdload_rsp_type*)pRsp)->success = FALSE;
		
	}
	else
	{
		rc = lg_rapi_check_validity_and_copy_result((void*)&ret, (char*)pRsp, arg.output_size);
		if(rc == LG_RAPI_INVALID_RESPONSE)
			((diag_webdload_rsp_type*)pRsp)->success = FALSE;
	}


	if (ret.output)
		kfree(ret.output);
	if (ret.out_len)
		kfree(ret.out_len);
	
	return ;
}