Exemplo n.º 1
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;
	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 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;
}
Exemplo n.º 3
0
void remote_did_rpc(void)
{
	struct oem_rapi_client_streaming_func_arg arg;
	struct oem_rapi_client_streaming_func_ret ret;
	int rc= -1;
	
	//int file_size=0;
	char fs_err_buf[20];
	//test_mode_emmc_direct_type did_info;

	const MmcPartition *pMisc_part; 
	unsigned int did_bytes_pos_in_emmc ;
	 int mtd_op_result ;
	

	printk(KERN_ERR "%s, start OEM_RAPI\n",__func__);
	//memset(&did_info,0x0,sizeof(test_mode_emmc_direct_type));
	
	//memset(fs_err_buf, 0, sizeof(fs_err_buf));

	Open_check();

		arg.event = LG_FW_DID_BACKUP_REQUEST;
		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(pbuf_emmc);

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

		rc = oem_rapi_client_streaming_function(client,&arg,&ret);
		#if 0
		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__);
		}
		#endif 
		
	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);	
	//memcpy(&did_info, ret.output, *ret.out_len);
	memcpy((void *)&pbuf_emmc2[0], ret.output, 192);  //form modem  length =192

	
//===================== emmc wirte routine =======================
	printk(KERN_ERR "%s, lge_mmc_scan_partitions\n",__func__);  
	lge_mmc_scan_partitions();
	pMisc_part = lge_mmc_find_partition_by_name("misc");
	printk(KERN_ERR "%s, lge_mmc_find_partition_by_name\n",__func__);  
	if (pMisc_part ==NULL)
	{
		if (ret.output)
		kfree(ret.output);
		if (ret.out_len)
		kfree(ret.out_len);
		return ; 
	}
	
	did_bytes_pos_in_emmc = (pMisc_part->dfirstsec)*512+0x300000;  //3M 
	memset((void *)pbuf_emmc, 0, sizeof(pbuf_emmc));  
	
	mtd_op_result = lge_read_block(did_bytes_pos_in_emmc, pbuf_emmc, 192);
	//printk(KERN_ERR "%s,lge_read_block\n",__func__);  
	//if(memcmp((void *)pbuf_emmc,(void *)ret.output, sizeof(pbuf_emmc)) != 0) 
	if(memcmp((void *)pbuf_emmc,(void *)pbuf_emmc2, sizeof(pbuf_emmc)) != 0) 
	{
	  //printk(KERN_ERR "%s,lge_write_block0\n",__func__);  
	  lge_write_block(did_bytes_pos_in_emmc, pbuf_emmc2, 192);	
	 // printk(KERN_ERR "%s,lge_write_block1\n",__func__);  
	}

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

/* 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;
}