[HowTo] Fix GPS issues (and SIM)

Doe

New Member
Feb 1, 2017
25
23
3
#1
Issue:
Currently on date 15/04/2017 on all custom ROMs I tested (basically all since they all rely on same vendor blobs and kernel base sources) there is a very tricky bug that is creating headache to a lot of people. GPS doesn't work well and sometimes at all.

Symptoms:
Whenever you try an application like GPS test (tested version is 1.5.4, here's the playstore link) you will face problems on getting signal lock on GPS status. The application sees some or many satellites but the fix/lock takes ages (2 minutes or sometimes even more) compared to usual time (which should be 30 seconds the first time and then less than 5/10 seconds) or other smartphones. Even when the lock/fix is taken the precision is weak. Usually a good value is between 5 and 15 meters, when this bug happens you will see a value higher (between 30 and 100 meters).

Why this happens:
  • The problem is happening because you probably tried to flash manually any baseband.
  • Another possible case is that you simply erased "modemst1" and/or "modemst2" partitions using fastboot commands. (maybe because you had SIM signal problems or just wanted to reset things up)
  • Last possible case is that you tried to flash a stock rom and you didn't run it for the first time nor you did try to get a first GPS fix.
In all the cases above you have reset the "modemst1" partition and this breaks the new initialization which is not correctly done with custom ROMs. That partition must be generated and seems it's different between each ZUK Z2 and probably also different within location you are in the first time you make the GPS fix.

How to reproduce it:
Simply erase "modemst1" partition with the following command:
Code:
fastboot erase modemst1
How to fix it:
No custom ROMs can manage the fix for now, so waiting for an integrated fix, there are 3 ways to fix it
  • Flash a Stock ROM via QFIL (no matter which one but it should be important to initialize it with the baseband flashed with the stock rom), run the ROM to allow the first boot to be executed correctly, install GPS test and wait for a first GPS lock/fix by updating AGPS data from the app's menu (you need also wifi or mobile data turned on)
  • If you have a dump of "modemst1" partition, which can be done if you have it already perfectly working
Code:
dd if=/dev/block/mmcblk0p37 of=/sdcard/dump-modemst1.bin
you can flash it back with the following command
Code:
fastboot flash modemst1 dump-modemst1.bin
just remember to use same baseband used to initilize the modemst partition the first time. I never tried to use baseband with partition initialized by another one
Do not forget that this partition is generated by software, so you can't share your partition with other people. You can try it, but it will not fix the problem.
  • (NOT TESTED 100%) Flash a modified stock-ROM like the ones by Francko76 or BSHUY2003 (these ROMs are TWRP flashable zip files), run the ROM and wait for first fix/lock GPS using GPS test or similar app and updating AGPS data (same steps like flashing stock rom via QFIL). This method could not work always because flashing the zip file with TWRP doesn't reset/erase the modem partitions. You probably need to erase manually modemst1 with the command wrote above and you should have the GPS working again. (at least with my tests, but if you find any other issue report it)
After this fix you should notice 5-15 meters precision and a lock/fix within 10 seconds or less.

Suggested way to be sure to have the problem fixed:
  • execute the command: fastboot erase modemst1
  • execute the command: fastboot erase modemst2
  • flash with QFIL last official stock ROM (currently the most updated one is 2.5.334 chinese based)
  • install GPS test app
  • turn ON the location (device only mode is enough)
  • turn ON wifi data or mobile data (you need internet connection to be able to update correctly AGPS data)
  • run GPS test app
  • press menu button and click on AGPS -> Update only
  • the GPS fix should be locked in 30 seconds about
  • done... you can now flash any custom rom
ToDo:
We have to wait for custom ROMs developers to fix the modemst partition initialization.
 
Last edited:

abu614

Active Member
Jan 31, 2017
147
67
28
23
#2
How strange, I erased modem and manually flashed the latest Chinese N baseband.
I get a fix in less than 30 seconds and an accuracy of 11 metres.
I had a vendor rom and went straight to custom, have never used an official stock ROM once, yet my GPS is working. I did obviously boot up the vendor ROM but I never had location enabled and since I flashed another baseband it negates it anyway doesn't it?
Is this GPS issue for everyone or only a select few, if you pardon my asking?

EDIT: Now it's 5-8M accuracy, how strange
 

Doe

New Member
Feb 1, 2017
25
23
3
#3
I've updated the first post with few details and a suggested way to be sure you get fixed the problem.
since I flashed another baseband it negates it anyway doesn't it?
Is this GPS issue for everyone or only a select few, if you pardon my asking?
The problem should happen to everyone (you can verify it by simply erasing the modemst1 partition if you want to give it a try), we still don't know where exactly the initialization of modemst partition is done. It could be a blobs problem, a kernel/HAL issue or whatelse.
It could be that past custom ROMs could have a fully working initialization of GPS (we didn't find yet any prove of this).
Flashing a new baseband without erasing the modemst partition doesn't break the GPS. I don't know how you got it working, if you remember exactly what rom you had after you flashed new baseband and erased modemst we can check it, do you?
We would like to know exactly which steps you did in sequence, so we can verify your case too.
 

Doe

New Member
Feb 1, 2017
25
23
3
#4
Oh I forgot to ask you: with custom ROMs did you mean also stock based roms? Because stock based ROMs actually fixes the problem too as reported in first post, so if you ever flashed any of those your situation simply confirms the bug and the fix solution (gizrom, francko76's, bshuy2003, miui or others based on stock)
 

abu614

Active Member
Jan 31, 2017
147
67
28
23
#5
I've updated the first post with few details and a suggested way to be sure you get fixed the problem.

The problem should happen to everyone (you can verify it by simply erasing the modemst1 partition if you want to give it a try), we still don't know where exactly the initialization of modemst partition is done. It could be a blobs problem, a kernel/HAL issue or whatelse.
It could be that past custom ROMs could have a fully working initialization of GPS (we didn't find yet any prove of this).
Flashing a new baseband without erasing the modemst partition doesn't break the GPS. I don't know how you got it working, if you remember exactly what rom you had after you flashed new baseband and erased modemst we can check it, do you?
We would like to know exactly which steps you did in sequence, so we can verify your case too.
Hi no problem, here's what I did;

0. Download and unpack zip-archive.
1. Load the phone into fastboot mode.
2. Connect to PC.
3. Run flash_radios.bat and follow instruction on screen.
4. In fastboot menu select "Power off". After some minutes - turn on the phone.

Notes from @.: SID :.
This flashes 1.7.0664, I used the bat file in Fastboot mode and went through the motions. On 4PDA, it says this erases BOTH modems too.

I flashed this
Flashed Lineage (I can't quite remember which version, but if it's working on the latest then it should work regardless, with this baseband tool?)
Flashed DD3 Kernel (not sure if relevant but I will just include all steps)
Flashed GAPPS
Flashed Magisk

I have NEVER used a custom stock based ROM, the only ROMs I have ever used are Lineage and Mokee MM and N. Nothing else, ever. My phone came with a Vendor ROM and I have never actually been on any official ZUI version. I guess I have booted up the vendor ROM, but I have erased the modem at least once, so not sure how mine is working.

I have just ran the test again, within 30 seconds I have a lock of an average 8 meters out. I also live in quite a rural area, so I am sure if I was in the city it'd be quicker and more accurate. It definitely doesn't take anywhere near 2 minutes. Each test has been done from fresh to see how long it'd take and it locks to 8M under 2 minutes, with a base 3D lock under 30 seconds.

Hope this helped. Also, is it confirmed flashing a stock based ROM fixes the GPS issues?
 

Doe

New Member
Feb 1, 2017
25
23
3
#6

abu614

Active Member
Jan 31, 2017
147
67
28
23
#8
Ok thank you, I will try to follow your steps and will update as soon as all tests will be made.
The steps posted on the open post are fully tested and confirmed to work, I would have never made this thread otherwise. You can also see the issue being tracked on Lineage OS by ontherunvaro: https://github.com/ontherunvaro/android_device_zuk_z2_plus/issues/64
Thanks, I think the stock based custom option is the best for now, QFIL is too much hassle.

Yep, that's the one, the latest version in the link.
 
Likes: Doe

Doe

New Member
Feb 1, 2017
25
23
3
#9
First of all I want to say Thank you again for your report. I want to make more tests and I want to discuss this with other people too (maybe other users here can post their results too), but I can say this for now:
the problem, as suspected, seems in the kernel, I flashed the kernel by DD3boh DarkMoon Kernel Nougat release 002 (the one linked in my previous post) and the modem partition seems initialing correctly for the GPS. I can get fast fix and precision is also good (even though compared to the stock initialization the precision seems still a bit corrupted, but it's indeed an improvement).

Can somebody else try to flash the darkmoon kernel to see if the GPS is being fixed after a modemst1 and modemst2 erase?
 
Likes: abu614

abu614

Active Member
Jan 31, 2017
147
67
28
23
#10
First of all I want to say Thank you again for your report. I want to make more tests and I want to discuss this with other people too (maybe other users here can post their results too), but I can say this for now:
the problem, as suspected, seems in the kernel, I flashed the kernel by DD3boh DarkMoon Kernel Nougat release 002 (the one linked in my previous post) and the modem partition seems initialing correctly for the GPS. I can get fast fix and precision is also good (even though compared to the stock initialization the precision seems still a bit corrupted, but it's indeed an improvement).

Can somebody else try to flash the darkmoon kernel to see if the GPS is being fixed after a modemst1 and modemst2 erase?
When you say corrupted, how so?
Is it more than 15M out still on yours?
 

Doe

New Member
Feb 1, 2017
25
23
3
#11
Yes, it's about 15-20 meters when with stock rom I get 5-10 meters. And when I first lock the accuracy is even weaker, around 50-70 decreasing after few seconds more until it gets stable at around 15-20.
I did some more tests and the fix by flashing the darkmoon kernel can be considered not a single case but a reproducible fix.
Now it's up to the developers to discover where in the kernel they fail, we have many way to make the fix now :)
 
Likes: abu614
Jan 21, 2017
78
10
8
32
#12
I had the same problem of long gps fixing time with DU and the baseband from 2.5 zui (I am quite sure I Flashed and booted 2.5 qpst rom via qfil).

Then I flashed 1.9.044 qpst zui via qfil as suggested here and boot inside the rom (but without doing any gps fix on the zui). Problem is gone. Accuracy is under 20 meters but I am trying inside a building
 

Doe

New Member
Feb 1, 2017
25
23
3
#15
@Doe

Just to ask; when you say "from fresh", what do you mean? Clearing and updating AGPS data and then trying to get a fix?
What do you mean? Where did I write that?
Really?! o_O
I don't think so...:cool:
The bug happens to everyone IF you ever did one of the above cases explained in the first post (which means IF you erased modem and used a bugged kernel like basically almost all the ones in custom ROMs). You can reproduce the issue if you don't believe it.
Thanks to abu614 we know that DarkMoon kernel also helps on fixing the issue, this kernel seems not having the GPS bug.
Let's pretend this was never posted before xD
It has been posted in fact. I don't pretend to be the first one and actually I don't care at all.
This thread meaning is to collect users experiences and to have an effective method reproducible. On many posts users just wrote to flash only 1.9 stock ROM, but that's not true. (and not all people could fix it by simply flashing stock rom, here it's explained why) You can flash any stock ROM version (so even 2.5.334) to fix the problem if you allow the GPS to be fixed.
It could also be that some past custom ROMs hadn't this problem because as it seems right now, it's a kernel issue. Not everybody uses the same kernel on cust-ROMs.

We also discovered the cause of the bug and why it happens (at least a part of the reason why).

I hope things are more understandable now. Otherwise I don't care. I've already managed to inform who needs to. Let's wait for a kernel fix.
 
Last edited:

Doe

New Member
Feb 1, 2017
25
23
3
#16
In confirmation that this is a kernel/driver/blobs issue (some cust-ROMs are actually messing things up all together), I've made other tests.

Sadly I have to admit that Mokee 6.0.1 Release version can be a solution as well (I'm not a big fan of mokee and going back to marshmellow is not good for me). I did erase both modemst1 and modemst2 (I'm currently still trying with baseband from 2.5.334) and with LOS from 14/04/2017, DU from 17/04/2017, AICP from 16/04/2017, they all can't get a GPS fix. With Mokee GPS gets fixed correctly. Seems like there is a bug on Nougat related to something developers missed out about GPS.

Maybe other users can confirm this too because I could only test 2 devices. If anybody else wants to try it or can confirm this I can add it to the first post.

I will test Mokee on Nougat as soon as possible, their servers are so slow...
 
Likes: SID

Doe

New Member
Feb 1, 2017
25
23
3
#17
I could test Mokee 7.1 nightly version and it doesn't work on fixing the GPS issue.

I decided then to try and test another MarshMellow custom-ROM and I tested PacROM by Fedor917. It's based on Android 6.0.1 and it works perfectly like Mokee 6.0.1.

Definitely developers missed something on adapting the kernel to Nougat.

I hope these tests can give to developers some hints to discover where exactly the bug is. It will solve a lot of users reports and claims.
 

rolex0815

Active Member
Jul 18, 2016
300
85
28
#18
I don't think, that it is the kernel.
It's driver and/or baseband related, but the kernel itself doesn't have anything to do with GPS.

I need to confirm, but the kernel source doesn't include files related to GPS.

See my thread, where I combined my devices, both different Android versions, both different kernels, both different basebands and both got a fix even inside my building.
 

Murilo

New Member
Mar 21, 2017
3
0
1
#19
I did not understand. Any custom system will happen this? What is the procedure for getting a custom rom then? QFIL ZUI 2.5, open gps, copy odemst1.bin file, clear cache, clean system, clean internal storage, insert the custom rom, gapps and paste odemst1.bin into the system?


Already put via qfil 1.9, and then customized rom, and still presents problem of gps
 

Waterman

Active Member
Dec 25, 2016
180
27
28
46
#20
How has this started to happen? Some days or weeks ago I think nobody was talking about this and now the question is everywhere.

¿¿??