Skip to content

Instantly share code, notes, and snippets.

@Vgdn1942
Last active June 22, 2022 12:27
Show Gist options
  • Save Vgdn1942/7cff9ff7897a50766baf908ed4f4b1e4 to your computer and use it in GitHub Desktop.
Save Vgdn1942/7cff9ff7897a50766baf908ed4f4b1e4 to your computer and use it in GitHub Desktop.
WIFI_MAC
// 1. Измените строку в файле /vendor/mediatek/proprietary/custom/$project/cgen/inc
/* WIFI file version */
#define AP_CFG_RDEB_FILE_WIFI_LID_VERNO "000"
//На
/* WIFI file version */
#define AP_CFG_RDEB_FILE_WIFI_LID_VERNO "001"
// 2. В файле /vendor/mediatek/proprietary/custom/st3/cgen/inc/CFG_file_info_custom.h
// В начало файла добавляем объявление функции:
int WIFI_ConvertFunc(int, int, char*, char*);
// Этот кусок структуры
{
"/data/nvram/APCFG/APRDEB/WIFI", VER(AP_CFG_RDEB_FILE_WIFI_LID), CFG_FILE_WIFI_REC_SIZE,
CFG_FILE_WIFI_REC_TOTAL, SIGNLE_DEFUALT_REC, (char *)&stWifiCfgDefault, DataReset, NULL
},
// Меняем на:
{
"/data/nvram/APCFG/APRDEB/WIFI", VER(AP_CFG_RDEB_FILE_WIFI_LID), CFG_FILE_WIFI_REC_SIZE,
CFG_FILE_WIFI_REC_TOTAL, SIGNLE_DEFUALT_REC, (char *)&stWifiCfgDefault, DataConvert, WIFI_ConvertFunc
},
//3. Добавляем функцию WIFI_ConvertFunc
int WIFI_ConvertFunc(int currentVerID, int NewVerID, char *pSrcMem, char *pDstMem) {
UINT_8 aucMacAddress[6] = {0};
WIFI_CFG_PARAM_STRUCT *p_wifi_para;
if (NULL == pSrcMem || NULL == pDstMem) {
NVRAM_LOG("WIFI_ConvertFunc(): pSrcMem or pDstMem NULL!\n");
return false;
} else {
// get the old wifi mac addr
p_wifi_para = (WIFI_CFG_PARAM_STRUCT*)pSrcMem;
memcpy(aucMacAddress, p_wifi_para->aucMacAddress, sizeof(aucMacAddress));
// write the new wifi parameter
memcpy(pDstMem, &stWifiCfgDefault, sizeof(WIFI_CFG_PARAM_STRUCT));
// restore the wifi mac addr
p_wifi_para = (WIFI_CFG_PARAM_STRUCT*)pDstMem;
memcpy(p_wifi_para->aucMacAddress, aucMacAddress, sizeof(aucMacAddress));
NVRAM_LOG("WIFI_ConvertFunc(): WiFi convert done!\n");
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment