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]; Open_check(); /* S_S [younsuk.song] 2010-09-06, Add error control code. Repeat 3 times if error occurs*/ int rc= -1; int errCount= 0; 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); } while (rc < 0 && errCount++ < 3); /* S_E [younsuk.song] */ memcpy(output,ret.output,*ret.out_len); kfree(ret.output); kfree(ret.out_len); return (GET_INT32(output)); }
void remote_rpc_with_mdm_nv_sync(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_SYNC; 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); memcpy(output, ret.output, *ret.out_len); if (ret.output) kfree(ret.output); if (ret.out_len) kfree(ret.out_len); return; }
void sky_sys_rst_NotiToMARM(uint32_t *reason) { struct msm_rpc_client *client; static struct oem_rapi_client_streaming_func_arg arg; static struct oem_rapi_client_streaming_func_ret ret; client = oem_rapi_client_init(); if(IS_ERR(client)) { printk(KERN_INFO "[PANTECH] OEM RAPI Error"); } else { if(smem_id_vendor0_ptr == NULL) { smem_id_vendor0_ptr = (smem_id_vendor0_type*)smem_alloc(SMEM_ID_VENDOR0, sizeof(smem_id_vendor0_type)); } arg.event = 62; //OEM_RAPI_CLIENT_EVENT_SKY_AARM_ERR_LOGGING arg.cb_func = 0; arg.handle = 0; arg.in_len = sizeof(uint32_t); arg.input = (char *)reason; arg.out_len_valid = 1; arg.output_valid = 1; arg.output_size = 128; ret.out_len = NULL; ret.output = NULL; oem_rapi_client_streaming_function(client, &arg, &ret); smem_id_vendor0_ptr->reset = SW_RESET; if(reason) smem_id_vendor0_ptr->reason = *reason; else smem_id_vendor0_ptr->reason = 0x00000000; } }
void lg_set_usb_unlock_fail_cnt(int cnt) { struct oem_rapi_client_streaming_func_arg arg; struct oem_rapi_client_streaming_func_ret ret; Open_check(); arg.event = LG_FW_SET_USB_UNLOCK_FAIL_CNT; arg.cb_func = NULL; arg.handle = (void*) 0; arg.in_len = sizeof(byte); arg.input = (char*) &cnt; arg.out_len_valid = 0; arg.output_valid = 0; arg.output_size = 0; ret.output = (char*)NULL; ret.out_len = 0; oem_rapi_client_streaming_function(client,&arg,&ret); 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; 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; oem_rapi_client_streaming_function(client, &arg, &ret); return; }
int eri_send_to_arm9(void* pReq, void* pRsp, unsigned int output_length) { struct oem_rapi_client_streaming_func_arg arg; struct oem_rapi_client_streaming_func_ret ret; // int result; Open_check(); printk(KERN_ERR "%s,LG_FW_RAPI_ERI_DIAG_WRITE : %d \n",__func__, LG_FW_RAPI_ERI_DIAG_WRITE); printk(KERN_ERR "%s, output_length : %d\n",__func__, output_length ); arg.event = LG_FW_RAPI_ERI_DIAG_WRITE; arg.cb_func = NULL; arg.handle = (void*) 0; arg.in_len = sizeof(eri_write_req_type); arg.input = (char*)pReq; arg.out_len_valid = 1; arg.output_valid = 1; arg.output_size = output_length; ret.output = NULL; ret.out_len = NULL; oem_rapi_client_streaming_function(client, &arg, &ret); printk(KERN_ERR "%s, finished OEM_RAPI\n",__func__); printk(KERN_ERR "%s, ret.out_len : %d\n",__func__, *ret.out_len); if(ret.output == NULL || ret.out_len == NULL){ printk(KERN_ERR "%s, output is NULL\n",__func__); return -1; } else { memcpy(pRsp,ret.output,*ret.out_len); return 0; } return 0; }
void remote_get_ftm_boot(int *info) { struct oem_rapi_client_streaming_func_arg arg; struct oem_rapi_client_streaming_func_ret ret; int ret_val; int resp_buf; int errCount = 0; Open_check(); do { arg.event = LG_FW_GET_FTM_BOOT; 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(int); ret.output = NULL; ret.out_len = NULL; ret_val = oem_rapi_client_streaming_function(client, &arg, &ret); if (ret_val == 0) { memcpy(&resp_buf, ret.output, *ret.out_len); *info = GET_INT32(&resp_buf); } else { *info = 0; //default value } if (ret.output) kfree(ret.output); if (ret.out_len) kfree(ret.out_len); } while (ret_val < 0 && errCount++ < 3); }
int lg_get_usb_lock_state(void) { struct oem_rapi_client_streaming_func_arg arg; struct oem_rapi_client_streaming_func_ret ret; byte lock_state = 0xFF; unsigned int out_len = 0xFFFFFFFF; int rc = -1; byte temp = 0; Open_check(); arg.event = LG_FW_GET_USB_LOCK_STATE; 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__); } lock_state = *ret.output; out_len = *ret.out_len; return lock_state; }
static int msm_unsubscribe_bdata_change(void) { struct oem_rapi_client_streaming_func_arg client_arg; struct oem_rapi_client_streaming_func_ret client_ret; int ret = 0; char dummy; memset(&client_arg, 0, sizeof client_arg); memset(&client_ret, 0, sizeof client_ret); client_arg.event = OEM_RAPI_CLIENT_EVENT_NOTIFY_BDATA_CB_UNREGISTER_SET; client_arg.input = &dummy; ret = oem_rapi_client_streaming_function(rpc_client, &client_arg, &client_ret); if (ret) printk(KERN_INFO SEMC_POWER_PLATFORM_NAME ": Failed unregister bdata change. Error %d\n", ret); return ret; }
static int proximity_sensor_set_configuration(int conf, int value) { struct oem_rapi_client_streaming_func_arg client_arg; struct oem_rapi_client_streaming_func_ret client_ret; int ret; if (!(proximity.proximity_state & PROX_RAPI_READY)) { if (start_oem_rapi_client() < 0) return -1; } memset(&client_arg, 0, sizeof client_arg); client_arg.event = conf; client_arg.in_len = sizeof(value); client_arg.input = (char *)&value; ret = oem_rapi_client_streaming_function(proximity.rpc_client, &client_arg, &client_ret); if (ret < 0) printk(KERN_ERR "%s (%s): failed to set configuration %d (rc=%d).\n", DEV_NAME, __func__, conf, ret); return ret < 0 ? ret : 0; }
static int msm_subscribe_cutoff_level(void) { struct oem_rapi_client_streaming_func_arg client_arg; struct oem_rapi_client_streaming_func_ret client_ret; int ret = 0; char dummy; memset(&client_arg, 0, sizeof client_arg); memset(&client_ret, 0, sizeof client_ret); client_arg.event = OEM_RAPI_CLIENT_EVENT_CUTOFF_LEVEL_CB_REGISTER; client_arg.cb_func = msm_cutoff_level_cb; client_arg.input = &dummy; ret = oem_rapi_client_streaming_function(rpc_client, &client_arg, &client_ret); if (ret) printk(KERN_INFO SEMC_POWER_PLATFORM_NAME ": Failed register cutoff level. Error %d\n", ret); return ret; }
static void call_oem_rapi_client_streaming_function(struct msm_rpc_client *client, char *input) { struct oem_rapi_client_streaming_func_arg client_arg = { OEM_RAPI_CLIENT_EVENT_TRI_COLOR_LED_WORK, NULL, (void *)NULL, sizeof(input), input, 0, 0, 0 }; struct oem_rapi_client_streaming_func_ret client_ret = { (uint32_t *)NULL, (char *)NULL }; int ret = oem_rapi_client_streaming_function(client, &client_arg, &client_ret); if (ret) printk(KERN_ERR "oem_rapi_client_streaming_function() error=%d\n", ret); }
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 lldm_sdio_info_set(int lldm_sdio_enable) { 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_LLDM_SDIO_INFO_SET; arg.cb_func = NULL; arg.handle = (void*) 0; arg.in_len = sizeof(int); arg.input = (char*) &lldm_sdio_enable; 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__); } /* 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 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_get_charging_stat_realtime_update(int *info) { struct oem_rapi_client_streaming_func_arg arg; struct oem_rapi_client_streaming_func_ret ret; uint32_t out_len; int ret_val; int resp_buf; Open_check(); arg.event = LG_FW_GET_CHARGING_STAT_REALTIME_UPDATE; 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(int); ret.output = NULL; ret.out_len = NULL; ret_val = oem_rapi_client_streaming_function(client, &arg, &ret); if (ret_val == 0) { memcpy(&resp_buf, ret.output, *ret.out_len); *info = GET_INT32(&resp_buf); } else { *info = 0; //default value } if (ret.output) kfree(ret.output); if (ret.out_len) kfree(ret.out_len); return; }
void get_charging_timer(int *info) { struct oem_rapi_client_streaming_func_arg arg; struct oem_rapi_client_streaming_func_ret ret; int ret_val; int resp_buf; Open_check(); arg.event = LG_FW_GET_CHARGING_TIMER; 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(int); ret.output = NULL; ret.out_len = NULL; ret_val = oem_rapi_client_streaming_function(client, &arg, &ret); if (ret_val == 0) { memcpy(&resp_buf, ret.output, *ret.out_len); *info = GET_INT32(&resp_buf); } else { *info = 1; //default value } if (ret.output) kfree(ret.output); if (ret.out_len) kfree(ret.out_len); }
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 remote_rpc_rooting_nv_cmmand( char nv_data) { struct oem_rapi_client_streaming_func_arg arg; struct oem_rapi_client_streaming_func_ret ret; int rc= -1; char request_cmd = nv_data; Open_check(); arg.event = OEM_RAPI_CLIENT_SET_ROOTING_NV_FROM_KERNEL; arg.cb_func = NULL; arg.handle = (void*) 0; arg.in_len = sizeof(request_cmd); arg.input = (char*)&request_cmd; 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__); } if (ret.output) kfree(ret.output); if (ret.out_len) kfree(ret.out_len); // return rc; }
void lg_set_usb_lock_key(char * usb_lock_key, int length) { struct oem_rapi_client_streaming_func_arg arg; struct oem_rapi_client_streaming_func_ret ret; Open_check(); arg.event = LG_FW_SET_USB_LOCK_KEY; arg.cb_func = NULL; arg.handle = (void*) 0; arg.in_len = length * sizeof(char); arg.input = (char*) usb_lock_key; // arg.in_len = length; // arg.input = (char*) usb_lock_key; arg.out_len_valid = 0; arg.output_valid = 0; arg.output_size = 0; ret.output = (char*)NULL; ret.out_len = 0; oem_rapi_client_streaming_function(client,&arg,&ret); return; }
nv_stat_enum_type oem_rapi_read_nv(u16 nv, void *buf, u8 size) { struct msm_rpc_client *client; char input[OEM_RAPI_CLIENT_MAX_OUT_BUFF_SIZE]; struct oem_rapi_client_streaming_func_arg client_arg; struct oem_rapi_client_streaming_func_ret client_ret; int ret=0; printk("%s: nv=%d buf size(%d)\n", __func__, nv, size); if ((size+sizeof(nv)) >= OEM_RAPI_CLIENT_MAX_OUT_BUFF_SIZE) { printk("%s: buf size(%d) is too large\n", __func__, size); return NV_BADPARM_S; } client = oem_rapi_client_init(); if (IS_ERR(client)) { printk("%s: couldn't open oem rapi client\n", __func__); return NV_RPC_ERROR_S; } else { printk("%s: connected to remote oem rapi server\n", __func__); } memset(input, 0, OEM_RAPI_CLIENT_MAX_OUT_BUFF_SIZE); memcpy(input, &nv, sizeof(nv)); input[sizeof(nv)] = size; memcpy(input+sizeof(nv)+sizeof(size), buf, 1); client_arg.event = HUAWEI_OEM_RAPI_GET_NV; client_arg.cb_func = oem_rapi_client_streaming_cb_func; client_arg.handle = 0; client_arg.in_len = OEM_RAPI_CLIENT_MAX_OUT_BUFF_SIZE; client_arg.input = input; client_arg.out_len_valid = 1;// 0:invalid; 1:valid client_arg.output_valid = 1;// 0:invalid; 1:valid client_arg.output_size = OEM_RAPI_CLIENT_MAX_OUT_BUFF_SIZE; client_ret.out_len = 0; client_ret.output = 0; ret = oem_rapi_client_streaming_function(client, &client_arg, &client_ret); printk("%s: oem_rapi_client_streaming_function result=%d\n", __func__, ret); if (0 == ret) { if (0 != *client_ret.out_len) { ret = *client_ret.output; } else { ret = NV_RPC_ERROR_S; } if (NV_DONE_S == ret) { memcpy(buf, client_ret.output+1, size); } printk("%s: out_len=%d ret=%d\n", __func__, *(client_ret.out_len), ret); } kfree(client_ret.out_len); kfree(client_ret.output); return (nv_stat_enum_type)ret; }
void remote_did_rpc(void) { struct oem_rapi_client_streaming_func_arg arg; struct oem_rapi_client_streaming_func_ret ret; int rc= -1; char fs_err_buf[20]; const MmcPartition *pMisc_part; unsigned int did_bytes_pos_in_emmc ; int mtd_op_result ; printk(KERN_ERR "%s, start OEM_RAPI\n",__func__); 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(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((void *)&pbuf_emmc2[0], ret.output, 192); //form modem length =192 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; memset((void *)pbuf_emmc, 0, sizeof(pbuf_emmc)); mtd_op_result = lge_read_block(did_bytes_pos_in_emmc, pbuf_emmc, 192); if(memcmp((void *)pbuf_emmc,(void *)pbuf_emmc2, sizeof(pbuf_emmc)) != 0) { lge_write_block(did_bytes_pos_in_emmc, pbuf_emmc2, 192); } if (ret.output) kfree(ret.output); if (ret.out_len) kfree(ret.out_len); return; }
/* * the oem_rapi_client_streaming read nv function * it can be used to all kernel file * the caller must ensure the pointer not be NULL. */ nv_stat_enum_type oem_rapi_read_nv(u16 nv, void *buf, u8 size) { struct msm_rpc_client *client; char input[OEM_RAPI_CLIENT_MAX_OUT_BUFF_SIZE]; struct oem_rapi_client_streaming_func_arg client_arg; struct oem_rapi_client_streaming_func_ret client_ret; int ret=0; /* check the nv size */ printk("%s: nv=%d buf size(%d)\n", __func__, nv, size); if ((size+sizeof(nv)) >= OEM_RAPI_CLIENT_MAX_OUT_BUFF_SIZE) { printk("%s: buf size(%d) is too large\n", __func__, size); return NV_BADPARM_S; } /* init the oem rapi client, it only init once */ client = oem_rapi_client_init(); if (IS_ERR(client)) { printk("%s: couldn't open oem rapi client\n", __func__); return NV_RPC_ERROR_S; } else { printk("%s: connected to remote oem rapi server\n", __func__); } /* clear the buffer */ memset(input, 0, OEM_RAPI_CLIENT_MAX_OUT_BUFF_SIZE); /* set the nv item value */ memcpy(input, &nv, sizeof(nv)); /* set the nv item len */ input[sizeof(nv)] = size; /* set the nv item nam value (1 byte) */ memcpy(input+sizeof(nv)+sizeof(size), buf, 1); /* set the client_arg data */ client_arg.event = HUAWEI_OEM_RAPI_GET_NV; client_arg.cb_func = oem_rapi_client_streaming_cb_func; client_arg.handle = 0; client_arg.in_len = OEM_RAPI_CLIENT_MAX_OUT_BUFF_SIZE; client_arg.input = input; client_arg.out_len_valid = 1;// 0:invalid; 1:valid client_arg.output_valid = 1;// 0:invalid; 1:valid client_arg.output_size = OEM_RAPI_CLIENT_MAX_OUT_BUFF_SIZE; client_ret.out_len = 0; client_ret.output = 0; /* call the rpc to get the modem data */ ret = oem_rapi_client_streaming_function(client, &client_arg, &client_ret); printk("%s: oem_rapi_client_streaming_function result=%d\n", __func__, ret); /* check the result */ if (0 == ret) { if (0 != *client_ret.out_len) { ret = *client_ret.output; } else { ret = NV_RPC_ERROR_S; } /* if nv read suc, copy data to the buf */ if (NV_DONE_S == ret) { /* +1 for the first byte is nv result */ memcpy(buf, client_ret.output+1, size); } printk("%s: out_len=%d ret=%d\n", __func__, *(client_ret.out_len), ret); } kfree(client_ret.out_len); kfree(client_ret.output); return (nv_stat_enum_type)ret; }
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(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__); rc = lge_mmc_scan_partitions(); if (rc < 0) { printk(KERN_ERR "%s couldn't scan the partition\n", __func__); return ; } 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__); } //============================================================= /* */ /* 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 ); /* 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, char* dec_sMeid) { struct oem_rapi_client_streaming_func_arg arg; struct oem_rapi_client_streaming_func_ret ret; int rc= -1; unsigned long long dec_meid = 0; unsigned long long dec_meid_high = 0; unsigned long long dec_meid_low = 0; unsigned long long multi_dec_meid = 100000000; char sMeid_high[16]; char sMeid_low[16]; char test1[16]; char test2[16]; char temp[16]; memset(temp,0,16); // passing argument 2 of 'memset' makes integer from pointer without a cast, change NULL to 0 memset(sMeid_high,0,16); memset(sMeid_low,0,16); memset(test1,0,16); memset(test2,0,16); 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 = 15; 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__); memset(sMeid,0,14); memset(dec_sMeid,0,14); } else { rc = lg_rapi_check_validity_and_copy_result((void*)&ret, (char*)sMeid, 14); // returned MEID size is 14 if(rc == LG_RAPI_INVALID_RESPONSE) { memset(sMeid,0,14); memset(dec_sMeid,0,14); } else { memcpy(sMeid_high, sMeid, 8); memcpy(sMeid_low, &sMeid[8], 6); dec_meid_high = simple_strtoul(sMeid_high, NULL, 16); dec_meid_low = simple_strtoul(sMeid_low, NULL, 16); dec_meid = (dec_meid_high * multi_dec_meid) + dec_meid_low; sprintf(dec_sMeid, "%llu", dec_meid); printk(KERN_INFO "meid from modem nv dec_meid_high : %llu dec_meid_low : %llu dec_meid : %llu \n", dec_meid_high, dec_meid_low, dec_meid); printk(KERN_INFO "meid from modem nv sMeid_high : %s sMeid_low : %s dec_sMeid : %s \n", sMeid_high, sMeid_low, dec_sMeid); } } /* 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 */ return; }
/* MOD 0014166: [KERNEL] send_to_arm9 work queue */ static void do_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_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; // DIAG_TEST_MODE_F_rsp_type union type is greater than the actual size, decrease it in case sensitive items switch(((DIAG_TEST_MODE_F_req_type*)pReq)->sub_cmd_code) { case TEST_MODE_FACTORY_RESET_CHECK_TEST: arg.output_size = sizeof(DIAG_TEST_MODE_F_rsp_type) - sizeof(test_mode_rsp_type); break; case TEST_MODE_TEST_SCRIPT_MODE: arg.output_size = sizeof(DIAG_TEST_MODE_F_rsp_type) - sizeof(test_mode_rsp_type) + sizeof(test_mode_req_test_script_mode_type); break; case TEST_MODE_XO_CAL_DATA_COPY: arg.output_size = sizeof(DIAG_TEST_MODE_F_rsp_type) - sizeof(test_mode_rsp_type) + sizeof(test_mode_req_XOCalDataBackup_Type); break; case TEST_MODE_MANUAL_TEST_MODE: arg.output_size = sizeof(DIAG_TEST_MODE_F_rsp_type) - sizeof(test_mode_rsp_type) + sizeof(test_mode_req_manual_test_mode_type); break; case TEST_MODE_BLUETOOTH_RW: arg.output_size = sizeof(DIAG_TEST_MODE_F_rsp_type) - sizeof(test_mode_rsp_type) + sizeof(test_mode_req_bt_addr_type); break; case TEST_MODE_WIFI_MAC_RW: arg.output_size = sizeof(DIAG_TEST_MODE_F_rsp_type) - sizeof(test_mode_rsp_type) + sizeof(test_mode_req_wifi_addr_type); break; default: arg.output_size = sizeof(DIAG_TEST_MODE_F_rsp_type); break; } 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__); ((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; } /* */ /* */ /* 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); /* */ printk(KERN_INFO "%s %s end\n", __func__, (flag==NORMAL_WORK_FLAG)?"[N]":"[WQ]"); }
int msm_rw_annoying_flc(uint32_t event, uint8_t is_write, char *buf, uint32_t len) { struct oem_rapi_client_streaming_func_arg arg; struct oem_rapi_client_streaming_func_ret ret; int rc= -1; char input[32] = {0,}; int result = 0; pr_info("%s, event:%d, buf:0x%x, len:%d \n", __func__, event, (unsigned int)buf, len); pr_info("checking current rpc status... \n"); Open_check(); if (IS_ERR(client)) { pr_err("rcp client status error \n"); result = RW_ANNOYING_FLC_FAIL; goto msm_rw_annoying_flc_fin; } pr_info("checking current rpc status... OK \n"); input[0] = is_write; arg.event = event; arg.cb_func = NULL; arg.handle = NULL; if (is_write == TRUE) // WRITE { pr_info("write case ... \n"); memcpy(input+1, buf, len); arg.in_len = 1 + len; arg.input = input; arg.out_len_valid = 0; arg.output_valid = 0; arg.output_size = 0; } else // READ { pr_info("read case ... \n"); arg.in_len = 1; arg.input = input; arg.out_len_valid = 1; arg.output_valid = 1; arg.output_size = len; } ret.output = NULL; ret.out_len = NULL; pr_info("call oem_rapi_client_streaming_function ... \n"); rc = oem_rapi_client_streaming_function(client, &arg, &ret); if (rc < 0) { pr_err("oem_rapi_client_streaming_function error \n"); memset(buf, 0, len); result = RW_ANNOYING_FLC_FAIL; goto msm_rw_annoying_flc_fin; } pr_info("call oem_rapi_client_streaming_function ... OK \n"); if (is_write == FALSE) { pr_info("in read case, validate result and copy ... \n"); if( ret.out_len != NULL && (*ret.out_len) == ANNOYING_FLC_NOT_ACTIVE_MARK ) { pr_info("NV not activated ..\n"); memset(buf, 0, len); result = RW_ANNOYING_FLC_NOT_ACTIVE; goto msm_rw_annoying_flc_fin; } rc = lg_rapi_check_validity_and_copy_result((void*)&ret, (char*)buf, arg.output_size); switch( rc ) { case LG_RAPI_OVER_UNDER_FLOW: pr_info("LG_RAPI_OVER_UNDER_FLOW happened.. \n"); result = len; break; case LG_RAPI_SUCCESS: pr_info("LG_RAPI_SUCCESS.. \n"); result = len; break; case LG_RAPI_INVALID_RESPONSE: default: pr_info("LG_RAPI_INVALID_RESPONSE .. \n"); memset(buf, 0, len); result = RW_ANNOYING_FLC_FAIL; goto msm_rw_annoying_flc_fin; break; } } else { pr_info("in write case.. \n"); result = len; } msm_rw_annoying_flc_fin: if (ret.output) { pr_info("free ret.output : 0x%x \n", (unsigned int)ret.output); kfree(ret.output); } if (ret.out_len) { pr_info("free ret.out_len : 0x%x \n", (unsigned int)ret.out_len); kfree(ret.out_len); } return result; }
void msm_rw_felica(uint32_t event, uint8_t is_write, char *buf, uint32_t len) { struct oem_rapi_client_streaming_func_arg arg; struct oem_rapi_client_streaming_func_ret ret; int rc= -1; char input[32] = {0,}; Open_check(); if (IS_ERR(client)) { pr_err("%s error \r\n", __func__); return; } input[0] = is_write; arg.event = event; arg.cb_func = NULL; arg.handle = NULL; if (is_write == TRUE) // WRITE { memcpy(input+1, buf, len); arg.in_len = 1 + len; arg.input = input; arg.out_len_valid = 0; arg.output_valid = 0; arg.output_size = 0; } else // READ { arg.in_len = 1; arg.input = input; arg.out_len_valid = 1; arg.output_valid = 1; arg.output_size = len; } ret.output = NULL; ret.out_len = 0; rc = oem_rapi_client_streaming_function(client, &arg, &ret); if (rc < 0) { pr_err("%s error \r\n", __func__); memset(buf, 0, len); } else if (is_write == FALSE); { rc = lg_rapi_check_validity_and_copy_result((void*)&ret, (char*)buf, arg.output_size); if(rc == LG_RAPI_INVALID_RESPONSE) memset(buf, 0, len); pr_info("%s: output_size(%d)\n", __func__, arg.output_size); { int i; for (i = 0; i < arg.output_size; i++) { pr_info("%s: output[i] = 0x%02X\n", __func__, buf[i]); } } } if (ret.output) kfree(ret.output); if (ret.out_len) kfree(ret.out_len); }