About the failure to read and write Nvram (IMEI SVN) under Recovery mode

Source: Internet
Author: User

The requirement needs to read and write the IMEI svn under recovery, but the related nodes are not successful through the read/write NVRAM operation, the following main implementation code and compiler exception, and when communicating with colleagues know that even if it can be compiled through and cannot call libnvram.so related functions. If there is a great God passing by, please advise twos.

Implementation code:

#include ". /.. /.. /.. /external/nvram/libnvram/libnvram.h "//here has introduced the relevant header file # include" Libnvram.h "#include" cfg_product_info_file.h "// Struct#include "Custom_nvram_lid.h"//lid#include "Cfg_module_file.h"//module

int Read_write () {int result;    F_ID imei_imeisv_nvram_id;    int test_fd;    int rec_size;    int rec_num;    nvram_ef_imei_imeisv_struct* imei_imeisv_struct;    BOOL Isread = True,iswrite = false;    printf ("read:\n"); imei_imeisv_nvram_id = Nvm_getfiledesc (Ap_cfg_reeb_product_info_lid, &rec_size, &rec_num,IsRead);//IsRead=        True if (Imei_imeisv_nvram_id.ifiledesc < 0) {printf ("Nvm_getfiledesc failed\n");    return 0;    } result = read (imei_imeisv_nvram_id.ifiledesc,&imei_imeisv_struct,rec_num*rec_size);        if (Result! = rec_num*rec_size) {printf ("Get file failed\n");    return 0;    } printf ("---------read---------\ n");    printf ("svn:%s\n", IMEI_IMEISV_STRUCT-&GT;SVN);    Ui->print ("svn:%s\n", IMEI_IMEISV_STRUCT-&GT;SVN);    printf ("------------------\ n"); if (!    Nvm_closefiledesc (imei_imeisv_nvram_id)) {printf ("Nvm_closefiledesc failed\n");    } printf ("write:\n"); imei_imeisv_nvram_id = Nvm_getfiledesc (ap_cfg_reEb_product_info_lid, &rec_size, &rec_num,iswrite)//iswrite=false if (Imei_imeisv_nvram_id.ifiledesc < 0)        {printf ("Nvm_getfiledesc failed\n");    return 0;    } IMEI_IMEISV_STRUCT-&GT;SVN = 55;    printf ("--------write----------\ n");    result = Write (imei_imeisv_nvram_id.ifiledesc,&imei_imeisv_struct,rec_num*rec_size);        if (Result! = rec_num*rec_size) {printf ("Write file failed\n");    return 0; } if (!    Nvm_closefiledesc (imei_imeisv_nvram_id)) {printf ("Nvm_closefiledesc failed\n"); } return 0;}

ANDROID.MK Related changes:

Local_c_includes: = $ (mtk_path_source)/external/nvram/libnvramlocal_shared_libraries: = Libnvram

The following is a compilation exception:

bootable/recovery/recovery.cpp:2088:error:undefined reference to ' Nvm_getfiledesc ' bootable/recovery/recovery.cpp : 2104:error:undefined reference to ' Nvm_closefiledesc ' bootable/recovery/recovery.cpp:2109:error:undefined Reference to ' Nvm_getfiledesc ' bootable/recovery/recovery.cpp:2121:error:undefined reference to ' nvm_ Closefiledesc ' Collect2:error:ld returned 1 exit status



Failed to read and write Nvram (IMEI SVN) under Recovery mode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.