void i51adePortInitLogFile( void ) { iU16 logfilename[32]= {0}; iU16 LDfilename[32]= {0}; i51AdeOsFileAModeEnable(); kal_wsprintf( logfilename , "%c:\\i51\\%s" , FS_GetDrive( FS_DRIVE_V_REMOVABLE , 1 , FS_NO_ALT_DRIVE ) , "i51.log" ); kal_wsprintf( LDfilename , "%c:\\i51\\%d_%d.dat" , FS_GetDrive( FS_DRIVE_V_REMOVABLE , 1 , FS_NO_ALT_DRIVE ) , I51_KERNEL_P4_VERSION , I51_ADAPTER_P4_VERSION ); if(i51AdeOsFileIsExist(logfilename)) { i51LogFileisExist = iTRUE; if(i51AdeOsFileIsExist(LDfilename)) { i51AdePortSysLogLoadData(LDfilename); } else i51AdeOsLog(0, "缺少日志数据库无法打印底层日志. 请下载版本号为 %d_%d 的日志数据库", I51_KERNEL_P4_VERSION, I51_ADAPTER_P4_VERSION); } else {//T卡中不存在,判断系统盘是否存在i51.log kal_wsprintf( logfilename , "%c:\\i51\\%s" , 'C' , "i51.log" ); kal_wsprintf( LDfilename , "%c:\\i51\\%d_%d.dat" , 'C' , I51_KERNEL_P4_VERSION , I51_ADAPTER_P4_VERSION ); if(i51AdeOsFileIsExist(logfilename)) { i51LogFileisExist = iTRUE; if(i51AdeOsFileIsExist(LDfilename)) { i51AdePortSysLogLoadData(LDfilename); } else i51AdeOsLog(0, "缺少日志数据库无法打印底层日志. 请下载版本号为 %d_%d 的日志数据库", I51_KERNEL_P4_VERSION, I51_ADAPTER_P4_VERSION); } } i51AdeOsFileAModeDisable(); }
/***************************************************************************** * FUNCTION * applib_file_delete_folder * DESCRIPTION * This function is used to remove one folder. * PARAMETERS * foldername [IN] The foldername * RETURNS * void *****************************************************************************/ kal_bool applib_file_delete_folder(kal_wchar *foldername) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ int h = -1; /* save temp. file handle for find */ FS_DOSDirEntry info; kal_wchar path[200]; kal_wchar filename[100]; kal_wchar wildcard[6]; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if (foldername == NULL) { return KAL_FALSE; } else if (app_ucs2_strlen((kal_int8*) foldername) > 97) { return KAL_FALSE; } else { kal_mem_set(path, 0, 400); app_ucs2_strcpy((kal_int8*) path, (kal_int8*) foldername); kal_wsprintf(wildcard, "\\*"); app_ucs2_strcat((kal_int8*) path, (kal_int8*) wildcard); h = FS_FindFirst(path, 0, 0, &info, filename, 200); if (h < 0) { return KAL_FALSE; } do { /* filter out folder results */ if (!(info.Attributes & FS_ATTR_DIR)) { kal_mem_set(path, 0, 400); app_ucs2_strcpy((kal_int8*) path, (kal_int8*) foldername); kal_wsprintf(wildcard, "\\"); app_ucs2_strcat((kal_int8*) path, (kal_int8*) wildcard); app_ucs2_strcat((kal_int8*) path, (kal_int8*) filename); FS_Delete(path); kal_mem_set(filename, 0x00, 200); } } while (FS_FindNext(h, &info, filename, 200) == FS_NO_ERROR); FS_FindClose(h); } return KAL_TRUE; }
/***************************************************************************** * FUNCTION * mmi_bth_simap_connect_ind_hdler * DESCRIPTION * This function is to * * PARAMETERS * a IN/OUT first variable, used as returns * b IN second variable * RETURNS * NONE. * GLOBALS AFFECTED * external_global *****************************************************************************/ void mmi_bth_simap_connect_ind(void *msg) { bt_simap_connect_ind_struct *msg_p = (bt_simap_connect_ind_struct *)msg; U16 str_popup[60]; MMI_TRACE(MMI_CONN_TRC_G7_BT, MMI_BTH_SIMAP_CONNECT_IND, g_mmi_simap_cntx_p->state); switch (g_mmi_simap_cntx_p->state) { case MMI_BTH_SIMAP_STAT_AUTHORIZED: { if (g_mmi_simap_cntx_p->bt_addr.lap != msg_p->lap || g_mmi_simap_cntx_p->bt_addr.uap != msg_p->uap || g_mmi_simap_cntx_p->bt_addr.nap != msg_p->nap) { MMI_ASSERT(0); } g_mmi_simap_cntx_p->connect_id = msg_p->cid; g_mmi_simap_cntx_p->state = MMI_BTH_SIMAP_STAT_CONNECT; srv_bt_cm_connect_ind(g_mmi_simap_cntx_p->cmgr_id); kal_wsprintf( str_popup, "%w%w", (WCHAR*)GetString(STR_BT_PROF_SAP), (WCHAR*)GetString(STR_BT_CONN_ED) ); mmi_frm_nmgr_popup(MMI_SCENARIO_ID_DEFAULT, MMI_EVENT_SUCCESS, (WCHAR*)str_popup); } } }
static void avk_framework_auto_case_time_cb() { U8 str[256]; U16 percent; MMI_ID group_id, scr_id; StopTimer(AVK_FRAMEWORK_AUTO_CASE_TIME); if (g_avk_framework_fw_ctx.avk_framework_stop_auto_process || !g_avk_framework_fw_ctx.avk_framework_foreground) { return; } mmi_frm_get_active_scrn_id(&group_id, &scr_id); if (g_avk_framework_fw_ctx.avk_framework_auto_scr_id != scr_id && GRP_ID_AVK == group_id) { return; } if (0 == g_avk_framework_ctx.auto_case_num) { mmi_frm_scrn_close_active_id(); return; } kal_wsprintf((WCHAR*)str,"Auto cases: %d / %d",g_avk_framework_ctx.current_num,g_avk_framework_ctx.auto_case_num); percent = (U16)g_avk_framework_ctx.current_num*100 / g_avk_framework_ctx.auto_case_num; if (percent > 100) { return; } UpdateCategory402Value(percent, (U8*)str); StartTimer(AVK_FRAMEWORK_AUTO_CASE_TIME,200,avk_framework_auto_case_time_cb); }
/** * Get Path for requested size */ kal_int16 FT_GetAvailableDrive(kal_int32 size) { #if !defined(__LOW_COST_SUPPORT_ULC__) kal_int16 drv_letter = -1; kal_int16 i = 0; kal_uint32 dev[4] = {FS_DRIVE_I_SYSTEM, FS_DRIVE_V_NORMAL, FS_DRIVE_V_REMOVABLE, FS_DRIVE_V_EXTERNAL}; kal_wchar *pathname = NULL; pathname = (kal_wchar*)get_ctrl_buffer(FT_FAT_MAX_FULLPATH); if(pathname) { for(i=0;i<4;i++) { drv_letter = FS_GetDrive(dev[i], 1, FS_NO_ALT_DRIVE); if(drv_letter > 0) { kal_wsprintf(pathname, "%c:\\", drv_letter); if(size < FT_GetDiskFreeSpace(pathname)) { break; } } } } else { ASSERT(0); } free_ctrl_buffer(pathname); return drv_letter; #else // #if !defined(__LOW_COST_SUPPORT_ULC__) return -1; #endif // #if defined(__LOW_COST_SUPPORT_ULC__) }
/***************************************************************************** * FUNCTION * aud_vr_check_db_folder * DESCRIPTION * check or create vr database folder * PARAMETERS * folder_name [?] * mode [IN] * lang [IN] * group_id [IN] * RETURNS * kal_bool *****************************************************************************/ kal_bool aud_vr_check_db_folder(kal_uint16 *folder_name, kal_uint8 mode, kal_uint8 lang, kal_uint8 group_id) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ kal_bool result = KAL_FALSE; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ switch (mode) { case MED_VR_ISD_MODE: kal_wsprintf(folder_name, "%c:\\VRDB\\ISD\\%d\\", (kal_uint8) vr_ctx.db_drive, group_id); break; case MED_VR_CSI_MODE: folder_name[0] = 0; break; case MED_VR_PSI_MODE: folder_name[0] = 0; break; default: folder_name[0] = 0; break; } if (folder_name[0] != 0) { kal_int32 res = aud_create_full_path_folder(folder_name); result = (res == FS_FILE_EXISTS || res == FS_NO_ERROR); } return result; }
/***************************************************************************** * FUNCTION * mmi_rmgr_list_ro_delete_all_entry * DESCRIPTION * Entry function of the list ro delete done screen * PARAMETERS * void * RETURNS * void *****************************************************************************/ static void mmi_rmgr_list_ro_delete_all_entry(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if (!DRM_consume_table_is_in_use()) { kal_uint8 serial; /* reset the ro_num to zero, in callback function we will delete the list screen and go back to main menu */ rmgr_list_ro_cntx.ro_num = 0; if (content_drv) { kal_wchar path[4]; kal_wsprintf(path, "%c:\\", content_drv); DRM_process_database( DRM_PROCESS_DATABASE_DELETE_ALL, 0, path, (kal_uint8*) & serial, mmi_rmgr_list_ro_del_callback); } else { DRM_process_database( DRM_PROCESS_DATABASE_DELETE_ALL, 0, NULL, (kal_uint8*) & serial, mmi_rmgr_list_ro_del_callback); } #ifdef __DM_LAWMO_SUPPORT__ if (rmgr_phone_lock_flag) { /* Do not show progressing screen*/ } else #endif /*__DM_LAWMO_SUPPORT__*/ { mmi_rmgr_entry_db_progressing(STR_GLOBAL_DELETING, serial, MMI_TRUE, MMI_FALSE); } } else { mmi_popup_display((WCHAR*)GetString(STR_ID_DRM_DB_LOCKED_BY_APP), MMI_EVENT_FAILURE, NULL); } content_drv = 0; }
static void i51RunBootApp( iBOOL results ) { extern const unsigned char* i51SapGetAppBoot(void); extern const int i51SapGetAppBootSize(void); U16 filename[256]; if(!results) return; kal_wsprintf( filename, "%c:\\i51CALLTIME", FS_GetDrive(FS_DRIVE_V_REMOVABLE, 1, FS_NO_ALT_DRIVE) ); if (FS_GetAttributes (filename) >= 0) i51SapAppBootPara[0]= 60; else { kal_wsprintf( filename, "C:\\i51CALLTIME" ); if (FS_GetAttributes (filename) >= 0) i51SapAppBootPara[0]= 60; } i51KernelRunStaticApp ( L"AppBoot" , (unsigned char* )i51SapGetAppBoot () , (unsigned int )i51SapGetAppBootSize () , i51SapAppBootPara, 1, 0 ) ; }
void test_wbxmlgen(void) { WG_HANDLE hd; FS_HANDLE fd; kal_char *dest = NULL; kal_wchar resultname[128]; xg_attr_struct attrlist[2]; char* data = NULL; kal_int32 ret, driver; kal_uint32 len, buf_len; driver = FS_GetDrive(FS_DRIVE_V_NORMAL, 1, FS_DRIVE_I_SYSTEM); kal_wsprintf((kal_uint16*)resultname, "%c:\\wbxmlsample.txt",driver); hd = wbxml_new_generator((kal_char*)resultname, 0); wbxml_register_get_token_handler(hd, wbxml_test_get_tagtoken_hdlr, wbxml_test_get_attrnametoken_hdlr, wbxml_test_get_attrvaluetoken_hdlr); ret = wbxml_generate_header(hd, 1, 0, "test publicid", WBXML_CHARSET_UTF_8); ret = wbxml_generate_stag(hd,"bookshop", 0, 0, 1); attrlist[0].attrname = "auther"; attrlist[0].attrvalue = "Jonh"; attrlist[1].attrname = "sex"; attrlist[1].attrvalue = "male"; ret = wbxml_generate_stag(hd, "book1", attrlist, 2, 1); data = "book1:computer book"; len = strlen(data); // ret = wbxml_generate_data(hd, data, len+1, 0); ret = wbxml_generate_data(hd, data, len, 1); // ret = wbxml_generate_data(hd, (kal_char*)L"D:\\data", 0, 1); ret = wbxml_generate_etag(hd, "book1"); data ="book2:artist book"; len = strlen(data); ret = wbxml_generate_inline_element(hd, "book2", data, len+1, 0); attrlist[0].attrname = "city"; attrlist[1].attrvalue = "Beijing"; ret = wbxml_generate_empty_element(hd, "address", attrlist, 1); ret = wbxml_generate_etag(hd, "bookshop"); len = wbxml_close_generator(hd); test_wbxmlp("wbxmlsample.txt", 0); // free_ctrl_buffer(dest); }
/***************************************************************************** * FUNCTION * vm_so_ws_get_path * DESCRIPTION * * PARAMETERS * drv [IN] * name [IN] * wname [IN] * wlen [IN] * RETURNS * *****************************************************************************/ static VMINT vm_so_get_path(VMINT drv, VMWSTR name, VMWSTR wname) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ VMINT find_hdl; struct vm_fileinfo_t info; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ #ifndef MRE_ON_MODIS kal_wsprintf(wname, "%c:\\mre\\%w.vso", drv, name); #else kal_wsprintf(wname, "%c:\\mre\\%w.dlo", drv, name); #endif if((find_hdl = vm_find_first(wname, &info)) >= 0) { vm_find_close(find_hdl); return TRUE; } return FALSE; }
static void avk_framework_entry_auto_cases_scr_ext(mmi_scrn_essential_struct* data) { MMI_BOOL enter_ret; // U8 *guiBuffer; U8 str[256]=""; U16 percent = 0; avk_test_case* item; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ item = (avk_test_case*)data->user_data; enter_ret = mmi_frm_scrn_enter(GRP_ID_AVK, data->scrn_id, (FuncPtr)NULL, (FuncPtr)avk_framework_entry_auto_cases_scr_ext, MMI_FRM_FULL_SCRN); if (enter_ret == MMI_FALSE) { return; } // guiBuffer = mmi_frm_scrn_get_active_gui_buf(); mmi_frm_scrn_set_leave_proc(GRP_ID_AVK, data->scrn_id, avk_framework_leave_scr); if (g_avk_framework_ctx.auto_case_num > 0) { kal_wsprintf((WCHAR*)str,"Auto cases: %d / %d",g_avk_framework_ctx.current_num,g_avk_framework_ctx.auto_case_num); percent = (U16)g_avk_framework_ctx.current_num*100 / g_avk_framework_ctx.auto_case_num; } ShowCategory402Screen((U8*)(item)->test_name, 0, 0, 0, 0, 0, 0, percent, (U8*)str); StartTimer(AVK_FRAMEWORK_AUTO_CASE_TIME,500,avk_framework_auto_case_time_cb); }
static kal_bool process_gt818_ctp_cmd( kal_uint8 action, kal_uint32 data_len, kal_uint8 *data_str ) { kal_uint16 ret_len = 0; kal_uint16 i; kal_uint16 inlen; kal_uint16 offset; STS_CTRL_COMMAND_T cmd; DCL_HANDLE handle; kal_uint8 *ctp_buffer = NULL; kal_uint8 *result = NULL; ctp_buffer = (kal_uint8 *)get_ctrl_buffer( 1024 ); if ( ctp_buffer == NULL ) EXT_ASSERT(0, (int)ctp_buffer, 0, 0); cmd.u4Command = action; cmd.pVoid1 = (void *)data_str; cmd.pVoid2 = (void *)&result; handle = DclSTS_Open( DCL_TS, 0 ); DclSTS_Control( handle, STS_CMD_COMMAND, (DCL_CTRL_DATA_T *)&cmd ); DclSTS_Close(handle); if ( action == DCL_CTP_COMMAND_GET_VERSION ) ret_len = 6; if ( action == DCL_CTP_COMMAND_GET_CONFIG ) ret_len = 106; if ( action == DCL_CTP_COMMAND_GET_DIFF_DATA ) ret_len = 162; if ( action == DCL_CTP_COMMAND_GET_FW_BUFFER ) { offset = data_str[0]*256 + data_str[1]; inlen = data_str[2]; memcpy( &result[offset], &data_str[3], inlen); if ( inlen != 128 ) { #define GT818_FW_STRING "ctp_firmware_rusklmeoxkwjadfjnklruo3" kal_int16 drv_letter; FS_HANDLE fs_handle; UINT writen; kal_wchar CTP_FIRMWARE_PATH[64]; drv_letter = FS_GetDrive(FS_DRIVE_V_NORMAL, 2, FS_DRIVE_I_SYSTEM | FS_DRIVE_V_NORMAL); kal_wsprintf( CTP_FIRMWARE_PATH, "%c:\\%s", drv_letter, GT818_FW_STRING ); fs_handle = FS_Open( CTP_FIRMWARE_PATH, FS_CREATE_ALWAYS | FS_READ_WRITE ); FS_Write(fs_handle, (kal_uint8 *) result , offset+inlen, &writen); FS_Close( fs_handle ); } } kal_sprintf( (kal_char *)ctp_buffer, "+EGCMD: " ); for ( i = 0 ; i < ret_len ; i++ ) kal_sprintf( (kal_char *)&ctp_buffer[strlen((char *)(ctp_buffer))], "%02X", result[i] ); rmmi_write_unsolicitedResultCode( ctp_buffer, strlen((kal_char *)(ctp_buffer)), KAL_TRUE, 1, NULL ); free_ctrl_buffer( ctp_buffer ); return KAL_TRUE; }
kal_bool BT_PcmLoopbackTest(void) { kal_int16 i, count = 0; kal_uint16 *buf; kal_uint32 len = 0, acmLen = 0; kal_int32 magDB = 0; TD_Handle hdl; kal_uint16 *rb_base; AM_BluetoothOn(2);//2:open earphone mode, 1: open cordless mode AM_FlushQFunction(); kal_prompt_trace(MOD_L1SP, "after set,DP_VOL_OUT_PCM= %d",*DP_VOL_OUT_PCM); /*initialize*/ rb_base = (kal_uint16 *)get_ctrl_buffer(BTLB_BUF_LEN << 1); Media_SetBuffer( rb_base, BTLB_BUF_LEN ); TD_Init( &hdl, TARGET_TONE, BLOCK_SIZE); #ifdef BTLB_DEBUG pcmDebugCnt = 0; pcmDebugPtr = btlbPcmDebugBuf; #endif /*start tone_play and record*/ KT_Play(TARGET_TONE, 0, 0); /*play single tone , continuous play*/ Media_Record(MEDIA_FORMAT_PCM_8K, BTLB_Handler, (void *)0); for (i = 0 ; i < 100 ; i++)/*if delay is large, we should enlarge this waiting*/ { Media_GetReadBuffer(&buf ,&len); if ( len==0 ) kal_sleep_task(1); else{ if ( (len + acmLen) >= BLOCK_SIZE ){/*acumulated length >= BLOCK_SIZE*/ len = BLOCK_SIZE - acmLen;/*recount samples to fit block*/ } TD_ProcessBlock(&hdl, (kal_int16 *)buf, len); #ifdef BTLB_DEBUG { int j; for(j = 0 ; j < len ; j++ ) if( pcmDebugCnt < 80000 ) { *pcmDebugPtr++ = buf[j]; pcmDebugCnt ++; } } #endif Media_ReadDataDone( len ); acmLen += len; if ( acmLen >= BLOCK_SIZE){ magDB = TD_GetMagnitudeDB( &hdl ); kal_prompt_trace( MOD_L1SP, "magDB = %d", magDB); if( magDB > BTLB_TONE_MAG_DB_THRESHOLD ) count ++; TD_Reset( &hdl ); acmLen=0;//reset if ( count > 2) break; } } } #ifdef BTLB_DEBUG { int file_handle; kal_prompt_trace(MOD_L1SP, "prepare to dump pcm file"); kal_wsprintf(debugFile, "d:\\BTLBdebug.pcm"); file_handle = FS_Open(debugFile, FS_CREATE); if(file_handle > 0) { FS_Write( file_handle, (void *)btlbPcmDebugBuf, pcmDebugCnt << 1, NULL ); FS_Close(file_handle); kal_prompt_trace(MOD_L1SP, "finish dump pcm file BTLBdebug.pcm"); } else{ kal_prompt_trace(MOD_L1SP, "unable to dump file"); } } #endif KT_StopAndWait(); Media_Stop(); AM_BluetoothOff();//close earphone mode /*close loopback path, should be removed in the future*/ //*AFE_VAC_CON1 &= ~0x02; free_ctrl_buffer( rb_base ); if ( count > 2){ return true; }else return false; }
void imps_custom_work_directory(void) { kal_int32 fd; kal_wchar ucs2_folder[IMPS_MAX_FILE_PATH_LEN]; /*Create folders(@imps,@imps\image) in system drive*/ kal_wsprintf(ucs2_folder, "%s", "Z:\\@imps\\"); fd = FS_Open(ucs2_folder, FS_OPEN_DIR | FS_READ_ONLY); if (fd < 0) { fd = FS_CreateDir(ucs2_folder); } else { FS_Close(fd); } /*image*/ kal_wsprintf(ucs2_folder,"%s%s","Z:\\@imps\\",IMPS_STATUS_CONTENT_FOLDER); fd = FS_Open(ucs2_folder, FS_OPEN_DIR | FS_READ_ONLY); if (fd < 0) { FS_CreateDir(ucs2_folder); } else { FS_Close(fd); } #ifdef IMPS_IN_LARGE_STORAGE /*Create folders(imps) in user drive*/ sprintf((char*)imps_directory, "%c%s",IMPS_APP_DISK,":\\imps\\"); kal_wsprintf(ucs2_folder, "%s", imps_directory); fd = FS_Open(ucs2_folder, FS_OPEN_DIR | FS_READ_ONLY); if (fd < 0) { fd = FS_CreateDir(ucs2_folder); FS_SetAttributes((unsigned short*)ucs2_folder,FS_ATTR_DIR|FS_ATTR_HIDDEN); } else { FS_Close(fd); } #else strcpy((char*)imps_directory,"Z:\\@imps\\"); #endif /*reply*/ kal_wsprintf(ucs2_folder, "%s%s", imps_directory, IMPS_HTTP_REPLY_FOLDER); fd = FS_Open(ucs2_folder, FS_OPEN_DIR | FS_READ_ONLY); if (fd < 0) { FS_CreateDir(ucs2_folder); } else { FS_Close(fd); } /*user*/ kal_wsprintf(ucs2_folder, "%s%s", imps_directory, IMPS_USER_CONTENT_FOLDER); fd = FS_Open(ucs2_folder, FS_OPEN_DIR | FS_READ_ONLY); if (fd < 0) { FS_CreateDir(ucs2_folder); } else { FS_Close(fd); } /*Received*/ kal_wsprintf(ucs2_folder, "%c:\\%w", IMPS_PUBLIC_DRV, IMPS_DEFAULT_FILE_PATH); fd = FS_Open(ucs2_folder, FS_OPEN_DIR | FS_READ_ONLY); if (fd < 0) { FS_CreateDir(ucs2_folder); } else { FS_Close(fd); } }
static kal_int32 gt818_downloader_probe( kal_uint16 cur_ver, kal_uint8 *firmware_ptr ) { //TODO: process file //struct file *fp; kal_uint32 rlen; kal_uint16 length; kal_uint16 retry = 0; FS_HANDLE handle; int ret = 0; ctp_firmware_info_t *fw_info = (ctp_firmware_info_t *)firmware_ptr; unsigned char *data_ptr = &(fw_info->data); kal_wchar CTP_FIRMWARE_PATH[64]; kal_int16 drv_letter; kal_bool delete_firmware = KAL_FALSE; CTP_DWN_DEBUG_LINE_TRACE(); length = 0; drv_letter = FS_GetDrive(FS_DRIVE_V_NORMAL, 2, FS_DRIVE_I_SYSTEM | FS_DRIVE_V_NORMAL); // phone memory kal_wsprintf( CTP_FIRMWARE_PATH, "%c:\\%s", drv_letter, GT818_FW_STRING ); ret = FS_CheckFile(CTP_FIRMWARE_PATH); if(ret < 0) { drv_letter = FS_GetDrive( FS_DRIVE_V_REMOVABLE, 1, FS_NO_ALT_DRIVE ); //SD Card kal_wsprintf( CTP_FIRMWARE_PATH, "%c:\\%s", drv_letter, GT818_FW_STRING ); } else { delete_firmware = KAL_TRUE; // need delete firmware after update } handle = FS_Open( CTP_FIRMWARE_PATH, FS_READ_ONLY ); if ( handle >= 0 ) // file system first { do { rlen = 0; ret = FS_Read( handle, &data_ptr[length], 256, &rlen ); length += rlen; if ( rlen != 256 ) { CTP_DWN_DEBUG_LINE_TRACE(); break; } else { drv_trace1( TRACE_GROUP_7, CTP_GOODIX_DWN_READ_IMAGE_TRACE, rlen); } } while ( 1 ); FS_Close( handle ); } else { const int MAGIC_NUMBER_1 = 0x4D454449; const int MAGIC_NUMBER_2 = 0x4154454B; unsigned short checksum = 0; int i; drv_trace2( TRACE_GROUP_7, CTP_GOODIX_DWN_MAGIC_NUM_TRACE, fw_info->magic_number_1, fw_info->magic_number_2 ); drv_trace2( TRACE_GROUP_7, CTP_GOODIX_DWN_MAGIC_NUM_TRACE, MAGIC_NUMBER_1, MAGIC_NUMBER_2 ); drv_trace2( TRACE_GROUP_7, CTP_GOODIX_DWN_VERSION_TRACE, cur_ver, fw_info->version ); drv_trace2( TRACE_GROUP_7, CTP_GOODIX_DWN_IMAGE_INFO_TRACE, fw_info->length, fw_info->checksum ); if ( fw_info->magic_number_1 != MAGIC_NUMBER_1 && fw_info->magic_number_2 != MAGIC_NUMBER_2 ) { CTP_DWN_DEBUG_LINE_TRACE(); goto exit_downloader; } if ( cur_ver >= fw_info->version ) { CTP_DWN_DEBUG_LINE_TRACE(); goto exit_downloader; } // check if it is the same chip version if ( get_chip_version( cur_ver ) != get_chip_version( fw_info->version ) ) { CTP_DWN_DEBUG_LINE_TRACE(); goto exit_downloader; } for ( i = 0 ; i < fw_info->length ; i++ ) checksum += data_ptr[i]; checksum = checksum%0xFFFF; if ( checksum != fw_info->checksum ) { CTP_DWN_DEBUG_LINE_TRACE(); goto exit_downloader; } length = fw_info->length; } while ( gt818_update_proc( data_ptr, length ) == 0 && retry < 2 ) retry++; if ( (handle >= 0) && delete_firmware) //delete firmware when firmware in phone memory FS_Delete( CTP_FIRMWARE_PATH ); //free_ctrl_buffer( nvram ); ret = 1; exit_downloader: return ret; }
static MMI_BOOL mmi_ssc_set_imei(void *buf) { U8 tempbufimei[(MAX_IMEI_LEN + 1) * ENCODING_LENGTH]; #ifdef __MMI_IMEISV_SUPPORT__ U8 tempbufsvn[(MAX_IMEI_LEN + 1) * ENCODING_LENGTH]; #endif //U8 tempbuf[(MAX_IMEI_LEN + 1) * ENCODING_LENGTH]; mmi_nw_get_imei_rsp_struct *imeiresponse = (mmi_nw_get_imei_rsp_struct*) buf; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ mmi_frm_clear_protocol_event_handler(MSG_ID_MMI_NW_GET_IMEI_RSP, NULL); if (imeiresponse->result == 1) { #if 0 #ifdef __ASCII /* under construction !*/ #endif /* under construction !*/ #ifdef __UCS2_ENCODING #ifdef __MMI_IMEISV_SUPPORT__ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ #else /* __MMI_IMEISV_SUPPORT__ */ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ #endif /* __MMI_IMEISV_SUPPORT__ */ #endif /* __UCS2_ENCODING */ #else #ifdef __UCS2_ENCODING mmi_asc_to_ucs2((CHAR*) tempbufimei, (CHAR*) imeiresponse->imei); #ifdef __MMI_IMEISV_SUPPORT__ mmi_asc_to_ucs2((CHAR*) tempbufsvn, (CHAR*) imeiresponse->svn); kal_wsprintf((WCHAR *) gstrIMEI,"%wIMEI:%w\nSVN:%w\n",gstrIMEI,tempbufimei,tempbufsvn); #else kal_wsprintf((WCHAR *) gstrIMEI,"%wIMEI:%w\n",gstrIMEI,tempbufimei); #endif #endif #endif return MMI_TRUE; } else { return MMI_FALSE; } }
/***************************************************************************** * FUNCTION * daf_set_data_info * DESCRIPTION * * PARAMETERS * info_p [?] * channel_num [IN] * duration [IN] * size [IN] * bitrate [IN] * samplerate [IN] * RETURNS * void *****************************************************************************/ void daf_set_data_info( aud_info_struct *info_p, kal_uint32 channel_num, kal_uint32 duration, kal_uint32 size, kal_uint32 bitrate, kal_uint32 samplerate) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ kal_wchar temp[30]; kal_uint32 bitrate_fraction_1, bitrate_fraction_2, bitrate_fraction_3 ; kal_uint32 samplerate_fraction_1, samplerate_fraction_2, samplerate_fraction_3 ; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ /* channel num */ info_p->channel_num = channel_num; /* quality */ if (bitrate > 0 || samplerate > 0) { if (bitrate > 0) { bitrate_fraction_1 = bitrate / 100; bitrate_fraction_1 = bitrate_fraction_1 - (bitrate_fraction_1 / 10) * 10; bitrate_fraction_2 = bitrate / 10; bitrate_fraction_2 = bitrate_fraction_2 - (bitrate_fraction_2 / 10) * 10; bitrate_fraction_3 = bitrate - (bitrate / 10) * 10 ; if(bitrate_fraction_3) { kal_wsprintf((kal_wchar*) info_p->quality, "%d.%d%d%dkbps", bitrate / 1000, bitrate_fraction_1, bitrate_fraction_2, bitrate_fraction_3); } else if(bitrate_fraction_2) { kal_wsprintf((kal_wchar*) info_p->quality, "%d.%d%dkbps", bitrate / 1000, bitrate_fraction_1, bitrate_fraction_2); } else if(bitrate_fraction_1) { kal_wsprintf((kal_wchar*) info_p->quality, "%d.%dkbps", bitrate / 1000, bitrate_fraction_1); } else { kal_wsprintf((kal_wchar*) info_p->quality, "%dkbps", bitrate / 1000); } if (samplerate > 0) { kal_wstrcat((kal_wchar*) info_p->quality, (kal_wchar*) L" / "); } } if (samplerate > 0) { samplerate_fraction_1 = samplerate / 100; samplerate_fraction_1 = samplerate_fraction_1 - (samplerate_fraction_1 / 10) * 10; samplerate_fraction_2 = samplerate / 10; samplerate_fraction_2 = samplerate_fraction_2 - (samplerate_fraction_2 / 10) * 10; samplerate_fraction_3 = samplerate - (samplerate / 10) * 10 ; if(samplerate_fraction_3) { kal_wsprintf((kal_wchar*) temp, "%d.%d%d%dkHz", samplerate / 1000, samplerate_fraction_1, samplerate_fraction_2, samplerate_fraction_3); } else if(samplerate_fraction_2) { kal_wsprintf((kal_wchar*) temp, "%d.%d%dkHz", samplerate / 1000, samplerate_fraction_1, samplerate_fraction_2); } else if(samplerate_fraction_1) { kal_wsprintf((kal_wchar*) temp, "%d.%dkHz", samplerate / 1000, samplerate_fraction_1); } else { kal_wsprintf((kal_wchar*) temp, "%dkHz", samplerate / 1000); } kal_wstrcat((kal_wchar*) info_p->quality, temp); } } /* size */ if(size >= 1024*1024) { size = size/1024 ; kal_wsprintf((kal_wchar*) info_p->size, "%d.%dM", size / 1024, (size % 1024) / 103); } else if (size >= 1024) { kal_wsprintf((kal_wchar*) info_p->size, "%d.%dK", size / 1024, (size % 1024) / 103); } else { kal_wsprintf((kal_wchar*) info_p->size, "%dB", size); } /* time */ if (duration > 0) { kal_uint32 duration_h=0,duration_m=0,duration_s=0; duration /= 1000; duration_m = duration/60 ; duration_s = duration%60 ; if(duration_m > 59) { duration_h = duration_m/60 ; duration_m = duration_m%60 ; kal_wsprintf((kal_wchar*) info_p->duration, "%02d:%02d:%02d", (int)duration_h, (int)duration_m, (int)duration_s); } else { kal_wsprintf((kal_wchar*) info_p->duration, "%02d:%02d", (int)duration_m, (int)duration_s); } } }
void FT_MISC_Operation(ilm_struct *ptrMsg) { kal_wchar wpath[128]; FT_MISC_REQ *p_req = (FT_MISC_REQ *)ptrMsg->local_para_ptr; FT_MISC_CNF misc_cnf; memset(&misc_cnf, 0x0, sizeof(misc_cnf)); peer_buff_struct *peer_buff_ret = NULL; // default value kal_char *pdu_ptr = NULL; kal_uint16 pdu_length = 0; misc_cnf.type = p_req->type; misc_cnf.status = FT_CNF_FAIL; // default value ft_gl_misc_token = p_req->header.token; switch(p_req->type) { case FT_MISC_OP_GET_IMEI_LOC: { misc_cnf.result.m_u1IMEILoc = nvram_get_imei_type(); misc_cnf.status = FT_CNF_OK; break; } case FT_MISC_OP_GET_IMEI_VALUE: { // check the record index (because tools before 0912 causes assertion) kal_uint16 rec_num = nvram_get_imei_record_num(); if(p_req->cmd.m_u1RecordIndex < 1 || p_req->cmd.m_u1RecordIndex > rec_num) { // set the record index to 1 (the behavior will be confrom to that of target load before 0909) p_req->cmd.m_u1RecordIndex = 1; } if(KAL_TRUE == nvram_get_imei_value(NVRAM_EF_IMEI_IMEISV_SIZE, misc_cnf.result.m_rIMEIData.buf, p_req->cmd.m_u1RecordIndex)) { misc_cnf.result.m_rIMEIData.buf_len = NVRAM_EF_IMEI_IMEISV_SIZE; misc_cnf.status = FT_CNF_OK; } else misc_cnf.status = FT_CNF_FAIL; break; } #if defined(__MTK_INTERNAL__) /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ /* under construction !*/ #endif //#if defined(__MTK_INTERNAL__) case FT_MISC_OP_GET_IMEI_REC_NUM: { misc_cnf.result.m_u2IMEIRecords = nvram_get_imei_record_num(); misc_cnf.status = FT_CNF_OK; break; } case FT_MISC_OP_VERIFY_TEMP_SML_FILE: { //kal_char *pdu_ptr; //kal_uint16 pdu_length; kal_wchar *w_filepath; // get the file path from peer_buffer if(ptrMsg->peer_buff_ptr != NULL) { pdu_ptr = get_peer_buff_pdu( ptrMsg->peer_buff_ptr, &pdu_length ); // cast to kal_wchar w_filepath = (kal_wchar *)pdu_ptr; misc_cnf.status = FT_CNF_OK; // ask nvram task to check the SML file if(NVRAM_IO_ERRNO_OK == nvram_validate_file(NVRAM_EF_SML_LID, w_filepath)) misc_cnf.result.m_u1VerifyResult = FT_SML_VALID; else misc_cnf.result.m_u1VerifyResult = FT_SML_INVALID; } else // peer buffer is null { misc_cnf.status = FT_CNF_FAIL; misc_cnf.result.m_u1VerifyResult = FT_SML_NO_FILENAME; } break; } case FT_MISC_OP_GET_CAL_INFO: { ft_misc_op_collect_cal_info(&misc_cnf); return; } case FT_MISC_OP_QUERY_NVRAM_FOLDER: { kal_uint16 length; kal_char* buf; kal_uint8 folder_total_amount = nvram_get_folder_total_amount(); kal_int16 total_length = 0; kal_int8 i; misc_cnf.status = FT_CNF_OK; // allocate peer buffer if(NULL == peer_buff_ret) {//FT_MISC_MAX_FRAME_SIZE peer_buff_ret = construct_peer_buff(FT_MISC_MAX_FRAME_SIZE, 0, 0, TD_CTRL); if(NULL == peer_buff_ret) return; peer_buff_ret->pdu_len = 0 ; } pdu_ptr = get_peer_buff_pdu( peer_buff_ret, &pdu_length ); for(i = 0;i<folder_total_amount;i++) { buf = nvram_get_work_path(i); kal_wsprintf(wpath, "%s", buf); if(nvram_check_hidden_file(wpath, true)) { continue; } length = (strlen(buf)+1); kal_mem_cpy(pdu_ptr+pdu_length+total_length, (buf), length ); *(pdu_ptr+pdu_length+total_length+length-1) = '?'; total_length += length; } // update pdu_len peer_buff_ret->pdu_len += (total_length); break; } case FT_MISC_OP_VERIFY_NVRAM_ATTR_SETTING_COMPLETE: { kal_uint16 stop_index = custom_meta_check_must_backup_lid_array(p_req->cmd.m_bcheckImeiFlag); if(stop_index == custom_meta_get_check_lid_num()) // check successfully! { misc_cnf.status = FT_CNF_OK; misc_cnf.result.m_rNvramVerifyResult.m_stop_enum_value = custom_meta_get_enum_by_index(stop_index-1); // pass the imei_enum misc_cnf.result.m_rNvramVerifyResult.m_total_lid_num = custom_meta_get_check_lid_num(); misc_cnf.result.m_rNvramVerifyResult.m_stop_index = stop_index; } else { misc_cnf.status = FT_CNF_FAIL; misc_cnf.result.m_rNvramVerifyResult.m_stop_enum_value = custom_meta_get_enum_by_index(stop_index); misc_cnf.result.m_rNvramVerifyResult.m_total_lid_num = custom_meta_get_check_lid_num(); misc_cnf.result.m_rNvramVerifyResult.m_stop_index = stop_index; } break; } case FT_MISC_OP_ENABLE_PATH_LIMITION: case FT_MISC_OP_DISABLE_PATH_LIMITION: { ft_gl_path_check_flag = (p_req->type == FT_MISC_OP_ENABLE_PATH_LIMITION)?true:false; misc_cnf.status = FT_CNF_OK; break; } case FT_MISC_OP_GET_NVRAM_FOLDER_AMOUNT: { kal_uint8 i; misc_cnf.result.m_u1NVRAMFolderAmount = nvram_get_folder_total_amount(); for(i = 0;i<nvram_get_folder_total_amount();i++) { kal_wsprintf(wpath, "%s", nvram_get_work_path(i)); if(nvram_check_hidden_file(wpath, true)) { misc_cnf.result.m_u1NVRAMFolderAmount--; } } misc_cnf.status = FT_CNF_OK; } break; #ifndef SIM_NOT_PRESENT case FT_MISC_OP_CHECK_SIM1_INSERTED: { // Send reset request to MOD_SIM ilm_struct ilm_ptr; sim_reset_req_struct* ptr_loc_para; FT_ALLOC_OTHER_MSG(&ilm_ptr, sizeof(sim_reset_req_struct)); ptr_loc_para = (sim_reset_req_struct*) (ilm_ptr.local_para_ptr); ptr_loc_para->src_id = 0xff; // set sim cmd type to global variable ft_gl_sim_cmd_type = FT_MISC_OP_CHECK_SIM1_INSERTED; FT_SEND_MSG(MOD_FT, MOD_SIM, PS_SIM_SAP, MSG_ID_SIM_RESET_REQ, &ilm_ptr); // wait for SIM task CNF message return; } #ifdef __GEMINI__ case FT_MISC_OP_CHECK_SIM2_INSERTED: { // Send reset request to MOD_SIM_2 ilm_struct ilm_ptr; sim_reset_req_struct* ptr_loc_para; FT_ALLOC_OTHER_MSG(&ilm_ptr, sizeof(sim_reset_req_struct)); ptr_loc_para = (sim_reset_req_struct*) (ilm_ptr.local_para_ptr); ptr_loc_para->src_id = 0xff; // set sim cmd type to global variable ft_gl_sim_cmd_type =FT_MISC_OP_CHECK_SIM2_INSERTED; FT_SEND_MSG(MOD_FT, MOD_SIM_2, PS_SIM_SAP, MSG_ID_SIM_RESET_REQ, &ilm_ptr); // wait for SIM task CNF message return; } #endif // __GEMINI__ #ifdef GEMINI_PLUS case FT_MISC_OP_CHECK_GEMINI_PLUS_SIM_INSERTED: { // Send reset request to MOD_SIM_N ilm_struct ilm_ptr; sim_reset_req_struct* ptr_loc_para; // if index out of range, break and then send error status CNF if(p_req->cmd.m_u1SimIndex >= GEMINI_PLUS) { break; } FT_ALLOC_OTHER_MSG(&ilm_ptr, sizeof(sim_reset_req_struct)); ptr_loc_para = (sim_reset_req_struct*) (ilm_ptr.local_para_ptr); ptr_loc_para->src_id = 0xff; // set sim cmd type to global variable ft_gl_sim_cmd_type = FT_MISC_OP_CHECK_GEMINI_PLUS_SIM_INSERTED; FT_SEND_MSG(MOD_FT, (module_type)(MOD_SIM + p_req->cmd.m_u1SimIndex), PS_SIM_SAP, MSG_ID_SIM_RESET_REQ, &ilm_ptr); // wait for SIM task CNF message return; } #endif // GEMINI_PLUS #endif // SIM_NOT_PRESENT case FT_MISC_OP_SET_MUIC_CHARGER_MODE: { #ifdef __DRV_EXT_CHARGER_DETECTION__ MU_BQ25040_Charger_Mode(p_req->cmd.m_u1ChargerMode); misc_cnf.status = FT_CNF_OK; #else misc_cnf.status = FT_CNF_FAIL; #endif break; } #if !defined(NVRAM_NOT_PRESENT) case FT_MISC_OP_CALDATA_INTEGRITY_START_REC: { if(g_b_ft_nvram_rec) { misc_cnf.status = FT_CNF_FAIL; break; } i4_ft_cur_misc_op = p_req->type; ft_misc_cal_data_read_from_nvram(); return; } case FT_MISC_OP_CALDATA_INTEGRITY_STOP_REC: { if(!g_b_ft_nvram_rec) { misc_cnf.status = FT_CNF_FAIL; break; } g_b_ft_nvram_rec = false; // stop record i4_ft_cur_misc_op = p_req->type; ft_misc_cal_data_write_to_nvram(); return; } case FT_MISC_OP_CALDATA_INTEGRITY_ADD_ONE: case FT_MISC_OP_CALDATA_INTEGRITY_DEL_ONE: case FT_MISC_OP_CALDATA_INTEGRITY_CHECK_ONE: ft_misc_cal_data_proc_one.u2LidEnumVal = p_req->cmd.m_rCalDataOne.u2LidEnum; ft_misc_cal_data_proc_one.u2LidRec = p_req->cmd.m_rCalDataOne.u2RID; ft_misc_cal_data_proc_one.u2CheckVal = 0; // note: don't break, keep going case FT_MISC_OP_CALDATA_INTEGRITY_DEL_ALL: case FT_MISC_OP_CALDATA_INTEGRITY_CHECK_ALL: { if(g_b_ft_nvram_rec) { misc_cnf.status = FT_CNF_FAIL; break; } i4_ft_cur_misc_op = p_req->type; ft_misc_cal_data_read_from_nvram(); return; } #endif // #if !defined(NVRAM_NOT_PRESENT) case FT_MISC_OP_GET_ADC_FROM_EFUSE: { kal_bool b_ret_code; kal_uint8 i; kal_uint8 adc_max_channel; DCL_HANDLE adc_handle; ADC_CTRL_READ_CALIBRATION_DATA_T prReadCalibrationData; adc_handle = DclSADC_Open(DCL_ADC, FLAGS_NONE); adc_max_channel = FT_GetAdcMaxChannel(); b_ret_code = (STATUS_OK == DclSADC_Control(adc_handle, ADC_CMD_READ_CALIBRATION_DATA, (DCL_CTRL_DATA_T*)&prReadCalibrationData)) ? KAL_TRUE : KAL_FALSE; misc_cnf.status = FT_CNF_OK; misc_cnf.result.m_rGetAdcFromEfuse.bADCStoredInEfuse = b_ret_code; misc_cnf.result.m_rGetAdcFromEfuse.u2ADCChnNum = b_ret_code ? adc_max_channel : 0; // if channel number > 0, construct peer buffer if(misc_cnf.result.m_rGetAdcFromEfuse.u2ADCChnNum > 0) // i.e. FT_GetAdcMaxChannel() { if( NULL != (peer_buff_ret=construct_peer_buff(adc_max_channel*8, 0, 0, TD_CTRL)) ) { pdu_ptr = get_peer_buff_pdu( peer_buff_ret, &pdu_length ); peer_buff_ret->pdu_len = adc_max_channel *8; for(i =0; i< adc_max_channel; i++) // append slope first { kal_mem_cpy(pdu_ptr+(i*4), &(prReadCalibrationData.i4ADCSlope[i]), sizeof(kal_int32)); } for(i =0; i<adc_max_channel; i++) // append offset second { kal_mem_cpy(pdu_ptr+((adc_max_channel+i)*4), &(prReadCalibrationData.i4ADCOffset[i]), sizeof(kal_int32)); } } } break; } case FT_MISC_OP_GET_CALFLAG_ENUM: { misc_cnf.result.m_u2CalFlagEnum = custom_ft_get_calflag_enum(); misc_cnf.status = FT_CNF_OK; } break; case FT_MISC_OP_GET_ADC_MAX_CHANNEL: { // HAL modification misc_cnf.status = FT_CNF_OK; misc_cnf.result.m_u1ADCMaxChannel = FT_GetAdcMaxChannel(); break; } case FT_MISC_OP_GET_TADC_INDEX: { // HAL modification //misc_cnf.result.m_u1TADCChannelIndex = custom_adc_get_channel(rftmp_adc_channel); DCL_HANDLE adc_handle; ADC_CTRL_GET_PHYSICAL_CHANNEL_T adc_ch; misc_cnf.status = FT_CNF_OK; adc_handle = DclSADC_Open(DCL_ADC, FLAGS_NONE); adc_ch.u2AdcName = DCL_RFTMP_ADC_CHANNEL; if(DclSADC_Control( adc_handle, ADC_CMD_GET_CHANNEL, (DCL_CTRL_DATA_T *)& adc_ch) != STATUS_OK) { misc_cnf.status = FT_CNF_FAIL; } misc_cnf.result.m_u1TADCChannelIndex = adc_ch.u1AdcPhyCh; if(DclSADC_Close(adc_handle) != STATUS_OK) { misc_cnf.status = FT_CNF_FAIL; } break; } case FT_MISC_OP_GET_RF_CAL_ENV_ENUM: misc_cnf.result.m_u2Enum = custom_ft_get_rf_cal_env_enum(); misc_cnf.status = FT_CNF_OK; break; case FT_MISC_OP_GET_RF_CAL_LOSS_SETTING_ENUM: misc_cnf.result.m_u2Enum = custom_ft_get_rf_loss_setting_enum(); misc_cnf.status = FT_CNF_OK; break; case FT_MISC_OP_GET_RF_TEST_POWER_RESULT_ENUM: misc_cnf.result.m_u2Enum = custom_ft_get_rf_test_power_result_enum(); misc_cnf.status = FT_CNF_OK; break; case FT_MISC_OP_GET_RID: { if(KAL_TRUE == SST_Get_ChipRID((kal_char*)misc_cnf.result.m_rRIDData.buf, (p_req->cmd.m_RIDLength*8))) { misc_cnf.result.m_rRIDData.buf_len = p_req->cmd.m_RIDLength; // return RID length in bytes } else { misc_cnf.result.m_rRIDData.buf_len = 0; // return length = 0 for error check } misc_cnf.status = FT_CNF_OK; break; } case FT_MISC_OP_GET_BARCODE_VALUE: { if(p_req->cmd.m_u1RecordIndex < 1 || p_req->cmd.m_u1RecordIndex > NVRAM_EF_BARCODE_NUM_TOTAL) { p_req->cmd.m_u1RecordIndex = 1; } if( NULL != (peer_buff_ret=construct_peer_buff(NVRAM_EF_BARCODE_NUM_SIZE, 0, 0, TD_CTRL))) { peer_buff_ret->pdu_len = NVRAM_EF_BARCODE_NUM_SIZE; pdu_ptr = get_peer_buff_pdu( peer_buff_ret, &pdu_length ); if(KAL_TRUE == nvram_external_read_data(NVRAM_EF_BARCODE_NUM_LID, p_req->cmd.m_u1RecordIndex, (kal_uint8*)pdu_ptr, NVRAM_EF_BARCODE_NUM_SIZE)) { misc_cnf.status = FT_CNF_OK; } } break; } default: return; } // send confirm to PC side FT_MISC_SendCnf(&misc_cnf, peer_buff_ret); }