[Moto G4 Plus Guides, News, & Discussion] HeethJain21:
There are a few youtube videos and internet guides which tells you to restore somebody else's persist file. That persist file is same in the Youtube video as well as those Internet guide (I have checked them).

Persist is unique to each and every device and using somebody else's persist on your device will never work.

IMEI is stored in /persist/rfs/msm/mpss/datablock directory where there are two files named as id_00 and id_01.

id_00 contains your 1st IMEI and id_01 contains your second IMEI.

The persist (from those guide and youtube videos)

lacks id_00 and id_01

and since you restored that persist, you have those files missing as well. Those files are unique to every device anyways so if you try to restore a persist which has those files, it won't work too as your device's IMEI is different altogether.

The only possible fix that comes to my mind is by manually editing the persist file.

On comparing both the files in a hex editor, it is found that both of them are completely same except from memory address/location 00000028 to 000000C7.

This makes me think that IMEI is stored between those memory locations.

Furthermore, the first 14 digits of IMEI are stored from 00000028 to 0000002F in a different manner.

This is how it is stored,

Lets take a sample random IMEI: 3 12 34 56 78 90 12 34

This will be stored as following: 3A 21 43 65 87 09 21 03

3A [COLOR="Black"]21[/COLOR] [COLOR="DarkRed"]43[/COLOR] [COLOR="Red"]65[/COLOR] [COLOR="Magenta"]87[/COLOR] [COLOR="Sienna"]09[/COLOR] [COLOR="DarkOrange"]21[/COLOR] [COLOR="DarkOliveGreen"]03[/COLOR]
3 [COLOR="black"]12[/COLOR] [COLOR="darkred"]34[/COLOR] [COLOR="red"]56[/COLOR] [COLOR="magenta"]78[/COLOR] [COLOR="sienna"]90[/COLOR] [COLOR="darkorange"]12[/COLOR] [COLOR="darkolivegreen"]34[/COLOR]

The first set of hex numbers is what is stored in id_00 and id_01

The second set of hex numbers is what the actual IMEI is.

As you can clearly notice the difference via colors that the digits are getting flipped. The persist is storing the last digit 4 in some different way.

Why is there a letter

A

in the start just after

3

, I found that it means that the last digit of IMEI stored in persist is

0

. And that makes sense to as when you flip the last two digits i.e

03

, you indeed get

30

which indicates the last digit is

0

.

I don't think I need to mention this, but if you have a dual sim device, the first thirteen digits of IMEI are same and only the last two digits are different.

Now, this makes me conclude that the last digit of actual IMEI is stored in some way in the rest of the id_00 and id_01. And since most of the content in both the files are same, we just have to compare the part which is different as that part has that last digit of the two IMEIs stored.

I can't upload the contents of my IMEI for obvious reasons. If we are able to find the pattern in which the last digit is stored inside those files, then I think we can edit them and it should solve the problem for those people. Of course, editing and putting on somebody else's IMEI in those files wouldn't work either as we have already tried replacing the entire id_00 and id_01 (infact entire working persist) but the IMEI still remains 0.

Perhaps there is someplace (not talking about fastboot imei) where IMEI is stored as well, and while generation of EFS, that place and the persist are checked together and if the IMEIs in both the places match, you get your IMEI and if not, then it knows that IMEI has tampered and hence it doesn't work.

This might be too dangerous as people could edit their IMEI and put on somebody else's IMEI and can create problems, but as I mentioned above, it doesn't work as you will need to have your own IMEI in persist.

Update: Thanx to [MENTION=7346927]NZedPred[/MENTION] for correcting me. Even on deleting id_00 and id_01, and then eraseing EFS, we still get our IMEI.

I also tried changing the first digit of dhob.bin file while keeping id_00 and if_01 intact and then erased EFS, but didn't get my IMEI.

So, dhob.bin is the one which is responsible for IMEI creation and I am not able to understand anything inside dhob.bin.

I am sorry, but I was already trying beyond my capabilities earlier by using many internet sources as reference and it was just by chance that I stumbled upon id_00 and id_01. I am going to stop here for now, as this stuff goes beyond my current capabilities. If I ever get to know anything, I will update it here so that if anybody else would like to continue, they could do it.

I am sorry I tag you here, [MENTION=7970352]echo92[/MENTION], [MENTION=613506]strongst[/MENTION], [MENTION=7346927]NZedPred[/MENTION], [MENTION=4736004]rachitrawat[/MENTION]. This is what I was able to find out. I request you to read this post, and please help if you can. Thank You.